Skip to content

Commit

Permalink
ADD: vc only preset to one click
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxTheGeeek committed Sep 18, 2024
1 parent 9b6752d commit 2afbf33
Show file tree
Hide file tree
Showing 12 changed files with 422 additions and 215 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
212 changes: 39 additions & 173 deletions launcher/public/output.css

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions launcher/src/components/UI/one-click/OneclickScreen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import ConfigPlugins from "./sections/ConfigPlugins.vue";
import MevboostRelays from "./sections/MevboostRelays.vue";
import SelectSync from "./sections/SelectSync.vue";
import VerifyCheck from "./sections/VerifyCheck.vue";
import OnlySource from "./sections/OnlySource.vue";
import AnimationSection from "./sections/AnimationSection.vue";
import { computed } from "vue";
import { useRouter } from "vue-router";
Expand All @@ -25,6 +26,11 @@ const components = [
path: "/oneClick/config",
component: ConfigPlugins,
},
{
path: "/oneClick/source",
component: OnlySource,
},
{
path: "/oneClick/mevboost",
component: MevboostRelays,
Expand Down
139 changes: 105 additions & 34 deletions launcher/src/components/UI/one-click/components/plugin/ConfigBody.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,41 @@
import { ref, computed, onMounted, watch } from 'vue';
<template>
<div class="w-full h-full col-start-1 col-span-full row-start-3 row-end-11 grid grid-cols-12 grid-rows-7 p-2 mx-auto">
<div
class="w-full h-full col-start-1 col-span-full row-start-3 row-end-11 grid grid-cols-12 grid-rows-7 p-2 mx-auto"
>
<div
class="w-full h-full col-start-3 col-end-11 row-start-1 row-span-full bg-[#1E2429] rounded-md grid grid-cols-12 grid-rows-7 p-4 gap-1"
>
<div class="col-start-1 col-span-full row-start-1 row-span-1 grid grid-cols-2 gap-1">
<div
class="col-start-1 col-span-full row-start-1 row-span-1 grid grid-cols-2 gap-1"
>
<div class="w-full h-10 col-start-1 col-span-1 flex justify-center items-center">
<div class="w-full h-8 border border-gray-600 rounded-md p-1 flex justify-center items-center">
<span class="text-center text-gray-400 text-md font-normal">{{ $t("oneClick.installedService") }}</span>
<div
class="w-full h-8 border border-gray-600 rounded-md p-1 flex justify-center items-center"
>
<span class="text-center text-gray-400 text-md font-normal">{{
$t("oneClick.installedService")
}}</span>
</div>
</div>
<div class="w-full h-10 col-start-2 col-span-1 flex justify-center items-center relative">
<div class="w-full h-8 border border-gray-600 rounded-md p-1 flex flex-col justify-between items-center">
<span class="text-center text-gray-400 text-md font-normal">{{ $t("oneClick.addOption") }}</span>
<div
class="w-full h-10 col-start-2 col-span-1 flex justify-center items-center relative"
>
<div
class="w-full h-8 border border-gray-600 rounded-md p-1 flex flex-col justify-between items-center"
>
<span class="text-center text-gray-400 text-md font-normal">{{
$t("oneClick.addOption")
}}</span>
</div>
</div>
</div>

<PluginRows :filtered-plugin="filteredPluginsOnCategory" @change-handler="pluginChangeHandler" @plugin-exchange="pluginExChange" />
<PluginRows
:filtered-plugin="filteredPluginsOnCategory"
@change-handler="pluginChangeHandler"
@plugin-exchange="pluginExChange"
/>

<InstallationPath />
</div>
Expand Down Expand Up @@ -53,12 +71,14 @@ watch(
//Lifecycle Hooks
onMounted(() => {
clickStore.selectedPreset.includedPlugins = clickStore.selectedPreset.includedPlugins.map((item) => {
return {
...item,
openReplaceModal: false,
};
});
clickStore.selectedPreset.includedPlugins = clickStore.selectedPreset.includedPlugins.map(
(item) => {
return {
...item,
openReplaceModal: false,
};
}
);
});
onMounted(() => {
getInstallPath();
Expand All @@ -72,12 +92,23 @@ const filterMonitoringServices = () => {
if (clickStore.installMonitoring) {
clickStore.selectedPreset.includedPlugins = clickStore.selectedPreset.includedPlugins.concat(
serviceStore.allServices.filter((s) =>
["GrafanaService", "PrometheusNodeExporterService", "PrometheusService", "MetricsExporterService"].includes(s.service)
[
"GrafanaService",
"PrometheusNodeExporterService",
"PrometheusService",
"MetricsExporterService",
].includes(s.service)
)
);
} else {
clickStore.selectedPreset.includedPlugins = clickStore.selectedPreset.includedPlugins.filter(
(s) => !["GrafanaService", "PrometheusNodeExporterService", "PrometheusService", "MetricsExporterService"].includes(s.service)
(s) =>
![
"GrafanaService",
"PrometheusNodeExporterService",
"PrometheusService",
"MetricsExporterService",
].includes(s.service)
);
}
};
Expand All @@ -89,34 +120,54 @@ const selectedPluginsValidation = () => {
};
const pluginChangeHandler = (plugin, item, idx) => {
plugin.openReplaceModal = false;
const oldPluginIndex = clickStore.selectedPreset.includedPlugins.findIndex((e) => e.id === plugin?.id);
const oldPluginIndex = clickStore.selectedPreset.includedPlugins.findIndex(
(e) => e.id === plugin?.id
);
if (oldPluginIndex !== -1) {
clickStore.selectedPreset.includedPlugins.splice(oldPluginIndex, 1);
}
clickStore.selectedPreset.includedPlugins.splice(idx, 0, item);
if (["staking", "mev boost", "stereum on arm", "archive", "lidocsm"].includes(clickStore.selectedPreset.name)) {
if (
["staking", "mev boost", "stereum on arm", "archive", "lidocsm", "vc only"].includes(
clickStore.selectedPreset.name
)
) {
if (item.category === "consensus") {
let valIndex = clickStore.selectedPreset.includedPlugins.findIndex((e) => e.category === "validator");
let valIndex = clickStore.selectedPreset.includedPlugins.findIndex(
(e) => e.category === "validator"
);
clickStore.selectedPreset.includedPlugins[valIndex] = serviceStore.allServices.find(
(e) => e.service === item.name + "ValidatorService"
);
} else if (item.category === "validator") {
let conIndex = clickStore.selectedPreset.includedPlugins.findIndex((e) => e.category === "consensus");
clickStore.selectedPreset.includedPlugins[conIndex] = serviceStore.allServices.find((e) => e.service === item.name + "BeaconService");
let conIndex = clickStore.selectedPreset.includedPlugins.findIndex(
(e) => e.category === "consensus"
);
clickStore.selectedPreset.includedPlugins[conIndex] = serviceStore.allServices.find(
(e) => e.service === item.name + "BeaconService"
);
}
}
sortPlugins();
};
const sortPlugins = () => {
if (clickStore.selectedPreset.includedPlugins) {
const ec = clickStore.selectedPreset.includedPlugins.filter((p) => p.category === "execution");
const cc = clickStore.selectedPreset.includedPlugins.filter((p) => p.category === "consensus");
const vc = clickStore.selectedPreset.includedPlugins.filter((p) => p.category === "validator");
const services = clickStore.selectedPreset.includedPlugins.filter((p) => p.category === "service");
const ec = clickStore.selectedPreset.includedPlugins.filter(
(p) => p.category === "execution"
);
const cc = clickStore.selectedPreset.includedPlugins.filter(
(p) => p.category === "consensus"
);
const vc = clickStore.selectedPreset.includedPlugins.filter(
(p) => p.category === "validator"
);
const services = clickStore.selectedPreset.includedPlugins.filter(
(p) => p.category === "service"
);
clickStore.selectedPreset.includedPlugins = new Array().concat(ec, cc, vc, services);
}
};
Expand All @@ -138,9 +189,14 @@ const checkPluginCategory = (element) => {
switch (clickStore.selectedPreset.name) {
case "lidocsm":
case "staking":
filter = (item) => item.category === element.category && !/(SSVNetwork|Web3Signer|Charon)/.test(item.service);
case "vc only":
filter = (item) =>
item.category === element.category &&
!/(SSVNetwork|Web3Signer|Charon)/.test(item.service);
if (manageStore.currentNetwork.network == "gnosis") {
filter = (item) => item.category === element.category && /(Lighthouse|Teku|Nethermind|Erigon|Nimbus|Lodestar)/.test(item.service);
filter = (item) =>
item.category === element.category &&
/(Lighthouse|Teku|Nethermind|Erigon|Nimbus|Lodestar)/.test(item.service);
}
break;
case "ssv.network":
Expand All @@ -160,7 +216,10 @@ const checkPluginCategory = (element) => {
case "lidoobol":
filter = (item) => {
if (element.category === "validator" && element.service !== "CharonService") {
return /Teku|Lodestar|Lighthouse|Nimbus/.test(item.service) && item.category === element.category;
return (
/Teku|Lodestar|Lighthouse|Nimbus/.test(item.service) &&
item.category === element.category
);
} else if (element.category === "validator") {
return item.service === "CharonService";
} else {
Expand All @@ -172,18 +231,28 @@ const checkPluginCategory = (element) => {
//filter = (item) => item.category === element.category
break;
case "mev boost":
filter = (item) => item.category === element.category && !/(SSVNetwork|Reth|Web3Signer|Charon)/.test(item.service);
filter = (item) =>
item.category === element.category &&
!/(SSVNetwork|Reth|Web3Signer|Charon)/.test(item.service);
break;
case "stereum on arm":
filter = (item) => item.category === element.category && !/(Prysm|Reth|SSVNetwork|Web3Signer|Charon)/.test(item.service);
filter = (item) =>
item.category === element.category &&
!/(Prysm|Reth|SSVNetwork|Web3Signer|Charon)/.test(item.service);
if (manageStore.currentNetwork.network == "gnosis") {
filter = (item) => item.category === element.category && /(Lighthouse|Teku|Nethermind)/.test(item.service);
filter = (item) =>
item.category === element.category &&
/(Lighthouse|Teku|Nethermind)/.test(item.service);
}
break;
case "archive":
filter = (item) => item.category === element.category && !/(SSVNetwork|Web3Signer|Charon)/.test(item.service);
filter = (item) =>
item.category === element.category &&
!/(SSVNetwork|Web3Signer|Charon)/.test(item.service);
if (manageStore.currentNetwork.network == "gnosis") {
filter = (item) => item.category === element.category && /(Lighthouse|Teku|Nethermind|Erigon|Nimbus|Lodestar)/.test(item.service);
filter = (item) =>
item.category === element.category &&
/(Lighthouse|Teku|Nethermind|Erigon|Nimbus|Lodestar)/.test(item.service);
}
break;
default:
Expand All @@ -195,7 +264,9 @@ const checkPluginCategory = (element) => {
const getInstallPath = async () => {
let largestVolumePath = await ControlService.getLargestVolumePath();
if (largestVolumePath === "/") largestVolumePath = largestVolumePath + "opt";
const stereumInstallationPath = [largestVolumePath, "/stereum"].join("/").replace(/\/{2,}/, "/");
const stereumInstallationPath = [largestVolumePath, "/stereum"]
.join("/")
.replace(/\/{2,}/, "/");
clickStore.installationPath = stereumInstallationPath;
};
</script>
Expand Down
142 changes: 142 additions & 0 deletions launcher/src/components/UI/one-click/components/vconly/OnlyBody.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
import { onMounted, ref } from 'vue';
<template>
<div
class="w-full h-full col-start-1 col-span-full row-start-3 row-end-11 grid grid-cols-12 grid-rows-7 p-2 mx-auto"
>
<div
class="w-full h-full col-start-3 col-end-11 row-start-1 row-span-full bg-[#1c1d1d] grid grid-cols-12 grid-rows-7 p-4 border border-gray-600 rounded-md"
>
<div class="w-full h-full col-start-1 col-span-full row-start-1 row-span-full">
<div
class="w-full h-full flex flex-col justify-start items-center mx-auto px-4 py-2 space-y-2 mt-6 relative"
>
<div class="w-full flex justify-center items-center">
<div class="w-full grid grid-cols-12 items-center text-md">
<img
class="col-start-1 w-8"
src="/img/icon/edit-node-icons/service-category.png"
alt="Path Icon"
/>
<span class="col-start-2 col-span-3 text-gray-400 text-md text-left"
>EXTERNAL SOURCE</span
>

<div
class="col-start-6 col-span-full w-full relative bg-[#141516] border border-gray-500 rounded-md grid grid-cols-12 items-center"
@click="dropdown"
>
<div
class="col-start-1 col-span-full flex justify-center items-center overflow-hidden"
>
<div
class="w-3/4 px-2 py-1 text-sm text-gray-400 capitalize flex justify-start items-center space-x-4"
>
<img
v-if="selectedSource.icon ? selectedSource.icon : null"
:src="selectedSource.icon"
class="w-5"
/>
<span>{{
selectedSource.name ? selectedSource.name : "Select Source"
}}</span>
</div>

<button
class="w-1/4 h-full p-1 text-gray-500 hover:text-gray-200 flex justify-end items-center"
>
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-4 w-4"
viewBox="0 0 20 20"
fill="currentColor"
>
<path
fill-rule="evenodd"
d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
clip-rule="evenodd"
/>
</svg>
</button>
</div>

<div
v-if="isOpen"
class="absolute top-8 left-0 z-10 mt-2 max-h-[160px] w-64 rounded-md bg-gray-700 shadow-lg overflow-x-hidden overflow-y-auto"
@mouseleave="isOpen = false"
>
<div class="divide-y divide-gray-500">
<div
v-for="source in sources"
:key="source"
class="w-full flex justify-center items-center space-x-4 px-4 py-2 text-sm text-gray-300 hover:text-gray-100 hover:bg-blue-500 uppercase cursor-pointer"
@click="pickSource(source)"
>
<img v-if="source.icon" :src="source.icon" class="w-6" />
<span>{{ source.name }}</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div
v-if="selectedSource.name === 'custom'"
class="w-full flex justify-center items-center"
>
<div class="w-full grid grid-cols-12 items-center text-md">
<img
class="col-start-1 w-8"
src="/img/icon/edit-node-icons/service-external-source.png"
alt="Path Icon"
/>
<span class="col-start-2 col-span-3 text-gray-400 text-left">ADDRESS</span>
<input
v-model="addressLink"
class="col-start-6 col-span-7 min-h-[30px] border border-gray-500 px-2 py-1 text-left text-gray-400 text-xs rounded bg-[#141516] focus:border-teal-500"
type="text"
autofocus
/>
</div>
</div>
</div>
</div>
</div>
</div>
</template>

<script setup>
import { ref, onMounted } from "vue";
const selectedSource = ref("");
const addressLink = ref("");
const isOpen = ref(false);
const properties = ref(null);
const sources = [
{ name: "custom", icon: null },
{ name: "stereumplus 1", icon: "/img/icon/stereumplus-icons/stereumplus-icon.png" },
{ name: "stereumplus 2", icon: "/img/icon/stereumplus-icons/stereumplus-icon.png" },
{ name: "stereumplus 3", icon: "/img/icon/stereumplus-icons/stereumplus-icon.png" },
];
onMounted(() => {
addressLink.value = "";
selectedSource.value = "";
addressLink.value = "";
});
//Methods
const dropdown = () => {
isOpen.value = !isOpen.value;
};
const pickSource = (source) => {
isOpen.value = false;
selectedSource.value = source;
properties.value = {
source: selectedSource.value,
address: addressLink.value,
};
};
</script>
Loading

0 comments on commit 2afbf33

Please sign in to comment.