Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix translations
Signed-off-by: Christopher Ng <[email protected]>
  • Loading branch information
Pytal committed Apr 13, 2022
commit 35ce7b6ae13af7a167cdbcefe7a602452465b257
17 changes: 8 additions & 9 deletions src/components/ExportSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

<template>
<div class="section">
<h2>{{ t(APP_ID, 'Export') }}</h2>
<h2>{{ t('user_migration', 'Export') }}</h2>

<h3 class="settings-hint">{{ t(APP_ID, 'Select the data you want to export') }}</h3>
<h3 class="settings-hint">{{ t('user_migration', 'Select the data you want to export') }}</h3>

<div class="section__grid">
<!-- Base user data is permanently enabled -->
Expand Down Expand Up @@ -52,32 +52,32 @@

<Button v-if="status.current !== 'export'"
type="secondary"
:aria-label="t(APP_ID, 'Export your data')"
:aria-label="t('user_migration', 'Export your data')"
:disabled="status.current === 'import'"
@click.stop.prevent="startExport">
<template #icon>
<PackageDown title="" :size="20" />
</template>
{{ t(APP_ID, 'Export') }}
{{ t('user_migration', 'Export') }}
</Button>
<Button v-else
type="secondary"
:aria-label="t(APP_ID, 'Show export status')"
:aria-label="t('user_migration', 'Show export status')"
:disabled="status.current === 'import'"
@click.stop.prevent="openModal">
{{ t(APP_ID, 'Show status')}}
{{ t('user_migration', 'Show status')}}
</Button>

<Modal v-if="modalOpened"
@close="closeModal">
<div class="section__modal">
<EmptyContent>
{{ t(APP_ID, 'Export in progress…') }}
{{ t('user_migration', 'Export in progress…') }}
<template #icon>
<PackageDown />
</template>
<template #desc>
{{ t(APP_ID, 'Please do not use your account while exporting.') }}
{{ t('user_migration', 'Please do not use your account while exporting.') }}
</template>
</EmptyContent>
<!-- TODO show list of data currently being exported -->
Expand Down Expand Up @@ -132,7 +132,6 @@ export default {
modalOpened: false,
selectedMigrators: ['settings'],
error: false,
APP_ID,
}
},

Expand Down
21 changes: 9 additions & 12 deletions src/components/ImportSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,36 @@

<template>
<div class="section">
<h2>{{ t(APP_ID, 'Import') }}</h2>
<h2>{{ t('user_migration', 'Import') }}</h2>

<h3 class="settings-hint">{{ t(APP_ID, 'Please note that existing data may be overwritten.') }}</h3>
<h3 class="settings-hint">{{ t('user_migration', 'Please note that existing data may be overwritten.') }}</h3>

<!-- TODO use server API -->

<Button v-if="status.current !== 'import'"
type="secondary"
:aria-label="t(APP_ID, 'Import your data')"
:aria-label="t('user_migration', 'Import your data')"
:disabled="status.current === 'export'"
@click.stop.prevent="pickImportFile">
<template #icon>
<PackageUp title="" :size="20" />
</template>
{{ t(APP_ID, 'Import') }}
{{ t('user_migration', 'Import') }}
</Button>
<Button v-else
type="secondary"
:aria-label="t(APP_ID, 'Show import status')"
:aria-label="t('user_migration', 'Show import status')"
:disabled="status.current === 'export'"
@click.stop.prevent="openModal">
{{ t(APP_ID, 'Show status') }}
{{ t('user_migration', 'Show status') }}
</Button>

<span class="error">{{ filePickerError }}</span>

<Modal v-if="modalOpened"
@close="closeModal">
<div class="section__modal">
<h2>{{ t(APP_ID, 'Importing…') }}</h2>
<h2>{{ t('user_migration', 'Importing…') }}</h2>
<ProgressBar size="medium"
:value="60"
:error="error" />
Expand All @@ -66,8 +66,6 @@ import Modal from '@nextcloud/vue/dist/Components/Modal'
import PackageUp from 'vue-material-design-icons/PackageUp'
import { getFilePickerBuilder } from '@nextcloud/dialogs'

import { APP_ID } from '../shared/constants'

const picker = getFilePickerBuilder(t('files', 'Choose a file to import'))
.setMultiSelect(false)
// TODO add custom mime type for user_migration files?
Expand Down Expand Up @@ -104,7 +102,6 @@ export default {
filePickerError: null,
modalOpened: false,
error: false,
APP_ID,
}
},

Expand All @@ -124,14 +121,14 @@ export default {
const filePath = await picker.pick()
this.logger.debug(`path ${filePath} selected for import`)
if (!filePath.startsWith('/')) {
throw new Error(t(APP_ID, 'Invalid import file selected'))
throw new Error(t('user_migration', 'Invalid import file selected'))
}
this.openModal()
// TODO start background job
} catch (error) {
this.importError = true
this.logger.error(`Selecting file for import aborted: ${error.message || 'Unknown error'}`, { error })
this.filePickerError = error.message || t(APP_ID, 'Unknown error')
this.filePickerError = error.message || t('user_migration', 'Unknown error')
}
},
},
Expand Down
8 changes: 2 additions & 6 deletions src/views/Admin/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,15 @@

<template>
<div class="section">
<h2>{{ t(APP_ID, 'Settings') }}</h2>
<h2>{{ t('user_migration', 'Settings') }}</h2>
</div>
</template>

<script>
import { APP_ID } from '../../shared/constants'

export default {
name: 'Settings',
data() {
return {
APP_ID,
}
return {}
},
}
</script>