Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15386631
D19613.id46888.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D19613.id46888.diff
View Options
diff --git a/resources/sql/autopatches/20180827.drydock.01.acquired.sql b/resources/sql/autopatches/20180827.drydock.01.acquired.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20180827.drydock.01.acquired.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_drydock.drydock_lease
+ ADD acquiredEpoch INT UNSIGNED;
diff --git a/resources/sql/autopatches/20180827.drydock.02.activated.sql b/resources/sql/autopatches/20180827.drydock.02.activated.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20180827.drydock.02.activated.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_drydock.drydock_lease
+ ADD activatedEpoch INT UNSIGNED;
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
@@ -163,6 +163,30 @@
}
$view->addProperty(pht('Expires'), $until_display);
+ $acquired_epoch = $lease->getAcquiredEpoch();
+ $activated_epoch = $lease->getActivatedEpoch();
+
+ if ($acquired_epoch) {
+ $acquired_display = phabricator_datetime($acquired_epoch, $viewer);
+ } else {
+ if ($activated_epoch) {
+ $acquired_display = phutil_tag(
+ 'em',
+ array(),
+ pht('Activated on Acquisition'));
+ } else {
+ $acquired_display = phutil_tag('em', array(), pht('Not Acquired'));
+ }
+ }
+ $view->addProperty(pht('Acquired'), $acquired_display);
+
+ if ($activated_epoch) {
+ $activated_display = phabricator_datetime($activated_epoch, $viewer);
+ } else {
+ $activated_display = phutil_tag('em', array(), pht('Not Activated'));
+ }
+ $view->addProperty(pht('Activated'), $activated_display);
+
$attributes = $lease->getAttributes();
if ($attributes) {
$view->addSectionHeader(
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
@@ -10,6 +10,8 @@
protected $authorizingPHID;
protected $attributes = array();
protected $status = DrydockLeaseStatus::STATUS_PENDING;
+ protected $acquiredEpoch;
+ protected $activatedEpoch;
private $resource = self::ATTACHABLE;
private $unconsumedCommands = self::ATTACHABLE;
@@ -62,6 +64,22 @@
$this->scheduleUpdate();
}
+ public function setStatus($status) {
+ if ($status == DrydockLeaseStatus::STATUS_ACQUIRED) {
+ if (!$this->getAcquiredEpoch()) {
+ $this->setAcquiredEpoch(PhabricatorTime::getNow());
+ }
+ }
+
+ if ($status == DrydockLeaseStatus::STATUS_ACTIVE) {
+ if (!$this->getActivatedEpoch()) {
+ $this->setActivatedEpoch(PhabricatorTime::getNow());
+ }
+ }
+
+ return parent::setStatus($status);
+ }
+
public function getLeaseName() {
return pht('Lease %d', $this->getID());
}
@@ -78,6 +96,8 @@
'resourceType' => 'text128',
'ownerPHID' => 'phid?',
'resourcePHID' => 'phid?',
+ 'acquiredEpoch' => 'epoch?',
+ 'activatedEpoch' => 'epoch?',
),
self::CONFIG_KEY_SCHEMA => array(
'key_resource' => array(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 16, 12:59 AM (2 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7704809
Default Alt Text
D19613.id46888.diff (3 KB)
Attached To
Mode
D19613: Add an "Activated Epoch" and an "Acquired Epoch" to Drydock Leases
Attached
Detach File
Event Timeline
Log In to Comment