From 35e0d57a0543b8e11b3490b985274bd7fda2afe2 Mon Sep 17 00:00:00 2001 From: Bai Date: Fri, 25 Jun 2021 17:14:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=AD=98=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/sessions.js | 20 +++++++++++ src/i18n/langs/cn.json | 3 ++ src/i18n/langs/en.json | 3 ++ src/views/sessions/Storage/CommandStorage.vue | 34 ++++++++++++++++--- src/views/sessions/Storage/ReplayStorage.vue | 34 ++++++++++++++++--- 5 files changed, 86 insertions(+), 8 deletions(-) diff --git a/src/api/sessions.js b/src/api/sessions.js index 60bd03b39..1ef2db725 100644 --- a/src/api/sessions.js +++ b/src/api/sessions.js @@ -57,6 +57,26 @@ export function TestReplayStorage(id) { }) } +function SetToDefaultStorage(url) { + return request({ + url: url, + method: 'patch', + data: { 'is_default': true } + }) +} + +export function SetToDefaultCommandStorage(id) { + return SetToDefaultStorage( + `/api/v1/terminal/command-storages/${id}/`, + ) +} + +export function SetToDefaultReplayStorage(id) { + return SetToDefaultStorage( + `/api/v1/terminal/replay-storages/${id}/`, + ) +} + export function getReplayStorage(id) { return request({ url: `/api/v1/terminal/replay-storages/${id}/`, diff --git a/src/i18n/langs/cn.json b/src/i18n/langs/cn.json index 69e94e4d1..8da00db5f 100644 --- a/src/i18n/langs/cn.json +++ b/src/i18n/langs/cn.json @@ -663,6 +663,9 @@ "SiteMessageList": "站内信" }, "sessions": { + "SetToDefault": "设为默认", + "SetSuccess": "设置成功", + "SetFailed": "设置失败", "StorageConfiguration": "存储配置", "accountKey": "账户密钥", "accountName": "账户名称", diff --git a/src/i18n/langs/en.json b/src/i18n/langs/en.json index 9627bf5a9..08d99f821 100644 --- a/src/i18n/langs/en.json +++ b/src/i18n/langs/en.json @@ -661,6 +661,9 @@ "SiteMessageList": "Site message" }, "sessions": { + "SetToDefault": "Set to default", + "SetSuccess": "Set success", + "SetFailed": "Set failed", "StorageConfiguration": "Storage configuration", "accountKey": "Account key", "accountName": "Account name", diff --git a/src/views/sessions/Storage/CommandStorage.vue b/src/views/sessions/Storage/CommandStorage.vue index af7f88ee1..ebc31d14b 100644 --- a/src/views/sessions/Storage/CommandStorage.vue +++ b/src/views/sessions/Storage/CommandStorage.vue @@ -1,10 +1,11 @@