Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/drydock/controller/DrydockController.php
12262 views
1
<?php
2
3
abstract class DrydockController extends PhabricatorController {
4
5
protected function buildLocksTab($owner_phid) {
6
$locks = DrydockSlotLock::loadLocks($owner_phid);
7
8
$rows = array();
9
foreach ($locks as $lock) {
10
$rows[] = array(
11
$lock->getID(),
12
$lock->getLockKey(),
13
);
14
}
15
16
$table = id(new AphrontTableView($rows))
17
->setNoDataString(pht('No slot locks held.'))
18
->setHeaders(
19
array(
20
pht('ID'),
21
pht('Lock Key'),
22
))
23
->setColumnClasses(
24
array(
25
null,
26
'wide',
27
));
28
29
return id(new PHUIPropertyListView())
30
->addRawContent($table);
31
}
32
33
protected function buildCommandsTab($target_phid) {
34
$viewer = $this->getViewer();
35
36
$commands = id(new DrydockCommandQuery())
37
->setViewer($viewer)
38
->withTargetPHIDs(array($target_phid))
39
->execute();
40
41
$consumed_yes = id(new PHUIIconView())
42
->setIcon('fa-check green');
43
$consumed_no = id(new PHUIIconView())
44
->setIcon('fa-clock-o grey');
45
46
$rows = array();
47
foreach ($commands as $command) {
48
$rows[] = array(
49
$command->getID(),
50
$viewer->renderHandle($command->getAuthorPHID()),
51
$command->getCommand(),
52
($command->getIsConsumed()
53
? $consumed_yes
54
: $consumed_no),
55
phabricator_datetime($command->getDateCreated(), $viewer),
56
);
57
}
58
59
$table = id(new AphrontTableView($rows))
60
->setNoDataString(pht('No commands issued.'))
61
->setHeaders(
62
array(
63
pht('ID'),
64
pht('From'),
65
pht('Command'),
66
null,
67
pht('Date'),
68
))
69
->setColumnClasses(
70
array(
71
null,
72
null,
73
'wide',
74
null,
75
null,
76
));
77
78
return id(new PHUIPropertyListView())
79
->addRawContent($table);
80
}
81
82
protected function buildLogTable(DrydockLogQuery $query) {
83
$viewer = $this->getViewer();
84
85
$logs = $query
86
->setViewer($viewer)
87
->setLimit(100)
88
->execute();
89
90
$log_table = id(new DrydockLogListView())
91
->setUser($viewer)
92
->setLogs($logs);
93
94
return $log_table;
95
}
96
97
protected function buildLogBox(DrydockLogListView $log_table, $all_uri) {
98
$log_header = id(new PHUIHeaderView())
99
->setHeader(pht('Logs'))
100
->addActionLink(
101
id(new PHUIButtonView())
102
->setTag('a')
103
->setHref($all_uri)
104
->setIcon('fa-search')
105
->setText(pht('View All')));
106
107
return id(new PHUIObjectBoxView())
108
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
109
->setHeader($log_header)
110
->setTable($log_table);
111
}
112
113
}
114
115