mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-13 19:35:24 +00:00
perf: Support batch import of leak passwords
This commit is contained in:
@@ -37,8 +37,12 @@ export default {
|
||||
|
||||
},
|
||||
headerActions: {
|
||||
hasExport: false,
|
||||
hasImport: false,
|
||||
hasExport: true,
|
||||
hasImport: true,
|
||||
importOptions: {
|
||||
encryptFields: [''], // 这里不加密 password,''只是为了保证数组有值
|
||||
canImportUpdate: false
|
||||
},
|
||||
hasCreate: true,
|
||||
hasSearch: true,
|
||||
hasRefresh: true,
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
:import-option="importOption"
|
||||
:json-data="jsonData"
|
||||
:url="url"
|
||||
v-bind="$attrs"
|
||||
@cancel="cancelUpload"
|
||||
@finish="closeDialog"
|
||||
/>
|
||||
@@ -247,46 +248,46 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
@import "~@/styles/variables";
|
||||
@import "~@/styles/variables";
|
||||
|
||||
.error-msg {
|
||||
color: $--color-danger;
|
||||
.error-msg {
|
||||
color: $--color-danger;
|
||||
}
|
||||
|
||||
.error-msg.error-results {
|
||||
background-color: #f3f3f4;
|
||||
max-height: 200px;
|
||||
overflow: auto
|
||||
}
|
||||
|
||||
.file-uploader ::v-deep .el-upload {
|
||||
width: 100%;
|
||||
//padding-right: 150px;
|
||||
}
|
||||
|
||||
.file-uploader ::v-deep .el-upload-dragger {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.importTableZone {
|
||||
padding: 0 20px;
|
||||
|
||||
.importTable {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.error-msg.error-results {
|
||||
background-color: #f3f3f4;
|
||||
max-height: 200px;
|
||||
overflow: auto
|
||||
.tableFilter {
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.file-uploader ::v-deep .el-upload {
|
||||
width: 100%;
|
||||
//padding-right: 150px;
|
||||
}
|
||||
.importTable ::v-deep .el-dialog__body {
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.file-uploader ::v-deep .el-upload-dragger {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.importTableZone {
|
||||
padding: 0 20px;
|
||||
|
||||
.importTable {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.tableFilter {
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.importTable ::v-deep .el-dialog__body {
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.export-item {
|
||||
margin-left: 80px;
|
||||
}
|
||||
.export-item {
|
||||
margin-left: 80px;
|
||||
}
|
||||
|
||||
.export-item:first-child {
|
||||
margin-left: 0;
|
||||
|
||||
@@ -97,6 +97,10 @@ export default {
|
||||
origin: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
encryptFields: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -273,11 +277,15 @@ export default {
|
||||
}
|
||||
return columns
|
||||
},
|
||||
getEncryptFields() {
|
||||
const fromProp = Array.isArray(this.encryptFields) && this.encryptFields.length ? this.encryptFields : null
|
||||
return fromProp || ['password', 'secret', 'private_key']
|
||||
},
|
||||
generateTableData(tableTitles, tableData) {
|
||||
const totalData = []
|
||||
tableData.forEach(item => {
|
||||
this.$set(item, '@status', 'pending')
|
||||
const encryptFields = ['password', 'secret', 'private_key']
|
||||
const encryptFields = this.getEncryptFields()
|
||||
for (const field of encryptFields) {
|
||||
if (item[field]) {
|
||||
item[field] = encryptPassword(item[field])
|
||||
|
||||
Reference in New Issue
Block a user