Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/almanac/query/AlmanacDeviceSearchEngine.php b/src/applications/almanac/query/AlmanacDeviceSearchEngine.php
index 86633ac870..b4f7836720 100644
--- a/src/applications/almanac/query/AlmanacDeviceSearchEngine.php
+++ b/src/applications/almanac/query/AlmanacDeviceSearchEngine.php
@@ -1,140 +1,166 @@
<?php
final class AlmanacDeviceSearchEngine
extends PhabricatorApplicationSearchEngine {
public function getResultTypeDescription() {
return pht('Almanac Devices');
}
public function getApplicationClassName() {
return PhabricatorAlmanacApplication::class;
}
public function newQuery() {
return new AlmanacDeviceQuery();
}
protected function buildCustomSearchFields() {
$status_options = AlmanacDeviceStatus::getStatusMap();
$status_options = mpull($status_options, 'getName');
return array(
id(new PhabricatorSearchTextField())
->setLabel(pht('Name Contains'))
->setKey('match')
->setDescription(pht('Search for devices by name substring.')),
id(new PhabricatorSearchStringListField())
->setLabel(pht('Exact Names'))
->setKey('names')
->setDescription(pht('Search for devices with specific names.')),
id(new PhabricatorSearchCheckboxesField())
->setLabel(pht('Statuses'))
->setKey('statuses')
->setDescription(pht('Search for devices with given statuses.'))
->setOptions($status_options),
id(new PhabricatorSearchThreeStateField())
->setLabel(pht('Cluster Device'))
->setKey('isClusterDevice')
->setOptions(
pht('Both Cluster and Non-cluster Devices'),
pht('Cluster Devices Only'),
pht('Non-cluster Devices Only')),
);
}
protected function buildQueryFromParameters(array $map) {
$query = $this->newQuery();
if ($map['match'] !== null) {
$query->withNameNgrams($map['match']);
}
if ($map['names']) {
$query->withNames($map['names']);
}
if ($map['isClusterDevice'] !== null) {
$query->withIsClusterDevice($map['isClusterDevice']);
}
if ($map['statuses']) {
$query->withStatuses($map['statuses']);
}
return $query;
}
protected function getURI($path) {
return '/almanac/device/'.$path;
}
protected function getBuiltinQueryNames() {
$names = array(
'active' => pht('Active Devices'),
'all' => pht('All Devices'),
);
return $names;
}
public function buildSavedQueryFromBuiltin($query_key) {
$query = $this->newSavedQuery();
$query->setQueryKey($query_key);
switch ($query_key) {
case 'active':
$active_statuses = AlmanacDeviceStatus::getActiveStatusList();
return $query->setParameter('statuses', $active_statuses);
case 'all':
return $query;
}
return parent::buildSavedQueryFromBuiltin($query_key);
}
protected function renderResultList(
array $devices,
PhabricatorSavedQuery $query,
array $handles) {
assert_instances_of($devices, 'AlmanacDevice');
$viewer = $this->requireViewer();
$list = new PHUIObjectItemListView();
$list->setUser($viewer);
foreach ($devices as $device) {
$item = id(new PHUIObjectItemView())
->setObjectName(pht('Device %d', $device->getID()))
->setHeader($device->getName())
->setHref($device->getURI())
->setObject($device);
if ($device->isClusterDevice()) {
$item->addIcon('fa-sitemap', pht('Cluster Device'));
}
if ($device->isDisabled()) {
$item->setDisabled(true);
}
$status = $device->getStatusObject();
$icon_icon = $status->getIconIcon();
$icon_color = $status->getIconColor();
$icon_label = $status->getName();
$item->setStatusIcon(
"{$icon_icon} {$icon_color}",
$icon_label);
$list->addItem($item);
}
$result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No Almanac Devices found.'));
return $result;
}
+ protected function getNewUserBody() {
+ $see_network = id(new PHUIButtonView())
+ ->setTag('a')
+ ->setText(pht('See Networks'))
+ ->setHref('/almanac/network/');
+
+ $create_button = id(new PHUIButtonView())
+ ->setTag('a')
+ ->setText(pht('Create a Device'))
+ ->setHref('/almanac/device/edit/')
+ ->setIcon('fa-plus')
+ ->setColor(PHUIButtonView::GREEN);
+
+ $app_name = pht('Devices');
+ $view = id(new PHUIBigInfoView())
+ ->setIcon('fa-server')
+ ->setTitle(pht('Welcome to %s', $app_name))
+ ->setDescription(
+ pht(
+ 'Use Almanac devices to catalogue your build hosts '.
+ 'and their SSH ports your network, and more.'))
+ ->addAction($see_network)
+ ->addAction($create_button);
+
+ return $view;
+ }
}
diff --git a/src/applications/almanac/query/AlmanacNetworkSearchEngine.php b/src/applications/almanac/query/AlmanacNetworkSearchEngine.php
index 5938fd44c7..7bb8b85116 100644
--- a/src/applications/almanac/query/AlmanacNetworkSearchEngine.php
+++ b/src/applications/almanac/query/AlmanacNetworkSearchEngine.php
@@ -1,90 +1,111 @@
<?php
final class AlmanacNetworkSearchEngine
extends PhabricatorApplicationSearchEngine {
public function getResultTypeDescription() {
return pht('Almanac Networks');
}
public function getApplicationClassName() {
return PhabricatorAlmanacApplication::class;
}
public function newQuery() {
return new AlmanacNetworkQuery();
}
protected function buildCustomSearchFields() {
return array(
id(new PhabricatorSearchTextField())
->setLabel(pht('Name Contains'))
->setKey('match')
->setDescription(pht('Search for networks by name substring.')),
);
}
protected function buildQueryFromParameters(array $map) {
$query = $this->newQuery();
if ($map['match'] !== null) {
$query->withNameNgrams($map['match']);
}
return $query;
}
protected function getURI($path) {
return '/almanac/network/'.$path;
}
protected function getBuiltinQueryNames() {
$names = array(
'all' => pht('All Networks'),
);
return $names;
}
public function buildSavedQueryFromBuiltin($query_key) {
$query = $this->newSavedQuery();
$query->setQueryKey($query_key);
switch ($query_key) {
case 'all':
return $query;
}
return parent::buildSavedQueryFromBuiltin($query_key);
}
protected function renderResultList(
array $networks,
PhabricatorSavedQuery $query,
array $handles) {
assert_instances_of($networks, 'AlmanacNetwork');
$viewer = $this->requireViewer();
$list = new PHUIObjectItemListView();
$list->setUser($viewer);
foreach ($networks as $network) {
$id = $network->getID();
$item = id(new PHUIObjectItemView())
->setObjectName(pht('Network %d', $id))
->setHeader($network->getName())
->setHref($this->getApplicationURI("network/{$id}/"))
->setObject($network);
$list->addItem($item);
}
$result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No Almanac Networks found.'));
return $result;
}
+
+ protected function getNewUserBody() {
+ $create_button = id(new PHUIButtonView())
+ ->setTag('a')
+ ->setText(pht('Create a Network'))
+ ->setHref('/almanac/network/edit/')
+ ->setIcon('fa-plus')
+ ->setColor(PHUIButtonView::GREEN);
+
+ $app_name = pht('Networks');
+ $view = id(new PHUIBigInfoView())
+ ->setIcon('fa-globe')
+ ->setTitle(pht('Welcome to %s', $app_name))
+ ->setDescription(
+ pht(
+ 'Use Almanac networks to catalogue private and public '.
+ 'computer networks.'))
+ ->addAction($create_button);
+
+ return $view;
+ }
}
diff --git a/src/applications/almanac/query/AlmanacServiceSearchEngine.php b/src/applications/almanac/query/AlmanacServiceSearchEngine.php
index f9786a87d2..46a9ebfbad 100644
--- a/src/applications/almanac/query/AlmanacServiceSearchEngine.php
+++ b/src/applications/almanac/query/AlmanacServiceSearchEngine.php
@@ -1,118 +1,146 @@
<?php
final class AlmanacServiceSearchEngine
extends PhabricatorApplicationSearchEngine {
public function getResultTypeDescription() {
return pht('Almanac Services');
}
public function getApplicationClassName() {
return PhabricatorAlmanacApplication::class;
}
public function newQuery() {
return new AlmanacServiceQuery();
}
protected function buildQueryFromParameters(array $map) {
$query = $this->newQuery();
if ($map['match'] !== null) {
$query->withNameNgrams($map['match']);
}
if ($map['names']) {
$query->withNames($map['names']);
}
if ($map['devicePHIDs']) {
$query->withDevicePHIDs($map['devicePHIDs']);
}
if ($map['serviceTypes']) {
$query->withServiceTypes($map['serviceTypes']);
}
return $query;
}
protected function buildCustomSearchFields() {
return array(
id(new PhabricatorSearchTextField())
->setLabel(pht('Name Contains'))
->setKey('match')
->setDescription(pht('Search for services by name substring.')),
id(new PhabricatorSearchStringListField())
->setLabel(pht('Exact Names'))
->setKey('names')
->setDescription(pht('Search for services with specific names.')),
id(new PhabricatorSearchDatasourceField())
->setLabel(pht('Service Types'))
->setKey('serviceTypes')
->setDescription(pht('Find services by type.'))
->setDatasource(id(new AlmanacServiceTypeDatasource())),
id(new PhabricatorPHIDsSearchField())
->setLabel(pht('Devices'))
->setKey('devicePHIDs')
->setDescription(
pht('Search for services bound to particular devices.')),
);
}
protected function getURI($path) {
return '/almanac/service/'.$path;
}
protected function getBuiltinQueryNames() {
$names = array(
'all' => pht('All Services'),
);
return $names;
}
public function buildSavedQueryFromBuiltin($query_key) {
$query = $this->newSavedQuery();
$query->setQueryKey($query_key);
switch ($query_key) {
case 'all':
return $query;
}
return parent::buildSavedQueryFromBuiltin($query_key);
}
protected function renderResultList(
array $services,
PhabricatorSavedQuery $query,
array $handles) {
assert_instances_of($services, 'AlmanacService');
$viewer = $this->requireViewer();
$list = new PHUIObjectItemListView();
$list->setUser($viewer);
foreach ($services as $service) {
$item = id(new PHUIObjectItemView())
->setObjectName(pht('Service %d', $service->getID()))
->setHeader($service->getName())
->setHref($service->getURI())
->setObject($service)
->addIcon(
$service->getServiceImplementation()->getServiceTypeIcon(),
$service->getServiceImplementation()->getServiceTypeShortName());
$list->addItem($item);
}
$result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No Almanac Services found.'));
return $result;
}
+
+ protected function getNewUserBody() {
+ $see_devices = id(new PHUIButtonView())
+ ->setTag('a')
+ ->setText(pht('See Devices'))
+ ->setHref('/almanac/device/');
+
+ $create_button = id(new PHUIButtonView())
+ ->setTag('a')
+ ->setText(pht('Create a Service'))
+ ->setHref('/almanac/service/edit/')
+ ->setIcon('fa-plus')
+ ->setColor(PHUIButtonView::GREEN);
+
+
+ $app_name = pht('Services');
+ $view = id(new PHUIBigInfoView())
+ ->setIcon('fa-plug')
+ ->setTitle(pht('Welcome to %s', $app_name))
+ ->setDescription(
+ pht(
+ 'Services describe pools of devices, and '.
+ 'they are available to Drydock for CI/CD, and more.'))
+ ->addAction($see_devices)
+ ->addAction($create_button);
+
+ return $view;
+ }
}
diff --git a/src/applications/drydock/query/DrydockBlueprintSearchEngine.php b/src/applications/drydock/query/DrydockBlueprintSearchEngine.php
index 244afcb986..f556f90146 100644
--- a/src/applications/drydock/query/DrydockBlueprintSearchEngine.php
+++ b/src/applications/drydock/query/DrydockBlueprintSearchEngine.php
@@ -1,141 +1,169 @@
<?php
final class DrydockBlueprintSearchEngine
extends PhabricatorApplicationSearchEngine {
public function getResultTypeDescription() {
return pht('Drydock Blueprints');
}
public function getApplicationClassName() {
return PhabricatorDrydockApplication::class;
}
public function newQuery() {
return id(new DrydockBlueprintQuery());
}
protected function buildQueryFromParameters(array $map) {
$query = $this->newQuery();
if ($map['match'] !== null) {
$query->withNameNgrams($map['match']);
}
if ($map['isDisabled'] !== null) {
$query->withDisabled($map['isDisabled']);
}
return $query;
}
protected function buildCustomSearchFields() {
return array(
id(new PhabricatorSearchTextField())
->setLabel(pht('Name Contains'))
->setKey('match')
->setDescription(pht('Search for blueprints by name substring.')),
id(new PhabricatorSearchThreeStateField())
->setLabel(pht('Disabled'))
->setKey('isDisabled')
->setOptions(
pht('(Show All)'),
pht('Show Only Disabled Blueprints'),
pht('Hide Disabled Blueprints')),
);
}
protected function getURI($path) {
return '/drydock/blueprint/'.$path;
}
protected function getBuiltinQueryNames() {
return array(
'active' => pht('Active Blueprints'),
'all' => pht('All Blueprints'),
);
}
public function buildSavedQueryFromBuiltin($query_key) {
$query = $this->newSavedQuery();
$query->setQueryKey($query_key);
switch ($query_key) {
case 'active':
return $query->setParameter('isDisabled', false);
case 'all':
return $query;
}
return parent::buildSavedQueryFromBuiltin($query_key);
}
protected function renderResultList(
array $blueprints,
PhabricatorSavedQuery $query,
array $handles) {
assert_instances_of($blueprints, 'DrydockBlueprint');
$viewer = $this->requireViewer();
if ($blueprints) {
$edge_query = id(new PhabricatorEdgeQuery())
->withSourcePHIDs(mpull($blueprints, 'getPHID'))
->withEdgeTypes(
array(
PhabricatorProjectObjectHasProjectEdgeType::EDGECONST,
));
$edge_query->execute();
}
$view = new PHUIObjectItemListView();
foreach ($blueprints as $blueprint) {
$impl = $blueprint->getImplementation();
$item = id(new PHUIObjectItemView())
->setHeader($blueprint->getBlueprintName())
->setHref($blueprint->getURI())
->setObjectName(pht('Blueprint %d', $blueprint->getID()));
if (!$impl->isEnabled()) {
$item->setDisabled(true);
$item->addIcon('fa-chain-broken grey', pht('Implementation'));
}
if ($blueprint->getIsDisabled()) {
$item->setDisabled(true);
$item->addIcon('fa-ban grey', pht('Disabled'));
}
$impl_icon = $impl->getBlueprintIcon();
$impl_name = $impl->getBlueprintName();
$impl_icon = id(new PHUIIconView())
->setIcon($impl_icon, 'lightgreytext');
$item->addAttribute(array($impl_icon, ' ', $impl_name));
$phid = $blueprint->getPHID();
$project_phids = $edge_query->getDestinationPHIDs(array($phid));
if ($project_phids) {
$project_handles = $viewer->loadHandles($project_phids);
$item->addAttribute(
id(new PHUIHandleTagListView())
->setLimit(4)
->setSlim(true)
->setHandles($project_handles));
}
$view->addItem($item);
}
$result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($view);
$result->setNoDataString(pht('No blueprints found.'));
return $result;
}
+ protected function getNewUserBody() {
+ $see_almanac_button = id(new PHUIButtonView())
+ ->setTag('a')
+ ->setText(pht('See Almanac services'))
+ ->setHref('/almanac/service/');
+
+ $create_button = id(new PHUIButtonView())
+ ->setTag('a')
+ ->setText(pht('Create a Blueprint'))
+ ->setHref('/drydock/blueprint/edit/')
+ ->setIcon('fa-plus')
+ ->setColor(PHUIButtonView::GREEN);
+
+ $app_name = pht('Blueprints');
+ $view = id(new PHUIBigInfoView())
+ ->setIcon('fa-map-o')
+ ->setTitle(pht('Welcome to %s', $app_name))
+ ->setDescription(
+ pht(
+ 'Blueprints allow to lease fresh working copies of repositories, '.
+ 'on your Drydock devices, when needed by CI/CD workflows, and more. '.
+ 'Blueprints lease services defined in your Almanac.'))
+ ->addAction($see_almanac_button)
+ ->addAction($create_button);
+
+ return $view;
+ }
+
}

File Metadata

Mime Type
text/x-diff
Expires
Mon, Nov 25, 1:19 AM (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1153
Default Alt Text
(17 KB)

Event Timeline