Skip to content

Commit

Permalink
update entity tab to display a card for no entities and fix typo in r…
Browse files Browse the repository at this point in the history
…oute (#2987)
  • Loading branch information
wssheldon authored Feb 14, 2023
1 parent c742b8d commit 6bc4a12
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 51 deletions.
107 changes: 57 additions & 50 deletions src/dispatch/static/dispatch/src/entity/EntitiesTab.vue
Original file line number Diff line number Diff line change
@@ -1,55 +1,62 @@
<template>
<v-container fluid>
<v-row>
<v-col
v-for="entity in entities"
:key="entity.id"
cols="6"
>
<entity-card :entity="entity" />
</v-col>
</v-row>
</v-container>
</template>
<v-container fluid>
<v-row v-if="entities.length >= 1">
<v-col
v-for="entity in entities"
:key="entity.id"
cols="6"
>
<entity-card :entity="entity" />
</v-col>
</v-row>
<v-row v-else>
<v-col cols="12">
<v-card>
<v-card-title>No entities found</v-card-title>
</v-card>
</v-col>
</v-row>
</v-container>
</template>

<script>
import EntityCard from "@/entity/EntityCard.vue"
<script>
import EntityCard from "@/entity/EntityCard.vue"
export default {
name: "EntitiesTab",
components: {
EntityCard,
export default {
name: "EntitiesTab",
components: {
EntityCard,
},
props: {
selected: {
type: Object,
required: true,
},
props: {
selected: {
type: Object,
required: true,
},
},
data() {
return {
headers: [
{ text: "Entity Type", value: "entity_type" },
{ text: "Entity", value: "entity" },
],
};
},
computed: {
entities() {
if (this.selected.signal_instances.length) {
// Concatenate all the entities associated with each SignalInstance
return this.selected.signal_instances.reduce((acc, curr) => {
const entities = curr.entities.map((entity) => ({
entity_type: entity.entity_type,
value: entity.value,
id: entity.id
}));
return acc.concat(entities);
}, []);
} else {
return [];
}
},
data() {
return {
headers: [
{ text: "Entity Type", value: "entity_type" },
{ text: "Entity", value: "entity" },
],
};
},
computed: {
entities() {
if (this.selected.signal_instances.length) {
// Concatenate all the entities associated with each SignalInstance
return this.selected.signal_instances.reduce((acc, curr) => {
const entities = curr.entities.map((entity) => ({
entity_type: entity.entity_type,
value: entity.value,
id: entity.id
}));
return acc.concat(entities);
}, []);
} else {
return [];
}
},
},
};
</script>
},
};
</script>
2 changes: 1 addition & 1 deletion src/dispatch/static/dispatch/src/router/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ export const protectedRoute = [
component: () => import("@/team/Table.vue"),
},
{
path: "entityTpes",
path: "entityTypes",
name: "EntityTypeTable",
meta: { title: "Entity Types", subMenu: "project", group: "knowledge" },
component: () => import("@/entity_type/Table.vue"),
Expand Down

0 comments on commit 6bc4a12

Please sign in to comment.