Page MenuHomePhabricator

D14150.id.diff
No OneTemporary

D14150.id.diff

diff --git a/src/applications/drydock/constants/DrydockLeaseStatus.php b/src/applications/drydock/constants/DrydockLeaseStatus.php
--- a/src/applications/drydock/constants/DrydockLeaseStatus.php
+++ b/src/applications/drydock/constants/DrydockLeaseStatus.php
@@ -2,21 +2,21 @@
final class DrydockLeaseStatus extends DrydockConstants {
- const STATUS_PENDING = 0;
- const STATUS_ACQUIRED = 5;
- const STATUS_ACTIVE = 1;
- const STATUS_RELEASED = 2;
- const STATUS_BROKEN = 3;
- const STATUS_EXPIRED = 4;
+ const STATUS_PENDING = 0;
+ const STATUS_ACQUIRED = 5;
+ const STATUS_ACTIVE = 1;
+ const STATUS_RELEASED = 2;
+ const STATUS_BROKEN = 3;
+ const STATUS_DESTROYED = 4;
public static function getNameForStatus($status) {
$map = array(
- self::STATUS_PENDING => pht('Pending'),
- self::STATUS_ACQUIRED => pht('Acquired'),
- self::STATUS_ACTIVE => pht('Active'),
- self::STATUS_RELEASED => pht('Released'),
- self::STATUS_BROKEN => pht('Broken'),
- self::STATUS_EXPIRED => pht('Expired'),
+ self::STATUS_PENDING => pht('Pending'),
+ self::STATUS_ACQUIRED => pht('Acquired'),
+ self::STATUS_ACTIVE => pht('Active'),
+ self::STATUS_RELEASED => pht('Released'),
+ self::STATUS_BROKEN => pht('Broken'),
+ self::STATUS_DESTROYED => pht('Destroyed'),
);
return idx($map, $status, pht('Unknown'));
@@ -29,7 +29,7 @@
self::STATUS_ACTIVE,
self::STATUS_RELEASED,
self::STATUS_BROKEN,
- self::STATUS_EXPIRED,
+ self::STATUS_DESTROYED,
);
}
diff --git a/src/applications/drydock/controller/DrydockLeaseViewController.php b/src/applications/drydock/controller/DrydockLeaseViewController.php
--- a/src/applications/drydock/controller/DrydockLeaseViewController.php
+++ b/src/applications/drydock/controller/DrydockLeaseViewController.php
@@ -102,30 +102,9 @@
$view = new PHUIPropertyListView();
$view->setActionList($actions);
- switch ($lease->getStatus()) {
- case DrydockLeaseStatus::STATUS_ACTIVE:
- $status = pht('Active');
- break;
- case DrydockLeaseStatus::STATUS_RELEASED:
- $status = pht('Released');
- break;
- case DrydockLeaseStatus::STATUS_EXPIRED:
- $status = pht('Expired');
- break;
- case DrydockLeaseStatus::STATUS_PENDING:
- $status = pht('Pending');
- break;
- case DrydockLeaseStatus::STATUS_BROKEN:
- $status = pht('Broken');
- break;
- default:
- $status = pht('Unknown');
- break;
- }
-
$view->addProperty(
pht('Status'),
- $status);
+ DrydockLeaseStatus::getNameForStatus($lease->getStatus()));
$view->addProperty(
pht('Resource Type'),
diff --git a/src/applications/drydock/storage/DrydockLease.php b/src/applications/drydock/storage/DrydockLease.php
--- a/src/applications/drydock/storage/DrydockLease.php
+++ b/src/applications/drydock/storage/DrydockLease.php
@@ -160,8 +160,8 @@
return;
case DrydockLeaseStatus::STATUS_RELEASED:
throw new Exception(pht('Lease has already been released!'));
- case DrydockLeaseStatus::STATUS_EXPIRED:
- throw new Exception(pht('Lease has already expired!'));
+ case DrydockLeaseStatus::STATUS_DESTROYED:
+ throw new Exception(pht('Lease has already been destroyed!'));
case DrydockLeaseStatus::STATUS_BROKEN:
throw new Exception(pht('Lease has been broken!'));
case DrydockLeaseStatus::STATUS_PENDING:
@@ -289,6 +289,7 @@
switch ($this->getStatus()) {
case DrydockLeaseStatus::STATUS_RELEASED:
+ case DrydockLeaseStatus::STATUS_DESTROYED:
return false;
default:
return true;
diff --git a/src/applications/drydock/worker/DrydockLeaseDestroyWorker.php b/src/applications/drydock/worker/DrydockLeaseDestroyWorker.php
--- a/src/applications/drydock/worker/DrydockLeaseDestroyWorker.php
+++ b/src/applications/drydock/worker/DrydockLeaseDestroyWorker.php
@@ -29,10 +29,8 @@
$blueprint->destroyLease($resource, $lease);
- // TODO: Rename DrydockLeaseStatus::STATUS_EXPIRED to STATUS_DESTROYED.
-
$lease
- ->setStatus(DrydockLeaseStatus::STATUS_EXPIRED)
+ ->setStatus(DrydockLeaseStatus::STATUS_DESTROYED)
->save();
}

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 16, 3:20 AM (2 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7705460
Default Alt Text
D14150.id.diff (4 KB)

Event Timeline