mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
Rename Drydock Lease STATUS_EXPIRED to STATUS_DESTROYED
Summary: Ref T9252. This is now more consistent (same as the equivalent Resource state) and accurate (leases can end up in this state a bunch of ways, including by expiring). Test Plan: `grep`, browsed around web UI. Reviewers: chad Reviewed By: chad Maniphest Tasks: T9252 Differential Revision: https://secure.phabricator.com/D14150
This commit is contained in:
parent
99e4472447
commit
309aadc595
4 changed files with 18 additions and 40 deletions
|
@ -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 @@ final class DrydockLeaseStatus extends DrydockConstants {
|
|||
self::STATUS_ACTIVE,
|
||||
self::STATUS_RELEASED,
|
||||
self::STATUS_BROKEN,
|
||||
self::STATUS_EXPIRED,
|
||||
self::STATUS_DESTROYED,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -102,30 +102,9 @@ final class DrydockLeaseViewController extends DrydockLeaseController {
|
|||
$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'),
|
||||
|
|
|
@ -160,8 +160,8 @@ final class DrydockLease extends DrydockDAO
|
|||
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 @@ final class DrydockLease extends DrydockDAO
|
|||
|
||||
switch ($this->getStatus()) {
|
||||
case DrydockLeaseStatus::STATUS_RELEASED:
|
||||
case DrydockLeaseStatus::STATUS_DESTROYED:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
|
|
|
@ -29,10 +29,8 @@ final class DrydockLeaseDestroyWorker extends DrydockWorker {
|
|||
|
||||
$blueprint->destroyLease($resource, $lease);
|
||||
|
||||
// TODO: Rename DrydockLeaseStatus::STATUS_EXPIRED to STATUS_DESTROYED.
|
||||
|
||||
$lease
|
||||
->setStatus(DrydockLeaseStatus::STATUS_EXPIRED)
|
||||
->setStatus(DrydockLeaseStatus::STATUS_DESTROYED)
|
||||
->save();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue