mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-19 17:54:37 +00:00
feat: 支持设置默认存储
This commit is contained in:
@@ -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) {
|
export function getReplayStorage(id) {
|
||||||
return request({
|
return request({
|
||||||
url: `/api/v1/terminal/replay-storages/${id}/`,
|
url: `/api/v1/terminal/replay-storages/${id}/`,
|
||||||
|
@@ -663,6 +663,9 @@
|
|||||||
"SiteMessageList": "站内信"
|
"SiteMessageList": "站内信"
|
||||||
},
|
},
|
||||||
"sessions": {
|
"sessions": {
|
||||||
|
"SetToDefault": "设为默认",
|
||||||
|
"SetSuccess": "设置成功",
|
||||||
|
"SetFailed": "设置失败",
|
||||||
"StorageConfiguration": "存储配置",
|
"StorageConfiguration": "存储配置",
|
||||||
"accountKey": "账户密钥",
|
"accountKey": "账户密钥",
|
||||||
"accountName": "账户名称",
|
"accountName": "账户名称",
|
||||||
|
@@ -661,6 +661,9 @@
|
|||||||
"SiteMessageList": "Site message"
|
"SiteMessageList": "Site message"
|
||||||
},
|
},
|
||||||
"sessions": {
|
"sessions": {
|
||||||
|
"SetToDefault": "Set to default",
|
||||||
|
"SetSuccess": "Set success",
|
||||||
|
"SetFailed": "Set failed",
|
||||||
"StorageConfiguration": "Storage configuration",
|
"StorageConfiguration": "Storage configuration",
|
||||||
"accountKey": "Account key",
|
"accountKey": "Account key",
|
||||||
"accountName": "Account name",
|
"accountName": "Account name",
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<ListTable :table-config="commandTableConfig" :header-actions="commandActions" />
|
<ListTable ref="ListTable" :table-config="commandTableConfig" :header-actions="commandActions" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ListTable from '@/components/ListTable'
|
import ListTable from '@/components/ListTable'
|
||||||
import { TestCommandStorage } from '@/api/sessions'
|
import { SetToDefaultCommandStorage, TestCommandStorage } from '@/api/sessions'
|
||||||
|
import { BooleanFormatter } from '@/components/TableFormatters'
|
||||||
export default {
|
export default {
|
||||||
name: 'CommandStorage',
|
name: 'CommandStorage',
|
||||||
components: {
|
components: {
|
||||||
@@ -17,11 +18,12 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
const vm = this
|
||||||
return {
|
return {
|
||||||
commandActions: {
|
commandActions: {
|
||||||
hasExport: false,
|
hasExport: false,
|
||||||
hasImport: false,
|
hasImport: false,
|
||||||
hasRefresh: false,
|
hasRefresh: true,
|
||||||
hasMoreActions: false,
|
hasMoreActions: false,
|
||||||
moreCreates: {
|
moreCreates: {
|
||||||
callback: (item) => {
|
callback: (item) => {
|
||||||
@@ -38,7 +40,7 @@ export default {
|
|||||||
commandTableConfig: {
|
commandTableConfig: {
|
||||||
title: 'command',
|
title: 'command',
|
||||||
url: '/api/v1/terminal/command-storages/',
|
url: '/api/v1/terminal/command-storages/',
|
||||||
columns: ['name', 'type', 'comment', 'actions'],
|
columns: ['name', 'type', 'comment', 'is_default', 'actions'],
|
||||||
columnsMeta: {
|
columnsMeta: {
|
||||||
comment: {
|
comment: {
|
||||||
sortable: 'custom'
|
sortable: 'custom'
|
||||||
@@ -53,6 +55,17 @@ export default {
|
|||||||
return row.type
|
return row.type
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
is_default: {
|
||||||
|
formatter: BooleanFormatter,
|
||||||
|
formatterArgs: {
|
||||||
|
iconChoices: {
|
||||||
|
true: 'fa-check text-primary',
|
||||||
|
false: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
align: 'center',
|
||||||
|
width: '100px'
|
||||||
|
},
|
||||||
actions: {
|
actions: {
|
||||||
prop: 'id',
|
prop: 'id',
|
||||||
formatterArgs: {
|
formatterArgs: {
|
||||||
@@ -79,6 +92,19 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'set_to_default',
|
||||||
|
title: this.$t('sessions.SetToDefault'),
|
||||||
|
type: 'primary',
|
||||||
|
callback: function({ row, col, cellValue, reload }) {
|
||||||
|
SetToDefaultCommandStorage(row.id).then(data => {
|
||||||
|
vm.$refs.ListTable.reloadTable()
|
||||||
|
this.$message.success(this.$t('sessions.SetSuccess'))
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message.error(this.$t('sessions.SetFailed'))
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@@ -1,20 +1,22 @@
|
|||||||
<template>
|
<template>
|
||||||
<ListTable :table-config="replayTableConfig" :header-actions="replayActions" />
|
<ListTable ref="ListTable" :table-config="replayTableConfig" :header-actions="replayActions" />
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import ListTable from '@/components/ListTable'
|
import ListTable from '@/components/ListTable'
|
||||||
import { TestReplayStorage } from '@/api/sessions'
|
import { TestReplayStorage, SetToDefaultReplayStorage } from '@/api/sessions'
|
||||||
|
import { BooleanFormatter } from '@/components/TableFormatters'
|
||||||
export default {
|
export default {
|
||||||
name: 'ReplayStorage',
|
name: 'ReplayStorage',
|
||||||
components: {
|
components: {
|
||||||
ListTable
|
ListTable
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
const vm = this
|
||||||
return {
|
return {
|
||||||
replayActions: {
|
replayActions: {
|
||||||
hasExport: false,
|
hasExport: false,
|
||||||
hasImport: false,
|
hasImport: false,
|
||||||
hasRefresh: false,
|
hasRefresh: true,
|
||||||
hasMoreActions: false,
|
hasMoreActions: false,
|
||||||
moreCreates: {
|
moreCreates: {
|
||||||
callback: (item) => {
|
callback: (item) => {
|
||||||
@@ -46,7 +48,7 @@ export default {
|
|||||||
},
|
},
|
||||||
replayTableConfig: {
|
replayTableConfig: {
|
||||||
url: '/api/v1/terminal/replay-storages/',
|
url: '/api/v1/terminal/replay-storages/',
|
||||||
columns: ['name', 'type', 'comment', 'actions'],
|
columns: ['name', 'type', 'comment', 'is_default', 'actions'],
|
||||||
columnsMeta: {
|
columnsMeta: {
|
||||||
name: {
|
name: {
|
||||||
formatter: function(row) {
|
formatter: function(row) {
|
||||||
@@ -58,6 +60,17 @@ export default {
|
|||||||
return row.type
|
return row.type
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
is_default: {
|
||||||
|
formatter: BooleanFormatter,
|
||||||
|
formatterArgs: {
|
||||||
|
iconChoices: {
|
||||||
|
true: 'fa-check text-primary',
|
||||||
|
false: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
align: 'center',
|
||||||
|
width: '100px'
|
||||||
|
},
|
||||||
comment: {
|
comment: {
|
||||||
sortable: 'custom'
|
sortable: 'custom'
|
||||||
},
|
},
|
||||||
@@ -87,6 +100,19 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'set_to_default',
|
||||||
|
title: this.$t('sessions.SetToDefault'),
|
||||||
|
type: 'primary',
|
||||||
|
callback: function({ row, col, cellValue, reload }) {
|
||||||
|
SetToDefaultReplayStorage(row.id).then(data => {
|
||||||
|
vm.$refs.ListTable.reloadTable()
|
||||||
|
this.$message.success(this.$t('sessions.SetSuccess'))
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message.error(this.$t('sessions.SetFailed'))
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user