-
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
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,110 @@ | ||
<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" | ||
@update:model-value="onUpdateHasGPU" | ||
hide-details | ||
/> | ||
</input-tooltip> | ||
|
||
<v-switch | ||
color="primary" | ||
inset | ||
label="Rented By Me" | ||
:model-value="rentedByMeModel" | ||
@update:model-value="onUpdateRentedByMe" | ||
hide-details | ||
/> | ||
|
||
<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" | ||
@update:model-value="onUpdateDedicated" | ||
hide-details | ||
/> | ||
</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" | ||
@update:model-value="onUpdateCertified" | ||
hide-details | ||
/> | ||
</input-tooltip> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { computed } from "vue"; | ||
|
||
import { manual } from "@/utils/manual"; | ||
|
||
const props = defineProps({ | ||
rentedByMe: Boolean, | ||
dedicated: Boolean, | ||
certified: Boolean, | ||
hasGPU: Boolean, | ||
showGPU: { type: Boolean, default: false }, | ||
}); | ||
|
||
const emit = defineEmits(["update:rentedByMe", "update:dedicated", "update:certified", "update:hasGPU"]); | ||
|
||
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), | ||
}); | ||
|
||
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
+89
to
+103
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. |
||
</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.
👏 its greate to use writable computed here thank you ya Samar