redis数据集插件。
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.
 
 
 
 
 
 

40 lines
1.2 KiB

import { model, Model } from '../../../core/core';
import { ParameterModel } from '../parameter.model';
import { inputTypes } from '../parameter.typings';
@model()
export class ParameterInputModel extends Model<{
types: {
selectedId: ParameterModel['TYPE']['selectedId'];
parameters: ParameterModel['TYPE']['parameters'];
},
context: ParameterInputModel['context'];
}> {
static xtype = 'plugin.model.report.json.components.parameter_input';
context = <const>['selectedId', 'parameters'];
actions = {
setSelectedId: (id: string) => {
this.model.selectedId = id;
},
setParameterName: (id: string, name: string) => {
const thisParameter = this.getParameter(id);
if (thisParameter) {
thisParameter.name = name;
}
},
setParameterValue: (id: string, value: string, type: inputTypes) => {
const thisParameter = this.getParameter(id);
if (thisParameter) {
thisParameter.value = value;
thisParameter.type = type;
}
},
}
private getParameter(id: string) {
return this.model.parameters.find(item => item.id === id);
}
}