Merge "Adding equevalance templates discarding the validation results"
This commit is contained in:
commit
aa9ee28a69
@ -106,29 +106,31 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
vitrageTopologySrv.validateTemplate($scope.templateContent, type, finalParameters).then(function (result) {
|
vitrageTopologySrv.validateTemplate($scope.templateContent, type, finalParameters).then(function (result) {
|
||||||
if (result.data.results[0]['status code'] !== 0) {
|
if (!result || !result.data || !result.data.results || result.data.results.length === 0) {
|
||||||
horizon.toast.add("error", gettext(result.data.results[0].message));
|
horizon.toast.add("error", gettext('Template Validation Failed'));
|
||||||
} else {
|
} 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') {
|
if (result.data[0].status === 'ERROR') {
|
||||||
horizon.toast.add("error", gettext(result.data[0]['status details']));
|
horizon.toast.add("error", gettext(result.data[0]['status details']));
|
||||||
} else {
|
} else {
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
$rootScope.$broadcast('autoRefresh');
|
$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) {
|
}).catch(function (reason) {
|
||||||
horizon.toast.add("error", gettext(reason));
|
horizon.toast.add("error", gettext(reason));
|
||||||
})
|
})
|
||||||
|
@ -2,4 +2,5 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
|
margin-bottom: 10%;
|
||||||
}
|
}
|
@ -18,6 +18,9 @@
|
|||||||
$scope.closeModal = function () {
|
$scope.closeModal = function () {
|
||||||
modalSrv.close();
|
modalSrv.close();
|
||||||
};
|
};
|
||||||
|
$scope.isObject = function (data) {
|
||||||
|
return typeof data ==='object';
|
||||||
|
};
|
||||||
|
|
||||||
vitrageTopologySrv.getTemplates(template.uuid)
|
vitrageTopologySrv.getTemplates(template.uuid)
|
||||||
.then(
|
.then(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<div class="template-container">
|
<div class="template-container">
|
||||||
<div class="controls">
|
<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}"
|
class="fa" ng-class="{'fa-file-text':!yaml_view, 'fa-list':yaml_view}"
|
||||||
ng-click="yaml_view = !yaml_view;"></i>
|
ng-click="yaml_view = !yaml_view;"></i>
|
||||||
<i title="Close" class="fa fa-times" ng-click="closeModal()"></i>
|
<i title="Close" class="fa fa-times" ng-click="closeModal()"></i>
|
||||||
@ -95,7 +95,16 @@
|
|||||||
<b>{$ key $}:</b> {$ value $}
|
<b>{$ key $}:</b> {$ value $}
|
||||||
</li>
|
</li>
|
||||||
<li ng-repeat="(property, value) in action.action.properties track by $index">
|
<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>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
@ -105,7 +114,15 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li><b>action:</b> {$ keys(action)[0] $}</li>
|
<li><b>action:</b> {$ keys(action)[0] $}</li>
|
||||||
<li ng-repeat="(key, value) in action[keys(action)[0]] track by $index">
|
<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>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
@ -118,9 +135,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div ng-show="yaml_view" class="definition-block">
|
<div ng-show="yaml_view" class="definition-block">
|
||||||
<pre contentEditable="false">
|
<pre contentEditable="false">{$ str_data $}</pre>
|
||||||
{$ str_data $}
|
|
||||||
</pre>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user