Skip to content

Commit

Permalink
fix(ui): handle dates in KV Store
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-mulier-p committed Aug 5, 2024
1 parent 3fb54f0 commit d058c56
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions ui/src/components/namespace/NamespaceKV.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
return this.kv.key ? this.$t("kv.update", {key: this.kv.key}) : this.$t("kv.add");
},
canUpdateKv() {
return this.$route.params.id
return this.$route.params.id
},
canDeleteKv() {
return this.$route.params.id
Expand Down Expand Up @@ -255,17 +255,14 @@
}
let value = this.kv.value;
const type = this.kv.type;
if (["DATE", "DATETIME"].includes(type)) {
if (this.kv.type === "BOOLEAN" && !this.kv.value) {
value = "false"
} else if (this.kv.type === "STRING" && !this.kv.value.startsWith("\"")) {
value = `"${value}"`
} else if (this.kv.type === "DATETIME") {
value = this.$moment(this.kv.value).toISOString()
if (this.kv.type === "DATE") {
value = value.split("T")[0]
}
}
if (["STRING", "DURATION"].includes(type)) {
value = JSON.stringify(value);
} else if (this.kv.type === "DATE") {
value = this.$moment(this.kv.value).toISOString(true).split("T")[0]
}
return this.$store
Expand Down

0 comments on commit d058c56

Please sign in to comment.