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

Sync display data on dedicated nodes table with node explorer #503

Merged
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions packages/dashboard/src/explorer/views/Nodes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ export default class Nodes extends Vue {
{ text: "Farm ID", value: "farmId", align: "center", customAlign: "text-center" },
{ text: "Total Public IPs", value: "totalPublicIPs", align: "center", customAlign: "text-center" },
{ text: "Free Public IPs", value: "freePublicIPs", align: "center", customAlign: "text-center" },
{ text: "HRU", value: "hru", align: "center", customAlign: "text-center", description: "Total HDD" },
{ text: "SRU", value: "sru", align: "center", customAlign: "text-center", description: "Total SSD" },
{ text: "MRU", value: "mru", align: "center", customAlign: "text-center", description: "Total Memory" },
{ text: "CRU", value: "cru", align: "center", customAlign: "text-center", description: "Total Cores" },
{ text: "MRU", value: "mru", align: "center", customAlign: "text-center", description: "Total Memory" },
{ text: "SRU", value: "sru", align: "center", customAlign: "text-center", description: "Total SSD" },
{ text: "HRU", value: "hru", align: "center", customAlign: "text-center", description: "Total HDD" },
{ text: "Up Time", value: "uptime", align: "center", customAlign: "text-center" },
{ text: "Status", value: "status", align: "center", customAlign: "text-center" },
];
Expand Down
20 changes: 10 additions & 10 deletions packages/dashboard/src/portal/components/NodesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
@item-expanded="getDNodeDetails"
>
<template v-slot:[`item.resources.mru`]="{ item }">
{{ byteToGB(item.resources.mru) }}
{{ convert(item.resources.mru) }}
</template>
<template v-slot:[`item.resources.sru`]="{ item }">
{{ byteToGB(item.resources.sru) }}
{{ convert(item.resources.sru) }}
</template>
<template v-slot:[`item.resources.hru`]="{ item }">
{{ byteToGB(item.resources.hru) }}
{{ convert(item.resources.hru) }}
</template>
<template v-slot:[`item.actions`]="{ item }">
<NodeActionBtn :nodeId="item.nodeId" :status="item.rentStatus" @node-status-changed="onStatusUpdate()" />
Expand Down Expand Up @@ -71,7 +71,7 @@
<strong style="color: #f44336">Failed to retrieve Node details</strong>
</td>
<td :colspan="headers.length" v-else>
<NodeDetails :node="item" :byteToGB="byteToGB" />
<NodeDetails :node="item" :convert="convert" />
</td>
</template>
</v-data-table>
Expand All @@ -81,10 +81,10 @@
<script lang="ts">
import { Component, Prop, Vue, Watch } from "vue-property-decorator";

import toTeraOrGigaOrPeta from "../../explorer/filters/toTeraOrGigaOrPeta";
import NodeActionBtn from "../components/NodeActionBtn.vue";
import NodeDetails from "../components/NodeDetails.vue";
import { getDNodes, getFarmDetails, ITab } from "../lib/nodes";
import { byteToGB } from "../lib/nodes";

@Component({
name: "NodesTable",
Expand All @@ -110,9 +110,9 @@ export default class NodesTable extends Vue {
{ text: "Node ID", value: "nodeId", align: "center" },
{ text: "Location", value: "location.country", align: "center" },
{ text: "CRU", value: "resources.cru", align: "center" },
{ text: "HRU (GB)", value: "resources.hru", align: "center" },
{ text: "MRU (GB)", value: "resources.mru", align: "center" },
{ text: "SRU (GB)", value: "resources.sru", align: "center" },
{ text: "MRU", value: "resources.mru", align: "center" },
{ text: "SRU", value: "resources.sru", align: "center" },
{ text: "HRU", value: "resources.hru", align: "center" },
{ text: "Price (USD)", value: "discount", align: "center" },
{ text: "Actions", value: "actions", align: "center", sortable: false },
];
Expand Down Expand Up @@ -181,8 +181,8 @@ export default class NodesTable extends Vue {
this.loading = false;
}

byteToGB(capacity: number) {
return byteToGB(capacity);
convert(capacity: number) {
return toTeraOrGigaOrPeta(capacity.toString());
}
}
</script>
Expand Down
3 changes: 2 additions & 1 deletion packages/dashboard/src/portal/lib/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,9 @@ export function generateReceipt(doc: jsPDF, node: nodeInterface) {
return doc;
}
export function byteToGB(capacity: number) {
return (capacity / 1024 / 1024 / 1024).toFixed(0);
return (capacity / 1024 / 1024 / 1024).toFixed(2);
}

export async function createRentContract(
api: apiInterface,
address: string,
Expand Down