Skip to content

Commit

Permalink
Merge pull request #1556 from slntopp/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
SazukinPavel authored Mar 14, 2024
2 parents 4d8f0e4 + 12eab3b commit 70881f4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 3 additions & 5 deletions admin-ui/src/components/instances_table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
</template>

<template v-slot:[`item.dueDate`]="{ item }">
{{ getValue("dueDate", item) || "Unknown" }}
{{ formatSecondsToDate(getValue("dueDate", item)) || "PayG" }}
</template>

<template v-slot:[`item.service`]="{ item, value }">
Expand Down Expand Up @@ -325,10 +325,8 @@ export default {
return inst.data.creation;
},
getExpirationDate(inst) {
if (isInstancePayg(inst) || inst.type === "openai") return "PayG";
return formatSecondsToDate(
inst.data.expiry?.expiredate || inst.data.next_payment_date || 0
);
if (isInstancePayg(inst) || inst.type === "openai") return 0;
return inst.data.expiry?.expiredate || inst.data.next_payment_date || 0;
},
getService({ service }) {
return (
Expand Down
16 changes: 9 additions & 7 deletions admin-ui/src/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,19 +510,21 @@ export function compareSearchValue(data, searchValue, field) {
return true;
}

data = new Date(data).toLocaleString();
if (typeof data === "number") data = new Date(data * 1000);
data = new Date(data).getTime();
const [first, second] = searchValue;
if (first && second) {
const min = (
new Date(first).getDate() > new Date(second)
new Date(first).getTime() > new Date(second).getTime()
? new Date(second)
: new Date(first)
)?.toLocaleString();
)?.getTime();
const max = (
new Date(first).getDate() < new Date(second)
new Date(first).getTime() < new Date(second).getTime()
? new Date(second)
: new Date(first)
)?.toLocaleString();
)?.getTime();

return data && min <= data && max >= data;
} else {
return data && data === new Date(first).toLocaleString();
Expand Down Expand Up @@ -680,6 +682,6 @@ export function getInstancePrice(inst) {
}
}

export function isInstancePayg(inst){
return inst.type === "ione" && inst.billingPlan.kind === "DYNAMIC"
export function isInstancePayg(inst) {
return inst.type === "ione" && inst.billingPlan.kind === "DYNAMIC";
}

0 comments on commit 70881f4

Please sign in to comment.