Merge "Adding equevalance templates discarding the validation results"

This commit is contained in:
Zuul 2019-03-26 14:46:33 +00:00 committed by Gerrit Code Review
commit aa9ee28a69
4 changed files with 44 additions and 23 deletions

View File

@ -106,29 +106,31 @@
);
vitrageTopologySrv.validateTemplate($scope.templateContent, type, finalParameters).then(function (result) {
if (result.data.results[0]['status code'] !== 0) {
horizon.toast.add("error", gettext(result.data.results[0].message));
if (!result || !result.data || !result.data.results || result.data.results.length === 0) {
horizon.toast.add("error", gettext('Template Validation Failed'));
} else {
vitrageTopologySrv.addTemplate($scope.templateContent, type, finalParameters).then(function (result) {
if (!(result.data.results[0]['status code'] === 0 || result.data.results[0]['status code'] === "")) {
horizon.toast.add("error", gettext(result.data.results[0].message));
} else {
vitrageTopologySrv.addTemplate($scope.templateContent, type, finalParameters).then(function (result) {
if (result.data[0].status === 'ERROR') {
horizon.toast.add("error", gettext(result.data[0]['status details']));
} else {
$scope.loading = false;
$rootScope.$broadcast('autoRefresh');
if (result.data[0].status === 'ERROR') {
horizon.toast.add("error", gettext(result.data[0]['status details']));
} else {
$scope.loading = false;
$rootScope.$broadcast('autoRefresh');
}
})
.catch(function () {
$scope.loading = false;
horizon.toast.add("error", gettext("Unable to add template"));
return;
});
}
})
.catch(function () {
$scope.loading = false;
horizon.toast.add("error", gettext("Unable to add template"));
return;
});
}
}
}).catch(function (reason) {
horizon.toast.add("error", gettext(reason));
})

View File

@ -2,4 +2,5 @@
height: 100%;
background: #ffffff;
opacity: 0.8;
margin-bottom: 10%;
}

View File

@ -18,6 +18,9 @@
$scope.closeModal = function () {
modalSrv.close();
};
$scope.isObject = function (data) {
return typeof data ==='object';
};
vitrageTopologySrv.getTemplates(template.uuid)
.then(

View File

@ -1,6 +1,6 @@
<div class="template-container">
<div class="controls">
<i title="{$ yaml_view ? 'Simple View' : 'Yaml View' $}"
<i title="{$ yaml_view ? 'Simple View' : 'Json View' $}"
class="fa" ng-class="{'fa-file-text':!yaml_view, 'fa-list':yaml_view}"
ng-click="yaml_view = !yaml_view;"></i>
<i title="Close" class="fa fa-times" ng-click="closeModal()"></i>
@ -95,7 +95,16 @@
<b>{$ key $}:</b> {$ value $}
</li>
<li ng-repeat="(property, value) in action.action.properties track by $index">
<b>{$ property $}:</b> {$ value $}
<span ng-if="!isObject(value)"> <b>{$ property $}:</b> {$ value $}</span>
<span ng-if="isObject(value)">
<b>{$ property $}</b>
<ol>
<li ng-repeat="(label, data) in value track by $index">
<b>{$ label $}:</b> {$ data $}
</li>
</ol>
</span>
</li>
</ul>
</li>
@ -105,7 +114,15 @@
<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 $}
<span ng-if="!isObject(value)"> <b>{$ key $}:</b> {$ value $}</span>
<span ng-if="isObject(value)">
<b> {$ key $}</b>
<ol>
<li ng-repeat="(label, data) in value track by $index">
<b>{$ label $}:</b> {$ data $}
</li>
</ol>
</span>
</li>
</ul>
</li>
@ -118,9 +135,7 @@
</div>
</div>
<div ng-show="yaml_view" class="definition-block">
<pre contentEditable="false">
{$ str_data $}
</pre>
<pre contentEditable="false">{$ str_data $}</pre>
</div>