Skip to content

Commit

Permalink
Revert "AppSidebar: fix tab validation: tabs are optional" (#447)
Browse files Browse the repository at this point in the history
Revert "AppSidebar: fix tab validation: tabs are optional"
  • Loading branch information
skjnldsv authored Jun 26, 2019
2 parents 4fe9383 + ca70f75 commit cf04f7a
Showing 1 changed file with 15 additions and 20 deletions.
35 changes: 15 additions & 20 deletions src/components/AppSidebar/AppSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,27 +166,22 @@ export default {
},
mounted() {
// Init tabs from $children
const tabs = this.$children.filter(comp => comp.$options.name === 'AppSidebarTab')
if (tabs.length === 0 || tabs.length === this.$children.length) {
this.tabs = tabs.reduce((tabs, tab) => {
if (!tab.name || typeof tab.name !== 'string') {
Vue.util.warn(`This tab is missing a valid name: ${tab.name}`, tab)
return tabs
}
if (!IsValidString(tab.id)) {
Vue.util.warn(`This tab is missing a valid id: ${tab.id}`, tab)
return tabs
}
if (!IsValidString(tab.icon)) {
Vue.util.warn(`This tab is missing a valid icon: ${tab.icon}`, tab)
return tabs
}
tabs.push(tab)
this.tabs = this.$children.reduce((tabs, tab) => {
if (!tab.name || typeof tab.name !== 'string') {
Vue.util.warn(`This tab is missing a valid name: ${tab.name}`, tab)
return tabs
}, [])
} else {
Vue.util.warn('You must use either AppSideTab\'s or custom elements.')
}
}
if (!IsValidString(tab.id)) {
Vue.util.warn(`This tab is missing a valid id: ${tab.id}`, tab)
return tabs
}
if (!IsValidString(tab.icon)) {
Vue.util.warn(`This tab is missing a valid icon: ${tab.icon}`, tab)
return tabs
}
tabs.push(tab)
return tabs
}, [])

// init active tab if exists
if (this.tabs.length > 0) {
Expand Down

0 comments on commit cf04f7a

Please sign in to comment.