Replacing loading dialog from ohif:user login page

This commit is contained in:
Bruno Alves de Faria 2017-03-27 15:08:58 -03:00
parent 43ce7857fc
commit cc76eab078
3 changed files with 27 additions and 7 deletions

View File

@ -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 = $('<i class="fa fa-spin fa-circle-o-notch fa-fw m-r"></i>');
component.$element.prepend($spinner);
const dismissSpinner = () => {
$spinner.remove();
form.disable(false);
};
component.actionResult.then(dismissSpinner).catch(dismissSpinner);
}
return component.actionResult;
}
}

View File

@ -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')

View File

@ -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);
}
};