Skip to content
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

Fixing reserve and unreserve button behaviour #2941

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ export default {
const profileManager = useProfileManager();
const gridStore = useGrid();
const grid = gridStore.client as unknown as GridClient;
const node = ref(props.node);
const stakingDiscount = ref<number>();
const loadingStakingDiscount = ref<boolean>(false);
const lastDeploymentTime = ref<number>(0);
Expand Down Expand Up @@ -316,59 +315,59 @@ export default {
}

const dedicated = computed(() => {
if (isGridNode(node.value)) {
return node.value?.dedicated;
if (isGridNode(props.node)) {
return props.node?.dedicated;
}
return null;
});

const serialNumber = computed(() => {
if (isGridNode(node.value)) {
if (isGridNode(props.node)) {
return null;
}
return node.value?.serialNumber;
return props.node?.serialNumber;
});

const num_gpu = computed(() => {
if (isGridNode(node.value)) {
return node.value?.num_gpu;
if (isGridNode(props.node)) {
return props.node?.num_gpu;
}
return node.value?.hasGPU;
return props.node?.hasGPU;
});

const rentable = computed(() => {
if (isGridNode(node.value)) {
return node.value?.rentable;
if (isGridNode(props.node)) {
return props.node?.rentable;
}
return null;
});

const rented = computed(() => {
if (isGridNode(node.value)) {
return node.value?.rented;
if (isGridNode(props.node)) {
return props.node?.rented;
}
return null;
});

const speed = computed(() => {
if (isGridNode(node.value)) {
return node.value?.speed;
if (isGridNode(props.node)) {
return props.node?.speed;
}
return null;
});

const price_usd = computed(() => {
if (isGridNode(node.value)) {
if (isGridNode(props.node)) {
// convert extra fee from mili usd to usd
const extraFee = node.value?.extraFee / 1000;
return node.value?.price_usd + extraFee;
const extraFee = props.node?.extraFee / 1000;
return props.node?.price_usd + extraFee;
}
return null;
});

const dmi = computed(() => {
if (isGridNode(node.value)) {
return node.value?.dmi;
if (isGridNode(props.node)) {
return props.node?.dmi;
}
return null;
});
Expand Down Expand Up @@ -427,11 +426,11 @@ export default {
}

function onReserveChange() {
if (!node.value) {
if (!props.node) {
return;
}

const n = { ...node.value } as NodeInfo | GridNode;
const n = { ...props.node } as NodeInfo | GridNode;
const gotReserved = n.rentedByTwinId === 0;

if (gotReserved) {
Expand All @@ -442,7 +441,6 @@ export default {
n.rented = false;
}
n.rentable = !n.rented;

ctx.emit("update:node", n);
}

Expand Down
Loading