mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-25 04:32:12 +08:00
26 lines
511 B
TypeScript
26 lines
511 B
TypeScript
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();
|