diff --git a/Packages/ohif-core/client/components/base/mixins/action.js b/Packages/ohif-core/client/components/base/mixins/action.js index 9fca9008e..26e139bd8 100644 --- a/Packages/ohif-core/client/components/base/mixins/action.js +++ b/Packages/ohif-core/client/components/base/mixins/action.js @@ -42,6 +42,20 @@ OHIF.mixins.action = new OHIF.Mixin({ // Call the defined action function component.actionResult = api[action].call(this, params); + // Prepend a spinner into the action element content if it's a promise + if (component.actionResult instanceof Promise) { + const form = component.getForm(); + form.disable(true); + const $spinner = $(''); + component.$element.prepend($spinner); + const dismissSpinner = () => { + $spinner.remove(); + form.disable(false); + }; + + component.actionResult.then(dismissSpinner).catch(dismissSpinner); + } + return component.actionResult; } } diff --git a/Packages/ohif-design/styles/common/form.styl b/Packages/ohif-design/styles/common/form.styl index 90353efc3..31fe235b6 100644 --- a/Packages/ohif-design/styles/common/form.styl +++ b/Packages/ohif-design/styles/common/form.styl @@ -12,6 +12,18 @@ label.wrapperLabel .form-themed + .btn, input[type=text], input[type=password] + + &[disabled], &.disabled + + &, &:hover, &:active + theme('background-color', '$uiGrayDarker') + theme('border-color', '$uiGrayLight') + theme('color', '$textPrimaryColor') + + & + .wrapperText + theme('color', '$textPrimaryColor') + input[type=text], input[type=password] theme('background-color', '$uiGray') theme('border-color', '$uiBorderColor') diff --git a/Packages/ohif-user/client/components/login/userLogin.js b/Packages/ohif-user/client/components/login/userLogin.js index 3dbe1e32f..a660432b9 100644 --- a/Packages/ohif-user/client/components/login/userLogin.js +++ b/Packages/ohif-user/client/components/login/userLogin.js @@ -36,13 +36,7 @@ Template.userLogin.onCreated(() => { }; // Call the login method - const promise = OHIF.user.login(formData).then(successHandler).catch(errorHandler); - - // Display loading state - OHIF.ui.showDialog('dialogLoading', { - text: 'Signing in...', - promise - }); + return OHIF.user.login(formData).then(successHandler).catch(errorHandler); } };