Слияние кода завершено, страница обновится автоматически
import { observable, action } from 'mobx';
import { getConsumeInfo, resetOffset, getConsumeGroup } from 'lib/api';
import { IOffset } from 'types/base-type';
export interface IConsumeInfo {
location: string;
consumerGroup: string;
clusterId?: number;
key?: string;
}
export interface IConsumeDetail {
clientId: string;
clusterId: number;
consumeOffset: number;
consumerGroup: string;
lag: number;
location: string;
partitionId: number;
partitionOffset: number;
topicName: string;
}
export interface IOffsetlist {
offset: number;
partitionId: number;
}
class Consume {
@observable
public data: IConsumeInfo[] = [];
@observable
public consumeGroupDetail: IConsumeDetail[] = [];
@observable
public offsetList: IOffsetlist[] = [{ offset: null, partitionId: null }];
@observable
public consumerTopic: any[] = [];
@action.bound
public setData(data: IConsumeInfo[]) {
this.data = data.map(i => {
i.location = i.location.toLowerCase();
return i;
});
}
@action.bound
public selectChange(index: number, value: number) {
this.offsetList[index].partitionId = value;
}
@action.bound
public inputChange(index: number, event: any) {
this.offsetList[index].offset = event.target.value;
}
@action.bound
public handleList(index?: number) {
index ? this.offsetList.splice(index, 1) : this.offsetList.push({ offset: null, partitionId: null });
this.offsetList = this.offsetList.slice(0);
}
@action.bound
public offsetPartition(params: IOffset, type?: number) {
if (type) return resetOffset(Object.assign(params, { offsetList: this.offsetList }));
return resetOffset(params);
}
@action.bound
public setConsumerTopic(topic: string[]) {
this.consumerTopic = topic.map(i => ({ topicName: i }));
}
public getConsumeInfo(clusterId: number) {
getConsumeInfo(clusterId).then(this.setData);
}
public getConsumerTopic( clusterId: number, consumerGroup: string, location: string ) {
getConsumeGroup(clusterId, consumerGroup, location).then(this.setConsumerTopic);
}
}
export const consume = new Consume();
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Комментарий ( 0 )