Skip to content
This repository has been archived by the owner on Feb 23, 2022. It is now read-only.

Commit

Permalink
Merge pull request #222 from multinet-app/item-panel-slot
Browse files Browse the repository at this point in the history
Use a slot to simplify item-panel dialog logic
  • Loading branch information
waxlamp committed Dec 31, 2019
2 parents 819d93a + 5b5519a commit 2a34a10
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 30 deletions.
25 changes: 1 addition & 24 deletions client/src/components/ItemPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,7 @@
<span>Delete selected</span>
</v-tooltip>

<table-dialog
v-if="isTable"
:workspace="workspace"
@success="$emit('new-table')"
/>
<graph-dialog
v-else
:node-tables="nodeTables"
:edge-tables="edgeTables"
:workspace="workspace"
@success="$emit('new-graph')"
/>
<slot></slot>

</v-subheader>

Expand Down Expand Up @@ -105,14 +94,6 @@ export default Vue.extend({
type: String,
required: true,
},
nodeTables: {
type: Array,
required: false,
},
edgeTables: {
type: Array,
required: false,
},
routeType: {
type: String,
required: true,
Expand All @@ -128,10 +109,6 @@ export default Vue.extend({
};
},
computed: {
isTable(): boolean {
return this.title === 'Tables';
},
anySelected(): boolean {
return Object.values(this.checkbox)
.some((d) => !!d);
Expand Down
20 changes: 14 additions & 6 deletions client/src/views/WorkspaceDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,12 @@
:workspace="workspace"
route-type="table"
icon="table_chart"
@new-table="update"
/>
>
<table-dialog
:workspace="workspace"
@success="update"
/>
</item-panel>

</v-card>
</v-flex>
Expand All @@ -105,12 +109,16 @@
title="Graphs"
:items="graphs"
:workspace="workspace"
:node-tables="nodeTables"
:edge-tables="edgeTables"
route-type="graph"
icon="timeline"
@new-graph="update"
/>
>
<graph-dialog
:node-tables="nodeTables"
:edge-tables="edgeTables"
:workspace="workspace"
@success="update"
/>
</item-panel>

</v-card>
</v-flex>
Expand Down

0 comments on commit 2a34a10

Please sign in to comment.