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

This commit is contained in:
ibuler
2022-11-25 11:18:10 +08:00
6 changed files with 175 additions and 30 deletions

View File

@@ -713,7 +713,8 @@
"JobType": "作业类型",
"Comment": "备注",
"History": "执行历史",
"UseParameterDefine": "定义参数"
"UseParameterDefine": "定义参数",
"TaskDispatch": "任务下发成功"
},
"perms": {
"": "",

View File

@@ -1,7 +1,7 @@
<template>
<el-select
:value="currentOrgId"
class="org-select organization"
class="org-select organization autoWidth-select"
filterable
:placeholder="$tc('common.Select')"
@change="changeOrg"
@@ -9,6 +9,9 @@
<template slot="prefix">
<svg-icon icon-class="organization" />
<span class="line" />
<span class="placeholder">
{{ (orgGroups.map(i => (i.options.find(item => item.id === currentOrg.id) || {}).name)).filter(Boolean) }}
</span>
</template>
<el-option-group
@@ -148,7 +151,7 @@ export default {
.line {
width: 1px;
margin-left: 8px;
margin-left: 6px;
border: .5px solid #FFF;
}
@@ -183,4 +186,26 @@ export default {
font-size: 12px;
line-height: 30px;
}
.autoWidth-select {
min-width: 140px;
&>>> input{
position: absolute;
}
&>>> .el-input__inner{
margin-left: 6px;
}
&>>> .el-input__prefix{
position: relative;
left: 0px;
box-sizing: border-box;
border: 1px solid #ffffff00;
padding: 0 30px 0 0;
height: 30px;
line-height: 30px;
.placeholder {
visibility: hidden;
}
}
}
</style>

View File

@@ -6,6 +6,7 @@
import GenericCreateUpdatePage from '@/layout/components/GenericCreateUpdatePage'
import { Select2, UploadKey } from '@/components'
import { UpdateToken } from '@/components/FormFields'
import ProtocolSelector from '../components/ProtocolSelector'
export default {
name: 'GatewayCreateUpdate',
@@ -13,23 +14,17 @@ export default {
data() {
return {
initial: {
protocol: 'ssh',
port: 22,
domain: this.$route.query.domain,
is_active: true
is_active: true,
protocols: '',
domain: this.$route.query.domain
},
fields: [
[this.$t('common.Basic'), ['name', 'ip', 'port', 'protocol', 'domain']],
[this.$t('common.Basic'), ['name', 'address']],
[this.$t('assets.Network'), ['domain', 'protocols']],
[this.$t('assets.Auth'), ['username', 'password', 'private_key', 'passphrase']],
[this.$t('common.Other'), ['is_active', 'comment']]
],
fieldsMeta: {
ip: {
type: 'input',
el: {
type: 'input'
}
},
domain: {
component: Select2,
el: {
@@ -40,17 +35,25 @@ export default {
multiple: false
}
},
protocol: {
helpText: this.$t('assets.GatewayProtocolHelpText')
protocols: {
component: ProtocolSelector,
el: {
},
hidden: (form) => {
const fieldsMeta = this.fieldsMeta
if (form['protocols']) {
fieldsMeta['protocols'].el.choices = form['protocols']
}
}
},
password: {
component: UpdateToken
},
is_active: {
type: 'switch'
},
private_key: {
component: UploadKey
},
is_active: {
type: 'switch'
}
},
updateSuccessNextRoute: {
@@ -87,6 +90,9 @@ export default {
}
}
},
mounted() {
console.log('---', this.object)
},
methods: {
}
}

View File

@@ -0,0 +1,116 @@
<template>
<div class="hide-setting">
<div v-for="item in items" :key="item.name" style="display: flex;margin-top: 8px;">
<el-input v-model="item.port" :placeholder="portPlaceholder" class="input-with-select" v-bind="$attrs">
<el-select
slot="prepend"
v-model="item.name"
class="prepend"
:disabled="true"
>
<el-option :key="item.name" :label="item.name" :value="item.name" />
</el-select>
</el-input>
</div>
</div>
</template>
<script>
export default {
props: {
value: {
type: [Array],
default: () => []
},
title: {
type: String,
default: ''
},
choices: {
type: Array,
default: () => ([{ 'name': 'ssh', 'port': 22 }])
}
},
data() {
return {
name: '',
items: [],
settingItem: {},
showDialog: false
}
},
computed: {
selectedProtocolNames() {
return this.items.map(item => item.name)
},
remainProtocols() {
return this.choices
},
portPlaceholder() {
if (this.settingReadonly) {
return this.$t('applications.port')
} else {
return this.$t('assets.DefaultPort')
}
}
},
watch: {
choices: {
handler(value) {
this.setDefaultItems(value)
}
},
items: {
handler(value) {
this.$emit('input', value)
},
immediate: true,
deep: true
}
},
mounted() {
this.setDefaultItems(this.choices)
},
methods: {
setDefaultItems(choices) {
this.items = choices
}
}
}
</script>
<style lang="less" scoped>
.el-select .el-input {
width: 130px;
}
.el-select {
max-width: 120px;
}
.input-with-select {
flex-shrink: 1;
width: calc(100%) !important;
}
.input-with-select .el-input-group__prepend {
background-color: #fff;
}
.el-select ::v-deep .el-input__inner {
width: 110px;
}
.input-button {
margin-top: 4px;
}
.input-button ::v-deep .el-button.el-button--mini {
height: 25px;
padding: 5px;
}
.el-input-group__append .el-button {
font-size: 14px;
color: #1a1a1a;
padding: 9px 20px;
}
</style>

View File

@@ -38,9 +38,9 @@ export default {
width: '96px',
formatter: (row) => {
if (row.is_finished) {
return <i Class='fa fa-check text-primary' />
return <i Class='fa fa-check text-primary'/>
}
return <i Class='fa fa-times text-danger' />
return <i Class='fa fa-times text-danger'/>
},
formatterArgs: {
width: '14px'
@@ -51,12 +51,12 @@ export default {
width: '96px',
formatter: (row) => {
if (!row.is_finished) {
return <i Class='fa fa fa-spinner fa-spin' />
return <i Class='fa fa fa-spinner fa-spin'/>
}
if (row.is_success) {
return <i Class='fa fa-check text-primary' />
return <i Class='fa fa-check text-primary'/>
}
return <i Class='fa fa-times text-danger' />
return <i Class='fa fa-times text-danger'/>
},
formatterArgs: {
width: '14px'

View File

@@ -8,7 +8,6 @@
<script>
import GenericListPage from '@/layout/components/GenericListPage'
import { ActionsFormatter, DateFormatter } from '@/components/TableFormatters'
import { openTaskPage } from '@/utils/jms'
import JobRunDialog from '@/views/ops/Job/JobRunDialog'
export default {
@@ -41,7 +40,7 @@ export default {
if (row.is_periodic) {
return <span>{row.type}&nbsp;
<el-tooltip content={this.$t('ops.ThisPeriodic')}>
<i Class='fa fa-circle-o text-primary' />
<i Class='fa fa-circle-o text-primary'/>
</el-tooltip>
</span>
}
@@ -119,10 +118,8 @@ export default {
this.$axios.post('/api/v1/ops/job-executions/', {
job: row.id,
parameters: parameters
}).then(data => {
this.$axios.get(`/api/v1/ops/job-executions/${data.id}/`).then(d => {
openTaskPage(d.task_id)
})
}).then(() => {
this.$message.success(this.$tc('ops.TaskDispatch'))
})
}
}