mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-08-17 13:19:26 +00:00
feat: Added new API for the vms
Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com>
This commit is contained in:
parent
77d80051c9
commit
0d9b976dd2
@ -398,11 +398,13 @@ const init = async() => {
|
|||||||
try {
|
try {
|
||||||
const providerUid = props.provider?.metadata?.uid;
|
const providerUid = props.provider?.metadata?.uid;
|
||||||
const providerType = props.provider?.spec?.type || 'vsphere';
|
const providerType = props.provider?.spec?.type || 'vsphere';
|
||||||
const baseUrl = `https://forklift-apir.13.48.147.135.sslip.io/providers/${ providerType }/${ providerUid }`;
|
const baseUrl = store.getters['harvester-common/getHarvesterClusterUrl'](
|
||||||
|
`v1/harvester/providers/${ providerType }/${ providerUid }`
|
||||||
|
);
|
||||||
|
|
||||||
const [networksData, datastoresData] = await Promise.all([
|
const [networksData, datastoresData] = await Promise.all([
|
||||||
fetch(`${ baseUrl }/networks`).then((r) => r.json()).catch(() => []),
|
store.dispatch(`${ inStore }/request`, { url: `${ baseUrl }/networks` }).catch(() => []),
|
||||||
fetch(`${ baseUrl }/datastores?detail=1`).then((r) => r.json()).catch(() => []),
|
store.dispatch(`${ inStore }/request`, { url: `${ baseUrl }/datastores?detail=1` }).catch(() => []),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (props.useAllProviderData) {
|
if (props.useAllProviderData) {
|
||||||
|
|||||||
@ -279,14 +279,17 @@ const fetchVMs = async() => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const inStore = store.getters['currentProduct'].inStore;
|
||||||
const providerUid = props.provider.metadata.uid;
|
const providerUid = props.provider.metadata.uid;
|
||||||
const providerType = props.provider.spec?.type || 'vsphere';
|
const providerType = props.provider.spec?.type || 'vsphere';
|
||||||
const baseUrl = `https://forklift-apir.13.48.147.135.sslip.io/providers/${ providerType }/${ providerUid }`;
|
const baseUrl = store.getters['harvester-common/getHarvesterClusterUrl'](
|
||||||
|
`v1/harvester/providers/${ providerType }/${ providerUid }`
|
||||||
|
);
|
||||||
|
|
||||||
const [vmsResp, networksResp, datastoresResp] = await Promise.all([
|
const [vmsResp, networksResp, datastoresResp] = await Promise.all([
|
||||||
fetch(`${ baseUrl }/vms`).then((r) => r.json()),
|
store.dispatch(`${ inStore }/request`, { url: `${ baseUrl }/vms` }),
|
||||||
fetch(`${ baseUrl }/networks`).then((r) => r.json()).catch(() => []),
|
store.dispatch(`${ inStore }/request`, { url: `${ baseUrl }/networks` }).catch(() => []),
|
||||||
fetch(`${ baseUrl }/datastores`).then((r) => r.json()).catch(() => []),
|
store.dispatch(`${ inStore }/request`, { url: `${ baseUrl }/datastores` }).catch(() => []),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (Array.isArray(vmsResp)) {
|
if (Array.isArray(vmsResp)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user