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

View File

@@ -154,6 +154,7 @@
"ReLogin": "Re-Login" "ReLogin": "Re-Login"
}, },
"common": { "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", "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", "BadRequestErrorMsg" : "Bad request, please check again",
"DateLast24Hours": "Last 24 hours", "DateLast24Hours": "Last 24 hours",

View File

@@ -8,9 +8,27 @@
:show-cancel="false" :show-cancel="false"
:show-confirm="false" :show-confirm="false"
> >
<GenericCreateUpdateForm <el-row>
v-bind="iFormSetting" <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> </Dialog>
</template> </template>
@@ -39,6 +57,9 @@ export default {
}, },
data: function() { data: function() {
return { return {
internalKey: 0,
selectPropertiesLabel: this.$t('common.SelectProperties'),
checkedFields: [],
iFormSetting: {} iFormSetting: {}
} }
}, },
@@ -47,6 +68,16 @@ export default {
this.iFormSetting = Object.assign({}, this.formSetting, defaultFormSetting) this.iFormSetting = Object.assign({}, this.formSetting, defaultFormSetting)
}, },
methods: { 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() { getDefaultFormSetting() {
const vm = this const vm = this
return { return {
@@ -87,6 +118,13 @@ export default {
} }
</script> </script>
<style scoped> <style lang="scss" scoped>
.el-row-divider{
margin-bottom: 20px;
}
.select-prop-label{
float: right;
padding-right: 30px;
}
</style> </style>

View File

@@ -279,13 +279,12 @@ export default {
platform: 'Linux' platform: 'Linux'
}, },
fields: [ fields: [
[this.$t('assets.Basic'), ['platform', 'domain']], 'platform', 'domain', 'admin_user', 'labels', 'comment'
[this.$t('assets.Auth'), ['admin_user']],
[this.$t('assets.Label'), ['labels']],
[this.$t('assets.Other'), ['comment']]
], ],
fieldsMeta: { fieldsMeta: {
platform: { platform: {
label: this.$t('assets.Platform'),
hidden: () => false,
el: { el: {
multiple: false, multiple: false,
ajax: { ajax: {
@@ -297,6 +296,8 @@ export default {
} }
}, },
domain: { domain: {
label: this.$t('assets.Domain'),
hidden: () => false,
el: { el: {
multiple: false, multiple: false,
ajax: { ajax: {
@@ -305,6 +306,8 @@ export default {
} }
}, },
admin_user: { admin_user: {
label: this.$t('assets.AdminUser'),
hidden: () => false,
el: { el: {
multiple: false, multiple: false,
ajax: { ajax: {
@@ -316,11 +319,17 @@ export default {
} }
}, },
labels: { labels: {
label: this.$t('assets.Label'),
hidden: () => false,
el: { el: {
ajax: { ajax: {
url: '/api/v1/assets/labels/' 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' date_expired: '2099-12-31 00:00:00 +0800'
}, },
fields: [ fields: [
[this.$t('users.Account'), ['groups']], 'groups', 'date_expired', 'comment'
[this.$t('users.Secure'), ['date_expired']],
[this.$t('common.Other'), ['comment']]
], ],
url: '/api/v1/users/users/', url: '/api/v1/users/users/',
fieldsMeta: { fieldsMeta: {
groups: { groups: {
label: this.$t('users.UserGroups'),
hidden: () => false,
el: { el: {
multiple: true, multiple: true,
ajax: { ajax: {
@@ -127,6 +127,16 @@ export default {
}, },
value: [] value: []
} }
},
date_expired: {
label: this.$t('common.dateExpired'),
hidden: () => false
},
comment: {
label: this.$t('common.Comment'),
hidden: () => false
} }
} }
} }