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

FIX: couple issues on Staking Page #1943

Merged
merged 3 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export default {
let test = [];
const selectedSetup = this.selectedSetup;
if (selectedSetup && selectedSetup.services) {
const selectedServiceIds = selectedSetup.services.map((service) => service.id);
const selectedServiceIds = selectedSetup.services.map((service) => service.config.serviceID);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it correct? we do NOT have service.config.serviceID in the selectedSetup.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes we do, because i changed it. the services in selectedSetup is now the same data as in InstalledServices.

before we had to manage 2 different service states which not only broke stuff, but also made everything very hard.

this.installedServices.forEach((service) => {
if ("validator".includes(service.category) && selectedServiceIds.includes(service.config.serviceID)) {
test.push({
Expand Down
24 changes: 18 additions & 6 deletions launcher/src/components/UI/edit-page/EditScreen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,24 @@ const switchClientConfirm = (properties) => {
const currentClientIndex = manageStore.newConfiguration.indexOf(current);

manageStore.newConfiguration.splice(currentClientIndex, 1);
properties.itemToInstall = {
...properties.itemToInstall,
isNewClient: true,
};

manageStore.newConfiguration.push(properties.itemToInstall);
let item = useDeepClone(properties.itemToInstall);
if (
item?.category === "service" &&
manageStore.newConfiguration.map((s) => s.service).includes(item.service) &&
setupStore.selectedSetup?.setupId === properties.itemToInstall?.setupId
) {
return;
} else {
item.id = manageStore.newConfiguration.length;
const newItem = {
...item,
isNewClient: true,
setupId: setupStore.selectedSetup?.setupId,
};
manageStore.newConfiguration.push(newItem);
}

manageStore.confirmChanges.push({
id: properties.itemToReplace.config?.serviceID,
content: "SWITCH CLIENT",
Expand Down Expand Up @@ -893,7 +905,7 @@ const deleteSetup = async (item) => {
});
const subtasks =
item?.services.flatMap((service) => {
const matchedServices = manageStore.newConfiguration.filter((e) => e.config?.serviceID === service.id);
const matchedServices = manageStore.newConfiguration.filter((e) => e.config?.serviceID === service.config?.serviceID);

return matchedServices.map((e) => ({
id: e.config?.serviceID,
Expand Down
105 changes: 0 additions & 105 deletions launcher/src/components/UI/edit-page/components/edit/EditBody.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,111 +80,6 @@ watch(

// methods

// const oneWayConnection = (start, end, startSocket, endSocket) => {
// if (start && end) {
// let newLine = new LeaderLine(start, end, { dash: { animation: true } }, { hide: true });
// newLine.position();
// newLine.setOptions({
// size: 2,
// color: "#DBEF6A",
// endPlug: "behind",
// startSocket: startSocket || "right",
// endSocket: endSocket || "left",
// });
// manageStore.lines.push(newLine);
// }
// };

// const lineDrawHandler = (item) => {
// let start;
// let end;
// if (item && !item.displayPluginMenu) {
// switch (item.category) {
// case "execution": {
// const dependencies = manageStore.newConfiguration.filter(
// (s) =>
// s.config?.dependencies?.executionClients?.length > 0 &&
// s.config?.dependencies?.executionClients.some((d) => d.id === item.config?.serviceID)
// );
// dependencies.forEach((d) => {
// if (d.category === "consensus") {
// start = d?.ref;
// end = item?.ref;
// if (start && end) {
// oneWayConnection(end, start);
// }
// }
// });
// break;
// }
// case "consensus": {
// const dependencies = manageStore.newConfiguration.filter(
// (s) =>
// (s.config?.dependencies?.consensusClients?.length > 0 &&
// s.config?.dependencies?.consensusClients.some((d) => d.id === item.config?.serviceID)) ||
// item.config?.dependencies?.executionClients.some((d) => d.id === s.config?.serviceID)
// );
// dependencies.forEach((d) => {
// if (d.category === "validator") {
// start = d?.ref;
// end = item?.ref;
// if (start && end) {
// oneWayConnection(end, start);
// }
// }
// if (d.category === "execution") {
// start = d?.ref;
// end = item?.ref;
// if (start && end) {
// oneWayConnection(start, end);
// }
// }
// });
// break;
// }
// case "validator": {
// const dependencies = manageStore.newConfiguration.filter(
// (s) =>
// item.config?.dependencies?.executionClients.some((d) => d.id === s.config?.serviceID) ||
// item.config?.dependencies?.consensusClients.some((d) => d.id === s.config?.serviceID) ||
// s.config?.dependencies?.consensusClients.some((d) => d.id === item.config?.serviceID)
// );
// dependencies.forEach((d) => {
// if (d.category === "validator") {
// start = d.ref;
// end = item.ref;
// if (start && end) {
// if (item.service === "CharonService") {
// oneWayConnection(end, start, "left", "left");
// } else {
// oneWayConnection(start, end, "left", "left");
// }
// }
// }
// if (d.category === "execution") {
// start = d.ref;
// end = item.ref;
// if (start && end) {
// oneWayConnection(start, end);
// }
// }
// if (d.category === "consensus") {
// start = d.ref;
// end = item.ref;
// if (start && end) {
// oneWayConnection(start, end);
// }
// }
// });
// break;
// }
// }
// } else if (item?.displayPluginMenu) {
// removeConnectionLines();
// }
// isLineDrawHandlerReady.value = true;
// };

const removeConnectionLines = () => {
// Remove all existing connections
manageStore.lines.forEach((line) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ const getFilteredValidators = computed(() => {
// If selectedSetup is null, return all keys
return stakingStore.filteredKeys;
} else {
const serviceIds = setupStore.selectedSetup.services.map((service) => service.id);
const serviceIds = setupStore.selectedSetup.services.map((service) => service.config.serviceID);
// Filter keys by checking if validatorID exists in serviceIds
return stakingStore.filteredKeys.filter((key) =>
serviceIds.includes(key.validatorID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,13 @@ const hoveredIndex = ref(null);

//Computed
const installedValidators = computed(() => {
let services;

if (setupStore.selectedSetup) {
services = serviceStore.installedServices
.filter(
(client) =>
setupStore.selectedSetup?.services.some(
(installedValidator) =>
installedValidator.id === client.config?.serviceID &&
client.category === "validator"
) && !/SSVNetwork|Charon/.test(client.service)
)
.map((service) => ({
...service,
selected: false,
}));
} else {
let services = [];
if(setupStore.selectedSetup === null){
services = serviceStore.installedServices.filter((s) => s.category === "validator" && !/SSVNetwork|Charon/.test(s.service))
}else{
services = serviceStore.installedServices
.filter((s) => s.category === "validator" && !/SSVNetwork|Charon/.test(s.service))
.map((service) => ({ ...service, selected: false }));
.filter((s) => s.category === "validator" && !/SSVNetwork|Charon/.test(s.service) && setupStore.selectedSetup?.services?.map(s => s.config.serviceID).includes(s.config.serviceID))
.map((service) => ({ ...service, selected: false }));
}
return services.sort((a, b) => a.name.localeCompare(b.name));
});
Expand All @@ -96,16 +83,7 @@ onMounted(() => {
//Methods

const getCurrentService = () => {
if (setupStore.selectedSetup) {
const matchingService = installedValidators.value.find((validator) =>
setupStore.selectedSetup.services.some(
(service) => service.id === validator.config?.serviceID
)
);
currentService.value = matchingService.config?.serviceID;
} else {
currentService.value = installedValidators.value[0]?.config?.serviceID;
}
};

const getActiveValidator = () => {
Expand Down
2 changes: 1 addition & 1 deletion launcher/src/components/UI/the-control/ControlScreen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ const selecteConfigServices = computed(() => {
let test = [];
const selectedSetup = setupStore.selectedSetup;
if (selectedSetup && selectedSetup.services) {
const selectedServiceIds = selectedSetup.services.map((service) => service.id);
const selectedServiceIds = selectedSetup.services.map((service) => service.config.serviceID);
serviceStore.installedServices.forEach((service) => {
if (
(["execution", "validator", "consensus"].includes(service.category) &&
Expand Down
13 changes: 1 addition & 12 deletions launcher/src/components/base/BaseLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
</div>
</template>
<script setup>
import { computed, onMounted, ref, watchEffect } from "vue";
import { computed, onMounted, ref } from "vue";

import TheFooter from "../layers/TheFooter.vue";
import LogoutModal from "../UI/base-header/components/modals/LogoutModal.vue";
Expand Down Expand Up @@ -121,17 +121,6 @@ const getLoadingAnime = computed(() => {
return "/animation/loading/robot-loader.gif";
});

watchEffect(() => {
if (
router.currentRoute.value.fullPath === "/node" ||
router.currentRoute.value.fullPath === "/edit"
) {
isPageLoading.value = true;
setTimeout(() => {
isPageLoading.value = false;
}, 3000);
}
});

onMounted(() => {
useUpdateCheck();
Expand Down