Skip to content

Commit

Permalink
Meshes view adjustments to make it accept single mesh filtering. menu…
Browse files Browse the repository at this point in the history
… and route adjustments to clean and tighten things up. GlobalOverview adjustments to account for Mesh Wizard being the only present one.
  • Loading branch information
Daryn St. Pierre committed Apr 16, 2020
1 parent 97768ec commit a017869
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 58 deletions.
15 changes: 9 additions & 6 deletions src/components/Sidebar/MenuList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ export default {
...mapState(['selectedMesh'])
},
watch: {
'$route' (to, from) {
// set the menu links accordingly
this.setMeshPath()
$route: {
deep: true,
handler () {
// set the menu links accordingly
this.setMeshPath()
}
}
},
beforeMount () {
Expand All @@ -72,10 +75,10 @@ export default {
} else if (meshFromLocalStorage && meshFromLocalStorage.length > 0) {
// otherwise fall back to what's present in localStorage
this.meshPath = meshFromLocalStorage
} else {
// otherwise fallback to what's in the store (it has a default value)
this.meshPath = this.$store.getters.getSelectedMesh
}
// otherwise fallback to what's in the store (it has a default value)
this.meshPath = this.$store.getters.getSelectedMesh
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions src/components/Sidebar/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ export default {
title: false,
root: true
},
// {
// name: 'Mesh Overview',
// link: '/overview',
// title: false
// },
{
name: 'Meshes',
link: '/meshes',
Expand Down
1 change: 0 additions & 1 deletion src/components/Skeletons/CardSkeleton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<KCard
:title="cardTitle"
:class="{ 'is-centered': centerText }"
border-variant="noBorder"
>
<template slot="body">
<slot
Expand Down
14 changes: 4 additions & 10 deletions src/components/Utils/MeshSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,10 @@ export default {
localStorage.setItem('selectedMesh', val)
// update the route accordingly
if (this.$route.name === 'global-overview') {
this.$router.push({
name: 'mesh-overview',
params: { mesh: val }
})
} else {
this.$router.push({
params: { mesh: val }
})
}
this.$router.push({
name: 'all-meshes',
query: { mesh: val }
})
}
}
}
Expand Down
28 changes: 6 additions & 22 deletions src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ export default (store) => {
},
component: () => import('@/views/NotFound')
},
// for testing the data overview skeleton component
// {
// path: '/test',
// name: 'test-overview',
// meta: {
// title: 'Test Overview'
// },
// component: () => import('@/views/Entities/TestOverview')
// },
{
path: '/',
redirect: { name: 'global-overview' }
Expand Down Expand Up @@ -82,28 +73,31 @@ export default (store) => {
]
},
// App

// meshes
{
path: '/overview',
alias: '/',
name: 'global-overview',
component: () => import('@/views/Overview'),
meta: {
title: 'Global Overview',
breadcrumb: 'Overview'
},
component: () => import('@/views/Overview')
}
},
// all Meshes
{
path: '/meshes',
alias: '/',
name: 'all-meshes',
meta: {
title: 'Meshes',
breadcrumb: 'Meshes',
parent: 'global-overview'
},
params: { mesh: ':mesh' },
component: () => import('@/views/Entities/Meshes')
},

{
path: '/:mesh',
redirect: { name: 'mesh-overview' },
Expand All @@ -116,16 +110,6 @@ export default (store) => {
params: { mesh: ':mesh' },
component: () => import('@/views/Shell'),
children: [
// meshes
{
path: 'overview',
name: 'mesh-overview',
component: () => import('@/views/Entities/EntityOverview'),
meta: {
title: 'Mesh Overview',
excludeAsBreadcrumb: true
}
},
// dataplanes
{
path: 'dataplanes',
Expand Down
36 changes: 28 additions & 8 deletions src/views/Entities/Meshes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export default {
this.$store.dispatch('updateSelectedTab', this.tabs[0].hash)
// set the active table row
this.$store.dispatch('updateSelectedTableRow', ev)
this.$store.dispatch('updateSelectedTableRow', data.name)
// load the data into the tabs
this.getEntity(data)
Expand All @@ -171,14 +171,34 @@ export default {
this.isLoading = true
this.isEmpty = false
const getHealthChecks = () => {
return this.$api.getAllMeshes()
const mesh = this.$route.query.mesh
const endpoint = (mesh === 'all' || !mesh)
? this.$api.getAllMeshes()
: this.$api.getMesh(mesh)
const getMeshes = () => {
return endpoint
.then(response => {
if (response.items.length > 0) {
const items = response.items
const cleanRes = () => {
if (mesh === 'all') {
return response.items
}
const newItems = { items: [] }
newItems.items.push(response)
return newItems.items
}
const items = cleanRes()
if (items.length > 0) {
// sort the table data by name and the mesh it's associated with
this.sortEntities(items)
if (mesh === 'all') {
this.sortEntities(items)
}
// set the first item as the default for initial load
this.firstEntity = items[0].name
Expand Down Expand Up @@ -210,14 +230,14 @@ export default {
})
}
getHealthChecks()
getMeshes()
},
getEntity (entity) {
this.entityIsLoading = true
this.entityIsEmpty = false
if (entity && entity !== null) {
return this.$api.getMesh(entity)
return this.$api.getMesh(entity.name)
.then(response => {
if (response) {
const selected = ['type', 'name']
Expand Down
12 changes: 6 additions & 6 deletions src/views/Overview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
:metrics="overviewMetrics"
/>

<div class="md:flex items-stretch -mx-4">
<div class="md:flex -mx-4">
<CardSkeleton
class="md:flex-1 mx-4"
class="md:flex-2 mx-4"
:card-action-route="{ path: '/wizard/mesh' }"
card-title="Create A Mesh"
card-action-button-text="Start Now"
Expand All @@ -25,7 +25,7 @@
</p>
</template>
</CardSkeleton>
<CardSkeleton
<!-- <CardSkeleton
class="md:flex-1 mx-4"
:card-action-route="{ path: '/default/dataplanes/' }"
card-title="Add A Service / Dataplane"
Expand All @@ -36,8 +36,8 @@
You can add a new service into a Mesh by adding Dataplanes to it.
</p>
</template>
</CardSkeleton>
<CardSkeleton
</CardSkeleton> -->
<!-- <CardSkeleton
class="md:flex-1 mx-4"
:card-action-route="{ path: '/default/dataplanes/' }"
card-title="Some Title"
Expand All @@ -48,7 +48,7 @@
Find Services among your {{ title }} Meshes
</p>
</template>
</CardSkeleton>
</CardSkeleton> -->
</div>

<FrameSkeleton>
Expand Down

0 comments on commit a017869

Please sign in to comment.