1.adjust export/import database;

This commit is contained in:
mitsuha
2022-09-02 15:59:24 +08:00
parent 8adc00a944
commit 14a3cdff41
10 changed files with 89 additions and 116 deletions
@@ -80,34 +80,20 @@ export const FileSystem = () => {
if (apiSupported && !selected) {
return (
<>
<MuiSnackbar
anchorOrigin={{ vertical: 'top', horizontal: 'right' }}
open={error}
message="Request File Permission failed, please check if you have permission"
sx={{ marginTop: '3em' }}
action={
<IconButton
aria-label="close"
onClick={() => setError(false)}
>
<CloseIcon />
</IconButton>
}
/>
<StyledFileSystem
onClick={async () => {
try {
await requestPermission('AFFiNE');
onSelected();
} catch (e) {
onError();
}
}}
>
{t('Sync to Disk')}
</StyledFileSystem>
</>
<MuiSnackbar
anchorOrigin={{ vertical: 'top', horizontal: 'right' }}
open={error}
message="Request File Permission failed, please check if you have permission"
sx={{ marginTop: '3em' }}
action={
<IconButton
aria-label="close"
onClick={() => setError(false)}
>
<CloseIcon />
</IconButton>
}
/>
);
}
return null;
@@ -70,9 +70,6 @@ export const LayoutHeader = () => {
<EditorBoardSwitcher />
</StyledContainerForEditorBoardSwitcher>
</StyledHeaderRoot>
<StyledUnstableTips>
<StyledUnstableTipsText>{warningTips}</StyledUnstableTipsText>
</StyledUnstableTips>
</StyledContainerForHeaderRoot>
);
};
@@ -2,8 +2,8 @@ import { useFlag } from '@toeverything/datasource/feature-flags';
export const useSettingFlags = () => {
const booleanFullWidthChecked = useFlag('BooleanFullWidthChecked', false);
const booleanExportWorkspace = useFlag('BooleanExportWorkspace', false);
const booleanImportWorkspace = useFlag('BooleanImportWorkspace', false);
const booleanExportWorkspace = useFlag('BooleanExportAffineDb', true);
const booleanImportWorkspace = useFlag('BooleanImportAffineDb', true);
const booleanExportHtml = useFlag('BooleanExportHtml', false);
const booleanExportPdf = useFlag('BooleanExportPdf', false);
const booleanExportMarkdown = useFlag('BooleanExportMarkdown', false);
@@ -145,12 +145,19 @@ export const useSettings = (): SettingItem[] => {
type: 'separator',
key: 'separator2',
},
{
type: 'button',
name: t('Clear Workspace'),
key: 'Clear Workspace',
onClick: () => clearWorkspace(workspaceId),
flag: 'booleanClearWorkspace',
},
{
type: 'button',
name: t('Import Workspace'),
key: 'Import Workspace',
onClick: () => importWorkspace(workspaceId),
flag: 'booleanImportWorkspace',
flag: 'booleanClearWorkspace',
},
{
type: 'button',
@@ -159,13 +166,6 @@ export const useSettings = (): SettingItem[] => {
onClick: () => exportWorkspace(),
flag: 'booleanExportWorkspace',
},
{
type: 'button',
name: t('Clear Workspace'),
key: 'Clear Workspace',
onClick: () => clearWorkspace(workspaceId),
flag: 'booleanClearWorkspace',
},
];
return filterSettings(settings, settingFlags);
@@ -6,8 +6,12 @@ export const importWorkspace = (workspaceId: string) => {
window.client
.inspector()
.load()
.then(() => {
window.location.href = `/${workspaceId}/`;
.then(status => {
if (status) {
if (window.confirm('Your currently open data will be lost.')) {
window.location.href = `/${workspaceId}/`;
}
}
});
};