Merge pull request #95 from jumpserver/dev_bulkUpdate

Dev bulk update
This commit is contained in:
BaiJiangJie
2020-06-11 18:49:26 +08:00
committed by GitHub
5 changed files with 70 additions and 11 deletions

View File

@@ -155,6 +155,7 @@
"ReLogin": "重新登录"
},
"common": {
"SelectProperties": "选择属性",
"CrontabHelpTips": "eg每周日 03:05 执行 <5 3 * * 0> <br> 提示: 使用5位 Linux crontab 表达式 <分 时 日 月 星期> <a href='https://tool.lu/crontab/' target='_blank'>在线工具</a> <br>注意: 如果同时设置了定期执行和周期执行,优先使用定期执行",
"BadRequestErrorMsg": "请求错误,请检查填写内容",
"MFARequireForSecurity": "为了安全请输入MFA",

View File

@@ -154,6 +154,7 @@
"ReLogin": "Re-Login"
},
"common": {
"SelectProperties": "Select properties",
"CrontabHelpTips": "eg: Every Sunday 03:05 run <5 3 * * 0> <br>Tips:Using 5 digits linux crontab expressions<min hour day month week> (<a href='https://tool.lu/crontab/' target='_blank'>Online tools</a>) <br>Note:If both Regularly perform and Cycle perform are set,give priority to Regularly perform",
"BadRequestErrorMsg" : "Bad request, please check again",
"DateLast24Hours": "Last 24 hours",

View File

@@ -8,9 +8,27 @@
:show-cancel="false"
:show-confirm="false"
>
<GenericCreateUpdateForm
v-bind="iFormSetting"
/>
<el-row>
<el-col :span="4">
<div class="select-prop-label">
<label>{{ selectPropertiesLabel }}</label>
</div>
</el-col>
<el-col :span="18">
<el-checkbox-group v-model="checkedFields" @change="handleCheckedFieldsChange">
<el-checkbox v-for="(value, name) in iFormSetting.fieldsMeta" :key="name" :checked="true" :label="name">{{ value.label }}</el-checkbox>
</el-checkbox-group>
</el-col>
</el-row>
<el-row class="el-row-divider">
<el-divider />
</el-row>
<el-row>
<GenericCreateUpdateForm
:key="internalKey"
v-bind="iFormSetting"
/>
</el-row>
</Dialog>
</template>
@@ -39,6 +57,9 @@ export default {
},
data: function() {
return {
internalKey: 0,
selectPropertiesLabel: this.$t('common.SelectProperties'),
checkedFields: [],
iFormSetting: {}
}
},
@@ -47,6 +68,16 @@ export default {
this.iFormSetting = Object.assign({}, this.formSetting, defaultFormSetting)
},
methods: {
handleCheckedFieldsChange(values) {
for (const field of Object.keys(this.iFormSetting.fieldsMeta)) {
if (values.indexOf(field) === -1) {
this.iFormSetting.fieldsMeta[field].hidden = () => true
} else {
this.iFormSetting.fieldsMeta[field].hidden = () => false
}
}
this.internalKey++
},
getDefaultFormSetting() {
const vm = this
return {
@@ -87,6 +118,13 @@ export default {
}
</script>
<style scoped>
<style lang="scss" scoped>
.el-row-divider{
margin-bottom: 20px;
}
.select-prop-label{
float: right;
padding-right: 30px;
}
</style>

View File

@@ -279,13 +279,12 @@ export default {
platform: 'Linux'
},
fields: [
[this.$t('assets.Basic'), ['platform', 'domain']],
[this.$t('assets.Auth'), ['admin_user']],
[this.$t('assets.Label'), ['labels']],
[this.$t('assets.Other'), ['comment']]
'platform', 'domain', 'admin_user', 'labels', 'comment'
],
fieldsMeta: {
platform: {
label: this.$t('assets.Platform'),
hidden: () => false,
el: {
multiple: false,
ajax: {
@@ -297,6 +296,8 @@ export default {
}
},
domain: {
label: this.$t('assets.Domain'),
hidden: () => false,
el: {
multiple: false,
ajax: {
@@ -305,6 +306,8 @@ export default {
}
},
admin_user: {
label: this.$t('assets.AdminUser'),
hidden: () => false,
el: {
multiple: false,
ajax: {
@@ -316,11 +319,17 @@ export default {
}
},
labels: {
label: this.$t('assets.Label'),
hidden: () => false,
el: {
ajax: {
url: '/api/v1/assets/labels/'
}
}
},
comment: {
label: this.$t('common.Comment'),
hidden: () => false
}
}
}

View File

@@ -113,13 +113,13 @@ export default {
date_expired: '2099-12-31 00:00:00 +0800'
},
fields: [
[this.$t('users.Account'), ['groups']],
[this.$t('users.Secure'), ['date_expired']],
[this.$t('common.Other'), ['comment']]
'groups', 'date_expired', 'comment'
],
url: '/api/v1/users/users/',
fieldsMeta: {
groups: {
label: this.$t('users.UserGroups'),
hidden: () => false,
el: {
multiple: true,
ajax: {
@@ -127,6 +127,16 @@ export default {
},
value: []
}
},
date_expired: {
label: this.$t('common.dateExpired'),
hidden: () => false
},
comment: {
label: this.$t('common.Comment'),
hidden: () => false
}
}
}