From 2224ece3f780cb7968d974a00cdb6ec097711fbb Mon Sep 17 00:00:00 2001 From: Mateusz Gapski Date: Wed, 2 Sep 2020 17:00:06 +0200 Subject: Add loading image from external server Signed-off-by: Mateusz Gapski Change-Id: Ie9793b25fdee0f438d64aafe0978d75025800cb8 --- src/store/modules/Control/VirtualMediaStore.js | 33 ++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'src/store') diff --git a/src/store/modules/Control/VirtualMediaStore.js b/src/store/modules/Control/VirtualMediaStore.js index e01cfce1..13ef8ee6 100644 --- a/src/store/modules/Control/VirtualMediaStore.js +++ b/src/store/modules/Control/VirtualMediaStore.js @@ -44,10 +44,12 @@ const VirtualMediaStore = { .then(devices => api.all(devices.map(device => api.get(device)))) .then(devices => { const deviceData = devices.map(device => { + const isActive = device.data?.Inserted === true ? true : false; return { id: device.data?.Id, transferProtocolType: device.data?.TransferProtocolType, - websocket: device.data?.Oem?.OpenBMC?.WebSocketEndpoint + websocket: device.data?.Oem?.OpenBMC?.WebSocketEndpoint, + isActive: isActive }; }); const proxyDevices = deviceData @@ -55,8 +57,7 @@ const VirtualMediaStore = { .map(device => { return { ...device, - file: null, - isActive: false + file: null }; }); const legacyDevices = deviceData @@ -64,7 +65,10 @@ const VirtualMediaStore = { .map(device => { return { ...device, - address: '' + serverUri: '', + username: '', + password: '', + isRW: false }; }); commit('setProxyDevicesData', proxyDevices); @@ -73,6 +77,27 @@ const VirtualMediaStore = { .catch(error => { console.log('Virtual Media:', error); }); + }, + async mountImage(_, { id, data }) { + return await api + .post( + `/redfish/v1/Managers/bmc/VirtualMedia/${id}/Actions/VirtualMedia.InsertMedia`, + data + ) + .catch(error => { + console.log('Mount image:', error); + throw new Error(); + }); + }, + async unmountImage(_, id) { + return await api + .post( + `/redfish/v1/Managers/bmc/VirtualMedia/${id}/Actions/VirtualMedia.EjectMedia` + ) + .catch(error => { + console.log('Unmount image:', error); + throw new Error(); + }); } } }; -- cgit v1.2.3