import { shortcut, store } from '@core/core'; import { Vertical, HorizotalAuto, CenterAdapt, Label, VerticalAdapt, Button } from 'ui'; import { TipFailModel, TipFailModelXtype } from './tip_fail.model'; export const TipFailXtype = 'dec.dcm.components.test_status.tip_fail'; export const EVENT_CLOSE = 'EVENT_CLOSE'; export const EVENT_RELOAD = 'EVENT_RELOAD'; export const EVENT_DETAIL = 'EVENT_DETAIL'; @shortcut(TipFailXtype) @store(TipFailModelXtype) export class TipFail extends BI.Widget { props = { tipCls: '', tipText: '', retryText: '', } model: TipFailModel['model']; store: TipFailModel['store']; detailButton: any; watch = { isCollapse: (isCollapse: boolean) => { this.detailButton.setText(isCollapse ? BI.i18nText('Dec-Dcm_Connection_Handup_Information') : BI.i18nText('Dec-Dcm_Connection_Detailed_Information')); }, } render() { const { tipCls, tipText, retryText } = this.options; return { type: CenterAdapt, items: [ { type: Vertical, items: [ { type: HorizotalAuto, cls: tipCls, bgap: 20, items: [{ type: 'bi.icon', width: 60, height: 60, }], }, { type: Label, height: 14, bgap: 10, text: tipText, }, { type: VerticalAdapt, hgap: 5, items: [ { type: Button, text: BI.i18nText('Dec-Dcm_Connection_Detailed_Information'), level: 'ignore', ref: (_ref: any) => { this.detailButton = _ref; }, handler: () => { this.store.setIsCollapse(!this.model.isCollapse); this.fireEvent(EVENT_DETAIL, !this.model.isCollapse); }, }, { type: Button, text: BI.i18nText('Dec-Dcm_Back'), level: 'ignore', handler: () => { this.fireEvent(EVENT_CLOSE); }, }, { type: Button, text: retryText, handler: () => { this.fireEvent(EVENT_RELOAD); }, }, ], }, ], }, ], }; } }