perf: 修改结果避免返回的错误不对

This commit is contained in:
ibuler
2023-04-03 15:56:23 +08:00
parent 41b00cb293
commit dde98e470b
4 changed files with 19 additions and 10 deletions

View File

@@ -49,7 +49,7 @@ export default {
protocols: [
{
name: 'ssh',
secret_types: ['password', 'ssh_key', 'token', 'api_key']
secret_types: ['password', 'ssh_key', 'token', 'access_key']
}
]
},
@@ -61,7 +61,7 @@ export default {
[this.$t('common.Basic'), ['name', 'username', ...this.controlShowField()]],
[this.$t('assets.Secret'), [
'secret_type', 'secret', 'ssh_key',
'token', 'api_key', 'passphrase'
'token', 'access_key', 'passphrase'
]],
[this.$t('common.Other'), ['push_now', 'on_invalid', 'is_active', 'comment']]
],
@@ -153,11 +153,11 @@ export default {
component: UploadSecret,
hidden: (formValue) => formValue.secret_type !== 'token'
},
api_key: {
id: 'api_key',
access_key: {
id: 'access_key',
label: this.$t('assets.AccessKey'),
component: UploadSecret,
hidden: (formValue) => formValue.secret_type !== 'api_key'
hidden: (formValue) => formValue.secret_type !== 'access_key'
},
secret_type: {
type: 'radio-group',
@@ -209,7 +209,7 @@ export default {
},
{
label: this.$t('assets.AccessKey'),
value: 'api_key'
value: 'access_key'
}
]
const secretTypes = []

View File

@@ -101,7 +101,13 @@ export default {
}).catch(error => this.setFieldError(error))
},
handleResult(resp, error) {
const bulkCreate = !this.asset
let bulkCreate = !this.asset
if (error && !Array.isArray(error)) {
bulkCreate = false
}
// if (resp && !Array.isArray(resp)) {
// bulkCreate = false
// }
if (!bulkCreate) {
if (!error) {
this.$message.success(this.$tc('common.createSuccessMsg'))
@@ -111,7 +117,6 @@ export default {
} else {
let result
if (error) {
console.log('Error: ', error)
result = error.response.data
} else {
result = resp

View File

@@ -338,8 +338,11 @@ export default {
this.$refs.ListTable.reloadTable()
},
showBulkCreateResult(results) {
this.showResultDialog = false
this.createAccountResults = results
this.showResultDialog = true
setTimeout(() => {
this.showResultDialog = true
}, 100)
}
}
}

View File

@@ -74,7 +74,8 @@ export default {
total: this.$tc('common.Total'),
created: this.$tc('common.Created'),
updated: this.$tc('common.Updated'),
skipped: this.$tc('common.Skipped')
skipped: this.$tc('common.Skipped'),
error: this.$tc('common.Error')
}
const grouped = _.groupBy(this.result, 'state')
const groupedLength = _.mapValues(grouped, 'length')