Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Epoch / Slot View - Multi Client Support #1567

Merged
merged 12 commits into from
Nov 17, 2023
5 changes: 3 additions & 2 deletions launcher/src/backend/Monitoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -3027,9 +3027,10 @@ rm -rf diskoutput
}
}

async getCurrentEpochSlot() {
async getCurrentEpochSlot(currBeaconService) {
try {
const beaconStatus = await this.getBeaconStatus();
let beaconStatus = await this.getBeaconStatus();
beaconStatus.data = beaconStatus.data.filter((obj) => obj.clt === currBeaconService);
let currentEpochSlotStatus = {};
if (beaconStatus.code === 0) {
// retrive current network & define epoch length (ethereum -> 32 | gnosis -> 16)
Expand Down
4 changes: 2 additions & 2 deletions launcher/src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,8 @@ ipcMain.handle("checkRemoteKeys", async (event, args) => {
return await validatorAccountManager.checkRemoteKeys(args.url, args.serviceID);
});

ipcMain.handle("getCurrentEpochSlot", async () => {
return await monitoring.getCurrentEpochSlot();
ipcMain.handle("getCurrentEpochSlot", async (event, args) => {
return await monitoring.getCurrentEpochSlot(args);
});

ipcMain.handle("changePassword", async (event, args) => {
Expand Down
50 changes: 35 additions & 15 deletions launcher/src/components/UI/the-control/AmsterdamComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export default {
footerInfo: this.$t("controlPage.netSel"),
proposed: [],
polling: {},
loadingStrater: false,
};
},
computed: {
Expand All @@ -148,6 +149,8 @@ export default {
currentEpochData: "currentEpochData",
currentResult: "currentResult",
noDataFlag: "noDataFlag",
consensusName: "consensusName",
pageNumber: "pageNumber",
}),
proposedBlock() {
if (this.currentNetwork.id === 4) {
Expand Down Expand Up @@ -175,6 +178,8 @@ export default {
return true;
} else if (this.currentResult.beaconStatus !== 0) {
return false;
} else if (this.loadingStrater) {
return true;
}
return false;
},
Expand All @@ -184,6 +189,14 @@ export default {
},

watch: {
pageNumber() {
clearInterval(this.polling);
this.loadingStrater = true;
setTimeout(() => {
this.refreshHandling(this.consensusName);
this.loadingStrater = false;
}, 3000);
},
currentResult: {
handler(newResult) {
if (newResult && newResult.currentEpochStatus && newResult.currentEpochStatus[0]) {
Expand All @@ -203,24 +216,32 @@ export default {
},
},
mounted() {
if (this.currentNetwork.id === 4) {
this.polling = setInterval(() => {
if (this.currentSlotData !== undefined && this.currentEpochData !== undefined) {
this.currentEpochSlot();
}
}, 5000);
} else {
this.polling = setInterval(() => {
if (this.currentSlotData !== undefined && this.currentEpochData !== undefined) {
this.currentEpochSlot();
}
}, 12000);
}
this.refreshTimer();
},
beforeUnmount() {
clearInterval(this.polling);
},
methods: {
refreshTimer() {
if (this.currentNetwork.id === 4) {
this.polling = setInterval(() => {
if (this.currentSlotData !== undefined && this.currentEpochData !== undefined) {
this.currentEpochSlot(this.consensusName);
}
}, 5000);
} else {
this.polling = setInterval(() => {
if (this.currentSlotData !== undefined && this.currentEpochData !== undefined) {
this.currentEpochSlot(this.consensusName);
}
}, 12000);
}
},
refreshHandling() {
this.currentResult = {};
clearInterval(this.polling);
this.currentEpochSlot(this.consensusName);
},
flagController() {
if (this.flag === false && this.currentResult.beaconStatus !== 0) {
this.noDataFlag = true;
Expand Down Expand Up @@ -259,8 +280,7 @@ export default {
},
async currentEpochSlot() {
try {
let res = await ControlService.getCurrentEpochSlot();

let res = await ControlService.getCurrentEpochSlot(this.consensusName);
if (res && res.currentSlot !== undefined && res.currentEpoch !== undefined) {
this.currentSlotData = res.currentSlot;
this.currentEpochData = res.currentEpoch;
Expand Down
10 changes: 7 additions & 3 deletions launcher/src/components/UI/the-control/SyncStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,13 @@ export default {
data() {
return {
isMultiService: false,
pageNumber: 1,
// pageNumber: 1,
clients: [],
syncItemsShow: false,
syncIcoUnknown: true,
syncIcoSituation: false,
syncIcoError: false,
noDataLayerShow: false,
consensusName: "",
executionName: "",
consensusFirstVal: 0,
consensusSecondVal: 0,
Expand Down Expand Up @@ -166,6 +165,11 @@ export default {
syncstatus: "syncstatus",
consensusClientsData: "consensusClientsData",
executionClientsData: "executionClientsData",
consensusName: "consensusName",
}),
...mapWritableState(useControlStore, {
consensusName: "consensusName",
pageNumber: "pageNumber",
}),
errorIco() {
return this.syncIco[0].icon;
Expand Down Expand Up @@ -315,7 +319,7 @@ export default {
this.syncIcoError = false;
this.syncIcoSituation = false;
this.noDataLayerShow = true;
//this.pageNumber = 1;
this.pageNumber = 1;
//this.clients = [];
//this.isMultiService = false;
}
Expand Down
4 changes: 2 additions & 2 deletions launcher/src/store/ControlService.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@ class ControlService extends EventEmitter {
return await this.promiseIpc.send("importConfig", args);
}

async getCurrentEpochSlot() {
return await this.promiseIpc.send("getCurrentEpochSlot");
async getCurrentEpochSlot(args) {
return await this.promiseIpc.send("getCurrentEpochSlot", args);
}

async changePassword(args) {
Expand Down
2 changes: 2 additions & 0 deletions launcher/src/store/theControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { defineStore } from "pinia";
export const useControlStore = defineStore("theControl", {
state: () => {
return {
pageNumber: 1,
consensusName: "",
request: [],
deleteKey: false,
generateModalShow: false,
Expand Down
Loading