Replacing loading dialog from ohif:user login page
This commit is contained in:
parent
43ce7857fc
commit
cc76eab078
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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')
|
||||
|
||||
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user