-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(lite,core,web): control domain store, refactor context access (#…
- Loading branch information
Showing
10 changed files
with
73 additions
and
33 deletions.
There are no files selected for viewing
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
21 changes: 21 additions & 0 deletions
21
@xen-orchestra/lite/src/stores/xen-api/control-domain.store.ts
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { useVmRawStore } from '@/stores/xen-api/vm-raw.store' | ||
import { createSubscribableStoreContext } from '@core/utils/create-subscribable-store-context.util' | ||
import { defineStore } from 'pinia' | ||
import { computed } from 'vue' | ||
|
||
export const useControlDomainStore = defineStore('xen-api-control-domain', () => { | ||
const deps = { | ||
vmRawStore: useVmRawStore(), | ||
} | ||
|
||
const vmRawContext = deps.vmRawStore.getContext() | ||
|
||
const records = computed(() => vmRawContext.records.value.filter(vm => vm.is_control_domain)) | ||
|
||
const context = { | ||
...vmRawContext, | ||
records, | ||
} | ||
|
||
return createSubscribableStoreContext({ context }, deps) | ||
}) |
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
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { createXapiStoreConfig } from '@/stores/xen-api/create-xapi-store-config' | ||
import { createSubscribableStoreContext } from '@core/utils/create-subscribable-store-context.util' | ||
import { sortByNameLabel } from '@core/utils/sort-by-name-label.util' | ||
import { defineStore } from 'pinia' | ||
|
||
export const useVmRawStore = defineStore('xen-api-vm-raw', () => { | ||
const config = createXapiStoreConfig('vm', { | ||
sortBy: (vm1, vm2) => sortByNameLabel(vm1, vm2), | ||
}) | ||
|
||
return createSubscribableStoreContext(config, {}) | ||
}) |
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
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
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
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
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
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