-
Notifications
You must be signed in to change notification settings - Fork 526
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update entity tab to display a card for no entities and fix typo in r…
…oute (#2987)
- Loading branch information
Showing
2 changed files
with
58 additions
and
51 deletions.
There are no files selected for viewing
107 changes: 57 additions & 50 deletions
107
src/dispatch/static/dispatch/src/entity/EntitiesTab.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters