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

This commit is contained in:
Bai
2020-06-15 19:43:37 +08:00
14 changed files with 209 additions and 70 deletions

View File

@@ -270,7 +270,7 @@ export default {
methods: {
MFAConfirm() {
if (this.MFAInput.length !== 6) {
return this.$message.error(this.$t('common.updateErrorMsg'))
return this.$message.error(this.$t('common.MFAErrorMsg'))
}
this.$axios.post(
`/api/v1/authentication/otp/verify/`, {

View File

@@ -223,6 +223,7 @@
"disableSelected": "禁用所选",
"fieldRequiredError": "这个字段是必填项",
"getErrorMsg": "获取失败",
"MFAErrorMsg":"MFA错误请检查",
"imExport": {
"ExportAll": "导出所有",
"ExportOnlyFiltered": "仅导出搜索结果",
@@ -334,7 +335,8 @@
"totalVersions": "版本数量",
"version": "版本",
"versionDetail": "版本详情",
"versionRunExecution": "执行历史"
"versionRunExecution": "执行历史",
"Unkown": "未知"
},
"perms": {
"": "",

View File

@@ -191,6 +191,7 @@
"RemoveSuccessMsg": "Remove success",
"Reset": "Reset",
"Search": "Search",
"MFAErrorMsg":"MFA Errorplease check",
"Select": "Select",
"SelectFile": "Select file",
"Show": "Show",
@@ -334,7 +335,8 @@
"totalVersions": "Total versions",
"version": "Version",
"versionDetail": "Version detail",
"versionRunExecution": "Version run execution"
"versionRunExecution": "Version run execution",
"Unkown": "Unkown"
},
"perms": {
"": "",

View File

@@ -45,7 +45,7 @@ export default {
callbacks: {
change: function(val) {
this.$axios.patch(
`api/v1/assets/assets/${this.object.id}/`,
`/api/v1/assets/assets/${this.object.id}/`,
{ is_active: val }
).then(res => {
this.$message.success(this.$t('common.updateSuccessMsg'))

View File

@@ -30,7 +30,7 @@ export default {
name: 'Detail'
}
],
hasRightSide: this.hasRightSide
hasRightSide: this.$route.params.id > 7
}
}
},

View File

@@ -60,4 +60,10 @@ export default {
.box-margin {
margin-bottom: 20px;
}
.el-table::before{
display: none;
}
.el-table >>> td{
border-bottom: none;
}
</style>

View File

@@ -69,6 +69,7 @@ export default {
that.iHasObjects = [...that.iHasObjects, ...objects]
that.$refs.select2.clearSelected()
// setTimeout(() => location.reload(), 300)
this.$message.success(this.$t('common.updateSuccessMsg'))
},
onDeleteSuccess: (obj, that) => {
const theRemoveIndex = that.iHasObjects.findIndex((v) => v.value === obj.value)

View File

@@ -4,8 +4,8 @@
<DetailCard :title="cardTitle" :items="detailCardItems" />
</el-col>
<el-col :span="10">
<RunInfoCard type="primary" v-bind="RunSuccessConfig" />
<RunInfoCard type="danger" style="margin-top: 15px" v-bind="RunFailedConfig" />
<RunInfoCard v-for="config in RunSuccessConfigs" :key="config.host" type="info" v-bind="config" />
<RunInfoCard v-for="config in RunFailedConfigs" :key="config.host" type="danger" style="margin-top: 15px" v-bind="config" />
</el-col>
</el-row>
</template>
@@ -14,6 +14,7 @@
import DetailCard from '@/components/DetailCard/index'
import { toSafeLocalDateStr } from '@/utils/common'
import RunInfoCard from '../../RunInfoCard'
import { toLastFailureDisplay, toLastSucessDisplay } from '../business'
export default {
name: 'AdhocDetail',
@@ -28,28 +29,35 @@ export default {
}
},
data() {
const last_success = toLastSucessDisplay(this.object.latest_execution)
const last_failure = toLastFailureDisplay(this.object.latest_execution)
return {
RunSuccessConfig: {
icon: 'fa-info',
title: this.$t('ops.lastRunSuccessHosts'),
content: {
hostname: 'linux',
result: 'api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据'
RunSuccessConfigs: last_success.map(host => {
return {
icon: 'fa-info',
title: this.$t('ops.lastRunSuccessHosts'),
content: {
hostname: host,
result: ''
}
}
},
RunFailedConfig: {
icon: 'fa-info',
title: this.$t('ops.lastRunFailedHosts'),
content: {
hostname: 'window',
result: 'api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据'
}),
RunFailedConfigs: last_failure.map(([host, msg]) => {
return {
icon: 'fa-info',
title: this.$t('ops.lastRunFailedHosts'),
content: {
hostname: host,
result: msg
}
}
}
})
}
},
computed: {
cardTitle() {
return 'api 没有该数据'
return `${this.object.task_name}: ${this.object.short_id}`
},
detailCardItems() {
return [
@@ -80,7 +88,7 @@ export default {
},
{
key: this.$t('common.createBy'),
value: 'api 没有该数据'
value: this.object.created_by
},
{
key: this.$t('common.dateCreated'),
@@ -88,27 +96,34 @@ export default {
},
{
key: this.$t('ops.runTimes'),
value: 'api 没有该数据'
value: this.object.run_times
},
{
key: this.$t('ops.lastRun'),
value: 'api 没有该数据'
value: this.object.latest_execution.last_run
},
{
key: this.$t('ops.timeDelta'),
value: 'api 没有该数据'
value: this.object.latest_execution.timedelta
},
{
key: this.$t('ops.isFinished'),
value: 'api 没有该数据'
value: this.toBooleanDisplay(this.object.latest_execution.is_finished)
},
{
key: this.$t('ops.isSuccess'),
value: 'api 没有该数据'
value: this.toBooleanDisplay(this.object.latest_execution.is_success)
},
{
key: this.$t('ops.tasks'),
value: 'api 没有该数据'
value: this.toContentsDisplay(this.object.tasks),
formatter(row, value) {
return (<div>{
value.map((content) => {
return <div>{ content }</div>
})}
</div>)
}
}
]
}
@@ -122,6 +137,23 @@ export default {
},
disPlayOptions(options) {
return options.replace(/:/g, '=').replace(/'/g, '').replace('{', '').replace('}', '')
},
toContentsDisplay(contents) {
const lines = []
for (let i = 0; i < contents.length; i++) {
const content = contents[i]
lines.push(`${i}. ${content.name} ::: ${content.action.module}`)
}
return lines
},
toBooleanDisplay(value) {
if (value === true) {
return this.$t('ops.Yes')
} else if (value === false) {
return this.$t('ops.No')
} else {
return this.$t('ops.Unkown')
}
}
}
}

View File

@@ -4,8 +4,8 @@
<DetailCard :title="cardTitle" :items="detailCardItems" />
</el-col>
<el-col :span="10">
<RunInfoCard type="primary" v-bind="RunSuccessConfig" />
<RunInfoCard type="danger" style="margin-top: 15px" v-bind="RunFailedConfig" />
<RunInfoCard v-for="config in RunSuccessConfigs" :key="config.host" type="info" v-bind="config" />
<RunInfoCard v-for="config in RunFailedConfigs" :key="config.host" type="danger" style="margin-top: 15px" v-bind="config" />
</el-col>
</el-row>
</template>
@@ -14,6 +14,7 @@
import DetailCard from '@/components/DetailCard'
import { toSafeLocalDateStr } from '@/utils/common'
import RunInfoCard from '../../RunInfoCard'
import { toLastFailureDisplay, toLastSucessDisplay } from '../business'
export default {
name: 'HistoryExecutionDetail',
@@ -28,23 +29,30 @@ export default {
}
},
data() {
const last_success = toLastSucessDisplay(this.object)
const last_failure = toLastFailureDisplay(this.object)
return {
RunSuccessConfig: {
icon: 'fa-info',
title: this.$t('ops.lastRunSuccessHosts'),
content: {
hostname: 'linux',
result: 'api没有该数据==api没有该数据api没有该数据api没有该数据api没有该数据'
RunSuccessConfigs: last_success.map(host => {
return {
icon: 'fa-info',
title: this.$t('ops.lastRunSuccessHosts'),
content: {
hostname: host,
result: ''
}
}
},
RunFailedConfig: {
icon: 'fa-info',
title: this.$t('ops.lastRunFailedHosts'),
content: {
hostname: 'linux',
result: 'api没有该数据==api没有该数据api没有该数据api没有该数据api没有该数据'
}),
RunFailedConfigs: last_failure.map(([host, msg]) => {
return {
icon: 'fa-info',
title: this.$t('ops.lastRunFailedHosts'),
content: {
hostname: host,
result: msg
}
}
}
})
}
},
computed: {

View File

@@ -13,6 +13,7 @@
<script type="text/jsx">
import DetailCard from '@/components/DetailCard'
import RunInfoCard from '../RunInfoCard/index'
import { toLastFailureDisplay, toLastSucessDisplay } from './business'
export default {
name: 'TaskDetail',
@@ -27,21 +28,8 @@ export default {
}
},
data() {
let last_success = this.object.last_success
last_success.length || (last_success = [''])
let last_failure = []
for (const host in this.object.last_failure) {
const task = this.object.last_failure[host]
const msgs = []
for (const name in task) {
msgs.push(`${name} => ${task[name].msg}`)
}
last_failure.push([host, msgs.join('\n')])
}
last_failure.length || (last_failure = [['', '']])
const last_success = toLastSucessDisplay(this.object.latest_execution)
const last_failure = toLastFailureDisplay(this.object.latest_execution)
return {
RunSuccessConfigs: last_success.map(host => {
@@ -115,7 +103,14 @@ export default {
},
{
key: this.$t('ops.contents'),
value: 'api 没有该数据'
value: this.toContentsDisplay(this.object.contents),
formatter(row, value) {
return (<div>{
value.map((content) => {
return <div>{ content }</div>
})}
</div>)
}
},
{
key: this.$t('ops.lastExecutionOutput'),
@@ -137,6 +132,14 @@ export default {
return this.$t('ops.No')
}
return this.$t('ops.Yes')
},
toContentsDisplay(contents) {
const lines = []
for (let i = 0; i < contents.length; i++) {
const content = contents[i]
lines.push(`${i}. ${content.name} ::: ${content.action.module}`)
}
return lines
}
}
}

View File

@@ -0,0 +1,24 @@
export const toLastSucessDisplay = function(object) {
if (!object) return ['']
const last_success = object.last_success
last_success.length || last_success.push('')
return last_success
}
export const toLastFailureDisplay = function(object) {
if (!object) return [['', '']]
const last_failure = []
for (const host in object.last_failure) {
const task = object.last_failure[host]
const msgs = []
for (const name in task) {
msgs.push(`${name} => ${task[name].msg}`)
}
last_failure.push([host, msgs.join('\n')])
}
last_failure.length || last_failure.push(['', ''])
return last_failure
}

View File

@@ -4,6 +4,7 @@
<script>
import { GenericCreateUpdatePage } from '@/layout/components'
import AssetPermissionFormActionField from './components/AssetPermissionFormActionField'
import AssetSelect from '@/components/AssetSelect'
export default {
@@ -89,14 +90,7 @@ export default {
},
actions: {
label: this.$t('perms.Actions'),
type: 'checkbox-group',
options: [
{ label: 'all', value: this.$t('perms.all') },
{ label: 'connect', value: this.$t('perms.connect') },
{ label: 'updownload', value: this.$t('perms.upDownload') },
{ label: 'upload_file', value: this.$t('perms.uploadFile') },
{ label: 'download_file', value: this.$t('perms.downloadFile') }
]
component: AssetPermissionFormActionField
},
date_start: {
label: this.$t('common.dateStart')

View File

@@ -1,7 +1,7 @@
<template>
<el-row :gutter="20">
<el-col :md="14" :sm="24">
<ListTable ref="ListTable" :table-config="tableConfig" :header-actions="headerActions" />
<ListTable ref="ListTable" :table-config="tableConfig" :header-actions="headerActions" class- />
</el-col>
<el-col :md="10" :sm="24">
<AssetRelationCard type="primary" v-bind="assetRelationConfig" />

View File

@@ -0,0 +1,67 @@
<template>
<el-tree
:data="data"
show-checkbox
node-key="id"
:default-expand-all="true"
:default-checked-keys="value"
:props="defaultProps"
@check="handleCheckChange"
/>
</template>
<script>
export default {
name: 'AssetPermissionFormActionFiel',
props: {
value: {
type: Array,
default: () => ['all', 'connect', 'upload_file', 'download_file', 'updownload']
}
},
data() {
return {
defaultProps: {
children: 'children',
label: 'label'
},
data: [
{
id: 'all',
label: this.$t('perms.all'),
children: [
{
id: 'connect',
label: this.$t('perms.connect')
},
{
id: 'updownload',
label: this.$t('perms.upDownload'),
children: [
{
id: 'upload_file',
label: this.$t('perms.uploadFile')
},
{
id: 'download_file',
label: this.$t('perms.downloadFile')
}
]
}
]
}
]
}
},
methods: {
handleCheckChange(data, obj) {
const checkedKeys = obj.checkedKeys
this.$emit('input', checkedKeys)
}
}
}
</script>
<style scoped>
</style>