mirror of
https://github.com/didi/KnowStreaming.git
synced 2026-01-02 02:02:13 +08:00
init
This commit is contained in:
25
console/src/store/controller.ts
Normal file
25
console/src/store/controller.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { observable, action } from 'mobx';
|
||||
import { getController } from 'lib/api';
|
||||
|
||||
export interface IController {
|
||||
brokerId: number;
|
||||
controllerTimestamp: number;
|
||||
controllerVersion: number;
|
||||
host: string;
|
||||
}
|
||||
|
||||
class Controller {
|
||||
@observable
|
||||
public data: IController[] = [];
|
||||
|
||||
@action.bound
|
||||
public setData(data: IController[]) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public getController(clusterId: number) {
|
||||
getController(clusterId).then(this.setData);
|
||||
}
|
||||
}
|
||||
|
||||
export const controller = new Controller();
|
||||
Reference in New Issue
Block a user