Merge "Support Version 3 template format displaying on template view"

This commit is contained in:
Zuul 2019-02-18 13:24:53 +00:00 committed by Gerrit Code Review
commit 19829bfdee
2 changed files with 29 additions and 4 deletions

View File

@ -24,6 +24,8 @@
function success(result) {
$scope.yaml_view = false;
$scope.data = result.data;
$scope.v3 = result.data.entities?true:false;
$scope.keys = Object.keys;
$scope.str_data = JSON.stringify(result.data, null, 4);
},
function error(result) {

View File

@ -10,9 +10,10 @@
<span id="template_name">{$ data.metadata.name $}</span>
</h2>
<div ng-show="!yaml_view">
<div class="definition-block" ng-if="data.definitions && data.definitions.entities">
<div class="definition-block" ng-if="data.entities||(data.definitions && data.definitions.entities)">
<h3>Entities</h3>
<div ng-repeat="entity in data.definitions.entities | orderBy: 'entity.category' track by entity.entity.template_id">
<div ng-if="!v3"
ng-repeat="entity in data.definitions.entities | orderBy: 'entity.category' track by entity.entity.template_id">
<details>
<summary>{$ entity.entity.template_id $}</summary>
<div class="tabbed">
@ -24,6 +25,18 @@
</div>
</details>
</div>
<div ng-if="v3" ng-repeat="(key,entity) in data.entities ">
<details>
<summary>{$ key $}</summary>
<div class="tabbed">
<ul>
<li ng-repeat="(property, value) in entity track by $index">
<b>{$ property $}:</b> {$ value $}
</li>
</ul>
</div>
</details>
</div>
<br>
</div>
<div class="definition-block" ng-if="data.definitions && data.definitions.relationships">
@ -70,11 +83,11 @@
<h3>Scenarios</h3>
<div ng-repeat="scenario in data.scenarios track by $index">
<details>
<summary>{$ scenario.scenario.condition $}</summary>
<summary>{$ scenario.condition||scenario.scenario.condition $}</summary>
<div class="tabbed">
<b>Actions:</b>
<ol>
<div ng-repeat="action in scenario.scenario.actions track by $index">
<div ng-if="!v3" ng-repeat="action in scenario.scenario.actions track by $index">
<li>
<ul>
<li><b>action:</b> {$ action.action.action_type $}</li>
@ -87,6 +100,16 @@
</ul>
</li>
</div>
<div ng-if="v3" ng-repeat="action in scenario.actions track by $index">
<li>
<ul>
<li><b>action:</b> {$ keys(action)[0] $}</li>
<li ng-repeat="(key, value) in action[keys(action)[0]] track by $index">
<b>{$ key $}:</b> {$ value $}
</li>
</ul>
</li>
</div>
</ol>
</div>
</details>