Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15342077
D19101.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D19101.id.diff
View Options
diff --git a/src/applications/drydock/logtype/DrydockLeaseNoAuthorizationsLogType.php b/src/applications/drydock/logtype/DrydockLeaseNoAuthorizationsLogType.php
--- a/src/applications/drydock/logtype/DrydockLeaseNoAuthorizationsLogType.php
+++ b/src/applications/drydock/logtype/DrydockLeaseNoAuthorizationsLogType.php
@@ -13,14 +13,13 @@
}
public function renderLog(array $data) {
- $viewer = $this->getViewer();
$authorizing_phid = idx($data, 'authorizingPHID');
return pht(
'The object which authorized this lease (%s) is not authorized to use '.
'any of the blueprints the lease lists. Approve the authorizations '.
'before using the lease.',
- $viewer->renderHandle($authorizing_phid)->render());
+ $this->renderHandle($authorizing_phid));
}
}
diff --git a/src/applications/drydock/logtype/DrydockLeaseReclaimLogType.php b/src/applications/drydock/logtype/DrydockLeaseReclaimLogType.php
--- a/src/applications/drydock/logtype/DrydockLeaseReclaimLogType.php
+++ b/src/applications/drydock/logtype/DrydockLeaseReclaimLogType.php
@@ -13,13 +13,11 @@
}
public function renderLog(array $data) {
- $viewer = $this->getViewer();
-
$resource_phids = idx($data, 'resourcePHIDs', array());
return pht(
'Reclaimed resource %s.',
- $viewer->renderHandleList($resource_phids)->render());
+ $this->renderHandleList($resource_phids));
}
}
diff --git a/src/applications/drydock/logtype/DrydockLeaseWaitingForResourcesLogType.php b/src/applications/drydock/logtype/DrydockLeaseWaitingForResourcesLogType.php
--- a/src/applications/drydock/logtype/DrydockLeaseWaitingForResourcesLogType.php
+++ b/src/applications/drydock/logtype/DrydockLeaseWaitingForResourcesLogType.php
@@ -13,13 +13,11 @@
}
public function renderLog(array $data) {
- $viewer = $this->getViewer();
-
$blueprint_phids = idx($data, 'blueprintPHIDs', array());
return pht(
'Waiting for available resources from: %s.',
- $viewer->renderHandleList($blueprint_phids)->render());
+ $this->renderHandleList($blueprint_phids));
}
}
diff --git a/src/applications/drydock/logtype/DrydockLogType.php b/src/applications/drydock/logtype/DrydockLogType.php
--- a/src/applications/drydock/logtype/DrydockLogType.php
+++ b/src/applications/drydock/logtype/DrydockLogType.php
@@ -4,17 +4,18 @@
private $viewer;
private $log;
+ private $renderingMode = 'text';
abstract public function getLogTypeName();
abstract public function getLogTypeIcon(array $data);
abstract public function renderLog(array $data);
- public function setViewer(PhabricatorUser $viewer) {
+ final public function setViewer(PhabricatorUser $viewer) {
$this->viewer = $viewer;
return $this;
}
- public function getViewer() {
+ final public function getViewer() {
return $this->viewer;
}
@@ -38,4 +39,36 @@
->execute();
}
+ final public function renderLogForText($data) {
+ $this->renderingMode = 'text';
+ return $this->renderLog($data);
+ }
+
+ final public function renderLogForHTML($data) {
+ $this->renderingMode = 'html';
+ return $this->renderLog($data);
+ }
+
+ final protected function renderHandle($phid) {
+ $viewer = $this->getViewer();
+ $handle = $viewer->renderHandle($phid);
+
+ if ($this->renderingMode == 'html') {
+ return $handle->render();
+ } else {
+ return $handle->setAsText(true)->render();
+ }
+ }
+
+ final protected function renderHandleList(array $phids) {
+ $viewer = $this->getViewer();
+ $handle_list = $viewer->renderHandleList($phids);
+
+ if ($this->renderingMode == 'html') {
+ return $handle_list->render();
+ } else {
+ return $handle_list->setAsText(true)->render();
+ }
+ }
+
}
diff --git a/src/applications/drydock/logtype/DrydockResourceReclaimLogType.php b/src/applications/drydock/logtype/DrydockResourceReclaimLogType.php
--- a/src/applications/drydock/logtype/DrydockResourceReclaimLogType.php
+++ b/src/applications/drydock/logtype/DrydockResourceReclaimLogType.php
@@ -13,12 +13,11 @@
}
public function renderLog(array $data) {
- $viewer = $this->getViewer();
$reclaimer_phid = idx($data, 'reclaimerPHID');
return pht(
'Resource reclaimed by %s.',
- $viewer->renderHandle($reclaimer_phid)->render());
+ $this->renderHandle($reclaimer_phid));
}
}
diff --git a/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php b/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php
--- a/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php
+++ b/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php
@@ -163,7 +163,7 @@
$log_data = $log->getData();
$type = $type_object->getLogTypeName();
- $data = $type_object->renderLog($log_data);
+ $data = $type_object->renderLogForText($log_data);
} else {
$type = pht('Unknown ("%s")', $type_key);
$data = null;
diff --git a/src/applications/drydock/view/DrydockLogListView.php b/src/applications/drydock/view/DrydockLogListView.php
--- a/src/applications/drydock/view/DrydockLogListView.php
+++ b/src/applications/drydock/view/DrydockLogListView.php
@@ -52,7 +52,7 @@
$type = $type_object->getLogTypeName();
$icon = $type_object->getLogTypeIcon($log_data);
- $data = $type_object->renderLog($log_data);
+ $data = $type_object->renderLogForHTML($log_data);
$data = phutil_escape_html_newlines($data);
} else {
$type = pht('<Unknown: %s>', $type_key);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 10, 9:02 PM (13 h, 40 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7472434
Default Alt Text
D19101.id.diff (5 KB)
Attached To
Mode
D19101: Render Drydock logs in text from "bin/drydock lease"; in HTML in web views
Attached
Detach File
Event Timeline
Log In to Comment