|
|
@ -1,11 +1,11 @@ |
|
|
|
import { shortcut, store } from '@core/core'; |
|
|
|
import {shortcut, store} from '@core/core'; |
|
|
|
import { TableList } from './table_list/table_list'; |
|
|
|
import {TableList} from './table_list/table_list'; |
|
|
|
import '../less/index.less'; |
|
|
|
import '../less/index.less'; |
|
|
|
import { DatabaseIndex } from './components/database_index/database_index'; |
|
|
|
import {DatabaseIndex} from './components/database_index/database_index'; |
|
|
|
import { RedisModel, ParameterType } from './app.model'; |
|
|
|
import {RedisModel, ParameterType} from './app.model'; |
|
|
|
import './app.less'; |
|
|
|
import './app.less'; |
|
|
|
import { redisField } from './app.constant'; |
|
|
|
import {redisField} from './app.constant'; |
|
|
|
import { Preview } from './components/preview/preview'; |
|
|
|
import {Preview} from './components/preview/preview'; |
|
|
|
|
|
|
|
|
|
|
|
@shortcut() |
|
|
|
@shortcut() |
|
|
|
@store(RedisModel) |
|
|
|
@store(RedisModel) |
|
|
@ -46,10 +46,17 @@ export class RedisProgram extends BI.Widget { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
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); |
|
|
|
this.store.setParameters(parameters); |
|
|
|
const inputType = typeof orderValue === 'string' ? 'formula' : 'int'; |
|
|
|
const inputType = typeof orderValue === 'string' ? 'formula' : 'int'; |
|
|
|
|
|
|
|
const plainScript = BI.Providers.getProvider("dec.provider.cipher").getPlain(script); |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
type: BI.HTapeLayout.xtype, |
|
|
|
type: BI.HTapeLayout.xtype, |
|
|
|
tgap: 15, |
|
|
|
tgap: 15, |
|
|
@ -157,7 +164,7 @@ export class RedisProgram extends BI.Widget { |
|
|
|
cls: 'bi-border', |
|
|
|
cls: 'bi-border', |
|
|
|
height: 200, |
|
|
|
height: 200, |
|
|
|
allowBlank: true, |
|
|
|
allowBlank: true, |
|
|
|
value: script, |
|
|
|
value: plainScript, |
|
|
|
ref: (_ref: any) => { |
|
|
|
ref: (_ref: any) => { |
|
|
|
this.queryCondition = _ref; |
|
|
|
this.queryCondition = _ref; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -212,7 +219,7 @@ export class RedisProgram extends BI.Widget { |
|
|
|
columnSize: [300, 300, ''], |
|
|
|
columnSize: [300, 300, ''], |
|
|
|
items: this.renderItems(), |
|
|
|
items: this.renderItems(), |
|
|
|
header: [this.model.paramHeader], |
|
|
|
header: [this.model.paramHeader], |
|
|
|
ref: (_ref: any) => { |
|
|
|
ref: (_ref: any) => { |
|
|
|
this.parameterEditor = _ref; |
|
|
|
this.parameterEditor = _ref; |
|
|
|
}, |
|
|
|
}, |
|
|
|
}], |
|
|
|
}], |
|
|
@ -222,7 +229,7 @@ export class RedisProgram extends BI.Widget { |
|
|
|
|
|
|
|
|
|
|
|
private renderItems() { |
|
|
|
private renderItems() { |
|
|
|
const self = this; |
|
|
|
const self = this; |
|
|
|
|
|
|
|
|
|
|
|
return this.model.parameters.map((item, index) => [{ |
|
|
|
return this.model.parameters.map((item, index) => [{ |
|
|
|
type: BI.Label.xtype, |
|
|
|
type: BI.Label.xtype, |
|
|
|
text: item.name, |
|
|
|
text: item.name, |
|
|
@ -237,7 +244,7 @@ export class RedisProgram extends BI.Widget { |
|
|
|
value: item.type, |
|
|
|
value: item.type, |
|
|
|
listeners: [{ |
|
|
|
listeners: [{ |
|
|
|
eventName: BI.IconTextValueCombo.EVENT_CHANGE, |
|
|
|
eventName: BI.IconTextValueCombo.EVENT_CHANGE, |
|
|
|
action () { |
|
|
|
action() { |
|
|
|
self.store.setParamType(index, this.getValue()[0]); |
|
|
|
self.store.setParamType(index, this.getValue()[0]); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}], |
|
|
|
}], |
|
|
@ -251,7 +258,7 @@ export class RedisProgram extends BI.Widget { |
|
|
|
self.store.setParamValue(index, value); |
|
|
|
self.store.setParamValue(index, value); |
|
|
|
})]); |
|
|
|
})]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private createParameterValueItem(param: ParameterType, cb: Function) { |
|
|
|
private createParameterValueItem(param: ParameterType, cb: Function) { |
|
|
|
return BI.Services.getService('dec.service.data.set').createParameterValueItem(param, cb); |
|
|
|
return BI.Services.getService('dec.service.data.set').createParameterValueItem(param, cb); |
|
|
|
} |
|
|
|
} |
|
|
@ -260,7 +267,7 @@ export class RedisProgram extends BI.Widget { |
|
|
|
return { |
|
|
|
return { |
|
|
|
database: this.tableList.getSelectedDatabase(), |
|
|
|
database: this.tableList.getSelectedDatabase(), |
|
|
|
orderValue: this.databaseIndex.getValue(), |
|
|
|
orderValue: this.databaseIndex.getValue(), |
|
|
|
script: this.queryCondition.getValue(), |
|
|
|
script: BI.Providers.getProvider("dec.provider.cipher").getCipher(this.queryCondition.getValue()), |
|
|
|
engineType: this.engineTypeSelect.getValue()[0], |
|
|
|
engineType: this.engineTypeSelect.getValue()[0], |
|
|
|
parameters: this.model.parameters, |
|
|
|
parameters: this.model.parameters, |
|
|
|
}; |
|
|
|
}; |
|
|
|