diff --git a/src/common/selectors.js b/src/common/selectors.js index eca7db18b..6666d1f6a 100644 --- a/src/common/selectors.js +++ b/src/common/selectors.js @@ -235,6 +235,19 @@ export const tasks = createSort( createFilter(_objects, object => object.type === 'task') ) +export const tags = create( + _objects, + objects => { + const tags = {} + forEach(objects, object => { + forEach(object.tags, tag => { + tags[tag] = true + }) + }) + return Object.keys(tags) + } +) + const _createObjectContainers = (set, container = '$container') => _createCollectionWrapper( create( diff --git a/src/xo-app/home/index.js b/src/xo-app/home/index.js index d633f66ca..0c3b45533 100644 --- a/src/xo-app/home/index.js +++ b/src/xo-app/home/index.js @@ -14,7 +14,10 @@ import { Text } from 'editable' import { create as createSelector, createFilter, - vms, vmContainers + pools, + hosts, + vms, vmContainers, + tags } from 'selectors' import { @@ -85,8 +88,11 @@ class VmItem extends Component { } } @connectStore({ + pools, + hosts, vmContainers, - vms + vms, + tags }) export default class Home extends Component { @@ -115,7 +121,7 @@ export default class Home extends Component { } render () { - const { vms, vmContainers } = this.props + const { vms, vmContainers, pools, hosts, tags } = this.props return