Skip to content

Commit

Permalink
Feat: Edit observable button (fixes #132) (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchop authored Jan 14, 2024
1 parent 595c3f6 commit 00e5199
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 116 deletions.
9 changes: 6 additions & 3 deletions src/components/EditObject.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<v-card>
<v-card-title>{{ object.name }}</v-card-title>
<v-card-title>{{ object.name || object.value }}</v-card-title>
<v-card-subtitle>Editing {{ typeDefinition.name }}</v-card-subtitle>
<v-card-text>
<object-fields :fields="editableFields" :object="localObject" />
Expand Down Expand Up @@ -29,6 +29,7 @@ import axios from "axios";
import { ENTITY_TYPES } from "@/definitions/entityDefinitions.js";
import { INDICATOR_TYPES } from "@/definitions/indicatorDefinitions.js";
import { OBSERVABLE_TYPES } from "@/definitions/observableDefinitions.js";
import ObjectFields from "@/components/ObjectFields.vue";
import { objectTypeAnnotation } from "@babel/types";
</script>
Expand Down Expand Up @@ -74,7 +75,7 @@ export default {
})
.then(response => {
this.$eventBus.emit("displayMessage", {
message: `${this.object.name} succesfully updated`,
message: `${this.object.name || "Observable"} succesfully updated`,
status: "success"
});
this.$emit("success", response.data);
Expand All @@ -98,7 +99,9 @@ export default {
computed: {
typeDefinition() {
return (
ENTITY_TYPES.find(t => t.type === this.object.type) || INDICATOR_TYPES.find(t => t.type === this.object.type)
ENTITY_TYPES.find(t => t.type === this.object.type) ||
INDICATOR_TYPES.find(t => t.type === this.object.type) ||
OBSERVABLE_TYPES.find(t => t.type === this.object.type)
);
},
editableFields() {
Expand Down
9 changes: 9 additions & 0 deletions src/components/ObjectFields.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
:label="field.label"
variant="outlined"
></v-select>

<v-checkbox
density="compact"
:indeterminate="object[field.field] === null"
v-if="field.type === 'bool'"
:label="field.label"
v-model="object[field.field]"
>
</v-checkbox>
</div>
</div>
</template>
Expand Down
Loading

0 comments on commit 00e5199

Please sign in to comment.