[test] displaying flavor prices

This commit is contained in:
baha 2024-12-05 23:13:19 +00:00
parent 5b18082654
commit e029e82347
68 changed files with 108 additions and 29 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 224 KiB

After

Width:  |  Height:  |  Size: 224 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -8,5 +8,5 @@
<body>
<div id="app"></div>
<script type="text/javascript" src="/runtime.1733147842.js"></script><script type="text/javascript" src="/main.bundle.1733147842.js"></script></body>
<script type="text/javascript" src="/runtime.1733220009.js"></script><script type="text/javascript" src="/main.bundle.1733220009.js"></script></body>
</html>

View File

@ -1 +1 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[13],{4126:function(e,a,t){"use strict";var u=t(20),o=t(21);u(a,"__esModule",{value:!0}),a.default=void 0;var d=o(t(416)),n=o(t(4127)),l=e=>(0,d.default)(n.default,e);a.default=l},4127:function(e,a,t){"use strict";var u=t(20),o=t(21);u(a,"__esModule",{value:!0}),a.default=void 0;var d=o(t(1263)),n=o(t(579)),l=[{path:"/management",component:d.default,routes:[{path:"*",component:n.default}]}];a.default=l}}]);
(window.webpackJsonp=window.webpackJsonp||[]).push([[13],{4125:function(e,a,t){"use strict";var u=t(20),o=t(21);u(a,"__esModule",{value:!0}),a.default=void 0;var d=o(t(416)),n=o(t(4126)),l=e=>(0,d.default)(n.default,e);a.default=l},4126:function(e,a,t){"use strict";var u=t(20),o=t(21);u(a,"__esModule",{value:!0}),a.default=void 0;var d=o(t(1263)),n=o(t(579)),l=[{path:"/management",component:d.default,routes:[{path:"*",component:n.default}]}];a.default=l}}]);

Binary file not shown.

View File

@ -1 +1 @@
!function(e){function t(t){for(var n,u,i=t[0],c=t[1],l=t[2],p=0,s=[];p<i.length;p++)u=i[p],Object.prototype.hasOwnProperty.call(o,u)&&o[u]&&s.push(o[u][0]),o[u]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(t);s.length;)s.shift()();return a.push.apply(a,l||[]),r()}function r(){for(var e,t=0;t<a.length;t++){for(var r=a[t],n=!0,i=1;i<r.length;i++){var c=r[i];0!==o[c]&&(n=!1)}n&&(a.splice(t--,1),e=u(u.s=r[0]))}return e}var n={},o={16:0},a=[];function u(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,u),r.l=!0,r.exports}u.e=function(e){var t=[],r=o[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=o[e]=[t,n]}));t.push(r[2]=n);var a,i=document.createElement("script");i.charset="utf-8",i.timeout=120,u.nc&&i.setAttribute("nonce",u.nc),i.src=function(e){return u.p+""+({0:"common",1:"vendor",2:"Container",3:"Inctance-HA",4:"auth",5:"base",6:"basic",7:"compute",8:"configuration",9:"container-infra",10:"heat",11:"identity",13:"management",14:"monitor-center",15:"network",17:"share",18:"storage",19:"user-center"}[e]||e)+".bundle.1733147842.js"}(e);var c=new Error;a=function(t){i.onerror=i.onload=null,clearTimeout(l);var r=o[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+a+")",c.name="ChunkLoadError",c.type=n,c.request=a,r[1](c)}o[e]=void 0}};var l=setTimeout((function(){a({type:"timeout",target:i})}),12e4);i.onerror=i.onload=a,document.head.appendChild(i)}return Promise.all(t)},u.m=e,u.c=n,u.d=function(e,t,r){u.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,t){if(1&t&&(e=u(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(u.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)u.d(r,n,function(t){return e[t]}.bind(null,n));return r},u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,"a",t),t},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.p="/",u.oe=function(e){throw e};var i=window.webpackJsonp=window.webpackJsonp||[],c=i.push.bind(i);i.push=t,i=i.slice();for(var l=0;l<i.length;l++)t(i[l]);var f=c;r()}([]);
!function(e){function t(t){for(var n,u,i=t[0],c=t[1],l=t[2],p=0,s=[];p<i.length;p++)u=i[p],Object.prototype.hasOwnProperty.call(o,u)&&o[u]&&s.push(o[u][0]),o[u]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(t);s.length;)s.shift()();return a.push.apply(a,l||[]),r()}function r(){for(var e,t=0;t<a.length;t++){for(var r=a[t],n=!0,i=1;i<r.length;i++){var c=r[i];0!==o[c]&&(n=!1)}n&&(a.splice(t--,1),e=u(u.s=r[0]))}return e}var n={},o={16:0},a=[];function u(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,u),r.l=!0,r.exports}u.e=function(e){var t=[],r=o[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=o[e]=[t,n]}));t.push(r[2]=n);var a,i=document.createElement("script");i.charset="utf-8",i.timeout=120,u.nc&&i.setAttribute("nonce",u.nc),i.src=function(e){return u.p+""+({0:"common",1:"vendor",2:"Container",3:"Inctance-HA",4:"auth",5:"base",6:"basic",7:"compute",8:"configuration",9:"container-infra",10:"heat",11:"identity",13:"management",14:"monitor-center",15:"network",17:"share",18:"storage",19:"user-center"}[e]||e)+".bundle.1733220009.js"}(e);var c=new Error;a=function(t){i.onerror=i.onload=null,clearTimeout(l);var r=o[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+a+")",c.name="ChunkLoadError",c.type=n,c.request=a,r[1](c)}o[e]=void 0}};var l=setTimeout((function(){a({type:"timeout",target:i})}),12e4);i.onerror=i.onload=a,document.head.appendChild(i)}return Promise.all(t)},u.m=e,u.c=n,u.d=function(e,t,r){u.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,t){if(1&t&&(e=u(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(u.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)u.d(r,n,function(t){return e[t]}.bind(null,n));return r},u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,"a",t),t},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.p="/",u.oe=function(e){throw e};var i=window.webpackJsonp=window.webpackJsonp||[],c=i.push.bind(i);i.push=t,i=i.slice();for(var l=0;l<i.length;l++)t(i[l]);var f=c;r()}([]);

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -187,6 +187,21 @@ export const getBaseColumns = (self) => [
return value;
},
},
{
title: 'Price EUR/second ',
dataIndex: 'priceEurPerSecond',
isHideable: true,
},
{
title: 'Price EUR/hour ',
dataIndex: 'priceEurPerHour',
isHideable: true,
},
{
title: 'Price EUR/month ',
dataIndex: 'priceEurPerMonth',
isHideable: true,
},
];
export const extraColumns = [

View File

@ -98,11 +98,73 @@ export class FlavorStore extends Base {
};
}
// async listDidFetch(items, _, filters) {
// const { tab } = filters;
// let newItems = tab
// ? items.filter((it) => it.architecture === tab)
// : items;
// console.log('hahahahah')
// console.log(newItems)
// return newItems;
// }
// async listDidFetch(items, _, filters) {
// const { tab } = filters;
// // Fetch data and log it
// try {
// const response = await fetch('https://baha-dev.felcloud.io/all_flavors');
// if (!response.ok) {
// throw new Error(`HTTP error! Status: ${response.status}`);
// }
// const data = await response.json();
// console.log('Fetched Data:', data);
// } catch (error) {
// console.error('Error fetching data:', error);
// }
// // Original logic remains unchanged
// let newItems = tab
// ? items.filter((it) => it.architecture === tab)
// : items;
// console.log('hahahahah');
// console.log(newItems);
// return newItems;
// }
async listDidFetch(items, _, filters) {
const { tab } = filters;
const newItems = tab
? items.filter((it) => it.architecture === tab)
: items;
let fetchedData = [];
try {
const response = await fetch('https://baha-dev.felcloud.io/all_flavors');
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
const data = await response.json();
console.log('Fetched Data:', data);
fetchedData = data.flatMap((entry) => entry.compute);
} catch (error) {
console.error('Error fetching data:', error);
return items;
}
let newItems = tab ? items.filter((it) => it.architecture === tab) : items;
newItems = newItems.map((item) => {
const match = fetchedData.find((flavor) => flavor.flavor === item.name);
if (match) {
const eurPrice = match.price.find((p) => p.name === 'EUR')?.value || 0;
const priceEurPerHour = parseFloat(eurPrice).toFixed(3);
const priceEurPerSecond = (priceEurPerHour / 3600).toFixed(5);
const priceEurPerMonth = (priceEurPerHour * 24 * 30).toFixed(3);
return {
...item,
priceEurPerHour,
priceEurPerSecond,
priceEurPerMonth,
};
}
return item;
});
return newItems;
}

View File

@ -51,6 +51,8 @@ export class InstancesStore extends Base {
const flavor = await globalFlavorStore.fetchDetail({
id: _get(item, 'flavor.id'),
});
console.log('hellooooo');
console.log(flavor);
return {
...item,
flavor: { ...item.flavor, ...flavor },