Patch by kpatenio <kpatenio@mozilla.com>. 1. Allows for selecting a custom path or the default (Documents) path for saving backups. The selection is passed from the "turn-on-scheduled-backups" dialog to "BackupService". 2. After pressing the "Choose" button in the dialog, a filepicker will appear so that a folder can be selected. 3. Once the dialog is confirmed, the absolute path is saved to a pref called "browser.backup.location" and saved in the service state. Other changes: - Added the Documents folder as the default save location - Added an onUpdate function for "browser.backup.location" that passes the updated BackupService state to registered widgets (backup settings section, dialogs) - Added Storybook entries and tests for the newly updated input and filepicker Figma: https://www.figma.com/design/vNbX4c0ws0L1qr0mxpKvsW/Fx-Backup?node-id=147-4568&t=tILUMKfg8c6Ed1Ul-0 (turn on backup dialog) Differential Revision: https://phabricator.services.mozilla.com/D210850
42 lines
1.3 KiB
JavaScript
42 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, ifDefined } from "lit.all.mjs";
|
|
import "chrome://global/content/elements/moz-card.mjs";
|
|
import "./turn-on-scheduled-backups.mjs";
|
|
|
|
window.MozXULElement.insertFTLIfNeeded("locales-preview/backupSettings.ftl");
|
|
window.MozXULElement.insertFTLIfNeeded("branding/brand.ftl");
|
|
|
|
export default {
|
|
title: "Domain-specific UI Widgets/Backup/Turn On Scheduled Backups",
|
|
component: "turn-on-scheduled-backups",
|
|
argTypes: {},
|
|
};
|
|
|
|
const Template = ({ defaultPath, _newPath, defaultLabel, _newLabel }) => html`
|
|
<moz-card style="width: 27.8rem;">
|
|
<turn-on-scheduled-backups
|
|
defaultPath=${defaultPath}
|
|
_newPath=${ifDefined(_newPath)}
|
|
defaultLabel=${defaultLabel}
|
|
_newLabel=${ifDefined(_newLabel)}
|
|
></turn-on-scheduled-backups>
|
|
</moz-card>
|
|
`;
|
|
|
|
export const Default = Template.bind({});
|
|
Default.args = {
|
|
defaultPath: "/Some/User/Documents",
|
|
defaultLabel: "Documents",
|
|
};
|
|
|
|
export const CustomLocation = Template.bind({});
|
|
CustomLocation.args = {
|
|
...Default.args,
|
|
_newPath: "/Some/Test/Custom/Dir",
|
|
_newLabel: "Dir",
|
|
};
|