From 9be0b58276a949a2b075caa11cfc87ac487c3f96 Mon Sep 17 00:00:00 2001 From: martinRenou Date: Thu, 11 May 2017 16:29:35 +0100 Subject: [PATCH 01/12] The model now return errors instead of dealing with it --- remoteappmanager/static/js/home/models.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/remoteappmanager/static/js/home/models.js b/remoteappmanager/static/js/home/models.js index c59bb0f26..e0696714b 100644 --- a/remoteappmanager/static/js/home/models.js +++ b/remoteappmanager/static/js/home/models.js @@ -1,9 +1,8 @@ define([ "jquery", "home/configurables", - "jsapi/v1/resources", - "dialogs" -], function ($, configurables, resources, dialogs) { + "jsapi/v1/resources" +], function ($, configurables, resources) { "use strict"; var Status = { @@ -154,18 +153,18 @@ define([ configurablesData[tag] = configurable.asConfigDict(); }); - resources.Container.create({ + return resources.Container.create({ mapping_id: currentApp.appData.mapping_id, configurables: configurablesData }).done(function() { this.updateIdx(selectedIndex) .fail(function(error) { currentApp.status = Status.STOPPED; - dialogs.webapi_error_dialog(error); + return error; }); }.bind(this)).fail(function(error) { currentApp.status = Status.STOPPED; - dialogs.webapi_error_dialog(error); + return error; }); }; @@ -175,17 +174,17 @@ define([ var url_id = appStopping.appData.container.url_id; - resources.Container.delete(url_id) + return resources.Container.delete(url_id) .done(function() { this.updateIdx(index) .fail(function(error) { appStopping.status = Status.STOPPED; - dialogs.webapi_error_dialog(error); + return error; }); }.bind(this)) .fail(function(error) { appStopping.status = Status.STOPPED; - dialogs.webapi_error_dialog(error); + return error; }); }; From bf22336d76874405016fea565d27f09e5ddb9d9e Mon Sep 17 00:00:00 2001 From: martinRenou Date: Thu, 11 May 2017 17:22:14 +0100 Subject: [PATCH 02/12] Add dialog --- remoteappmanager/static/js/home/controller.js | 3 ++- .../static/js/home/views/application_view.js | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/remoteappmanager/static/js/home/controller.js b/remoteappmanager/static/js/home/controller.js index eef36c39b..d5d9227ec 100644 --- a/remoteappmanager/static/js/home/controller.js +++ b/remoteappmanager/static/js/home/controller.js @@ -5,7 +5,8 @@ require([ "home/views/application_view", "components/vue/dist/vue", "gamodule", - "vue/filters" + "vue/filters", + "admin/vue-components/toolkit/toolkit" ], function( models, applicationListView, diff --git a/remoteappmanager/static/js/home/views/application_view.js b/remoteappmanager/static/js/home/views/application_view.js index 21f85cb28..248d41bc2 100644 --- a/remoteappmanager/static/js/home/views/application_view.js +++ b/remoteappmanager/static/js/home/views/application_view.js @@ -1,7 +1,7 @@ define([ "urlutils", "utils", - '../../components/vue/dist/vue' + "../../components/vue/dist/vue" ], function (urlUtils, utils, Vue) { "use strict"; @@ -11,6 +11,12 @@ define([ '
' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + ' ' + '
' + @@ -78,6 +84,10 @@ define([ ' ' + '
', + data: function() { + return { showErrorDialog: false }; + }, + computed: { currentApp: function() { return this.model.appList[this.model.selectedIndex] || null; @@ -102,7 +112,10 @@ define([ methods: { startApplication: function() { this.$emit('startApplication', this.currentApp); - this.model.startApplication(); + this.model.startApplication().fail(function(error) { + console.log(error); + this.showErrorDialog = true; + }.bind(this)); }, getIframeSize: function() { return utils.maxIframeSize(); From 78704f0a7fd31249a218b97b44ce902c25abccdb Mon Sep 17 00:00:00 2001 From: martinRenou Date: Fri, 12 May 2017 09:51:55 +0100 Subject: [PATCH 03/12] Change confirm dialog so that it doesn't show cancel button if not callback --- .../static/js/admin/vue-components/toolkit/ConfirmDialog.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/remoteappmanager/static/js/admin/vue-components/toolkit/ConfirmDialog.js b/remoteappmanager/static/js/admin/vue-components/toolkit/ConfirmDialog.js index 5145dc177..b7ca6686b 100644 --- a/remoteappmanager/static/js/admin/vue-components/toolkit/ConfirmDialog.js +++ b/remoteappmanager/static/js/admin/vue-components/toolkit/ConfirmDialog.js @@ -1,7 +1,7 @@ define([ ], function() { "use strict"; - + return { props: { title: { @@ -10,7 +10,7 @@ define([ }, closeCallback: { type: Function, - default: function() {} + default: undefined }, okCallback: { type: Function, @@ -24,7 +24,7 @@ define([ ' ' + ' ' + ' ' + ' ' + From 66a6022118204ef46950e9bf1b0b33139524ab76 Mon Sep 17 00:00:00 2001 From: martinRenou Date: Fri, 12 May 2017 12:31:07 +0100 Subject: [PATCH 04/12] Fixed css of the confirm dialog --- .../static/css/remoteappmanager.css | 66 ++----------------- .../vue-components/toolkit/ConfirmDialog.js | 20 +++--- 2 files changed, 17 insertions(+), 69 deletions(-) diff --git a/remoteappmanager/static/css/remoteappmanager.css b/remoteappmanager/static/css/remoteappmanager.css index 344cd3d80..f08aef6d6 100644 --- a/remoteappmanager/static/css/remoteappmanager.css +++ b/remoteappmanager/static/css/remoteappmanager.css @@ -188,68 +188,16 @@ li a .stop-button:hover { padding: 0px; } -.modal-mask { - position: fixed; - z-index: 9998; - top: 0; - left: 0; - width: 100%; - height: 100%; - background-color: rgba(0, 0, 0, .5); - display: table; - transition: opacity .3s ease; +/* Transition for the modal dialog */ +.modal-fade-enter-active, .modal-fade-leave-active { + transition: opacity .2s } - -.modal-wrapper { - display: table-cell; - vertical-align: middle; -} - -.modal-container { - width: 300px; - margin: 0px auto; - padding: 20px 30px; - background-color: #fff; - border-radius: 2px; - box-shadow: 0 2px 8px rgba(0, 0, 0, .33); - transition: all .3s ease; - font-family: Helvetica, Arial, sans-serif; -} - -.modal-header h3 { - margin-top: 0; - color: #42b983; -} - -.modal-body { - margin: 20px 0; -} - -.modal-default-button { - float: right; -} - -/* - * The following styles are auto-applied to elements with - * transition="modal" when their visibility is toggled - * by Vue.js. - * - * You can easily play with the modal transition by editing - * these styles. - */ - -.modal-enter { - opacity: 0; -} - -.modal-leave-active { - opacity: 0; +.modal-fade-enter, .modal-fade-leave-to { + opacity: 0 } -.modal-enter .modal-container, -.modal-leave-active .modal-container { - -webkit-transform: scale(1.1); - transform: scale(1.1); +.modal-display { + display: block; } .required-field > label::after { diff --git a/remoteappmanager/static/js/admin/vue-components/toolkit/ConfirmDialog.js b/remoteappmanager/static/js/admin/vue-components/toolkit/ConfirmDialog.js index b7ca6686b..066e48a47 100644 --- a/remoteappmanager/static/js/admin/vue-components/toolkit/ConfirmDialog.js +++ b/remoteappmanager/static/js/admin/vue-components/toolkit/ConfirmDialog.js @@ -17,19 +17,19 @@ define([ default: function() {} } }, - template: '' + - '