mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-29 02:02:41 +01:00
d4a0b1c870
Summary: Ref T9252. Long ago you sometimes manually created resources, so they had human-enterable names. However, users never make resources manually any more, so this field isn't really useful any more. In particular, it means we write a lot of untranslatable strings like "Working Copy" to the database in the default locale. Instead, do the call at runtime so resource names are translatable. Also clean up a few minor things I hit while kicking the tires here. It's possible we might eventually want to introduce a human-choosable label so you can rename your favorite resources and this would just be a default name. I don't really have much of a use case for that yet, though, and I'm not sure there will ever be one. Test Plan: - Restarted a Harbormaster build, got a clean build. - Released all leases/resources, restarted build, got a clean build with proper resource names. Reviewers: hach-que, chad Reviewed By: hach-que, chad Maniphest Tasks: T9252 Differential Revision: https://secure.phabricator.com/D14213
62 lines
1.3 KiB
PHP
62 lines
1.3 KiB
PHP
<?php
|
|
|
|
abstract class DrydockLeaseController
|
|
extends DrydockController {
|
|
|
|
private $resource;
|
|
|
|
public function setResource($resource) {
|
|
$this->resource = $resource;
|
|
return $this;
|
|
}
|
|
|
|
public function getResource() {
|
|
return $this->resource;
|
|
}
|
|
|
|
public function buildSideNavView() {
|
|
$nav = new AphrontSideNavFilterView();
|
|
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
|
|
|
$engine = id(new DrydockLeaseSearchEngine())
|
|
->setViewer($this->getRequest()->getUser());
|
|
|
|
if ($this->getResource()) {
|
|
$engine->setResource($this->getResource());
|
|
}
|
|
|
|
$engine->addNavigationItems($nav->getMenu());
|
|
|
|
$nav->selectFilter(null);
|
|
|
|
return $nav;
|
|
}
|
|
|
|
protected function buildApplicationCrumbs() {
|
|
$crumbs = parent::buildApplicationCrumbs();
|
|
|
|
$resource = $this->getResource();
|
|
if ($resource) {
|
|
$id = $resource->getID();
|
|
|
|
$crumbs->addTextCrumb(
|
|
pht('Resources'),
|
|
$this->getApplicationURI('resource/'));
|
|
|
|
$crumbs->addTextCrumb(
|
|
$resource->getResourceName(),
|
|
$this->getApplicationURI("resource/{$id}/"));
|
|
|
|
$crumbs->addTextCrumb(
|
|
pht('Leases'),
|
|
$this->getApplicationURI("resource/{$id}/leases/"));
|
|
|
|
} else {
|
|
$crumbs->addTextCrumb(
|
|
pht('Leases'),
|
|
$this->getApplicationURI('lease/'));
|
|
}
|
|
return $crumbs;
|
|
}
|
|
|
|
}
|