gecko-dev/browser/components/backup/content/disable-backup-encryption.stories.mjs
Stephen Thompson 6c1381ca4b Bug 1901308 - Show profile backup errors and keep modals open r=backup-reviewers,fluent-reviewers,firefox-desktop-core-reviewers ,mconley,bolsson
Currently, clicking "confirm" buttons on modals in the profile backup settings menu will always close the modals regardless of whether the operation succeeded or failed. In the case of errors, users don't know that something went wrong. It's better to keep the modals open and display an error so that the user knows what to do next and can try to fix the issue, if applicable.

Differential Revision: https://phabricator.services.mozilla.com/D218358
2024-08-06 18:21:16 +00:00

44 lines
1.3 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// eslint-disable-next-line import/no-unresolved
import { html } from "lit.all.mjs";
import "chrome://global/content/elements/moz-card.mjs";
import { ERRORS } from "chrome://browser/content/backup/backup-constants.mjs";
import "./disable-backup-encryption.mjs";
window.MozXULElement.insertFTLIfNeeded("locales-preview/backupSettings.ftl");
window.MozXULElement.insertFTLIfNeeded("branding/brand.ftl");
const SELECTABLE_ERRORS = {
"(none)": 0,
...ERRORS,
};
export default {
title: "Domain-specific UI Widgets/Backup/Disable Encryption",
component: "disable-backup-encryption",
argTypes: {
disableEncryptionErrorCode: {
options: Object.keys(SELECTABLE_ERRORS),
mapping: SELECTABLE_ERRORS,
control: { type: "select" },
},
},
};
const Template = ({ disableEncryptionErrorCode }) => html`
<moz-card style="width: 23.94rem;">
<disable-backup-encryption
.disableEncryptionErrorCode=${disableEncryptionErrorCode}
></disable-backup-encryption>
</moz-card>
`;
export const Default = Template.bind({});
export const DisableError = Template.bind({});
DisableError.args = {
disableEncryptionErrorCode: ERRORS.UNKNOWN,
};