Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EF Menu Page #242

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions src/lib/langs/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@
"Task List": "Task List",
"Knowledge Manager":"Knowledge Manager",
"Migrate agents from file repository to MongoDB":"Migrate agents from file repository to MongoDB",
"Migrate agents from file repository to PostgreSql":"Migrate agents from file repository to PostgreSql",
"Migrate agents from file repository to MySql":"Migrate agents from file repository to MySql",
"Setting":"Setting",
"Start Migration":"Start Migration",
"Plugin":"Plugin",
Expand Down
2 changes: 2 additions & 0 deletions src/lib/langs/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@
"Task List": "任务列表",
"Knowledge Manager":"知识管理",
"Migrate agents from file repository to MongoDB":"将代理从文件存储库迁移到MongoDB",
"Migrate agents from file repository to PostgreSql":"将代理从文件存储库迁移到PostgreSql",
"Migrate agents from file repository to MySql":"将代理从文件存储库迁移到MySql",
"Setting":"设置",
"Start Migration":"开始迁移",
"Plugin":"插件",
Expand Down
59 changes: 59 additions & 0 deletions src/routes/page/mysql/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<script>
import { Button } from '@sveltestrap/sveltestrap';
import Breadcrumb from '$lib/common/Breadcrumb.svelte';
import HeadTitle from '$lib/common/HeadTitle.svelte';
import { refreshAgents } from '$lib/services/agent-service';
import LoadingToComplete from '$lib/common/LoadingToComplete.svelte';
import { _ } from 'svelte-i18n';
import Swal from 'sweetalert2/dist/sweetalert2.js';
import "sweetalert2/src/sweetalert2.scss";

let isLoading = false;
let isComplete = false;
let isError = false;
const duration = 3000;

function readyToRefresh() {
// @ts-ignore
Swal.fire({
title: 'Are you sure?',
text: "You will migrate all agents data to mysql.",
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Yes',
cancelButtonText: 'No'
// @ts-ignore
}).then((result) => {
if (result.value) {
refreshAgentData();
}
});
}

const refreshAgentData = () => {
isLoading = true;
refreshAgents().then(res => {
isComplete = true;
isLoading = false;
setTimeout(() => {
isComplete = false;
}, duration);
}).catch(err => {
isLoading = false;
isComplete = false;
isError = true;
setTimeout(() => {
isError = false;
}, duration);
});
};
</script>

<HeadTitle title="MySql" />
<Breadcrumb title="MySql" pagetitle="{$_('Setting')}" />
<LoadingToComplete isLoading={isLoading} isComplete={isComplete} isError={isError} />

<h3>{$_('Migrate agents from file repository to MySql')}</h3>
<Button color="primary" on:click={() => readyToRefresh()} disabled={isLoading}>
<i class="bx bx-copy" /> {$_('Start Migration')}
</Button>
59 changes: 59 additions & 0 deletions src/routes/page/pgsql/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<script>
import { Button } from '@sveltestrap/sveltestrap';
import Breadcrumb from '$lib/common/Breadcrumb.svelte';
import HeadTitle from '$lib/common/HeadTitle.svelte';
import { refreshAgents } from '$lib/services/agent-service';
import LoadingToComplete from '$lib/common/LoadingToComplete.svelte';
import { _ } from 'svelte-i18n';
import Swal from 'sweetalert2/dist/sweetalert2.js';
import "sweetalert2/src/sweetalert2.scss";

let isLoading = false;
let isComplete = false;
let isError = false;
const duration = 3000;

function readyToRefresh() {
// @ts-ignore
Swal.fire({
title: 'Are you sure?',
text: "You will migrate all agents data to pgsql.",
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Yes',
cancelButtonText: 'No'
// @ts-ignore
}).then((result) => {
if (result.value) {
refreshAgentData();
}
});
}

const refreshAgentData = () => {
isLoading = true;
refreshAgents().then(res => {
isComplete = true;
isLoading = false;
setTimeout(() => {
isComplete = false;
}, duration);
}).catch(err => {
isLoading = false;
isComplete = false;
isError = true;
setTimeout(() => {
isError = false;
}, duration);
});
};
</script>

<HeadTitle title="PostgreSql" />
<Breadcrumb title="PostgreSql" pagetitle="{$_('Setting')}" />
<LoadingToComplete isLoading={isLoading} isComplete={isComplete} isError={isError} />

<h3>{$_('Migrate agents from file repository to PostgreSql')}</h3>
<Button color="primary" on:click={() => readyToRefresh()} disabled={isLoading}>
<i class="bx bx-copy" /> {$_('Start Migration')}
</Button>
Loading