mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +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
|
@ -7,7 +7,7 @@ final class DrydockLeaseStatus extends DrydockConstants {
|
||||||
const STATUS_ACTIVE = 1;
|
const STATUS_ACTIVE = 1;
|
||||||
const STATUS_RELEASED = 2;
|
const STATUS_RELEASED = 2;
|
||||||
const STATUS_BROKEN = 3;
|
const STATUS_BROKEN = 3;
|
||||||
const STATUS_EXPIRED = 4;
|
const STATUS_DESTROYED = 4;
|
||||||
|
|
||||||
public static function getNameForStatus($status) {
|
public static function getNameForStatus($status) {
|
||||||
$map = array(
|
$map = array(
|
||||||
|
@ -16,7 +16,7 @@ final class DrydockLeaseStatus extends DrydockConstants {
|
||||||
self::STATUS_ACTIVE => pht('Active'),
|
self::STATUS_ACTIVE => pht('Active'),
|
||||||
self::STATUS_RELEASED => pht('Released'),
|
self::STATUS_RELEASED => pht('Released'),
|
||||||
self::STATUS_BROKEN => pht('Broken'),
|
self::STATUS_BROKEN => pht('Broken'),
|
||||||
self::STATUS_EXPIRED => pht('Expired'),
|
self::STATUS_DESTROYED => pht('Destroyed'),
|
||||||
);
|
);
|
||||||
|
|
||||||
return idx($map, $status, pht('Unknown'));
|
return idx($map, $status, pht('Unknown'));
|
||||||
|
@ -29,7 +29,7 @@ final class DrydockLeaseStatus extends DrydockConstants {
|
||||||
self::STATUS_ACTIVE,
|
self::STATUS_ACTIVE,
|
||||||
self::STATUS_RELEASED,
|
self::STATUS_RELEASED,
|
||||||
self::STATUS_BROKEN,
|
self::STATUS_BROKEN,
|
||||||
self::STATUS_EXPIRED,
|
self::STATUS_DESTROYED,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,30 +102,9 @@ final class DrydockLeaseViewController extends DrydockLeaseController {
|
||||||
$view = new PHUIPropertyListView();
|
$view = new PHUIPropertyListView();
|
||||||
$view->setActionList($actions);
|
$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(
|
$view->addProperty(
|
||||||
pht('Status'),
|
pht('Status'),
|
||||||
$status);
|
DrydockLeaseStatus::getNameForStatus($lease->getStatus()));
|
||||||
|
|
||||||
$view->addProperty(
|
$view->addProperty(
|
||||||
pht('Resource Type'),
|
pht('Resource Type'),
|
||||||
|
|
|
@ -160,8 +160,8 @@ final class DrydockLease extends DrydockDAO
|
||||||
return;
|
return;
|
||||||
case DrydockLeaseStatus::STATUS_RELEASED:
|
case DrydockLeaseStatus::STATUS_RELEASED:
|
||||||
throw new Exception(pht('Lease has already been released!'));
|
throw new Exception(pht('Lease has already been released!'));
|
||||||
case DrydockLeaseStatus::STATUS_EXPIRED:
|
case DrydockLeaseStatus::STATUS_DESTROYED:
|
||||||
throw new Exception(pht('Lease has already expired!'));
|
throw new Exception(pht('Lease has already been destroyed!'));
|
||||||
case DrydockLeaseStatus::STATUS_BROKEN:
|
case DrydockLeaseStatus::STATUS_BROKEN:
|
||||||
throw new Exception(pht('Lease has been broken!'));
|
throw new Exception(pht('Lease has been broken!'));
|
||||||
case DrydockLeaseStatus::STATUS_PENDING:
|
case DrydockLeaseStatus::STATUS_PENDING:
|
||||||
|
@ -289,6 +289,7 @@ final class DrydockLease extends DrydockDAO
|
||||||
|
|
||||||
switch ($this->getStatus()) {
|
switch ($this->getStatus()) {
|
||||||
case DrydockLeaseStatus::STATUS_RELEASED:
|
case DrydockLeaseStatus::STATUS_RELEASED:
|
||||||
|
case DrydockLeaseStatus::STATUS_DESTROYED:
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -29,10 +29,8 @@ final class DrydockLeaseDestroyWorker extends DrydockWorker {
|
||||||
|
|
||||||
$blueprint->destroyLease($resource, $lease);
|
$blueprint->destroyLease($resource, $lease);
|
||||||
|
|
||||||
// TODO: Rename DrydockLeaseStatus::STATUS_EXPIRED to STATUS_DESTROYED.
|
|
||||||
|
|
||||||
$lease
|
$lease
|
||||||
->setStatus(DrydockLeaseStatus::STATUS_EXPIRED)
|
->setStatus(DrydockLeaseStatus::STATUS_DESTROYED)
|
||||||
->save();
|
->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue