|
|
|
import { shortcut, store } from '@core/core';
|
|
|
|
import { Button } from '@fui/core';
|
|
|
|
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: Button;
|
|
|
|
|
|
|
|
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: BI.CenterAdaptLayout.xtype,
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
type: BI.VerticalLayout.xtype,
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
type: BI.HorizontalAutoLayout.xtype,
|
|
|
|
cls: tipCls,
|
|
|
|
bgap: 20,
|
|
|
|
items: [{
|
|
|
|
type: 'bi.icon',
|
|
|
|
width: 60,
|
|
|
|
height: 60,
|
|
|
|
}],
|
|
|
|
}, {
|
|
|
|
type: BI.Label.xtype,
|
|
|
|
height: 14,
|
|
|
|
bgap: 10,
|
|
|
|
text: tipText,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: BI.VerticalAdaptLayout.xtype,
|
|
|
|
hgap: 5,
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
type: BI.Button.xtype,
|
|
|
|
text: BI.i18nText('Dec-Dcm_Connection_Detailed_Information'),
|
|
|
|
level: 'ignore',
|
|
|
|
ref: (_ref: Button) => {
|
|
|
|
this.detailButton = _ref;
|
|
|
|
},
|
|
|
|
handler: () => {
|
|
|
|
this.store.setIsCollapse(!this.model.isCollapse);
|
|
|
|
this.fireEvent(EVENT_DETAIL, !this.model.isCollapse);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: BI.Button.xtype,
|
|
|
|
text: BI.i18nText('Dec-Dcm_Back'),
|
|
|
|
level: 'ignore',
|
|
|
|
handler: () => {
|
|
|
|
this.fireEvent(EVENT_CLOSE);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: BI.Button.xtype,
|
|
|
|
text: retryText,
|
|
|
|
handler: () => {
|
|
|
|
this.fireEvent(EVENT_RELOAD);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|