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.
 
 
 
 
 
 

38 lines
1.2 KiB

import { model, Model } from '@core/core';
import { getConnectionlist, getTableList } from '../crud/crud.request';
@model()
export class TableModelModel extends Model {
static xtype = 'dec.model.dcm.connection.plugin.redis.table_list';
state() {
return {
connections: [] as string[],
tables: [] as string[],
search: '',
selectedConnection: '',
};
}
actions = {
initData: () => {
getConnectionlist().then(re => {
this.model.connections = re.data.filter(item => item.connectionType === 'Redis').map(item => item.connectionName);
});
},
initTableList: () => {
if (this.model.selectedConnection) {
getTableList(this.model.selectedConnection, this.model.search).then(re => {
this.model.tables = re ? re : [];
});
} else {
this.model.tables = [];
}
},
setSearch(value: string) {
this.model.search = value;
},
setSelectedConnection(name: string) {
this.model.selectedConnection = name;
},
}
}