Skip to content

Commit

Permalink
[Fix]: Ensure Proper Functionality of Header Modals with Multiple Ins… (
Browse files Browse the repository at this point in the history
#2007)

* [Fix]: Ensure Proper Functionality of Header Modals with Multiple Instances of the Same Service Installed

fix #1961
fix #1962

* fix: index of header services

* FIX: error handling for slides

* FIX: Ensure MEV Boost Relay list shows correctly with multiSetup

fix #1962
  • Loading branch information
mabasian authored Aug 26, 2024
1 parent 3af4672 commit b85dda2
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 50 deletions.
48 changes: 6 additions & 42 deletions launcher/public/output.css
Original file line number Diff line number Diff line change
Expand Up @@ -987,56 +987,20 @@ video {
top: 1px;
}

.top-\[56px\]{
top: 56px;
}

.top-\[7rem\]{
top: 7rem;
}

.bottom-8{
bottom: 2rem;
}

.top-\[-55\%\]{
top: -55%;
}

.top-\[-5rem\]{
top: -5rem;
}

.top-\[-10\%\]{
top: -10%;
}

.top-\[0\%\]{
top: 0%;
}

.top-\[10\%\]{
top: 10%;
}

.top-\[40\%\]{
top: 40%;
.top-\[33\%\]{
top: 33%;
}

.top-\[42\%\]{
top: 42%;
}

.top-\[35\%\]{
top: 35%;
}

.top-\[32\%\]{
top: 32%;
.top-\[56px\]{
top: 56px;
}

.top-\[33\%\]{
top: 33%;
.top-\[7rem\]{
top: 7rem;
}

.z-0{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,61 @@
<script setup>
import ServiceCarousel from "./ServiceCarousel.vue";
import { useNodeHeader } from "@/store/nodeHeader";
import { useSetups } from "@/store/setups";
import { computed } from "vue";
const headerStore = useNodeHeader();
const setupsStore = useSetups();
const slides = computed(() => {
return JSON.parse(JSON.stringify(headerStore.runningServices));
const services = headerStore.runningServices;
const selectedSetup = setupsStore.selectedSetup;
if (!selectedSetup || !Array.isArray(selectedSetup.services)) {
return services.filter(
(service) =>
service.service !== "FlashbotsMevBoostService" &&
service.service !== "SSVNetworkService" &&
service.service !== "CharonService"
);
}
const mevBoostInSetup = selectedSetup.services.some(
(service) => service.service === "FlashbotsMevBoostService"
);
const ssvInSetup = selectedSetup.services.some(
(service) => service.service === "SSVNetworkService"
);
const obolInSetup = selectedSetup.services.some(
(service) => service.service === "CharonService"
);
let filteredServices = services.filter((service) => {
if (!mevBoostInSetup && service.service === "FlashbotsMevBoostService") return false;
if (!ssvInSetup && service.service === "SSVNetworkService") return false;
if (!obolInSetup && service.service === "CharonService") return false;
return true;
});
const uniqueServices = [
"FlashbotsMevBoostService",
"SSVNetworkService",
"CharonService",
];
uniqueServices.forEach((uniqueService) => {
const serviceIndex = filteredServices.findIndex(
(service) => service.service === uniqueService
);
if (serviceIndex !== -1) {
filteredServices = filteredServices.filter(
(service, index) => service.service !== uniqueService || index === serviceIndex
);
}
});
return filteredServices;
});
</script>
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<template>
<div class="w-10/12 h-full grid grid-cols-2 grid-flow-row p-2 mx-auto trasnform duration-200 mt-6">
<div
class="w-10/12 h-full grid grid-cols-2 grid-flow-row p-2 mx-auto trasnform duration-200 mt-6"
>
<RelaysCheckbox
v-for="relay in availableBlocks"
:key="relay.id"
Expand All @@ -15,6 +17,7 @@
import RelaysCheckbox from "./RelaysCheckbox.vue";
import { useNodeManage } from "@/store/nodeManage";
import { onMounted, computed } from "vue";
import { useSetups } from "@/store/setups";
const manageStore = useNodeManage();
Expand All @@ -29,11 +32,13 @@ const props = defineProps({
},
});
const setupsStore = useSetups();
const availableBlocks = computed({
get: () => manageStore.availableBlocks,
set: () =>
(manageStore.availableBlocks = shuffleRelaysList(
manageStore.relaysList.filter((r) => r[manageStore.currentNetwork.network])
manageStore.relaysList.filter((r) => r[setupsStore.selectedSetup.network])
)),
});
Expand All @@ -43,7 +48,7 @@ onMounted(() => {
relay.isSelected = false;
});
manageStore.availableBlocks = shuffleRelaysList(
manageStore.relaysList.filter((r) => r[manageStore.currentNetwork.network])
manageStore.relaysList.filter((r) => r[setupsStore.selectedSetup.network])
);
});
Expand Down
12 changes: 8 additions & 4 deletions launcher/src/components/UI/services-modal/MevboostModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import { mapState, mapWritableState } from "pinia";
import { useNodeManage } from "@/store/nodeManage";
import { useServices } from "@/store/services";
import { useSetups } from "@/store/setups";
import ControlService from "@/store/ControlService";
import { toRaw } from "vue";
export default {
Expand All @@ -84,7 +85,9 @@ export default {
}),
...mapWritableState(useNodeManage, {
relaysList: "relaysList",
currentNetwork: "currentNetwork",
}),
...mapState(useSetups, {
selectedSetup: "selectedSetup",
}),
combinedBlocs() {
let names = new Set();
Expand All @@ -101,8 +104,9 @@ export default {
mounted() {
this.filtermevService();
this.availableBlocks = this.shuffleRelaysList(
this.relaysList.filter((r) => r[this.currentNetwork.network.toLowerCase()])
this.relaysList.filter((r) => r[this.selectedSetup?.network.toLowerCase()])
);
console.log(this.selectedSetup);
},
methods: {
shuffleRelaysList(array) {
Expand Down Expand Up @@ -136,7 +140,7 @@ export default {
if (service.entrypoint[relayEntryPointIndex + 1]) {
const relayURLs = service.entrypoint[relayEntryPointIndex + 1].split(",");
relayURLs.forEach((relay) => {
let relayData = this.relaysList.find((r) => r[this.currentNetwork.network.toLowerCase()] === relay);
let relayData = this.relaysList.find((r) => r[this.selectedSetup?.network.toLowerCase()] === relay);
if (relayData) this.checkedRelays.push(relayData);
});
}
Expand Down Expand Up @@ -174,7 +178,7 @@ export default {
this.loading = true;
if (this.serviceConfig.entrypoint) {
this.serviceConfig.entrypoint[this.serviceConfig.entrypoint.findIndex((e) => e === "-relays") + 1] =
this.checkedRelays.map((r) => r[this.currentNetwork.network.toLowerCase()]).join();
this.checkedRelays.map((r) => r[this.selectedSetup?.network.toLowerCase()]).join();
ControlService.writeServiceConfig(toRaw(this.serviceConfig)).then(() => {
setTimeout(() => {
this.loading = false;
Expand Down

0 comments on commit b85dda2

Please sign in to comment.