2013-12-26 21:30:36 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DrydockConsoleController extends DrydockController {
|
|
|
|
|
|
|
|
public function shouldAllowPublic() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function buildSideNavView() {
|
|
|
|
$nav = new AphrontSideNavFilterView();
|
|
|
|
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
|
|
|
|
|
|
|
// These are only used on mobile.
|
|
|
|
|
|
|
|
$nav->addFilter('blueprint', pht('Blueprints'));
|
|
|
|
$nav->addFilter('resource', pht('Resources'));
|
|
|
|
$nav->addFilter('lease', pht('Leases'));
|
2015-10-17 03:47:05 +02:00
|
|
|
$nav->addFilter('operation', pht('Repository Operations'));
|
2013-12-26 21:30:36 +01:00
|
|
|
|
|
|
|
$nav->selectFilter(null);
|
|
|
|
|
|
|
|
return $nav;
|
|
|
|
}
|
|
|
|
|
2015-07-27 16:56:52 +02:00
|
|
|
public function handleRequest(AphrontRequest $request) {
|
|
|
|
$viewer = $request->getViewer();
|
2013-12-26 21:30:36 +01:00
|
|
|
|
|
|
|
$menu = id(new PHUIObjectItemListView())
|
|
|
|
->setUser($viewer);
|
|
|
|
|
|
|
|
$menu->addItem(
|
|
|
|
id(new PHUIObjectItemView())
|
|
|
|
->setHeader(pht('Blueprints'))
|
Give Drydock resources a proper expiry mechanism
Summary:
Fixes T6569. This implements an expiry mechanism for Drydock resources which parallels the mechanism for leases.
A few things are missing that we'll probably need in the future:
- An "EXPIRES" command to update the expiration time. This would let resources be permanent while leased, then expire after, say, 24 hours without any leases.
- A callback like `shouldActuallyExpireRightNow()` for resources and leases that lets them decide not to expire at the last second.
- A callback like `didAcquireLease()` for resource blueprints, to parallel `didReleaseLease()`, letting them clear or extend their timer.
However, this stuff would mostly just let us tune behaviors, not really open up new capabilities.
Test Plan: Changed host resources to expire after 60 seconds, leased one, saw it vanish 60 seconds later.
Reviewers: hach-que, chad
Reviewed By: chad
Maniphest Tasks: T6569
Differential Revision: https://secure.phabricator.com/D14176
2015-09-28 18:35:14 +02:00
|
|
|
->setFontIcon('fa-map-o')
|
2013-12-26 21:30:36 +01:00
|
|
|
->setHref($this->getApplicationURI('blueprint/'))
|
|
|
|
->addAttribute(
|
|
|
|
pht(
|
|
|
|
'Configure blueprints so Drydock can build resources, like '.
|
|
|
|
'hosts and working copies.')));
|
|
|
|
|
|
|
|
$menu->addItem(
|
|
|
|
id(new PHUIObjectItemView())
|
|
|
|
->setHeader(pht('Resources'))
|
Give Drydock resources a proper expiry mechanism
Summary:
Fixes T6569. This implements an expiry mechanism for Drydock resources which parallels the mechanism for leases.
A few things are missing that we'll probably need in the future:
- An "EXPIRES" command to update the expiration time. This would let resources be permanent while leased, then expire after, say, 24 hours without any leases.
- A callback like `shouldActuallyExpireRightNow()` for resources and leases that lets them decide not to expire at the last second.
- A callback like `didAcquireLease()` for resource blueprints, to parallel `didReleaseLease()`, letting them clear or extend their timer.
However, this stuff would mostly just let us tune behaviors, not really open up new capabilities.
Test Plan: Changed host resources to expire after 60 seconds, leased one, saw it vanish 60 seconds later.
Reviewers: hach-que, chad
Reviewed By: chad
Maniphest Tasks: T6569
Differential Revision: https://secure.phabricator.com/D14176
2015-09-28 18:35:14 +02:00
|
|
|
->setFontIcon('fa-map')
|
2013-12-26 21:30:36 +01:00
|
|
|
->setHref($this->getApplicationURI('resource/'))
|
|
|
|
->addAttribute(
|
2015-05-22 09:27:56 +02:00
|
|
|
pht('View and manage resources Drydock has built, like hosts.')));
|
2013-12-26 21:30:36 +01:00
|
|
|
|
|
|
|
$menu->addItem(
|
|
|
|
id(new PHUIObjectItemView())
|
|
|
|
->setHeader(pht('Leases'))
|
Give Drydock resources a proper expiry mechanism
Summary:
Fixes T6569. This implements an expiry mechanism for Drydock resources which parallels the mechanism for leases.
A few things are missing that we'll probably need in the future:
- An "EXPIRES" command to update the expiration time. This would let resources be permanent while leased, then expire after, say, 24 hours without any leases.
- A callback like `shouldActuallyExpireRightNow()` for resources and leases that lets them decide not to expire at the last second.
- A callback like `didAcquireLease()` for resource blueprints, to parallel `didReleaseLease()`, letting them clear or extend their timer.
However, this stuff would mostly just let us tune behaviors, not really open up new capabilities.
Test Plan: Changed host resources to expire after 60 seconds, leased one, saw it vanish 60 seconds later.
Reviewers: hach-que, chad
Reviewed By: chad
Maniphest Tasks: T6569
Differential Revision: https://secure.phabricator.com/D14176
2015-09-28 18:35:14 +02:00
|
|
|
->setFontIcon('fa-link')
|
2013-12-26 21:30:36 +01:00
|
|
|
->setHref($this->getApplicationURI('lease/'))
|
2015-05-22 09:27:56 +02:00
|
|
|
->addAttribute(pht('Manage leases on resources.')));
|
2013-12-26 21:30:36 +01:00
|
|
|
|
2015-10-17 03:47:05 +02:00
|
|
|
$menu->addItem(
|
|
|
|
id(new PHUIObjectItemView())
|
|
|
|
->setHeader(pht('Repository Operations'))
|
|
|
|
->setFontIcon('fa-fighter-jet')
|
|
|
|
->setHref($this->getApplicationURI('operation/'))
|
|
|
|
->addAttribute(pht('Review the repository operation queue.')));
|
|
|
|
|
2013-12-26 21:30:36 +01:00
|
|
|
$crumbs = $this->buildApplicationCrumbs();
|
|
|
|
$crumbs->addTextCrumb(pht('Console'));
|
|
|
|
|
2015-05-28 20:12:49 +02:00
|
|
|
$box = id(new PHUIObjectBoxView())
|
|
|
|
->setHeaderText(pht('Drydock Console'))
|
|
|
|
->setObjectList($menu);
|
|
|
|
|
2013-12-26 21:30:36 +01:00
|
|
|
return $this->buildApplicationPage(
|
|
|
|
array(
|
|
|
|
$crumbs,
|
2015-05-28 20:12:49 +02:00
|
|
|
$box,
|
2013-12-26 21:30:36 +01:00
|
|
|
),
|
|
|
|
array(
|
|
|
|
'title' => pht('Drydock Console'),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|