Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

用户管理可生成AccessKey和SecretKey,为第三方应用接入鉴权 #28

Open
wants to merge 9 commits into
base: 2.1.2-release
Choose a base branch
from
8 changes: 8 additions & 0 deletions src/api/datax-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ export function updateUser(data) {
})
}

export function updateUserKey(data) {
return request({
url: '/api/user/updateKey',
method: 'post',
data
})
}

export function createUser(data) {
return request({
url: '/api/user/add',
Expand Down
4 changes: 4 additions & 0 deletions src/views/datax/jdbc-datasource/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ export default {
{ value: 'postgresql', label: 'postgresql' },
{ value: 'sqlserver', label: 'sqlserver' },
{ value: 'db2', label: 'db2' },
{ value: 'oscar', label: 'oscar' },
{ value: 'hive', label: 'hive' },
{ value: 'hbase', label: 'hbase' },
{ value: 'mongodb', label: 'mongodb' },
Expand Down Expand Up @@ -267,6 +268,9 @@ export default {
} else if (datasource === 'db2') {
this.temp.jdbcUrl = 'jdbc:db2://{host}[:{port}]/{database}'
this.temp.jdbcDriverClass = 'com.ibm.db2.jcc.DB2Driver'
} else if (datasource === 'oscar') {
this.temp.jdbcUrl = 'jdbc:oscar://{host}[:{port}]/{database}'
this.temp.jdbcDriverClass = 'com.oscar.Driver'
} else if (datasource === 'clickhouse') {
this.temp.jdbcUrl = 'jdbc:clickhouse://{host}:{port}/{database}'
this.temp.jdbcDriverClass = 'ru.yandex.clickhouse.ClickHouseDriver'
Expand Down
5 changes: 3 additions & 2 deletions src/views/datax/json-build-batch/reader/tableReader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export default {
size: 200,
ascs: 'datasource_name'
},
needShemaList: ['postgresql', 'oracle', 'sqlserver', 'db2', 'oscar'],
rDsList: [],
rTbList: [],
schemaList: [],
Expand All @@ -80,7 +81,7 @@ export default {
},
watch: {
'readerForm.datasourceId': function(oldVal, newVal) {
if (this.dataSource === 'postgresql' || this.dataSource === 'oracle' || this.dataSource === 'sqlserver' || this.dataSource === 'db2') {
if (this.needShemaList.includes(this.dataSource)) {
this.getSchema()
this.needSchema = true
} else {
Expand All @@ -101,7 +102,7 @@ export default {
this.rDsList = records
this.dataSource = this.rDsList[0].datasource
this.readerForm.datasourceId = this.rDsList[0].id;
if(this.dataSource === 'postgresql' || this.dataSource === 'oracle' || this.dataSource === 'sqlserver' || this.dataSource === 'db2'){
if(this.needShemaList.includes(this.dataSource)){
this.needSchema = true;
}else{
this.needSchema = false;
Expand Down
5 changes: 3 additions & 2 deletions src/views/datax/json-build-batch/writer/tableWriter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default {
size: 200,
ascs: 'datasource_name'
},
needShemaList: ['postgresql', 'oracle', 'sqlserver', 'db2', 'oscar'],
wDsList: [],
schemaList: [],
fromTableName: '',
Expand All @@ -74,7 +75,7 @@ export default {
},
watch: {
'writerForm.datasourceId': function(oldVal, newVal) {
if (this.dataSource === 'postgresql' || this.dataSource === 'oracle' || this.dataSource === 'sqlserver' || this.dataSource === 'db2') {
if (this.needShemaList.includes(this.dataSource)) {
this.getSchema()
this.needSchema = true
} else {
Expand All @@ -95,7 +96,7 @@ export default {
this.wDsList = records
this.dataSource = this.wDsList[0].datasource
this.writerForm.datasourceId = this.wDsList[0].id;
if(this.dataSource === 'postgresql' || this.dataSource === 'oracle' || this.dataSource === 'sqlserver' || this.dataSource === 'db2'){
if(this.needShemaList.includes(this.dataSource)){
this.needSchema = true;
}else{
this.needSchema = false;
Expand Down
3 changes: 3 additions & 0 deletions src/views/datax/json-build/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ export default {
}
if (this.active === 4) {
this.temp.jobJson = this.configJson
delete this.temp.addTime
delete this.temp.glueUpdatetime
delete this.temp.updateTime
job.createJob(this.temp).then(() => {
this.$notify({
title: 'Success',
Expand Down
5 changes: 3 additions & 2 deletions src/views/datax/json-build/reader/RDBMSReader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export default {
size: 200,
ascs: 'datasource_name'
},
needShemaList: ['postgresql', 'oracle', 'sqlserver', 'db2', 'oscar'],
rDsList: [],
rTbList: [],
schemaList: [],
Expand Down Expand Up @@ -98,7 +99,7 @@ export default {
watch: {
'readerForm.datasourceId': function(oldVal, newVal) {
// 当需要选择schemas时,先选择schemas再加载表
if (this.dataSource === 'postgresql' || this.dataSource === 'oracle' || this.dataSource === 'sqlserver' || this.dataSource === 'db2') {
if (this.needShemaList.includes(this.dataSource)) {
this.getSchema()
this.needSchema = true
} else {
Expand All @@ -119,7 +120,7 @@ export default {
this.rDsList = records
this.dataSource = this.rDsList[0].datasource
this.readerForm.datasourceId = this.rDsList[0].id;
if(this.dataSource === 'postgresql' || this.dataSource === 'oracle' || this.dataSource === 'sqlserver' || this.dataSource === 'db2'){
if(this.needShemaList.includes(this.dataSource)){
this.needSchema = true;
}else{
this.needSchema = false;
Expand Down
5 changes: 3 additions & 2 deletions src/views/datax/json-build/writer/RDBMSWriter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export default {
size: 200,
ascs: 'datasource_name'
},
needShemaList: ['postgresql', 'oracle', 'sqlserver', 'db2', 'oscar'],
wDsList: [],
schemaList: [],
fromTableName: '',
Expand Down Expand Up @@ -108,7 +109,7 @@ export default {
watch: {
'writerForm.datasourceId': function(oldVal, newVal) {
// 当需要选择schemas时,先选择schemas再加载表
if (this.dataSource === 'postgresql' || this.dataSource === 'oracle' || this.dataSource === 'sqlserver' || this.dataSource === 'db2') {
if (this.needShemaList.includes(this.dataSource)) {
this.getSchema()
this.needSchema = true
} else {
Expand All @@ -129,7 +130,7 @@ export default {
this.wDsList = records
this.dataSource = this.wDsList[0].datasource
this.writerForm.datasourceId = this.wDsList[0].id;
if(this.dataSource === 'postgresql' || this.dataSource === 'oracle' || this.dataSource === 'sqlserver' || this.dataSource === 'db2'){
if(this.needShemaList.includes(this.dataSource)){
this.needSchema = true;
}else{
this.needSchema = false;
Expand Down
29 changes: 26 additions & 3 deletions src/views/datax/user/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,25 @@
<span>{{ scope.row.role }}</span>
</template>
</el-table-column>
<el-table-column label="AccessKey" align="center" width="200">
<template slot-scope="scope">
<span>{{ scope.row.accessKey }}</span>
</template>
</el-table-column>
<el-table-column label="SecretKey" align="center">
<template slot-scope="scope">
<span>{{ scope.row.secretKey }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="{row}">
<el-button type="primary" size="mini" @click="handleUpdate(row)">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="handleKeyUpdate(scope.$index, scope.row)">
重置
</el-button>
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">
编辑
</el-button>
<el-button v-if="row.status!=='deleted'" size="mini" type="danger" @click="handleDelete(row)">
<el-button v-if="scope.row.status!=='deleted'" size="mini" type="danger" @click="handleDelete(scope.row)">
删除
</el-button>
</template>
Expand Down Expand Up @@ -189,6 +202,16 @@ export default {
this.$refs['dataForm'].clearValidate()
})
},
handleKeyUpdate(index, row){
let istde = [...this.list]
const tempData = {'id': row.id, 'username': row.username}
user.updateUserKey(tempData).then(response => {
const { content } = response
istde[index].accessKey = content.accessKey
istde[index].secretKey = content.secretKey
this.list = istde;
})
},
updateData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
Expand Down