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, {
text: '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';

1
src/modules/constants/env.ts

@ -1,6 +1,7 @@
const fineServletURL = Dec ? Dec.fineServletURL : '/webroot/decision';
export const ReqPrefix = `${fineServletURL}/v10/config/connection`;
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 : {
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) {
this.model.datebaseTypeSelected = name;
},
setIsEdit(isEdit: boolean) {
this.model.isEdit = isEdit;
setIsEdit(isEdit: boolean, name: string) {
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) {
const connections = this.model.connections.map(item => {
return {
...item,
connectionName: item.connectionName === oldName ? newName : item.connectionName,
connectionId: oldName,
};
});
const connection = this.model.connections.find(item => item.connectionName === oldName);
connection.connectionId = oldName;
connection.connectionName = newName;
return api.updateConnection(connections);
return api.updateConnection(connection);
},
setIsCopy(isCopy: boolean) {
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 { Vtape, Label, Absolute, Img } from 'ui';
import { DatebaseTypeModel, DatebaseTypeModelXtype } from './database_type.model';
import { ImgPrefix } from '@constants/env';
import { ImgPrefix, PluginImgPrefix } from '@constants/env';
import './database_type.less';
export const DatebaseTypeXtype = 'dec.dcm.datebase.type';
@ -38,7 +38,7 @@ export class DatebaseType extends BI.BasicButton {
{
el: {
type: Img,
src: iconUrl ? iconUrl : `${ImgPrefix}${databaseType}.jpg`,
src: iconUrl ? this.getIconUrl(iconUrl) : `${ImgPrefix}${databaseType}.jpg`,
ref: (_ref: any) => {
this.img = _ref;
},
@ -79,4 +79,12 @@ export class DatebaseType extends BI.BasicButton {
this.img.setSrc(`${ImgPrefix}default.jpg`);
};
}
private getIconUrl(url: string) {
if (url.startsWith('/')) {
return `${PluginImgPrefix}${url}`;
}
return `${PluginImgPrefix}/${url}`;
}
}

Loading…
Cancel
Save