-
Notifications
You must be signed in to change notification settings - Fork 8
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
base: development
Are you sure you want to change the base?
Changes from all commits
3f7cce2
fa4f269
760518e
6204356
41d3b58
f611dfe
2d45b5f
14684ef
e5d8373
8aa1d50
6080d4b
33a4aff
4364f4f
5e9df5d
7088c08
0b0a8fc
286647e
599346c
6148f14
29dace4
1b40ce9
236c0f2
2673096
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
<template> | ||
<div class="flex flex-col gap-4"> | ||
<input-tooltip | ||
v-if="showGPU" | ||
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 | ||
color="primary" | ||
inset | ||
label="GPU" | ||
:model-value="hasGPUModel" | ||
hide-details | ||
@update:model-value="onUpdateHasGPU" | ||
/> | ||
</input-tooltip> | ||
|
||
<v-switch | ||
color="primary" | ||
inset | ||
label="Rented By Me" | ||
:model-value="rentedByMeModel" | ||
hide-details | ||
@update:model-value="onUpdateRentedByMe" | ||
/> | ||
|
||
<input-tooltip | ||
inline | ||
tooltip="Click to know more about dedicated machines." | ||
:href="manual?.dedicated_machines" | ||
> | ||
<v-switch | ||
color="primary" | ||
inset | ||
label="Rentable" | ||
:model-value="dedicatedModel" | ||
hide-details | ||
@update:model-value="onUpdateDedicated" | ||
/> | ||
</input-tooltip> | ||
|
||
<input-tooltip | ||
inline | ||
tooltip="Renting capacity on certified nodes is charged 25% extra." | ||
> | ||
<v-switch | ||
color="primary" | ||
inset | ||
label="Certified" | ||
:model-value="certifiedModel" | ||
hide-details | ||
@update:model-value="onUpdateCertified" | ||
/> | ||
</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), | ||
}); | ||
0oM4R marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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); | ||
|
||
function onUpdateRentedByMe(val: boolean | null) { | ||
rentedByMeModel.value = !!val; | ||
} | ||
|
||
function onUpdateDedicated(val: boolean | null) { | ||
dedicatedModel.value = !!val; | ||
} | ||
|
||
function onUpdateCertified(val: boolean | null) { | ||
certifiedModel.value = !!val; | ||
} | ||
|
||
function onUpdateHasGPU(val: boolean | null) { | ||
hasGPUModel.value = !!val; | ||
} | ||
Comment on lines
+101
to
+115
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think inline change the values in template would be better, Those founciton are not used anywhere else
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did, but it caused type-check errors, let me try adding types there There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @0oM4R I tried it, but it caused the same error I mentioned, so I returned to the previous solution. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. <v-switch
color="primary"
inset
label="Rented By Me"
:model-value="rentedByMeModel"
hide-details
@update:model-value="(val) => rentedByMeModel = !!val"
/> this works fine with me without any errors There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @samaradel please check this comment |
||
</script> | ||
|
||
<script lang="ts"> | ||
export default { | ||
name: "RentalFilterSwitches", | ||
}; | ||
</script> |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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