Backport of UI: Scroll to top after PKI form save (#20929)

Co-authored-by: Chelsea Shaw <82459713+hashishaw@users.noreply.github.com>
This commit is contained in:
hc-github-team-secure-vault-core 2023-06-01 11:07:53 -04:00 committed by GitHub
parent 94a7385904
commit c5e522c9f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 0 deletions

View File

@ -91,9 +91,11 @@ export default class PkiGenerateCsrComponent extends Component<Args> {
const useIssuer = yield this.getCapability();
yield model.save({ adapterOptions: { actionType: 'generate-csr', useIssuer } });
this.flashMessages.success('Successfully generated CSR.');
// This component shows the results, but call `onSave` for any side effects on parent
if (onSave) {
onSave();
}
window?.scrollTo(0, 0);
} else {
this.modelValidations = state;
this.alert = invalidFormMessage;

View File

@ -112,9 +112,11 @@ export default class PkiGenerateRootComponent extends Component<Args> {
// this way an issuer_id exists for backend to interpolate into the template
yield this.setUrls();
this.flashMessages.success('Successfully generated root.');
// This component shows the results, but call `onSave` for any side effects on parent
if (this.args.onSave) {
this.args.onSave();
}
window?.scrollTo(0, 0);
} catch (e) {
this.errorBanner = errorMessage(e);
this.invalidFormAlert = 'There was a problem generating the root.';

View File

@ -88,6 +88,7 @@ export default class PkiImportPemBundle extends Component<Args> {
if (this.args.onSave) {
this.args.onSave();
}
window?.scrollTo(0, 0);
} catch (error) {
this.errorBanner = errorMessage(error);
}

View File

@ -40,6 +40,7 @@ export default class PkiSignIntermediateFormComponent extends Component<Args> {
try {
yield this.args.model.save();
this.flashMessages.success('Successfully signed CSR.');
window?.scrollTo(0, 0);
} catch (e) {
this.errorBanner = errorMessage(e);
this.inlineFormAlert = 'There was a problem signing the CSR.';