Browse Source

Pull request #6863: REPORT-89173 fix: JNDI入口屏蔽

Merge in DEC/decision-webui-dcm from ~AUSTIN.DUAN/decision-webui-dcm:release/11.0 to release/11.0

* commit '49779bdcbd5e26f106848b9e968e6fb3628c8f48':
  无JIRA任务,处理下类型
  REPORT-89173 fix: JNDI入口屏蔽
release/11.0
Austin.Duan-段嗣跃 2 years ago
parent
commit
6c09907778
  1. 18
      src/modules/app.service.ts
  2. 5
      src/modules/crud/api.ts
  3. 7
      src/modules/crud/decision.api.ts
  4. 4
      src/modules/crud/design.api.ts
  5. 23
      src/modules/pages/database/database.model.ts
  6. 13
      src/modules/pages/database/database.ts

18
src/modules/app.service.ts

@ -1,7 +1,7 @@
import { DATA_BASE_TYPES, DATA_BASE_TYPES_OTHER, DESIGN_DRIVER_TYPE, OTHER_JDBC } from '@constants/constant';
import { DatabaseType } from './app.typings';
import { Connection } from './crud/crud.typings';
export function getAllDatabaseTypes():DatabaseType[] {
export function getAllDatabaseTypes(): DatabaseType[] {
return [
...DATA_BASE_TYPES,
...BI.Providers.getProvider('dec.connection.provider.datebase').customDatabaseType.map(item => {
@ -45,11 +45,11 @@ export function getJdbcDatabaseType(database: string, driver: string): DatabaseT
if (!databaseType) {
return DATA_BASE_TYPES_OTHER;
}
return databaseType;
}
export function resolveUrlInfo (url: string, database?: string) {
export function resolveUrlInfo(url: string, database?: string) {
if (BI.isNull(url)) return {};
return BI.Providers.getProvider('dec.connection.provider.datebase').getJdbcResolveByType(database)(url) || {
@ -70,11 +70,11 @@ export function splitUrl(host: string, port: string, database: string, baseUrl:
// https://work.fineres.com/browse/REPORT-72078
if (baseUrl.startsWith('jdbc:informix-sqli')) {
return baseUrl.replace('hostname', host)
.replace(':port', port ? `:${port}` : '')
.replace('database', database)
.replace(':INFORMIXSERVER={server}','');
.replace(':port', port ? `:${port}` : '')
.replace('database', database)
.replace(':INFORMIXSERVER={server}', '');
}
return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '')
.replace('database', database)
.replace('dbname', database);
@ -85,13 +85,13 @@ export function connectionCanEdit(connection: Connection) {
// privilegeType === 4 代表编辑权限,privilegeValue === 2 代表有权限
return connection.privilegeDetailBeanList.some(item => item.privilegeType === 4 && item.privilegeValue === 2);
}
return true;
}
export function getTextByDatabaseType(databaseType: string) {
const database = getAllDatabaseTypes().find(item => item.databaseType === databaseType);
return database ? database.text : '';
}

5
src/modules/crud/api.ts

@ -93,4 +93,9 @@ export interface Api {
*
*/
getHyperlink(name: string): string;
/**
* JNDI数据库类型可用状态
*/
getJNDIDatabaseStatus(): Promise<{ data?: boolean }>;
}

7
src/modules/crud/decision.api.ts

@ -129,11 +129,16 @@ export class DecisionApi implements Api {
getTimeOut(): Promise<{ data?: any }> {
return requestGet('kdc/timeout', {});
}
putTimeOut(value: number) {
return requestPut(`kdc/timeout?timeout=${value}`, {})
}
// 获取当前lic是否可以使用JNDI数据库类型
getJNDIDatabaseStatus(): Promise<{ data?: boolean }> {
return requestGet('databasetype/limit', {});
}
private sendEditStatusEvent(name: string, type: string): Promise<SocketResult> {
return new Promise(resolve => {
if (Dec && Dec.socket.connected) {

4
src/modules/crud/design.api.ts

@ -88,4 +88,8 @@ export class DesignApi implements Api {
// 设计器获取超链
return '';
}
getJNDIDatabaseStatus() {
return Promise.resolve({ data: true });
}
}

23
src/modules/pages/database/database.model.ts

@ -2,10 +2,12 @@ import { model, Model } from '@core/core';
import { AppModel } from 'src/modules/app.model';
import { getAllDatabaseTypes } from '../../app.service';
import { DatabaseType } from '../../app.typings';
import { connectionType } from '@constants/env';
import { OTHER_JDBC } from '@constants/constant';
@model()
export class DatebaseModel extends Model<{
types : {
types: {
filter: AppModel['TYPE']['filter'];
datebaseTypeSelected: AppModel['TYPE']['datebaseTypeSelected'];
},
@ -20,20 +22,30 @@ export class DatebaseModel extends Model<{
isInternal: true,
isPlugin: true,
datebaseTypes: getAllDatabaseTypes().filter(item => item.commonly),
isJNDILimit: false,
};
}
computed = {
otherDatabases: () => {
return this.model.isJNDILimit
? [OTHER_JDBC]
: [OTHER_JDBC, connectionType.JNDI];
}
}
actions = {
setSearch:(search: string) => {
setSearch: (search: string) => {
this.model.search = search;
},
setFilter:(filter: string) => {
setFilter: (filter: string) => {
this.model.filter = filter;
},
setDatebaseTypes: (datebaseTypes: DatabaseType[]) => {
this.model.datebaseTypes = datebaseTypes;
this.model.datebaseTypeSelected = '';
},
setInternal:(isInternal: boolean) => {
setInternal: (isInternal: boolean) => {
this.model.isInternal = isInternal;
},
setPlugin: (isPlugin: boolean) => {
@ -42,5 +54,8 @@ export class DatebaseModel extends Model<{
setDatebaseTypeSelected(datebaseType: string) {
this.model.datebaseTypeSelected = datebaseType;
},
setJNDILimit: (v: boolean) => {
this.model.isJNDILimit = v;
},
}
}

13
src/modules/pages/database/database.ts

@ -6,6 +6,10 @@ import { connectionType } from '@constants/env';
import { DatebaseType } from './database_type/database_type';
import { getAllDatabaseTypes } from '../../app.service';
import { ButtonGroup, MultiSelectItem, SearchEditor } from '@fui/core';
import { ApiFactory } from 'src/modules/crud/apiFactory';
const api = new ApiFactory().create();
@shortcut()
@store(DatebaseModel)
export class Datebase extends BI.Widget {
@ -65,6 +69,7 @@ export class Datebase extends BI.Widget {
mounted() {
this.store.setFilter(DATEBASE_FILTER_TYPE.COMMONLY);
this.store.setDatebaseTypeSelected('');
this.getDatabaseTypeLimit();
}
render() {
@ -250,11 +255,17 @@ export class Datebase extends BI.Widget {
this.store.setDatebaseTypes(this.allDatabaseTypes.filter(item => item.commonly));
break;
case DATEBASE_FILTER_TYPE.OTHER:
this.store.setDatebaseTypes(this.allDatabaseTypes.filter(item => item.type === connectionType.JNDI || item.type === OTHER_JDBC));
this.store.setDatebaseTypes(this.allDatabaseTypes.filter(item => this.model.otherDatabases.includes(item.type)));
break;
default:
this.store.setDatebaseTypes(this.allDatabaseTypes.filter(item => item.type !== connectionType.JNDI && item.type !== OTHER_JDBC));
break;
}
}
// 获取JNDI
private async getDatabaseTypeLimit() {
const result = await api.getJNDIDatabaseStatus();
this.store.setJNDILimit(result);
}
}

Loading…
Cancel
Save