You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.1 KiB
65 lines
2.1 KiB
import {WidgetType, Left, Label, Button} from '@ui/index'; |
|
import RightTitleModel from '../../link-set.model'; |
|
import {LinkType} from '@ui/type'; |
|
import {saveConnection} from '../../link-set.service'; |
|
const className = 'fr.component.right.title'; |
|
const Widget: WidgetType = { |
|
_store() { |
|
return BI.Models.getModel(RightTitleModel); |
|
}, |
|
render() { |
|
const linkSelected: LinkType = this.model.linkSelected; |
|
const linkList: LinkType[] = this.model.linkList; |
|
const that = this; |
|
const {isEdit} = this.options; |
|
const title = linkSelected.text === 'other' ? BI.i18nText('Dec-Dcm_Connection_Other') : linkSelected.text; |
|
|
|
return { |
|
type: Left, |
|
height: 40, |
|
cls: 'right-title', |
|
items: [ |
|
{ |
|
type: Label, |
|
cls: 'right-title-text', |
|
text: `${BI.i18nText('Dec-Dcm_Data_Connections')}(${title ? title : BI.i18nText('Dec-Dcm_Default')})`, |
|
}, |
|
{ |
|
type: Button, |
|
cls:'right-title-button', |
|
invisible: isEdit, |
|
text: BI.i18nText('Dec-Dcm_Edit'), |
|
handler() { |
|
that.store.setEdit(true); |
|
}, |
|
}, |
|
{ |
|
type: Button, |
|
cls:'right-title-button', |
|
invisible: !isEdit, |
|
text: BI.i18nText('Dec-Dcm_Save'), |
|
handler() { |
|
const result = BI.find(linkList, (idx: number, value: LinkType) => that.model.linkUpdate.connectionName === value.connectionName && value.connectionId !== that.model.linkUpdate.connectionId); |
|
if (result) { |
|
that.store.setConnectionNameErr(BI.i18nText('Dec-Dcm_Connection_Is_Existence')); |
|
} else { |
|
that.store.saveLink(); |
|
} |
|
}, |
|
}, |
|
{ |
|
type: Button, |
|
cls:'right-title-button', |
|
invisible: !isEdit, |
|
level: 'ignore', |
|
text: BI.i18nText('BI-Basic_Cancel'), |
|
handler() { |
|
that.store.setCancel(); |
|
}, |
|
}, |
|
], |
|
}; |
|
}, |
|
}; |
|
BI.shortcut(className, BI.inherit(BI.Widget, Widget)); |
|
export default className;
|
|
|