This is an automated email from the ASF dual-hosted git repository. machristie pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
commit b176d64fae8e69a95a1ca65d2ac19d6709736ea6 Author: Marcus Christie <[email protected]> AuthorDate: Fri Sep 21 13:49:48 2018 -0400 AIRAVATA-2876 Display success message when application saved --- .../applications/ApplicationEditorContainer.vue | 22 +++++- .../common/js/components/NotificationsDisplay.vue | 88 +++++++++++----------- .../common/js/notifications/NotificationList.js | 13 ++-- 3 files changed, 67 insertions(+), 56 deletions(-) diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationEditorContainer.vue b/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationEditorContainer.vue index fd96abd..583ea8d 100644 --- a/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationEditorContainer.vue +++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationEditorContainer.vue @@ -429,7 +429,6 @@ export default { ); } return Promise.resolve(this.currentDeployment); - this.setCurrentApplicationDeploymentSharedEntity(this.currentDeployment); }, setCurrentDeploymentFromComputeHostId(computeHostId) { this.currentDeployment = this.appDeployments.find( @@ -541,6 +540,13 @@ export default { ); }) .then(sharedEntities => { + notifications.NotificationList.add( + new notifications.Notification({ + type: "SUCCESS", + message: "Application saved successfully", + duration: 5 + }) + ); if (!this.id && this.appModule.appModuleId) { // if we just create a new module, navigate to app module route now // that we have an id @@ -549,9 +555,17 @@ export default { params: { id: this.appModule.appModuleId } }); } - // Reinitialize deployment editing so that deployment being edited is - // the saved instance - this.initializeDeploymentEditing(); + if (this.hostId) { + // If creating a new deployment, navigate to the deployments list + this.$router.push({ + name: "application_deployments", + params: { id: this.appModule.appModuleId } + }); + } else { + // Reinitialize deployment editing so that deployment being edited is + // the saved instance + this.initializeDeploymentEditing(); + } }); }, cancel() { diff --git a/django_airavata/static/common/js/components/NotificationsDisplay.vue b/django_airavata/static/common/js/components/NotificationsDisplay.vue index d61a249..d96e4a2 100644 --- a/django_airavata/static/common/js/components/NotificationsDisplay.vue +++ b/django_airavata/static/common/js/components/NotificationsDisplay.vue @@ -1,61 +1,57 @@ <template> - <div id="notifications-display"> - <transition-group name="fade" tag="div"> - <b-alert v-for="unhandledError in unhandledErrors" - variant="danger" :key="unhandledError.id" - show dismissible @dismissed="dismissUnhandledError(unhandledError)"> - {{ unhandledError.message }} - </b-alert> - <b-alert v-for="notification in notifications" - :variant="variant(notification)" :key="notification.id" - show dismissible @dismissed="dismissNotification(notification)"> - {{ notification.message }} - </b-alert> - </transition-group> - </div> + <div id="notifications-display"> + <transition-group name="fade" tag="div"> + <b-alert v-for="unhandledError in unhandledErrors" variant="danger" :key="unhandledError.id" show dismissible @dismissed="dismissUnhandledError(unhandledError)"> + {{ unhandledError.message }} + </b-alert> + <b-alert v-for="notification in notifications" :variant="variant(notification)" :key="notification.id" :show="notification.duration > 0 ? notification.duration : true" + dismissible @dismissed="dismissNotification(notification)"> + {{ notification.message }} + </b-alert> + </transition-group> + </div> </template> <script> - -import { errors } from 'django-airavata-api' -import Notification from '../notifications/Notification' -import NotificationList from '../notifications/NotificationList' +import { errors } from "django-airavata-api"; +import Notification from "../notifications/Notification"; +import NotificationList from "../notifications/NotificationList"; export default { - name: "notifications-display", - data () { - return { - notifications: NotificationList.list, - unhandledErrors: errors.UnhandledErrorDisplayList.list, - } + name: "notifications-display", + data() { + return { + notifications: NotificationList.list, + unhandledErrors: errors.UnhandledErrorDisplayList.list + }; + }, + methods: { + dismissNotification: function(notification) { + NotificationList.remove(notification); }, - methods: { - dismissNotification: function(notification) { - NotificationList.remove(notification); - }, - dismissUnhandledError: function(unhandledError) { - errors.UnhandledErrorDisplayList.remove(unhandledError); - }, - variant: function(notification) { - if (notification.type === "SUCCESS") { - return "success"; - } else if (notification.type === "ERROR") { - return "danger"; - } else { - return "secondary"; - } - } + dismissUnhandledError: function(unhandledError) { + errors.UnhandledErrorDisplayList.remove(unhandledError); }, -} + variant: function(notification) { + if (notification.type === "SUCCESS") { + return "success"; + } else if (notification.type === "ERROR") { + return "danger"; + } else { + return "secondary"; + } + } + } +}; </script> <style> #notifications-display { - position: fixed; - top: 75px; - left: 20vw; - width: 60vw; - z-index: 10000; + position: fixed; + top: 75px; + left: 20vw; + width: 60vw; + z-index: 10000; } </style> diff --git a/django_airavata/static/common/js/notifications/NotificationList.js b/django_airavata/static/common/js/notifications/NotificationList.js index de8b6f8..dcb9448 100644 --- a/django_airavata/static/common/js/notifications/NotificationList.js +++ b/django_airavata/static/common/js/notifications/NotificationList.js @@ -1,7 +1,6 @@ -import Notification from './Notification' +import Notification from "./Notification"; class NotificationList { - constructor() { this.notifications = []; } @@ -12,10 +11,12 @@ class NotificationList { // Convenience method for adding an error addError(error) { - this.notifications.push(new Notification({ - type: "ERROR", - message: error.message - })) + this.notifications.push( + new Notification({ + type: "ERROR", + message: error.message + }) + ); } remove(notification) {
