diff --git a/packages/client/src/components/molecule/admin/department/DepartmentImportExportModal.svelte b/packages/client/src/components/molecule/admin/department/DepartmentImportExportModal.svelte
new file mode 100644
index 00000000..36a74d3f
--- /dev/null
+++ b/packages/client/src/components/molecule/admin/department/DepartmentImportExportModal.svelte
@@ -0,0 +1,108 @@
+
+
+
green = checkConfigJSON()}
+ on:click={updateConfigs}
+ {title}
+ bind:open
+ primaryDisabled={!green}
+ primaryText="가져오기"
+ secondaryText="검증"
+ isPrimaryBtnIconRight
+ isSecondaryBtnIconRight
+ {...$$restProps}>
+
+
+
데이터를 복사하여 저장하거나, 직접 수정하여 서비스에 적용할 수 있습니다.
+ {#if green}
+
+ {:else if error}
+
+
{error}
+ {:else}
+
데이터를 가져오려면 검증하세요.
+ {/if}
+
+
+
+
diff --git a/packages/client/src/components/molecule/admin/department/DepartmentSettings.svelte b/packages/client/src/components/molecule/admin/department/DepartmentSettings.svelte
index 11b46f1e..6e6abc30 100644
--- a/packages/client/src/components/molecule/admin/department/DepartmentSettings.svelte
+++ b/packages/client/src/components/molecule/admin/department/DepartmentSettings.svelte
@@ -4,11 +4,19 @@
import DepartmentConfigEditor from './DepartmentConfigEditor.svelte';
import Skeleton from '../../../atom/Skeleton.svelte';
import { apiDeleteConfig, apiUpdateConfig, getDepartmentConfigs } from '$lib/api/config';
+ import Code from '../../../../icons/Code.svelte';
+ import DepartmentImportExportModal from './DepartmentImportExportModal.svelte';
+ import Button from '../../../atom/Button.svelte';
$: configs = $config && $config.success ? getDepartmentConfigs($config.result) : [];
let updating = false;
$: if ($config) updating = false;
+ let importExportModalOpen = false;
+
+ function openImportExportModal() {
+ importExportModalOpen = true;
+ }
function deleteDepartment(event: CustomEvent
) {
updating = true;
@@ -43,10 +51,40 @@
updating = false;
});
}
+
+ function importDepartmentConfigs(event: CustomEvent) {
+ importExportModalOpen = false;
+ const importedConfig = event.detail;
+ updating = true;
+ const updatePromises = importedConfig.map((conf) => apiUpdateConfig(conf as DepartmentConfigUpdateRequest).then((res) => {
+ if(res.success == false) {
+ throw (res as ErrorResponse).error;
+ }
+ return true;
+ }));
+ Promise.all(updatePromises)
+ .then(() => {
+ updating = false;
+ config.refresh();
+ })
+ .catch((err) => {
+ console.error(err);
+ updating = false;
+ });
+ }
-
-
학과(부)별 설정
+
+
+
학과(부)별 설정
+ {#if !updating}
+
+
+
+ {/if}
+
{#if $config && $config.success && !updating}
@@ -57,3 +95,8 @@
{/if}
+
+
(importExportModalOpen = false)}
+ on:submit={importDepartmentConfigs} />
diff --git a/packages/client/src/components/molecule/admin/service/ServiceImportExportModal.svelte b/packages/client/src/components/molecule/admin/service/ServiceImportExportModal.svelte
new file mode 100644
index 00000000..3387c970
--- /dev/null
+++ b/packages/client/src/components/molecule/admin/service/ServiceImportExportModal.svelte
@@ -0,0 +1,105 @@
+
+
+ green = checkConfigJSON()}
+ on:click={updateConfigs}
+ {title}
+ bind:open
+ primaryDisabled={!green}
+ primaryText="가져오기"
+ secondaryText="검증"
+ isPrimaryBtnIconRight
+ isSecondaryBtnIconRight
+ {...$$restProps}>
+
+
+
데이터를 복사하여 저장하거나, 직접 수정하여 서비스에 적용할 수 있습니다.
+ {#if green}
+
+ {:else if error}
+
+
{error}
+ {:else}
+
데이터를 가져오려면 검증하세요.
+ {/if}
+
+
+
+
diff --git a/packages/client/src/components/molecule/admin/service/ServiceSettings.svelte b/packages/client/src/components/molecule/admin/service/ServiceSettings.svelte
index d40b985e..93fc2907 100644
--- a/packages/client/src/components/molecule/admin/service/ServiceSettings.svelte
+++ b/packages/client/src/components/molecule/admin/service/ServiceSettings.svelte
@@ -11,6 +11,8 @@
import UpdateScreen from '../../../atom/UpdateScreen.svelte';
import Warning from '../../../../icons/Warning.svelte';
import Skeleton from '../../../atom/Skeleton.svelte';
+ import Code from 'src/icons/Code.svelte';
+ import ServiceImportExportModal from './ServiceImportExportModal.svelte';
let updating = false;
@@ -19,6 +21,11 @@
let activateTo: Date;
let alert: string;
let buildings: { [buildingNum: string]: Building };
+ let importExportModalOpen = false;
+
+ function openImportExportModal() {
+ importExportModalOpen = true;
+ }
$: serviceConfig = $config && $config.success ? getServiceConfig($config.result) : undefined;
@@ -66,6 +73,25 @@
});
}
+ function importServiceConfig(event: CustomEvent) {
+ importExportModalOpen = false;
+ const importedConfig = event.detail;
+ updating = true;
+ apiUpdateConfig(importedConfig as ServiceConfigUpdateRequest)
+ .then((res) => {
+ updating = false;
+ if (res.success) {
+ config.refresh();
+ } else {
+ console.error((res as ErrorResponse).error);
+ }
+ })
+ .catch((err) => {
+ console.error(err);
+ updating = false;
+ });
+ }
+
$: if (serviceConfig) {
initializeValues();
updating = false;
@@ -102,6 +128,12 @@
저장
+
{#if serviceConfig && !isServiceReady}
@@ -193,3 +225,8 @@
{/if}