diff --git a/src/components/FormFields/JSONManyToManySelect/AttrFormDialog.vue b/src/components/FormFields/JSONManyToManySelect/AttrFormDialog.vue
new file mode 100644
index 000000000..9e621043a
--- /dev/null
+++ b/src/components/FormFields/JSONManyToManySelect/AttrFormDialog.vue
@@ -0,0 +1,148 @@
+
+
+
+
+
+
+
+
diff --git a/src/components/FormFields/JSONManyToManySelect/AttrMatchResultDialog.vue b/src/components/FormFields/JSONManyToManySelect/AttrMatchResultDialog.vue
new file mode 100644
index 000000000..af1894425
--- /dev/null
+++ b/src/components/FormFields/JSONManyToManySelect/AttrMatchResultDialog.vue
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
diff --git a/src/components/FormFields/JSONManyToManySelect/ValueField.vue b/src/components/FormFields/JSONManyToManySelect/ValueField.vue
index d407625aa..c764cbcf9 100644
--- a/src/components/FormFields/JSONManyToManySelect/ValueField.vue
+++ b/src/components/FormFields/JSONManyToManySelect/ValueField.vue
@@ -2,7 +2,7 @@
-
+
@@ -37,37 +37,41 @@ export default {
},
watch: {
match() {
- this.getSetType()
+ this.setTypeAndValue()
},
attr: {
handler() {
- this.getSetType()
+ this.setTypeAndValue()
},
deep: true
}
},
mounted() {
- this.getSetType()
- this.loading = false
+ this.setTypeAndValue()
},
methods: {
handleInput(value) {
this.$emit('input', value)
},
- getSetType() {
- this.loading = true
+ setTypeAndValue() {
+ this.loading = false
this.type = this.getType()
+ console.log('Type: ', this.type, 'Value: ', this.value)
if (['select', 'array'].includes(this.type) && typeof this.value === 'string') {
const value = this.value ? this.value.split(',') : []
- console.log('Type: ', this.type, 'Value: ', value)
this.handleInput(value)
+ } else if (this.type === 'bool') {
+ const value = !!this.value
+ this.handleInput(value)
+ console.log('This. vlaue: ', value)
}
this.$nextTick(() => {
this.loading = false
})
},
getType() {
- const attrType = this.attr.type
+ const attrType = this.attr.type || 'str'
+ this.$log.debug('Value field attr type: ', attrType, this.attr, this.match)
if (attrType === 'm2m') {
return 'select'
} else if (attrType === 'bool') {
diff --git a/src/components/FormFields/JSONManyToManySelect/ValueFormatter.vue b/src/components/FormFields/JSONManyToManySelect/ValueFormatter.vue
index e6a67d51d..0286c9d99 100644
--- a/src/components/FormFields/JSONManyToManySelect/ValueFormatter.vue
+++ b/src/components/FormFields/JSONManyToManySelect/ValueFormatter.vue
@@ -28,13 +28,11 @@ export default {
return {
formatterArgs: formatterArgs,
loading: true,
+ attr: {},
value: ''
}
},
computed: {
- attr() {
- return this.formatterArgs.attrs.find(attr => attr.name === this.row.name) || {}
- }
},
watch: {
cellValue: {
@@ -50,6 +48,9 @@ export default {
},
methods: {
async getValue() {
+ this.attr = this.formatterArgs.attrs.find(attr => attr.name === this.row.name)
+ this.match = this.row.match
+ console.log('Attr: ', this.attr, this.row.name)
if (this.attr.type === 'm2m') {
const url = setUrlParam(this.attr.el.url, 'ids', this.cellValue.join(','))
const data = await this.$axios.get(url)
@@ -61,6 +62,8 @@ export default {
this.value = this.attr.el.options
.filter(item => this.cellValue.includes(item.value))
.map(item => item.label).join(',')
+ } else if (['in', 'ip_in'].includes(this.match)) {
+ this.value = this.cellValue.join(', ')
} else {
this.value = this.cellValue
}
diff --git a/src/components/FormFields/JSONManyToManySelect/const.js b/src/components/FormFields/JSONManyToManySelect/const.js
new file mode 100644
index 000000000..d70bebd11
--- /dev/null
+++ b/src/components/FormFields/JSONManyToManySelect/const.js
@@ -0,0 +1,25 @@
+import i18n from '@/i18n/i18n'
+
+export const strMatchValues = ['exact', 'not', 'in', 'contains', 'startswith', 'endswith', 'regex']
+export const typeMatchMapper = {
+ str: strMatchValues,
+ bool: ['exact', 'not'],
+ m2m: ['m2m'],
+ ip: strMatchValues + ['ip_in'],
+ int: strMatchValues + ['gte', 'lte'],
+ select: ['in']
+}
+
+export const attrMatchOptions = [
+ { label: i18n.t('common.Equal'), value: 'exact' },
+ { label: i18n.t('common.NotEqual'), value: 'not' },
+ { label: i18n.t('common.MatchIn'), value: 'in' },
+ { label: i18n.t('common.Contains'), value: 'contains' },
+ { label: i18n.t('common.Startswith'), value: 'startswith' },
+ { label: i18n.t('common.Endswith'), value: 'endswith' },
+ { label: i18n.t('common.Regex'), value: 'regex' },
+ { label: i18n.t('common.BelongTo'), value: 'm2m' },
+ { label: i18n.t('common.IPMatch'), value: 'ip_in' },
+ { label: i18n.t('common.GreatEqualThan'), value: 'gte' },
+ { label: i18n.t('common.LessEqualThan'), value: 'lte' }
+]
diff --git a/src/components/FormFields/JSONManyToManySelect/index.vue b/src/components/FormFields/JSONManyToManySelect/index.vue
index ea3e881ab..ad21201eb 100644
--- a/src/components/FormFields/JSONManyToManySelect/index.vue
+++ b/src/components/FormFields/JSONManyToManySelect/index.vue
@@ -5,7 +5,7 @@
{{ tp.label }}
-
+
-
-
+
+
diff --git a/src/i18n/langs/en.json b/src/i18n/langs/en.json
index c68e3a495..30b5e7f42 100644
--- a/src/i18n/langs/en.json
+++ b/src/i18n/langs/en.json
@@ -461,7 +461,7 @@
"ReLoginErr": "Login time has exceeded 5 minutes, please login again"
},
"common": {
- "BatchProcessing": "Batch processing(select {Number} items)",
+ "BatchProcessing": "Select {Number} items",
"ServerError": "Server Error",
"CommunityEdition": "Community Edition",
"EnterpriseEdition": "Enterprise Edition",
diff --git a/src/i18n/langs/ja.json b/src/i18n/langs/ja.json
index e24d055f3..025e448bc 100644
--- a/src/i18n/langs/ja.json
+++ b/src/i18n/langs/ja.json
@@ -461,7 +461,7 @@
"ReLoginErr": "ログイン時間が 5 分を超えました。もう一度ログインしてください"
},
"common": {
- "BatchProcessing": "一括処理(選択 {Number} 項目)",
+ "BatchProcessing": "選択 {Number} 項目",
"ServerError": "サーバーエラー",
"RestoreDefault": "デフォルトに戻す",
"DownloadCenter": "ダウンロードセンター",
diff --git a/src/i18n/langs/zh.json b/src/i18n/langs/zh.json
index d060ba0b5..d7332d2b1 100644
--- a/src/i18n/langs/zh.json
+++ b/src/i18n/langs/zh.json
@@ -482,7 +482,7 @@
"RelAnd": "与",
"RelOr": "或",
"RelNot": "非",
- "BatchProcessing": "批量处理(选中 {Number} 项)",
+ "BatchProcessing": "选中 {Number} 项",
"Created": "已创建",
"Updated": "已更新",
"Skipped": "已跳过",
diff --git a/src/router/console/perms.js b/src/router/console/perms.js
index 966a6c9a9..8c20d0616 100644
--- a/src/router/console/perms.js
+++ b/src/router/console/perms.js
@@ -40,7 +40,7 @@ export default [
]
},
{
- path: 'host-acls',
+ path: 'login-asset-acls',
component: empty,
redirect: '',
meta: {
diff --git a/src/views/perms/AssetPermission/components/AccountFormatter.vue b/src/views/perms/AssetPermission/components/AccountFormatter.vue
index 77ad5b9b6..9622e34dc 100644
--- a/src/views/perms/AssetPermission/components/AccountFormatter.vue
+++ b/src/views/perms/AssetPermission/components/AccountFormatter.vue
@@ -57,7 +57,7 @@ export default {
},
props: {
value: {
- type: [Array],
+ type: [Array, String],
default: () => []
},
assets: {
@@ -176,7 +176,11 @@ export default {
},
mounted() {
this.initDefaultChoice()
- this.$emit('input', this.value)
+ if (this.value === '') {
+ this.$emit('input', [])
+ } else {
+ this.$emit('input', this.value)
+ }
},
methods: {
initDefaultChoice() {
@@ -245,6 +249,9 @@ export default {
}
.spec-accounts {
+ >>> .el-select {
+ width: 100%;
+ }
}
.help-text {