import { model, Model } from '@core/core'; import { AppModel } from '../../app.model'; import { ApiFactory } from 'src/modules/crud/apiFactory'; const api = new ApiFactory().create(); @model() export class ConnectionModel extends Model<{ types : { pageIndex: AppModel['TYPE']['pageIndex']; connections: AppModel['TYPE']['connections']; connectionSelected: AppModel['TYPE']['connectionSelected']; connectionSelectedOne: AppModel['TYPE']['connectionSelectedOne']; datebaseTypeSelected: AppModel['TYPE']['datebaseTypeSelected']; }, context: ConnectionModel['context']; }> { static xtype = 'dec.dcm.model.connection'; context = ['pageIndex', 'connectionSelected', 'connectionSelectedOne', 'datebaseTypeSelected']; actions = { setPageIndex:(index: string) => { this.model.pageIndex = index; }, setDatebaseTypeSelected(name: string) { this.model.datebaseTypeSelected = name; }, setConnectionSelected(name: string) { this.model.connectionSelected = name; }, getConnectionStatus() { return api.getConnectionStatus(this.model.connectionSelected); }, } }