Merge branch 'dev' of github.com:jumpserver/lina into dev

This commit is contained in:
Bai
2020-06-16 14:58:59 +08:00
7 changed files with 43 additions and 15 deletions

View File

@@ -8,8 +8,13 @@ export default {
name: 'DateFormatter', name: 'DateFormatter',
extends: BaseFormatter, extends: BaseFormatter,
data() { data() {
let value
if (this.cellValue) {
const dt = new Date(this.cellValue) const dt = new Date(this.cellValue)
const value = this.$d(dt, 'medium') value = this.$d(dt, 'medium')
} else {
value = ''
}
// const locale = this.$i18n.locale // const locale = this.$i18n.locale
// const value = dt.toLocaleString(locale, { hourCycle: 'h23' }) // const value = dt.toLocaleString(locale, { hourCycle: 'h23' })
// console.log(this.$i18n.locale) // console.log(this.$i18n.locale)

View File

@@ -543,7 +543,8 @@
"user": "用户", "user": "用户",
"riskLevels": { "riskLevels": {
"common": "普通" "common": "普通"
} },
"Monitor": "监控"
}, },
"setting": { "setting": {
"ApiKeyList": "API Key 列表", "ApiKeyList": "API Key 列表",

View File

@@ -543,7 +543,8 @@
"user": "Use", "user": "Use",
"riskLevels": { "riskLevels": {
"common": "common" "common": "common"
} },
"Monitor": "Monitor"
}, },
"setting": { "setting": {
"ApiKeyList": "Api key list", "ApiKeyList": "Api key list",

View File

@@ -43,14 +43,27 @@ export default {
return <router-link {...{ attrs: route }}>{ label }</router-link> return <router-link {...{ attrs: route }}>{ label }</router-link>
} }
}, },
user: {
showOverflowTooltip: true
},
asset: {
showOverflowTooltip: true
},
command_amount: { command_amount: {
label: this.$t('sessions.command') label: this.$t('sessions.command'),
width: '60px'
}, },
login_from: { login_from: {
label: this.$t('sessions.loginFrom') label: this.$t('sessions.loginFrom'),
width: '110px'
},
remote_addr: {
width: '130px'
}, },
protocol: { protocol: {
label: this.$t('sessions.protocol'), label: this.$t('sessions.protocol'),
width: '60px',
sortable: false,
formatter: null formatter: null
}, },
date_start: { date_start: {
@@ -62,7 +75,8 @@ export default {
label: this.$t('sessions.duration'), label: this.$t('sessions.duration'),
formatter: function(row) { formatter: function(row) {
return timeOffset(row.date_start, row.date_end) return timeOffset(row.date_start, row.date_end)
} },
width: '80px'
}, },
actions: { actions: {
prop: 'id', prop: 'id',

View File

@@ -31,7 +31,7 @@ export default {
}, },
{ {
name: 'join', name: 'join',
title: this.$t('sessions.join'), title: this.$t('sessions.Monitor'),
type: 'primary', type: 'primary',
can: (row, cellValue) => { can: (row, cellValue) => {
return row.can_join return row.can_join

View File

@@ -2,7 +2,7 @@
<ListTable :table-config="tableConfig" :header-actions="headerActions" /> <ListTable :table-config="tableConfig" :header-actions="headerActions" />
</template> </template>
<script> <script type="text/jsx">
import ListTable from '@/components/ListTable' import ListTable from '@/components/ListTable'
export default { export default {
@@ -14,7 +14,7 @@ export default {
tableConfig: { tableConfig: {
url: '/api/v1/xpack/cloud/accounts/', url: '/api/v1/xpack/cloud/accounts/',
columns: [ columns: [
'name', 'get_provider_display', 'get_validity_display', 'date_created', 'comment', 'actions' 'name', 'provider', 'validity', 'date_created', 'comment', 'actions'
], ],
columnsMeta: { columnsMeta: {
name: { name: {
@@ -24,6 +24,16 @@ export default {
formatterArgs: { formatterArgs: {
updateRoute: 'AccountUpdate' updateRoute: 'AccountUpdate'
} }
},
validity: {
formatter: (row, col, cellValue) => {
const display = row.validity_display
if (cellValue) {
return display
} else {
return <span class='text-danger'>{ display }</span>
}
}
} }
} }
}, },

View File

@@ -30,10 +30,8 @@ export default {
name: 'execute', name: 'execute',
type: 'info', type: 'info',
callback: function(data) { callback: function(data) {
this.$axios.get( this.$axios.get(`/api/v1/xpack/cloud/sync-instance-tasks/${data.row.id}/run/`).then(res => {
`/api/v1/xpack/cloud/sync-instance-tasks/${data.row.id}/run/` window.open(`/#/ops/celery/task/${res.task}/log/`, '', 'width=900,height=600')
).then(res => {
}).catch(res => {
}) })
} }
} }
@@ -48,7 +46,6 @@ export default {
headerActions: { headerActions: {
hasBulkDelete: false, hasBulkDelete: false,
hasImport: false, hasImport: false,
hasRefresh: false,
hasExport: false, hasExport: false,
createRoute: 'SyncInstanceTaskCreate' createRoute: 'SyncInstanceTaskCreate'
} }