|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
import { shortcut, store } from '@core/core'; |
|
|
|
|
import { VerticalXtype, HtapeXtype, LabelXtype, IconComboXtype, TextValueComboXtype, CodeEditorXtype, ComponentsStyleTable, ButtonXtype, IconTextValue_Combo } from 'ui'; |
|
|
|
|
import { VerticalXtype, HtapeXtype, LabelXtype, IconComboXtype, TextValueComboXtype, TextAreaEditorXtype, ComponentsStyleTable, ButtonXtype, IconTextValue_Combo } from 'ui'; |
|
|
|
|
import { TableList } from './table_list/table_list'; |
|
|
|
|
import '../less/index.less'; |
|
|
|
|
import { DatabaseIndex } from './components/database_index/database_index'; |
|
|
|
@ -29,7 +29,7 @@ export class RedisProgram extends BI.Widget {
|
|
|
|
|
value: { |
|
|
|
|
datasetData: { |
|
|
|
|
database: '', |
|
|
|
|
orderValue: '0', |
|
|
|
|
orderValue: 0, |
|
|
|
|
script: '', |
|
|
|
|
engineType: 0, |
|
|
|
|
parameters: [], |
|
|
|
@ -41,14 +41,15 @@ export class RedisProgram extends BI.Widget {
|
|
|
|
|
parameters: () => { |
|
|
|
|
this.parameterEditor.populate(this.renderItems(), [this.model.paramHeader]); |
|
|
|
|
}, |
|
|
|
|
ablePreview: (ablePreview: boolean) => { |
|
|
|
|
this.previewButton.setEnable(ablePreview); |
|
|
|
|
ableSave: (ableSave: boolean) => { |
|
|
|
|
this.previewButton.setEnable(ableSave); |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
|
const { database = '', orderValue = '0', script = '', parameters = [], engineType = 0 } = this.options.value.datasetData || {}; |
|
|
|
|
const { database = '', orderValue = 0, script = '', parameters = [], engineType = 0 } = this.options.value.datasetData || {}; |
|
|
|
|
this.store.setParameters(parameters); |
|
|
|
|
const inputType = typeof orderValue === 'string' ? 'formula' : 'int'; |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
type: HtapeXtype, |
|
|
|
@ -84,7 +85,7 @@ export class RedisProgram extends BI.Widget {
|
|
|
|
|
type: IconComboXtype, |
|
|
|
|
height: 22, |
|
|
|
|
width: 28, |
|
|
|
|
value: 'int', |
|
|
|
|
value: inputType, |
|
|
|
|
items: [{ |
|
|
|
|
text: BI.i18nText('Plugin-Redis_Parameter_Type_Int'), |
|
|
|
|
value: 'int', |
|
|
|
@ -110,6 +111,7 @@ export class RedisProgram extends BI.Widget {
|
|
|
|
|
type: DatabaseIndex.xtype, |
|
|
|
|
rgap: 11, |
|
|
|
|
value: orderValue, |
|
|
|
|
inputType, |
|
|
|
|
ref: (_ref: any) => { |
|
|
|
|
this.databaseIndex = _ref; |
|
|
|
|
}, |
|
|
|
@ -152,9 +154,10 @@ export class RedisProgram extends BI.Widget {
|
|
|
|
|
}, |
|
|
|
|
width: this.textWidth, |
|
|
|
|
}, { |
|
|
|
|
type: CodeEditorXtype, |
|
|
|
|
type: TextAreaEditorXtype, |
|
|
|
|
cls: 'bi-border', |
|
|
|
|
height: 200, |
|
|
|
|
allowBlank: true, |
|
|
|
|
value: script, |
|
|
|
|
ref: (_ref: any) => { |
|
|
|
|
this.queryCondition = _ref; |
|
|
|
@ -193,7 +196,7 @@ export class RedisProgram extends BI.Widget {
|
|
|
|
|
el: { |
|
|
|
|
type: ButtonXtype, |
|
|
|
|
text: BI.i18nText('Plugin-Redis_Preview'), |
|
|
|
|
disabled: !this.model.ablePreview, |
|
|
|
|
disabled: !BI.get(this.model, 'ableSave'), |
|
|
|
|
handler: () => { |
|
|
|
|
this.openPreview(); |
|
|
|
|
}, |
|
|
|
|