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. 10
      src/modules/app.service.ts
  2. 5
      src/modules/crud/api.ts
  3. 5
      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

10
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 { DATA_BASE_TYPES, DATA_BASE_TYPES_OTHER, DESIGN_DRIVER_TYPE, OTHER_JDBC } from '@constants/constant';
import { DatabaseType } from './app.typings'; import { DatabaseType } from './app.typings';
import { Connection } from './crud/crud.typings'; import { Connection } from './crud/crud.typings';
export function getAllDatabaseTypes():DatabaseType[] { export function getAllDatabaseTypes(): DatabaseType[] {
return [ return [
...DATA_BASE_TYPES, ...DATA_BASE_TYPES,
...BI.Providers.getProvider('dec.connection.provider.datebase').customDatabaseType.map(item => { ...BI.Providers.getProvider('dec.connection.provider.datebase').customDatabaseType.map(item => {
@ -49,7 +49,7 @@ export function getJdbcDatabaseType(database: string, driver: string): DatabaseT
return databaseType; return databaseType;
} }
export function resolveUrlInfo (url: string, database?: string) { export function resolveUrlInfo(url: string, database?: string) {
if (BI.isNull(url)) return {}; if (BI.isNull(url)) return {};
return BI.Providers.getProvider('dec.connection.provider.datebase').getJdbcResolveByType(database)(url) || { return BI.Providers.getProvider('dec.connection.provider.datebase').getJdbcResolveByType(database)(url) || {
@ -70,9 +70,9 @@ export function splitUrl(host: string, port: string, database: string, baseUrl:
// https://work.fineres.com/browse/REPORT-72078 // https://work.fineres.com/browse/REPORT-72078
if (baseUrl.startsWith('jdbc:informix-sqli')) { if (baseUrl.startsWith('jdbc:informix-sqli')) {
return baseUrl.replace('hostname', host) return baseUrl.replace('hostname', host)
.replace(':port', port ? `:${port}` : '') .replace(':port', port ? `:${port}` : '')
.replace('database', database) .replace('database', database)
.replace(':INFORMIXSERVER={server}',''); .replace(':INFORMIXSERVER={server}', '');
} }
return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '')

5
src/modules/crud/api.ts

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

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

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

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

@ -88,4 +88,8 @@ export class DesignApi implements Api {
// 设计器获取超链 // 设计器获取超链
return ''; 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 { AppModel } from 'src/modules/app.model';
import { getAllDatabaseTypes } from '../../app.service'; import { getAllDatabaseTypes } from '../../app.service';
import { DatabaseType } from '../../app.typings'; import { DatabaseType } from '../../app.typings';
import { connectionType } from '@constants/env';
import { OTHER_JDBC } from '@constants/constant';
@model() @model()
export class DatebaseModel extends Model<{ export class DatebaseModel extends Model<{
types : { types: {
filter: AppModel['TYPE']['filter']; filter: AppModel['TYPE']['filter'];
datebaseTypeSelected: AppModel['TYPE']['datebaseTypeSelected']; datebaseTypeSelected: AppModel['TYPE']['datebaseTypeSelected'];
}, },
@ -20,20 +22,30 @@ export class DatebaseModel extends Model<{
isInternal: true, isInternal: true,
isPlugin: true, isPlugin: true,
datebaseTypes: getAllDatabaseTypes().filter(item => item.commonly), datebaseTypes: getAllDatabaseTypes().filter(item => item.commonly),
isJNDILimit: false,
}; };
} }
computed = {
otherDatabases: () => {
return this.model.isJNDILimit
? [OTHER_JDBC]
: [OTHER_JDBC, connectionType.JNDI];
}
}
actions = { actions = {
setSearch:(search: string) => { setSearch: (search: string) => {
this.model.search = search; this.model.search = search;
}, },
setFilter:(filter: string) => { setFilter: (filter: string) => {
this.model.filter = filter; this.model.filter = filter;
}, },
setDatebaseTypes: (datebaseTypes: DatabaseType[]) => { setDatebaseTypes: (datebaseTypes: DatabaseType[]) => {
this.model.datebaseTypes = datebaseTypes; this.model.datebaseTypes = datebaseTypes;
this.model.datebaseTypeSelected = ''; this.model.datebaseTypeSelected = '';
}, },
setInternal:(isInternal: boolean) => { setInternal: (isInternal: boolean) => {
this.model.isInternal = isInternal; this.model.isInternal = isInternal;
}, },
setPlugin: (isPlugin: boolean) => { setPlugin: (isPlugin: boolean) => {
@ -42,5 +54,8 @@ export class DatebaseModel extends Model<{
setDatebaseTypeSelected(datebaseType: string) { setDatebaseTypeSelected(datebaseType: string) {
this.model.datebaseTypeSelected = datebaseType; 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 { DatebaseType } from './database_type/database_type';
import { getAllDatabaseTypes } from '../../app.service'; import { getAllDatabaseTypes } from '../../app.service';
import { ButtonGroup, MultiSelectItem, SearchEditor } from '@fui/core'; import { ButtonGroup, MultiSelectItem, SearchEditor } from '@fui/core';
import { ApiFactory } from 'src/modules/crud/apiFactory';
const api = new ApiFactory().create();
@shortcut() @shortcut()
@store(DatebaseModel) @store(DatebaseModel)
export class Datebase extends BI.Widget { export class Datebase extends BI.Widget {
@ -65,6 +69,7 @@ export class Datebase extends BI.Widget {
mounted() { mounted() {
this.store.setFilter(DATEBASE_FILTER_TYPE.COMMONLY); this.store.setFilter(DATEBASE_FILTER_TYPE.COMMONLY);
this.store.setDatebaseTypeSelected(''); this.store.setDatebaseTypeSelected('');
this.getDatabaseTypeLimit();
} }
render() { render() {
@ -250,11 +255,17 @@ export class Datebase extends BI.Widget {
this.store.setDatebaseTypes(this.allDatabaseTypes.filter(item => item.commonly)); this.store.setDatebaseTypes(this.allDatabaseTypes.filter(item => item.commonly));
break; break;
case DATEBASE_FILTER_TYPE.OTHER: 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; break;
default: default:
this.store.setDatebaseTypes(this.allDatabaseTypes.filter(item => item.type !== connectionType.JNDI && item.type !== OTHER_JDBC)); this.store.setDatebaseTypes(this.allDatabaseTypes.filter(item => item.type !== connectionType.JNDI && item.type !== OTHER_JDBC));
break; break;
} }
} }
// 获取JNDI
private async getDatabaseTypeLimit() {
const result = await api.getJNDIDatabaseStatus();
this.store.setJNDILimit(result);
}
} }

Loading…
Cancel
Save