diff --git a/frontend/src/components/Entity.vue b/frontend/src/components/Entity.vue index 4eb3fa3..b471120 100644 --- a/frontend/src/components/Entity.vue +++ b/frontend/src/components/Entity.vue @@ -26,6 +26,7 @@ import EntityForm from "@/components/inputs/EntityForm"; import Changes from "@/components/change_review/Changes"; import Tabbing from "@/components/layout/Tabbing"; import PermissionList from "@/components/auth/PermissionList"; +import EntityBulkAdd from "@/components/EntityBulkAdd"; export default { name: "Entity", @@ -42,6 +43,12 @@ export default { icon: "mode_edit", tooltip: "Edit/show entity details" }, + { + name: "Bulk Add (copy Attributes)", + component: markRaw(EntityBulkAdd), + icon: "add_circle", + tooltip: "Copy over entity attributes to new entities" + }, { name: "Permissions", component: markRaw(PermissionList), @@ -63,6 +70,7 @@ export default { }, bindArgs() { return [ + { schema: this.activeSchema, entity: this.entity }, { schema: this.activeSchema, entity: this.entity }, { objectType: "Entity", objectId: this.entity?.id }, { schema: this.activeSchema, entitySlug: this.$route.params.entitySlug }, @@ -70,7 +78,7 @@ export default { }, }, methods: { - async updateEntity() { + async getEntity() { if (this.$route.params.entitySlug && this.$route.params.schemaSlug) { const params = { schemaSlug: this.$route.params.schemaSlug, @@ -81,12 +89,14 @@ export default { this.entity = null; } }, - async onUpdate() { - await this.updateEntity(); + async onUpdate(entity) { + if (entity) { + this.entity = entity; + } } }, async activated() { - await this.updateEntity(); + await this.getEntity(); }, watch: { entity(newValue) { @@ -95,7 +105,7 @@ export default { } }, $route: { - handler: "updateEntity", + handler: "getEntity", immediate: true }, } diff --git a/frontend/src/components/EntityBulkAdd.vue b/frontend/src/components/EntityBulkAdd.vue new file mode 100644 index 0000000..ef9d529 --- /dev/null +++ b/frontend/src/components/EntityBulkAdd.vue @@ -0,0 +1,122 @@ + + + \ No newline at end of file diff --git a/frontend/src/components/inputs/EntityForm.vue b/frontend/src/components/inputs/EntityForm.vue index 6840833..cdd1b0c 100644 --- a/frontend/src/components/inputs/EntityForm.vue +++ b/frontend/src/components/inputs/EntityForm.vue @@ -5,7 +5,26 @@ :required="true"/> -

Attributes

+
+

Attributes

+
+ Values to copy: +
+
+ +
+
+
+