Browse Source

fix: 无jira任务 重命名的时候也发送socket,修改插件图片地址

qufenxi
alan 5 years ago
parent
commit
7162af5fb2
  1. 2
      redis.js
  2. 1
      src/modules/constants/env.ts
  3. 29
      src/modules/pages/connection/list/list_item/list_item.model.ts
  4. 12
      src/modules/pages/database/database_type/database_type.ts

2
redis.js

@ -6,7 +6,7 @@ BI.DOM.ready(() => {
BI.config(ConstantRedisType, datas => [...datas, { BI.config(ConstantRedisType, datas => [...datas, {
text: 'Redis', text: 'Redis',
databaseType: 'Redis', databaseType: 'Redis',
iconUrl: 'http://alan-picpack.oss-cn-hangzhou.aliyuncs.com/1567134942861890', iconUrl: 'com/fr/plugin/db/redis/images/redis.png',
}]); }]);
const RedisShowName = 'dec.dcm.connection.plugin.redis.show'; const RedisShowName = 'dec.dcm.connection.plugin.redis.show';

1
src/modules/constants/env.ts

@ -1,6 +1,7 @@
const fineServletURL = Dec ? Dec.fineServletURL : '/webroot/decision'; const fineServletURL = Dec ? Dec.fineServletURL : '/webroot/decision';
export const ReqPrefix = `${fineServletURL}/v10/config/connection`; export const ReqPrefix = `${fineServletURL}/v10/config/connection`;
export const ImgPrefix = `${fineServletURL}/resources?path=/com/fr/web/resources/dist/images/2x/icon/database/`; export const ImgPrefix = `${fineServletURL}/resources?path=/com/fr/web/resources/dist/images/2x/icon/database/`;
export const PluginImgPrefix = `${fineServletURL}/resources?path=`;
export const connectionType = DecCst ? DecCst.Connect.ConnectionType : { export const connectionType = DecCst ? DecCst.Connect.ConnectionType : {
JDBC: 'jdbc', JDBC: 'jdbc',

29
src/modules/pages/connection/list/list_item/list_item.model.ts

@ -50,19 +50,28 @@ export class ListItemModel extends Model<{
setDatebaseTypeSelected(name: string) { setDatebaseTypeSelected(name: string) {
this.model.datebaseTypeSelected = name; this.model.datebaseTypeSelected = name;
}, },
setIsEdit(isEdit: boolean) { setIsEdit(isEdit: boolean, name: string) {
this.model.isEdit = isEdit; if (isEdit) {
api.getConnectionStatus(name).then(re => {
if (re.data && re.data === 'success') {
this.model.isEdit = true;
} else {
BI.Msg.toast(BI.i18nText('Dec-Dcm_Connection_Is_Using', re.errorMsg), {
level: 'error',
});
}
});
} else {
api.shutdownConnectionStatus(name);
this.model.isEdit = false;
}
}, },
changeName(oldName: string, newName: string) { changeName(oldName: string, newName: string) {
const connections = this.model.connections.map(item => { const connection = this.model.connections.find(item => item.connectionName === oldName);
return { connection.connectionId = oldName;
...item, connection.connectionName = newName;
connectionName: item.connectionName === oldName ? newName : item.connectionName,
connectionId: oldName,
};
});
return api.updateConnection(connections); return api.updateConnection(connection);
}, },
setIsCopy(isCopy: boolean) { setIsCopy(isCopy: boolean) {
this.model.isCopy = isCopy; this.model.isCopy = isCopy;

12
src/modules/pages/database/database_type/database_type.ts

@ -1,7 +1,7 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { Vtape, Label, Absolute, Img } from 'ui'; import { Vtape, Label, Absolute, Img } from 'ui';
import { DatebaseTypeModel, DatebaseTypeModelXtype } from './database_type.model'; import { DatebaseTypeModel, DatebaseTypeModelXtype } from './database_type.model';
import { ImgPrefix } from '@constants/env'; import { ImgPrefix, PluginImgPrefix } from '@constants/env';
import './database_type.less'; import './database_type.less';
export const DatebaseTypeXtype = 'dec.dcm.datebase.type'; export const DatebaseTypeXtype = 'dec.dcm.datebase.type';
@ -38,7 +38,7 @@ export class DatebaseType extends BI.BasicButton {
{ {
el: { el: {
type: Img, type: Img,
src: iconUrl ? iconUrl : `${ImgPrefix}${databaseType}.jpg`, src: iconUrl ? this.getIconUrl(iconUrl) : `${ImgPrefix}${databaseType}.jpg`,
ref: (_ref: any) => { ref: (_ref: any) => {
this.img = _ref; this.img = _ref;
}, },
@ -79,4 +79,12 @@ export class DatebaseType extends BI.BasicButton {
this.img.setSrc(`${ImgPrefix}default.jpg`); this.img.setSrc(`${ImgPrefix}default.jpg`);
}; };
} }
private getIconUrl(url: string) {
if (url.startsWith('/')) {
return `${PluginImgPrefix}${url}`;
}
return `${PluginImgPrefix}/${url}`;
}
} }

Loading…
Cancel
Save