Skip to content

Commit

Permalink
Add global import/export switch to ProjectSettings
Browse files Browse the repository at this point in the history
  • Loading branch information
dchiquito committed Dec 1, 2021
1 parent 7ad7888 commit edd3746
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
23 changes: 23 additions & 0 deletions client/src/components/ProjectSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ export default defineComponent({
const importPath = ref('');
const exportPath = ref('');
const globalImportExport = ref(false);
watchEffect(() => {
djangoRest.settings(currentProject.value.id).then((settings) => {
importPath.value = settings.importPath;
exportPath.value = settings.exportPath;
globalImportExport.value = settings.globalImportExport;
});
});
Expand All @@ -37,6 +39,7 @@ export default defineComponent({
await djangoRest.setSettings(currentProject.value.id, {
importPath: importPath.value,
exportPath: exportPath.value,
globalImportExport: globalImportExport.value,
});
changed.value = false;
} catch (e) {
Expand All @@ -57,6 +60,7 @@ export default defineComponent({
currentProject,
importPath,
exportPath,
globalImportExport,
changed,
importPathError,
exportPathError,
Expand Down Expand Up @@ -120,6 +124,25 @@ export default defineComponent({
/>
</v-flex>
</v-layout>
<v-layout>
<v-tooltip top>
<template v-slot:activator="{ on, attrs }">
<div
v-bind="attrs"
v-on="on"
>
<v-switch
v-model="globalImportExport"
@click="changed = true"
color="primary"
label="Global import/export"
/>
</div>
</template>
Global imports/exports will use the project name from the import file, which will
potentially modify other projects.
</v-tooltip>
</v-layout>
<v-btn
:disabled="!changed"
v-if="user.is_superuser"
Expand Down
3 changes: 2 additions & 1 deletion client/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ interface Project {

interface Settings {
importPath: string,
exportPath: string
exportPath: string,
globalImportExport: boolean
}

export {
Expand Down

0 comments on commit edd3746

Please sign in to comment.