diff --git a/vitrage_dashboard/dashboard/static/dashboard/project/components/addTemplate/addTemplateContainer.controller.js b/vitrage_dashboard/dashboard/static/dashboard/project/components/addTemplate/addTemplateContainer.controller.js index 69a4a1c..36a128b 100644 --- a/vitrage_dashboard/dashboard/static/dashboard/project/components/addTemplate/addTemplateContainer.controller.js +++ b/vitrage_dashboard/dashboard/static/dashboard/project/components/addTemplate/addTemplateContainer.controller.js @@ -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)); }) diff --git a/vitrage_dashboard/dashboard/static/dashboard/project/components/rca/rcaContainer.scss b/vitrage_dashboard/dashboard/static/dashboard/project/components/rca/rcaContainer.scss index c17c78b..a870d35 100644 --- a/vitrage_dashboard/dashboard/static/dashboard/project/components/rca/rcaContainer.scss +++ b/vitrage_dashboard/dashboard/static/dashboard/project/components/rca/rcaContainer.scss @@ -2,4 +2,5 @@ height: 100%; background: #ffffff; opacity: 0.8; + margin-bottom: 10%; } \ No newline at end of file diff --git a/vitrage_dashboard/dashboard/static/dashboard/project/components/template/templateContainer.controller.js b/vitrage_dashboard/dashboard/static/dashboard/project/components/template/templateContainer.controller.js index 8521533..834ac85 100644 --- a/vitrage_dashboard/dashboard/static/dashboard/project/components/template/templateContainer.controller.js +++ b/vitrage_dashboard/dashboard/static/dashboard/project/components/template/templateContainer.controller.js @@ -18,6 +18,9 @@ $scope.closeModal = function () { modalSrv.close(); }; + $scope.isObject = function (data) { + return typeof data ==='object'; + }; vitrageTopologySrv.getTemplates(template.uuid) .then( diff --git a/vitrage_dashboard/dashboard/static/dashboard/project/components/template/templateContainer.html b/vitrage_dashboard/dashboard/static/dashboard/project/components/template/templateContainer.html index 1b2a710..43923ad 100644 --- a/vitrage_dashboard/dashboard/static/dashboard/project/components/template/templateContainer.html +++ b/vitrage_dashboard/dashboard/static/dashboard/project/components/template/templateContainer.html @@ -1,6 +1,6 @@
- {$ str_data $} -+
{$ str_data $}