Skip to content

Group all toggles in one component #4161

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

Open
wants to merge 24 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3f7cce2
Group all toggles in one component
samaradel May 21, 2025
fa4f269
- Fix type check
samaradel May 21, 2025
760518e
Set default values for props
samaradel May 21, 2025
6204356
Verify passed value type
samaradel May 21, 2025
41d3b58
Avoid inline assignments
samaradel May 21, 2025
f611dfe
Handle null values
samaradel May 21, 2025
2d45b5f
Removed the onUpdated functions
samaradel May 22, 2025
14684ef
Fix types
samaradel May 22, 2025
e5d8373
Get the old changes back
samaradel May 22, 2025
8aa1d50
Move rental switchs component inside selection details component
samaradel May 28, 2025
6080d4b
Merge branch 'development' into dev_toggles_component
samaradel May 28, 2025
33a4aff
Remove the default true value
samaradel Jun 1, 2025
4364f4f
Merge branch 'development' into dev_toggles_component
samaradel Jun 3, 2025
5e9df5d
Remove static showGPU prop
samaradel Jun 3, 2025
7088c08
Fix conflicts
samaradel Jun 4, 2025
0b0a8fc
Fix eslint config file
samaradel Jun 4, 2025
286647e
Merge branch 'development' into dev_toggles_component
samaradel Jun 12, 2025
599346c
lint fix
samaradel Jun 12, 2025
6148f14
Merge branch 'development' into dev_toggles_component
samaradel Jun 12, 2025
29dace4
Remove unrelated changes
samaradel Jun 18, 2025
1b40ce9
Merge branch 'development' into dev_toggles_component
samaradel Jun 18, 2025
236c0f2
Update eslint.config.js
samaradel Jun 18, 2025
2673096
Revert unwanted changes
samaradel Jun 22, 2025
770abe7
Removed the unnecessary handler functions
samaradel Jul 10, 2025
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
15 changes: 4 additions & 11 deletions packages/playground/src/components/caprover_worker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,12 @@
required
:ipv4="$props.modelValue.ipv4"
/>
<!-- <input-tooltip inline tooltip="" :href="manual"> -->
<v-switch v-model="$props.modelValue.rentedByMe" color="primary" inset label="Rented By Me" hide-details />
<!-- </input-tooltip> -->
<input-tooltip inline tooltip="Click to know more about dedicated machines." :href="manual.dedicated_machines">
<v-switch v-model="$props.modelValue.dedicated" color="primary" inset label="Rentable" hide-details />
</input-tooltip>
<input-tooltip inline tooltip="Renting capacity on certified nodes is charged 25% extra.">
<v-switch v-model="$props.modelValue.certified" color="primary" inset label="Certified" hide-details />
</input-tooltip>

<TfSelectionDetails
v-model="$props.modelValue.selectionDetails"
v-model:rented-by-me="$props.modelValue.rentedByMe"
v-model:dedicated="$props.modelValue.dedicated"
v-model:certified="$props.modelValue.certified"
:selected-machines="selectedMachines"
:nodes-lock="nodesLock"
:filters="{
Expand Down Expand Up @@ -70,7 +64,6 @@ import { computed, type PropType } from "vue";

import { useGrid } from "@/stores";
import type { SelectedMachine } from "@/types/nodeSelector";
import { manual } from "@/utils/manual";

import Networks from "../components/networks.vue";
import type { CaproverWorker } from "../types";
Expand Down Expand Up @@ -142,7 +135,7 @@ export default {
}, [] as SelectedMachine[]);
});

return { rootFilesystemSize, manual, selectedMachines, rentedBy };
return { rootFilesystemSize, selectedMachines, rentedBy };
},
};
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<template>
<div class="flex flex-col gap-4">
<input-tooltip
v-if="showGPU"
Copy link
Contributor

Choose a reason for hiding this comment

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

you can just remove this v-if condition and remove showGPU prop since it will always be true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same, it's just check for only 2 solutions not the rest

Copy link
Contributor

Choose a reason for hiding this comment

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

please refer to replies above

inline
tooltip="
Selecting a Node with GPU.
When selecting a node with GPU resources, please make sure that you have a rented node. To rent a node and gain access to GPU capabilities, you can use our dashboard.
"
>
<v-switch v-model="hasGPUModel" color="primary" inset label="GPU" hide-details />
</input-tooltip>

<v-switch v-model="rentedByMeModel" color="primary" inset label="Rented By Me" hide-details />

<input-tooltip inline tooltip="Click to know more about dedicated machines." :href="manual?.dedicated_machines">
<v-switch v-model="dedicatedModel" color="primary" inset label="Rentable" hide-details />
</input-tooltip>

<input-tooltip inline tooltip="Renting capacity on certified nodes is charged 25% extra.">
<v-switch v-model="certifiedModel" color="primary" inset label="Certified" hide-details />
</input-tooltip>
</div>
</template>

<script setup lang="ts">
import { computed } from "vue";

import { manual } from "@/utils/manual";
import { solutionType } from "@/types";

import { useRoute } from "vue-router";

const props = defineProps({
rentedByMe: Boolean,
dedicated: Boolean,
certified: Boolean,
hasGPU: Boolean,
});
const emit = defineEmits(["update:rentedByMe", "update:dedicated", "update:certified", "update:hasGPU"]);

const route = useRoute();

const rentedByMeModel = computed({
get: () => !!props.rentedByMe,
set: val => emit("update:rentedByMe", val),
});

const dedicatedModel = computed({
get: () => !!props.dedicated,
set: val => emit("update:dedicated", val),
});

const certifiedModel = computed({
get: () => !!props.certified,
set: val => emit("update:certified", val),
});

const hasGPUModel = computed({
get: () => !!props.hasGPU,
set: val => emit("update:hasGPU", val),
});

const showGPU = computed(() => route.meta.title == solutionType.fullvm || route.meta.title == solutionType.openwebui);
</script>

<script lang="ts">
export default {
name: "RentalFilterSwitches",
};
</script>
17 changes: 4 additions & 13 deletions packages/playground/src/components/k8s_worker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,11 @@
:memory="$props.modelValue.memory"
/>

<!-- <input-tooltip inline tooltip="" :href="manual"> -->
<v-switch v-model="$props.modelValue.rentedByMe" color="primary" inset label="Rented By Me" hide-details />
<!-- </input-tooltip> -->
<input-tooltip inline tooltip="Click to know more about dedicated machines." :href="manual.dedicated_machines">
<v-switch v-model="$props.modelValue.dedicated" color="primary" inset label="Rentable" hide-details />
</input-tooltip>

<input-tooltip inline tooltip="Renting capacity on certified nodes is charged 25% extra.">
<v-switch v-model="$props.modelValue.certified" color="primary" inset label="Certified" hide-details />
</input-tooltip>

<TfSelectionDetails
v-model="$props.modelValue.selectionDetails"
v-model:rented-by-me="$props.modelValue.rentedByMe"
v-model:dedicated="$props.modelValue.dedicated"
v-model:certified="$props.modelValue.certified"
:selected-machines="selectedMachines"
:nodes-lock="nodesLock"
:filters-validators="{
Expand Down Expand Up @@ -124,7 +116,6 @@ import { computed, type PropType } from "vue";

import { useGrid } from "@/stores";
import type { SelectedMachine } from "@/types/nodeSelector";
import { manual } from "@/utils/manual";

import Networks from "../components/networks.vue";
import type { K8SWorker } from "../types";
Expand Down Expand Up @@ -193,7 +184,7 @@ export default {
}, [] as SelectedMachine[]);
});

return { calculateRootFileSystem, manual, selectedMachines, rentedBy };
return { calculateRootFileSystem, selectedMachines, rentedBy };
},
};
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,62 @@
<h3 class="bg-primary pa-2 text-h6 rounded">
Node Selection
</h3>
<p class="text-h6 mb-4 mt-2 ml-2">

<TfRentalFilterSwitches
:rented-by-me="rentedByMe"
:dedicated="dedicated"
:certified="certified"
:has-g-p-u="hasGPU"
class="my-2"
@update:rented-by-me="$emit('update:rentedByMe', $event)"
@update:dedicated="$emit('update:dedicated', $event)"
@update:certified="$emit('update:certified', $event)"
@update:has-g-p-u="$emit('update:hasGPU', $event)"
/>

<p class="text-h6 mb-4 ml-2">
Choose a way to select Node
</p>

<v-radio-group v-model="wayToSelect" color="primary" inline>
<v-radio-group
v-model="wayToSelect"
color="primary"
inline
>
<InputTooltip
align-center
tooltip="Automatically select your node by filtering with Region, country, or farm name"
>
<v-radio label="Automated" value="automated" />
<v-radio
label="Automated"
value="automated"
/>
</InputTooltip>
<InputTooltip align-center tooltip="Manually select your node by entering its id">
<v-radio label="Manual" value="manual" class="ml-5" />
<InputTooltip
align-center
tooltip="Manually select your node by entering its id"
>
<v-radio
label="Manual"
value="manual"
class="ml-5"
/>
</InputTooltip>
</v-radio-group>

<div ref="input">
<template v-if="wayToSelect === 'automated'">
<TfSelectLocation v-model="location" title="Choose a Location" :status="NodeStatus.Up" />
<TfSelectFarm v-model="farm" :valid-filters="validFilters" :filters="filters" :location="location" />
<TfSelectLocation
v-model="location"
title="Choose a Location"
:status="NodeStatus.Up"
/>
<TfSelectFarm
v-model="farm"
:valid-filters="validFilters"
:filters="filters"
:location="location"
/>
<TfAutoNodeSelector
v-model="node"
v-model:status="nodeStatus"
Expand Down Expand Up @@ -99,6 +135,7 @@ import type {
SelectionDetailsFiltersValidators,
} from "../../types/nodeSelector";
import { createSelectionDetailsFiltersValidator } from "../../utils/nodeSelector";
import TfRentalFilterSwitches from "../filters/TfRentalFilterSwitches.vue";
import TfAutoNodeSelector from "./TfAutoNodeSelector.vue";
import TfDomainName from "./TfDomainName.vue";
import TfManualNodeSelector from "./TfManualNodeSelector.vue";
Expand All @@ -108,7 +145,15 @@ import TfSelectLocation from "./TfSelectLocation.vue";

export default {
name: "TfSelectionDetails",
components: { TfSelectLocation, TfSelectFarm, TfAutoNodeSelector, TfManualNodeSelector, TfSelectGpu, TfDomainName },
components: {
TfRentalFilterSwitches,
TfSelectLocation,
TfSelectFarm,
TfAutoNodeSelector,
TfManualNodeSelector,
TfSelectGpu,
TfDomainName,
},
props: {
modelValue: Object as PropType<SelectionDetails>,
filters: {
Expand All @@ -132,10 +177,18 @@ export default {
default: () => [],
},
nodesLock: Object as PropType<AwaitLock>,
rentedByMe: Boolean,
dedicated: Boolean,
certified: Boolean,
hasGPU: Boolean,
},
emits: {
"update:model-value": (value: SelectionDetails) => true || value,
"update:status": (value: ValidatorStatus) => true || value,
"update:rentedByMe": (value: boolean) => value,
"update:dedicated": (value: boolean) => value,
"update:certified": (value: boolean) => value,
"update:hasGPU": (value: boolean) => value,
},
setup(props, ctx) {
const input = ref<HTMLElement>();
Expand Down
16 changes: 3 additions & 13 deletions packages/playground/src/weblets/tf_algorand.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,11 @@
</input-tooltip>
</AlgorandCapacity>

<!-- <input-tooltip inline tooltip="" :href="manual"> -->
<v-switch v-model="rentedByMe" color="primary" inset label="Rented By Me" hide-details />
<!-- </input-tooltip> -->
<input-tooltip inline tooltip="Click to know more about dedicated machines." :href="manual.dedicated_machines">
<v-switch v-model="dedicated" color="primary" inset label="Rentable" hide-details />
</input-tooltip>

<input-tooltip inline tooltip="Renting capacity on certified nodes is charged 25% extra.">
<v-switch v-model="certified" color="primary" inset label="Certified" hide-details />
</input-tooltip>

<TfSelectionDetails
v-model="selectionDetails"
v-model:rented-by-me="rentedByMe"
v-model:dedicated="dedicated"
v-model:certified="certified"
:filters-validators="{
cpu: { min: type === 'relay' || type === 'indexer' ? 4 : 2 },
memory: { min: type === 'relay' || type === 'indexer' ? 8192 : 4096 },
Expand Down Expand Up @@ -124,8 +116,6 @@
<script lang="ts" setup>
import { computed, type Ref, ref, watch } from "vue";

import { manual } from "@/utils/manual";

import { useLayout } from "../components/weblet_layout.vue";
import { useGrid } from "../stores";
import { type Flist, ProjectName } from "../types";
Expand Down
16 changes: 3 additions & 13 deletions packages/playground/src/weblets/tf_casperlabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,11 @@
require-domain
/>

<!-- <input-tooltip inline tooltip="" :href="manual"> -->
<v-switch v-model="rentedByMe" color="primary" inset label="Rented By Me" hide-details />
<!-- </input-tooltip> -->
<input-tooltip inline tooltip="Click to know more about dedicated machines." :href="manual.dedicated_machines">
<v-switch v-model="dedicated" color="primary" inset label="Rentable" hide-details />
</input-tooltip>

<input-tooltip inline tooltip="Renting capacity on certified nodes is charged 25% extra.">
<v-switch v-model="certified" color="primary" inset label="Certified" hide-details />
</input-tooltip>

<TfSelectionDetails
v-model="selectionDetails"
v-model:rented-by-me="rentedByMe"
v-model:dedicated="dedicated"
v-model:certified="certified"
:filters="{
ipv4,
ipv6,
Expand Down Expand Up @@ -95,8 +87,6 @@
import { calculateRootFileSystem, FLISTS, type GridClient } from "@threefold/grid_client";
import { computed, type Ref, ref } from "vue";

import { manual } from "@/utils/manual";

import { useLayout } from "../components/weblet_layout.vue";
import { useGrid, useProfileManager } from "../stores";
import type { Flist, solutionFlavor as SolutionFlavor } from "../types";
Expand Down
16 changes: 3 additions & 13 deletions packages/playground/src/weblets/tf_discourse.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,11 @@
:has-smtp="true"
/>

<!-- <input-tooltip inline tooltip="" :href="manual"> -->
<v-switch v-model="rentedByMe" color="primary" inset label="Rented By Me" hide-details />
<!-- </input-tooltip> -->
<input-tooltip inline tooltip="Click to know more about dedicated machines." :href="manual.dedicated_machines">
<v-switch v-model="dedicated" color="primary" inset label="Rentable" hide-details />
</input-tooltip>

<input-tooltip inline tooltip="Renting capacity on certified nodes is charged 25% extra.">
<v-switch v-model="certified" color="primary" inset label="Certified" hide-details />
</input-tooltip>

<TfSelectionDetails
v-model="selectionDetails"
v-model:rented-by-me="rentedByMe"
v-model:dedicated="dedicated"
v-model:certified="certified"
:filters="{
ipv4,
ipv6,
Expand Down Expand Up @@ -126,8 +118,6 @@ import { Buffer } from "buffer";
import TweetNACL from "tweetnacl";
import { computed, type Ref, ref, watch } from "vue";

import { manual } from "@/utils/manual";

import { useLayout } from "../components/weblet_layout.vue";
import { useGrid, useProfileManager } from "../stores";
import type { Flist, solutionFlavor as SolutionFlavor } from "../types";
Expand Down
15 changes: 3 additions & 12 deletions packages/playground/src/weblets/tf_freeflow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,12 @@
:has-custom-domain="selectionDetails?.domain?.enabledCustomDomain"
require-domain
/>
<!-- <input-tooltip inline tooltip="" :href="manual"> -->
<v-switch v-model="rentedByMe" color="primary" inset label="Rented By Me" hide-details />
<!-- </input-tooltip> -->
<input-tooltip inline tooltip="Click to know more about dedicated machines." :href="manual.dedicated_machines">
<v-switch v-model="dedicated" color="primary" inset label="Rentable" hide-details />
</input-tooltip>

<input-tooltip inline tooltip="Renting capacity on certified nodes is charged 25% extra.">
<v-switch v-model="certified" color="primary" inset label="Certified" hide-details />
</input-tooltip>

<TfSelectionDetails
v-model="selectionDetails"
v-model:rented-by-me="rentedByMe"
v-model:dedicated="dedicated"
v-model:certified="certified"
:filters="{
ipv4,
ipv6,
Expand Down Expand Up @@ -101,8 +94,6 @@
import { calculateRootFileSystem, FLISTS, type GridClient } from "@threefold/grid_client";
import { computed, onMounted, type Ref, ref } from "vue";

import { manual } from "@/utils/manual";

import { useLayout } from "../components/weblet_layout.vue";
import { useGrid } from "../stores";
import type { Flist, solutionFlavor as SolutionFlavor } from "../types";
Expand Down
Loading
Loading