From a2c1620dba024c44bcfb0e7cabe9ab2907b8f52c Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Thu, 7 Jul 2022 17:48:22 +0800 Subject: [PATCH 1/9] =?UTF-8?q?REPORT-72487=20f=08=08eat:=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/zh_cn.properties | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/i18n/zh_cn.properties b/i18n/zh_cn.properties index 30f185f..3170f13 100644 --- a/i18n/zh_cn.properties +++ b/i18n/zh_cn.properties @@ -62,6 +62,11 @@ Dec-Dcm_Connection_Form_UserName= 用户名 Dec-Dcm_Connection_Form_Password= 密码 Dec-Dcm_Connection_Form_Principal= 客户端principal Dec-Dcm_Connection_Form_KeyPath= keytab密钥路径 +Dec-Dcm_Connection_Form_Krb5File= krb5.conf文件 +Dec-Dcm_Connection_File_Upload_Success= 已成功上传并校验成功 +Dec-Dcm_Connection_File_Upload_Error= 检测异常 +Dec-Dcm_Connection_File_Upload_ErrorCode= 错误代码 +Dec-Dcm_Connection_File_Upload_ErrorMsg= 错误详情 Dec-Dcm_Connection_Form_Pool_Properties= 连接池属性 Dec-Dcm_Connection_Form_SQL_Validation_Query= SQL验证查询 Dec-Dcm_Connection_Form_Connection-Check= 获取连接前校验 @@ -303,4 +308,7 @@ BI-Basic_No_Select= 不选 BI-Basic_Now= 此刻 Dec-Dcm_Connection_Analytic_DB=阿里云AnalyticDB Dec-Dcm_Connection_Value_Out_Range=数值超出范围 -Dec-Dcm_Socket_Unable_Connect_Tip=可能出现编辑冲突 \ No newline at end of file +Dec-Dcm_Socket_Unable_Connect_Tip=可能出现编辑冲突 +Dec-Dcm_Connection_File_Upload_ErrorTip1= 参考 +Dec-Dcm_Connection_File_Upload_ErrorTip2= kerberos配置 +Dec-Dcm_Connection_File_Upload_ErrorTip3= 获取帮助或联系技术支持 \ No newline at end of file From f9d98bff0c630a5f0e3765680290717457a4a83f Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Fri, 8 Jul 2022 15:03:18 +0800 Subject: [PATCH 2/9] =?UTF-8?q?REPORT-72487=20fix:=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E4=BC=98=E5=8C=96=E5=89=8D=E7=AB=AF=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- private/i18n.ts | 8 + .../components/file_upload/file_upload.less | 13 + .../file_upload/file_upload.model.ts | 35 ++ .../components/file_upload/file_upload.ts | 328 ++++++++++++++++++ src/modules/crud/crud.typings.d.ts | 4 + src/modules/crud/decision.api.ts | 4 + .../maintain/forms/components/form.jdbc.ts | 146 ++++++-- 7 files changed, 507 insertions(+), 31 deletions(-) create mode 100644 src/modules/components/file_upload/file_upload.less create mode 100644 src/modules/components/file_upload/file_upload.model.ts create mode 100644 src/modules/components/file_upload/file_upload.ts diff --git a/private/i18n.ts b/private/i18n.ts index 8f00670..1a530af 100644 --- a/private/i18n.ts +++ b/private/i18n.ts @@ -61,6 +61,11 @@ export default { 'Dec-Dcm_Connection_Form_Password': '密码', 'Dec-Dcm_Connection_Form_Principal': '客户端principal', 'Dec-Dcm_Connection_Form_KeyPath': 'keytab密钥路径', + 'Dec-Dcm_Connection_Form_Krb5File': 'krb5.conf文件', + 'Dec-Dcm_Connection_File_Upload_Success': ' 已成功上传并校验成功', + 'Dec-Dcm_Connection_File_Upload_Error': '检测异常', + 'Dec-Dcm_Connection_File_Upload_ErrorCode': '错误代码', + 'Dec-Dcm_Connection_File_Upload_ErrorMsg': '错误详情', 'Dec-Dcm_Connection_Form_Pool_Properties': '连接池属性', 'Dec-Dcm_Connection_Form_SQL_Validation_Query': 'SQL验证查询', 'Dec-Dcm_Connection_Form_Connection-Check': '获取连接前校验', @@ -306,4 +311,7 @@ export default { 'Dec-Connection_Lic_Limit_Approach_Tip': '当前数据连接数量超过注册lic限制({}个),所有数据连接都不可用,请删除多余的数据连接', 'Dec-Connection_Lic_Limit_Approach_Prevent_Tip': '当前数据连接数量已经达到注册lic限制({}个),无法新增', 'Dec-Dcm_Connection_Check_Fetch_Size_Range': '请输入0-1000000之间的值', + 'Dec-Dcm_Connection_File_Upload_ErrorTip1':'参考', + 'Dec-Dcm_Connection_File_Upload_ErrorTip2': 'kerberos配置', + 'Dec-Dcm_Connection_File_Upload_ErrorTip3': '取帮助或联系技术支持', }; diff --git a/src/modules/components/file_upload/file_upload.less b/src/modules/components/file_upload/file_upload.less new file mode 100644 index 0000000..83c51ce --- /dev/null +++ b/src/modules/components/file_upload/file_upload.less @@ -0,0 +1,13 @@ +.data-conf-file { + .x-icon{ + width: 48px; + height: 48px; + } +} + +.data-keytab-file { + .x-icon{ + width: 48px; + height: 48px; + } +} diff --git a/src/modules/components/file_upload/file_upload.model.ts b/src/modules/components/file_upload/file_upload.model.ts new file mode 100644 index 0000000..78d0a75 --- /dev/null +++ b/src/modules/components/file_upload/file_upload.model.ts @@ -0,0 +1,35 @@ +import { model, Model } from '@core/core'; + +type UploadParam = { + keytabPath: string; + krb5ConfPath: string; + principal: string; +} + +@model() +export class FileUploadModel extends Model { + static xtype = 'dec.dcm.model.components.file_upload'; + + private options: { + inter: string; + } + + state() { + return { + uploadUrl: '', + fileName: '', + }; + } + + actions = { + setFileInfo: (params: UploadParam) => { + var inter = this.options.inter; + + this.model.uploadUrl = Dec.Utils.getEncodeURL(Dec.fineServletURL + inter, "", params); + }, + + setFileName:(v: string) => { + this.model.fileName = v; + } + } +} diff --git a/src/modules/components/file_upload/file_upload.ts b/src/modules/components/file_upload/file_upload.ts new file mode 100644 index 0000000..56265be --- /dev/null +++ b/src/modules/components/file_upload/file_upload.ts @@ -0,0 +1,328 @@ +import { shortcut, store } from '@core/core'; +import { SignEditor, MultiLayerSingleLevelTree, SearchEditor, Button, Editor, Label } from '@fui/core'; +import { FileUploadModel } from './file_upload.model'; +import { ApiFactory } from 'src/modules/crud/apiFactory'; +import './file_upload.less'; + +const api = new ApiFactory().create(); + +@shortcut() +@store(FileUploadModel, { + props(this: FileUpload) { + return this.options; + }, +}) +export class FileUpload extends BI.Widget { + public static xtype = "dec.dcm.components.file_upload"; + public static EVENT_CHECK_SUCCESS = 'EVENT_CHECK_SUCCESS'; + public static EVENT_CLEAR_FILE = 'EVENT_CLEAR_FILE'; + + public props = { + watermark: '', + value: '', + processId: '', + disabled: false, + inter: '', + access: '', + iconCls: '' + }; + + model: FileUploadModel['model']; + store: FileUploadModel['store']; + watch = { + uploadUrl: function () { + this.uploader.setUrl(this.model.uploadUrl); + }, + }; + + public textEditor: SignEditor; + public keywordEditor: SearchEditor; + public fileTree: MultiLayerSingleLevelTree; + public sureButton: Button; + public infoLabel: Label; + + public render() { + const { width, watermark, value, processId, inter } = this.options; + var self = this; + var processName = BI.concat("process-", processId); + var processClass = BI.concat(".process-", processId); + this.setFileInfo({ + keytabPath: '', + principal:'', + krb5ConfPath: '', + }); + + return { + type: BI.VerticalLayout.xtype, + items:[{ + type: BI.FloatLeftLayout.xtype, + items: [ + { + type: BI.SignEditor.xtype, + cls: 'bi-border bi-focus-shadow', + width: 300, + height: 22, + watermark, + disabled: true, + value, + ref: (_ref: SignEditor) => { + this.textEditor = _ref; + }, + listeners: [ + { + eventName: BI.SignEditor.EVENT_CHANGE, + action: () => { + const value = this.textEditor.getValue(); + this.setValue(value); + }, + }, + ], + }, { + type: BI.Button.xtype, + width: 100, + _lgap: 10, + iconCls: "upload-font", + level: "ignore", + ghost: true, + ref: (_ref: Button) => { + this.uploadButton = _ref; + }, + text: BI.i18nText('Dec-Basic_Choose_File'), + handler: () => { + self.uploader.select(); + }, + }, + ], + }, { + type: BI.FloatLeftLayout.xtype, + tgap: 8, + invisible: true, + ref: (_ref) => { + this.fileInfo = _ref; + }, + items: [ + { + type: BI.VerticalLayout.xtype, + cls: "bi-border", + items: [{ + type: BI.HTapeLayout.xtype, + height: 68, + width: 300, + items: [{ + el: { + type: BI.IconLabel.xtype, + cls: this.options.iconCls, + }, + width: 48, + lgap: 8, + }, { + el: { + type: BI.VerticalLayout.xtype, + items : [{ + type: BI.Label.xtype, + width: 200, + height: 20, + textAlign: "left", + ref: (_ref: Label) => { + this.fileName = _ref; + }, + },{ + type: BI.VerticalAdaptLayout.xtype, + items: [{ + type: BI.Label.xtype, + cls: "bi-tips", + height: 20, + rgap: 3, + ref: (_ref: Label) => { + this.fileSize = _ref; + }, + }, { + type: BI.Label.xtype, + cls: "bi-tips", + height: 20, + ref: (_ref: Label) => { + this.fileModified = _ref; + }, + }] + + }], + + }, + tgap: 14, + lgap: 4, + }, { + el: { + type: BI.IconButton.xtype, + cls: "default-delete-font", + handler: function () { + NProgress.set(0.0); + self.xhr.abort(); + self.uploadButton.setEnable(true); + self.fileInfo.setVisible(false); + self.store.setFileName(''); + self.clearInfo(); + self.fireEvent(FileUpload.EVENT_CLEAR_FILE); + + }, + }, + rgap: 10, + }] + }, { + type: BI.VerticalLayout.xtype, + cls: processName, + width: 300, + height: 1, + }] + + }, { + el :{ + type: BI.VerticalLayout.xtype, + cls: "bi-error", + ref: (_ref: any) => { + this.errorInfo = _ref; + }, + invisible: true, + items : [{ + type: BI.Label.xtype, + height: 20, + textAlign: "left", + ref: (_ref: Label) => { + this.errorCode = _ref; + }, + },{ + type: BI.Label.xtype, + height: 20, + textAlign: "left", + ref: (_ref: Label) => { + this.errorMsg = _ref; + }, + }, { + type: "bi.vertical_adapt", + rgap: 5, + items: [ + { + type: "bi.label", + text: BI.i18nText('Dec-Dcm_Connection_File_Upload_ErrorTip1'), + },{ + type: "bi.text_button", + cls: "bi-high-light bi-high-light-border-bottom", + text: BI.i18nText('Dec-Dcm_Connection_File_Upload_ErrorTip2'), + handler: function () { + window.open(Dec.system[DecCst.Hyperlink.DECISION_HYPERLINK_CONFIG][DecCst.Hyperlink.KERBEROS_CONF_HELP]); + }, + },{ + type: "bi.label", + text: BI.i18nText('Dec-Dcm_Connection_File_Upload_ErrorTip3'), + } + ], + },], + }, + vgap: 4, + lgap: 8, + } + ], + }, { + type: BI.MultifileEditor.xtype, + ref: (ref:any) => { + self.uploader = ref; + }, + url: this.model.uploadUrl, + accept: this.options.accept, + listeners: [ + { + // 选择文件 + eventName: BI.MultifileEditor.EVENT_CHANGE, + action: function (files) { + self.options.attachId = ''; + var fileInfo = files.files[0]; + self.setInfo(fileInfo); + self.store.setFileName(fileInfo.fileName); + this.upload(); + NProgress.configure({ parent: processClass, minimum: 0.0 }); + }, + }, + { + // 上传进度刷新 + eventName: BI.MultifileEditor.EVENT_PROGRESS, + action: function (progress) { + var rate = progress.loaded/progress.total; + NProgress.set(rate); + }, + }, + { + // 开始上传文件 + eventName: BI.MultifileEditor.EVENT_UPLOADSTART, + action: function (progressEvent, xhr) { + self.xhr = xhr; + }, + }, + { + // 上传文件完毕 + eventName: BI.MultifileEditor.EVENT_UPLOADED, + action: function () { + var uploadedInfo = this.getValue(); + var failed = BI.some(uploadedInfo, function (index, file) { + if (file.data.errorCode) { + BI.Msg.toast(uploadedInfo[0].filename + BI.i18nText('Dec-Dcm_Connection_File_Upload_Error'), { + level: "error", + }); + self.setErrorInfo(file.data) + return true; + } + }); + var key = self.options.processId +'Path'; + !failed && self.setValue(uploadedInfo[0].data.kerberosInfo[key]); + !failed && self.fireEvent(FileUpload.EVENT_CHECK_SUCCESS, uploadedInfo[0].data); + !failed && BI.Msg.toast(uploadedInfo[0].filename + BI.i18nText('Dec-Dcm_Connection_File_Upload_Success'),{ + level: "success" + }); + }, + }, + ], + }] + + }; + } + + public getValue(): string { + return this.options.value; + } + + public setValue(value: string) { + this.options.value = value; + this.textEditor.text.setTitle(value); + this.textEditor.setValue(value); + } + + public setInfo(info: any) { + this.uploadButton.setEnable(false); + this.fileInfo.setVisible(true); + this.textEditor.setValue(info.fileName); + this.fileName.setText(info.fileName); + this.fileSize.setText(Dec.Utils.getByteWidthUnit(info.size)); + this.fileModified.setText(BI.getDate(info.lastModified).print("%Y-%X-%d %H:%M:%S")) + } + + public clearInfo() { + this.uploadButton.setEnable(true); + this.fileInfo.setVisible(false); + this.textEditor.setValue(''); + this.options.attachId = ''; + } + + public setErrorInfo(errorInfo: any) { + this.errorInfo.setVisible(true); + this.errorCode.setText(BI.i18nText("Dec-Dcm_Connection_File_Upload_ErrorCode") + ":"+ errorInfo.errorCode); + this.errorMsg.setText(BI.i18nText("Dec-Dcm_Connection_File_Upload_ErrorMsg") + ":" + errorInfo.errorMessage); + } + + public setEnable(v) { + this.uploadButton._setEnable(v); + } + + public setFileInfo(params) { + this.store.setFileInfo(params); + } +} + +BI.shortcut("dec.dcm.components.file_upload", FileUpload); diff --git a/src/modules/crud/crud.typings.d.ts b/src/modules/crud/crud.typings.d.ts index 43d6dee..339f02a 100644 --- a/src/modules/crud/crud.typings.d.ts +++ b/src/modules/crud/crud.typings.d.ts @@ -192,6 +192,10 @@ export type ConnectionJDBC ={ * 秘钥路径 */ keyPath?: string; + /** + * krb5.conf文件 + */ + krb5Path?: string; /** * fetchSize */ diff --git a/src/modules/crud/decision.api.ts b/src/modules/crud/decision.api.ts index 7301526..5a5c8ce 100644 --- a/src/modules/crud/decision.api.ts +++ b/src/modules/crud/decision.api.ts @@ -120,6 +120,10 @@ export class DecisionApi implements Api { return Dec.system[DecCst.Hyperlink.DECISION_HYPERLINK_CONFIG][name]; } + changePrincipal(value: any) { + return requestPost(`switch/principal`, value); + } + private sendEditStatusEvent(name: string, type: string): Promise { return new Promise(resolve => { if (Dec && Dec.socket.connected) { diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 4e6c4a6..1f39f08 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -11,6 +11,7 @@ import { FileChooser } from '../../../../components/file_chooser/file_chooser'; import { ApiFactory } from 'src/modules/crud/apiFactory'; import { Editor, Label, TextAreaEditor, TextEditor, TextValueCombo, VerticalLayout, MultiSelectItem } from '@fui/core'; import { DriverSelector } from '../../components/driverselector/driverselector'; +import { FileUpload } from '../../../../components/file_upload/file_upload'; const api = new ApiFactory().create(); @@ -37,6 +38,7 @@ export class FormJdbc extends BI.Widget { formPassword: FormItem; formPrincipal: FormItem; formKeyPath: FormItem; + formKrb5File: FormItem; labelTips: Label; form = { @@ -50,6 +52,7 @@ export class FormJdbc extends BI.Widget { authType: null, principal: null, keyPath: null, + krb5Path: null, originalCharsetName: null, schema: null, url: null, @@ -99,6 +102,7 @@ export class FormJdbc extends BI.Widget { authType, principal, keyPath, + krb5Path, fetchSize, // ssh usingSsh = false, @@ -316,9 +320,10 @@ export class FormJdbc extends BI.Widget { const type = this.form.authType.getValue()[0]; this.formPrincipal.setVisible(!!type); this.formKeyPath.setVisible(!!type); + this.formKrb5File.setVisible(!!type); + this.form.krb5Path.setEnable(!type); this.formUser.setVisible(!type); this.formPassword.setVisible(!type); - this.labelTips.setVisible(!!type); }, }, ], @@ -373,6 +378,55 @@ export class FormJdbc extends BI.Widget { }, ], }, + // keytab密钥路径 + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'), + invisible: !authType, + ref: (_ref: FormItem) => { + this.formKeyPath = _ref; + }, + forms: [ + { + type: FileUpload.xtype, + $value: 'key-path', + processId: "keytab", + allowBlank: true, + value: keyPath, + accept: '.keytab', + inter: '/v10/config/connection/upload/keytab?', + iconCls: "data-keytab-file", + watermark: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'), + ref: (_ref: FileUpload) => { + this.form.keyPath = _ref; + }, + listeners: [ + { + eventName: FileUpload.EVENT_CHECK_SUCCESS, + action: (value) => { + var principalsItems = BI.map(value.principals, function(index, item) { + return { + text: item, + value: item + } + }) + this.form.principal.populate(principalsItems); + this.form.principal.setValue(principalsItems[0].value); + this.setKerberos(); + this.form.krb5Path.setEnable(true); + }, + }, { + eventName: FileUpload.EVENT_CLEAR_FILE, + action: () => { + this.form.krb5Path.setEnable(false); + this.form.principal.populate(); + this.form.principal.setValue(); + } + } + ] + }, + ], + }, // 客户端principal { type: FormItem.xtype, @@ -383,52 +437,57 @@ export class FormJdbc extends BI.Widget { }, forms: [ { - type: BI.TextEditor.xtype, + type: BI.TextValueCombo.xtype, $value: 'principal', width: 300, - allowBlank: true, value: principal, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Principal'), ref: (_ref: TextEditor) => { this.form.principal = _ref; }, - }, + listeners: [ + { + eventName: BI.Combo.EVENT_CHANGE, + action: () => { + this.changePrincipal(); + this.setKerberos(); + }, + }, + ], + } ], }, - // keytab密钥路径 + // krb5.conf文件 { type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'), + name: BI.i18nText('Dec-Dcm_Connection_Form_Krb5File'), invisible: !authType, ref: (_ref: FormItem) => { - this.formKeyPath = _ref; + this.formKrb5File = _ref; }, forms: [ { - type: BI.Editor.xtype, - $value: 'key-path', - cls: 'bi-border', - width: 300, - height: 20, + type: FileUpload.xtype, + $value: 'krb5-file', + processId: "krb5Conf", allowBlank: true, - value: keyPath, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'), - ref: (_ref: Editor) => { - this.form.keyPath = _ref; + value: krb5Path, + iconCls: "data-conf-file", + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Krb5File'), + ref: (_ref: FileUpload) => { + this.form.krb5Path = _ref; }, - }, - ], - }, - // 关于krb5的提示 - { - type: BI.Label.xtype, - cls: 'bi-tips', - textAlign: 'left', - invisible: true, - text: BI.i18nText('Dec-Dcm_Connection_JDBC_Warning'), - ref: (_ref: Label) => { - this.labelTips = _ref; - }, + inter: '/v10/config/connection/upload/krb5?', + accept: '.conf', + listeners: [ + { + eventName: FileUpload.EVENT_CHECK_SUCCESS, + action: () => { + this.setKerberos(); + }, + } + ] + } + ] }, // 编码 { @@ -1266,6 +1325,30 @@ export class FormJdbc extends BI.Widget { } } + public setKerberos() { + const KerberosParams = BI.extend({},{ + keytabPath: this.form.keyPath.getValue(), + krb5ConfPath: this.form.krb5Path.getValue(), + principal: this.form.principal.getValue()[0] + }); + this.form.krb5Path.setFileInfo(KerberosParams); + this.form.keyPath.setFileInfo(KerberosParams); + } + + public changePrincipal() { + var self = this; + const KerberosParams = BI.extend({},{ + keytabPath: this.form.keyPath.getValue(), + krb5ConfPath: this.form.krb5Path.getValue(), + principal: this.form.principal.getValue()[0] + }); + api.changePrincipal(KerberosParams).then(res =>{ + self.form.keyPath.setValue(res.data.keytabPath); + self.form.krb5Path.setValue(res.data.krb5ConfPath); + }); + + } + public validation(): boolean { const driver = this.form.driver.validation(); const sshSet = !this.form.usingSsh.isSelected() || (this.form.sshIp.getValue() !== '' && this.form.sshPort.getValue() !== ''); @@ -1297,8 +1380,9 @@ export class FormJdbc extends BI.Widget { host: this.form.host.getValue(), authType: this.form.authType.getValue()[0] || '', creator: Dec ? Dec.personal.username : '', - principal: this.form.principal.getValue(), + principal: this.form.principal.getValue()[0], keyPath: this.form.keyPath.getValue(), + krb5Path: this.form.krb5Path.getValue(), fetchSize: BI.isEmptyString(this.form.fetchSize.getValue()) ? -2 : BI.parseInt(this.form.fetchSize.getValue()), // ssh usingSsh: this.form.usingSsh.isSelected(), From 912407297dd6bc0d9730002fec61a53e31ca8f2e Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Fri, 8 Jul 2022 15:32:02 +0800 Subject: [PATCH 3/9] =?UTF-8?q?REPORT-72487=20fix:var=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E4=B8=BAlet=E6=88=96const?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/file_upload/file_upload.model.ts | 2 +- .../components/file_upload/file_upload.ts | 16 ++++++++-------- .../pages/maintain/forms/components/form.jdbc.ts | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/modules/components/file_upload/file_upload.model.ts b/src/modules/components/file_upload/file_upload.model.ts index 78d0a75..bf6d905 100644 --- a/src/modules/components/file_upload/file_upload.model.ts +++ b/src/modules/components/file_upload/file_upload.model.ts @@ -23,7 +23,7 @@ export class FileUploadModel extends Model { actions = { setFileInfo: (params: UploadParam) => { - var inter = this.options.inter; + const inter = this.options.inter; this.model.uploadUrl = Dec.Utils.getEncodeURL(Dec.fineServletURL + inter, "", params); }, diff --git a/src/modules/components/file_upload/file_upload.ts b/src/modules/components/file_upload/file_upload.ts index 56265be..e3211a2 100644 --- a/src/modules/components/file_upload/file_upload.ts +++ b/src/modules/components/file_upload/file_upload.ts @@ -43,9 +43,9 @@ export class FileUpload extends BI.Widget { public render() { const { width, watermark, value, processId, inter } = this.options; - var self = this; - var processName = BI.concat("process-", processId); - var processClass = BI.concat(".process-", processId); + let self = this; + const processName = BI.concat("process-", processId); + const processClass = BI.concat(".process-", processId); this.setFileInfo({ keytabPath: '', principal:'', @@ -234,7 +234,7 @@ export class FileUpload extends BI.Widget { eventName: BI.MultifileEditor.EVENT_CHANGE, action: function (files) { self.options.attachId = ''; - var fileInfo = files.files[0]; + const fileInfo = files.files[0]; self.setInfo(fileInfo); self.store.setFileName(fileInfo.fileName); this.upload(); @@ -245,7 +245,7 @@ export class FileUpload extends BI.Widget { // 上传进度刷新 eventName: BI.MultifileEditor.EVENT_PROGRESS, action: function (progress) { - var rate = progress.loaded/progress.total; + let rate = progress.loaded/progress.total; NProgress.set(rate); }, }, @@ -260,8 +260,8 @@ export class FileUpload extends BI.Widget { // 上传文件完毕 eventName: BI.MultifileEditor.EVENT_UPLOADED, action: function () { - var uploadedInfo = this.getValue(); - var failed = BI.some(uploadedInfo, function (index, file) { + const uploadedInfo = this.getValue(); + const failed = BI.some(uploadedInfo, function (index, file) { if (file.data.errorCode) { BI.Msg.toast(uploadedInfo[0].filename + BI.i18nText('Dec-Dcm_Connection_File_Upload_Error'), { level: "error", @@ -270,7 +270,7 @@ export class FileUpload extends BI.Widget { return true; } }); - var key = self.options.processId +'Path'; + const key = self.options.processId +'Path'; !failed && self.setValue(uploadedInfo[0].data.kerberosInfo[key]); !failed && self.fireEvent(FileUpload.EVENT_CHECK_SUCCESS, uploadedInfo[0].data); !failed && BI.Msg.toast(uploadedInfo[0].filename + BI.i18nText('Dec-Dcm_Connection_File_Upload_Success'),{ diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 1f39f08..3e1685d 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -404,7 +404,7 @@ export class FormJdbc extends BI.Widget { { eventName: FileUpload.EVENT_CHECK_SUCCESS, action: (value) => { - var principalsItems = BI.map(value.principals, function(index, item) { + const principalsItems = BI.map(value.principals, function(index, item) { return { text: item, value: item @@ -1336,7 +1336,7 @@ export class FormJdbc extends BI.Widget { } public changePrincipal() { - var self = this; + let self = this; const KerberosParams = BI.extend({},{ keytabPath: this.form.keyPath.getValue(), krb5ConfPath: this.form.krb5Path.getValue(), From 3c4f53a4abc19abbb872bd19bcfafb6d848eb275 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Fri, 8 Jul 2022 15:38:12 +0800 Subject: [PATCH 4/9] =?UTF-8?q?REPORT-72487=20fix:=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/components/file_upload/file_upload.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/components/file_upload/file_upload.ts b/src/modules/components/file_upload/file_upload.ts index e3211a2..988dbf8 100644 --- a/src/modules/components/file_upload/file_upload.ts +++ b/src/modules/components/file_upload/file_upload.ts @@ -89,7 +89,7 @@ export class FileUpload extends BI.Widget { }, text: BI.i18nText('Dec-Basic_Choose_File'), handler: () => { - self.uploader.select(); + this.uploader.select(); }, }, ], @@ -197,7 +197,7 @@ export class FileUpload extends BI.Widget { this.errorMsg = _ref; }, }, { - type: "bi.vertical_adapt", + type: BI.VerticalLayout.xtype, rgap: 5, items: [ { From 16f8d2182332cb728947d0617203284fa2424ec5 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Fri, 8 Jul 2022 15:57:18 +0800 Subject: [PATCH 5/9] =?UTF-8?q?REPORT-72487=20fix:=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/components/file_upload/file_upload.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/components/file_upload/file_upload.ts b/src/modules/components/file_upload/file_upload.ts index 988dbf8..ece2282 100644 --- a/src/modules/components/file_upload/file_upload.ts +++ b/src/modules/components/file_upload/file_upload.ts @@ -197,7 +197,7 @@ export class FileUpload extends BI.Widget { this.errorMsg = _ref; }, }, { - type: BI.VerticalLayout.xtype, + type: BI.VerticalAdaptLayout.xtype, rgap: 5, items: [ { @@ -276,6 +276,8 @@ export class FileUpload extends BI.Widget { !failed && BI.Msg.toast(uploadedInfo[0].filename + BI.i18nText('Dec-Dcm_Connection_File_Upload_Success'),{ level: "success" }); + NProgress.configure({ parent: 'body'}); + }, }, ], From 598546772cc84e39e29024a1f5bdd31c9ec24496 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Fri, 8 Jul 2022 16:06:42 +0800 Subject: [PATCH 6/9] =?UTF-8?q?REPORT-72487=20fix:=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/components/file_upload/file_upload.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/components/file_upload/file_upload.ts b/src/modules/components/file_upload/file_upload.ts index ece2282..6633d07 100644 --- a/src/modules/components/file_upload/file_upload.ts +++ b/src/modules/components/file_upload/file_upload.ts @@ -201,17 +201,17 @@ export class FileUpload extends BI.Widget { rgap: 5, items: [ { - type: "bi.label", + type: BI.Label.xtype, text: BI.i18nText('Dec-Dcm_Connection_File_Upload_ErrorTip1'), },{ - type: "bi.text_button", + type: BI.TextButton.xtype, cls: "bi-high-light bi-high-light-border-bottom", text: BI.i18nText('Dec-Dcm_Connection_File_Upload_ErrorTip2'), handler: function () { window.open(Dec.system[DecCst.Hyperlink.DECISION_HYPERLINK_CONFIG][DecCst.Hyperlink.KERBEROS_CONF_HELP]); }, },{ - type: "bi.label", + type: BI.Label.xtype, text: BI.i18nText('Dec-Dcm_Connection_File_Upload_ErrorTip3'), } ], From af840451ad28be0df9af8c23411484f600639ed5 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Thu, 14 Jul 2022 11:24:22 +0800 Subject: [PATCH 7/9] =?UTF-8?q?REPORT-75736=20fix:=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=94=B9=E4=B8=BA=E4=B8=8A=E4=BC=A0=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/components/file_upload/file_upload.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/components/file_upload/file_upload.ts b/src/modules/components/file_upload/file_upload.ts index 6633d07..f81f622 100644 --- a/src/modules/components/file_upload/file_upload.ts +++ b/src/modules/components/file_upload/file_upload.ts @@ -302,7 +302,7 @@ export class FileUpload extends BI.Widget { this.textEditor.setValue(info.fileName); this.fileName.setText(info.fileName); this.fileSize.setText(Dec.Utils.getByteWidthUnit(info.size)); - this.fileModified.setText(BI.getDate(info.lastModified).print("%Y-%X-%d %H:%M:%S")) + this.fileModified.setText(BI.getDate().print("%Y-%X-%d %H:%M:%S")) } public clearInfo() { From 27871652ab2f91fd0a9c11d7dced6fa68879a9f7 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Mon, 18 Jul 2022 18:52:19 +0800 Subject: [PATCH 8/9] =?UTF-8?q?REPORT-75699=20fix:=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E6=97=B6principal=E5=80=BC=E4=B8=8E=E9=80=89?= =?UTF-8?q?=E9=A1=B9=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/crud/decision.api.ts | 4 ++++ .../pages/maintain/forms/components/form.jdbc.ts | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/modules/crud/decision.api.ts b/src/modules/crud/decision.api.ts index 5a5c8ce..d399399 100644 --- a/src/modules/crud/decision.api.ts +++ b/src/modules/crud/decision.api.ts @@ -124,6 +124,10 @@ export class DecisionApi implements Api { return requestPost(`switch/principal`, value); } + getPrincipals(keytab: string) { + return requestGet(`/principals?keytabPath=${keytab}`, {}); + } + private sendEditStatusEvent(name: string, type: string): Promise { return new Promise(resolve => { if (Dec && Dec.socket.connected) { diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 3e1685d..9415eb7 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -121,6 +121,7 @@ export class FormJdbc extends BI.Widget { } = connectionData as ConnectionJDBC; this.oldPassword = password; this.oldSshSecret = sshSecret; + !BI.isUndefined(principal) && this.getPrincipals(keyPath, principal); const { initialSize, @@ -1335,6 +1336,20 @@ export class FormJdbc extends BI.Widget { this.form.keyPath.setFileInfo(KerberosParams); } + public getPrincipals(keyPath, principal) { + let self = this; + api.getPrincipals(keyPath).then(res => { + const principalsItems = BI.map(res.data, function(index, item) { + return { + text: item, + value: item + } + }); + self.form.principal.populate(principalsItems); + self.form.principal.setValue(principal); + }) + } + public changePrincipal() { let self = this; const KerberosParams = BI.extend({},{ From 787aa83b90e8f4778373ae9ce14f37100339d5c8 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Tue, 19 Jul 2022 09:50:17 +0800 Subject: [PATCH 9/9] =?UTF-8?q?REPORT-75699=20fix:=E8=A7=84=E8=8C=83?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/maintain/forms/components/form.jdbc.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 9415eb7..fdfce5c 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -121,7 +121,7 @@ export class FormJdbc extends BI.Widget { } = connectionData as ConnectionJDBC; this.oldPassword = password; this.oldSshSecret = sshSecret; - !BI.isUndefined(principal) && this.getPrincipals(keyPath, principal); + !BI.isUndefined(principal) && this.initPrincipals(keyPath, principal); const { initialSize, @@ -1336,7 +1336,7 @@ export class FormJdbc extends BI.Widget { this.form.keyPath.setFileInfo(KerberosParams); } - public getPrincipals(keyPath, principal) { + public initPrincipals(keyPath, principal) { let self = this; api.getPrincipals(keyPath).then(res => { const principalsItems = BI.map(res.data, function(index, item) {