[change] the entire data manipulation between skyline iframe and console felcloud
BIN
skyline_console/static/Container.bundle.1741741357.js.gz
Normal file
BIN
skyline_console/static/Inctance-HA.bundle.1741741357.js.gz
Normal file
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 73 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 224 KiB After Width: | Height: | Size: 224 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
BIN
skyline_console/static/auth.bundle.1741741357.js.gz
Normal file
BIN
skyline_console/static/base.bundle.1741741357.js.gz
Normal file
1
skyline_console/static/basic.bundle.1741741357.js
Normal file
BIN
skyline_console/static/basic.bundle.1741741357.js.gz
Normal file
1
skyline_console/static/common.bundle.1741741357.js
Normal file
BIN
skyline_console/static/common.bundle.1741741357.js.gz
Normal file
BIN
skyline_console/static/compute.bundle.1741741357.js.gz
Normal file
BIN
skyline_console/static/configuration.bundle.1741741357.js.gz
Normal file
BIN
skyline_console/static/container-infra.bundle.1741741357.js.gz
Normal file
BIN
skyline_console/static/heat.bundle.1741741357.js.gz
Normal file
BIN
skyline_console/static/identity.bundle.1741741357.js.gz
Normal file
@ -8,5 +8,5 @@
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="text/javascript" src="/runtime.1741618532.js"></script><script type="text/javascript" src="/main.bundle.1741618532.js"></script></body>
|
||||
<script type="text/javascript" src="/runtime.1741741357.js"></script><script type="text/javascript" src="/main.bundle.1741741357.js"></script></body>
|
||||
</html>
|
||||
|
BIN
skyline_console/static/main.bundle.1741741357.js.gz
Normal file
@ -1 +1 @@
|
||||
(window.webpackJsonp=window.webpackJsonp||[]).push([[13],{4131: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(4132)),l=e=>(0,d.default)(n.default,e);a.default=l},4132: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],{4124: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(4125)),l=e=>(0,d.default)(n.default,e);a.default=l},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(1263)),n=o(t(579)),l=[{path:"/management",component:d.default,routes:[{path:"*",component:n.default}]}];a.default=l}}]);
|
BIN
skyline_console/static/monitor-center.bundle.1741741357.js.gz
Normal file
BIN
skyline_console/static/network.bundle.1741741357.js.gz
Normal 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.1741618532.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.1741741357.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()}([]);
|
BIN
skyline_console/static/share.bundle.1741741357.js.gz
Normal file
BIN
skyline_console/static/storage.bundle.1741741357.js.gz
Normal file
BIN
skyline_console/static/vendor.bundle.1741741357.js.gz
Normal file
@ -60,7 +60,7 @@ export class AuthLayout extends Component {
|
||||
<div className={styles.lang}>
|
||||
<SelectLang />
|
||||
</div>
|
||||
<div style={{ padding: '2px' }}>tag : 89edd83823 </div>
|
||||
<div style={{ padding: '2px' }}>tag : 7d2c716040 </div>
|
||||
<div className={styles.main}>
|
||||
<div className={styles.top}>
|
||||
<div className={styles.header} style={{ width: 'fit-content' }}>
|
||||
|
@ -47,10 +47,41 @@ export class BaseLayout extends Component {
|
||||
this.init();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.autoReaction();
|
||||
componentDidMount() {
|
||||
window.addEventListener('message', this.handleMessage);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
// Remove the event listener when the component is unmounted
|
||||
window.removeEventListener('message', this.handleMessage);
|
||||
}
|
||||
|
||||
handleMessage = (event) => {
|
||||
// Get the origin of the parent app dynamically
|
||||
const allowedOrigin = event.origin; // Dynamically get the parent app origin
|
||||
if (!allowedOrigin) {
|
||||
console.warn('Event origin is missing');
|
||||
return;
|
||||
}
|
||||
|
||||
const { type, value } = event.data;
|
||||
if (type === 'SET_DATA') {
|
||||
const { currency, floatingIps, userEmail, consoleHost, computePrices } =
|
||||
value;
|
||||
if (!consoleHost || consoleHost !== allowedOrigin) {
|
||||
console.error('Invalid consoleHost received:', consoleHost);
|
||||
return;
|
||||
}
|
||||
if (currency) localStorage.setItem('currency', currency);
|
||||
if (floatingIps)
|
||||
localStorage.setItem('floatingIps', JSON.stringify(floatingIps));
|
||||
if (userEmail) localStorage.setItem('userEmail', userEmail);
|
||||
if (consoleHost) localStorage.setItem('consoleHost', consoleHost);
|
||||
if (computePrices)
|
||||
localStorage.setItem('computePrices', JSON.stringify(computePrices));
|
||||
}
|
||||
};
|
||||
|
||||
get isAdminPage() {
|
||||
const { pathname } = this.props.location;
|
||||
return isAdminPage(pathname);
|
||||
@ -258,24 +289,18 @@ export class BaseLayout extends Component {
|
||||
);
|
||||
|
||||
render() {
|
||||
console.log('uams');
|
||||
const { pathname } = this.props.location;
|
||||
const currentRoutes = this.getCurrentMenu(pathname);
|
||||
if (window.opener) {
|
||||
const keystoneToken = JSON.parse(
|
||||
localStorage.getItem('keystone_token')
|
||||
).value;
|
||||
const allowedOrigins = [
|
||||
'https://baha-dev.felcloud.io',
|
||||
'https://demo.felcloud.io',
|
||||
];
|
||||
allowedOrigins.forEach((origin) => {
|
||||
const message = {
|
||||
status: 'popupCompleted',
|
||||
token: keystoneToken,
|
||||
};
|
||||
window.opener.postMessage(message, origin);
|
||||
});
|
||||
const origin = localStorage.getItem('consoleHost');
|
||||
const message = {
|
||||
status: 'popupCompleted',
|
||||
token: keystoneToken,
|
||||
};
|
||||
window.opener.postMessage(message, origin);
|
||||
return (
|
||||
<Modal
|
||||
visible
|
||||
|
@ -42,15 +42,19 @@ export class Edit extends ModalAction {
|
||||
}
|
||||
|
||||
get defaultValue() {
|
||||
// you gonna get all the floatings Ips from the postmessage ,
|
||||
// filter these floating ips , to match the one , that the user clicked on
|
||||
// get its reverse dnd data , and get it's value
|
||||
const { item } = this.props;
|
||||
const floatingIpsFromMessage = window.floatingIps || [];
|
||||
const matchingIp = floatingIpsFromMessage.find(
|
||||
(ip) => ip.floating_ip_address === item.floating_ip_address
|
||||
);
|
||||
const ptrRecord = matchingIp ? matchingIp.ptr_record : '';
|
||||
let ptrRecord = '';
|
||||
try {
|
||||
const floatingIps = JSON.parse(localStorage.getItem('floatingIps'));
|
||||
const matchingIp = floatingIps.find(
|
||||
(ip) => ip.floating_ip_address === item.floating_ip_address
|
||||
);
|
||||
if (matchingIp) {
|
||||
ptrRecord = matchingIp.ptr_record;
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
return {
|
||||
description: this.item.description,
|
||||
reversedns: ptrRecord,
|
||||
@ -80,13 +84,10 @@ export class Edit extends ModalAction {
|
||||
static allowed = () => Promise.resolve(true);
|
||||
|
||||
onSubmit = (values) => {
|
||||
const { floating_ip_address } = this.item;
|
||||
const userEmail = window.user_email || '';
|
||||
const { description, qos_policy_id, reversedns } = values;
|
||||
const body = {
|
||||
description,
|
||||
};
|
||||
const path = process.env.REACT_APP_BAHA_CONSOLE;
|
||||
if (this.qosEndpoint) {
|
||||
body.qos_policy_id = qos_policy_id
|
||||
? qos_policy_id.selectedRowKeys.length
|
||||
@ -94,26 +95,40 @@ export class Edit extends ModalAction {
|
||||
: null
|
||||
: null;
|
||||
}
|
||||
// Send to Flask app with API key
|
||||
fetch(`${path}/api/reversedns`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-API-Key': `${process.env.REACT_APP_FELCLOUD_API_KEY}`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
reversedns,
|
||||
floating_ip_address,
|
||||
user_email: userEmail,
|
||||
}),
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
console.log('Response from Flask:', data);
|
||||
try {
|
||||
const { floating_ip_address } = this.item;
|
||||
const userEmail = localStorage.getItem('userEmail') || '';
|
||||
const path = localStorage.getItem('consoleHost');
|
||||
fetch(`${path}/api/reversedns`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
reversedns,
|
||||
floating_ip_address,
|
||||
user_email: userEmail,
|
||||
}),
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error sending to Flask app:', error);
|
||||
});
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
if (data.status === 'success') {
|
||||
const floatingIps =
|
||||
JSON.parse(localStorage.getItem('floatingIps')) || [];
|
||||
const updatedIps = floatingIps.map((ip) =>
|
||||
ip.floating_ip_address === floating_ip_address
|
||||
? { ...ip, ptr_record: reversedns }
|
||||
: ip
|
||||
);
|
||||
localStorage.setItem('floatingIps', JSON.stringify(updatedIps));
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error sending to Flask app:', error);
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
return globalFloatingIpsStore.edit({ id: this.item.id }, body);
|
||||
};
|
||||
|
@ -33,19 +33,6 @@ export class FloatingIps extends Base {
|
||||
init() {
|
||||
this.store = new FloatingIpStore();
|
||||
this.downloadStore = new FloatingIpStore();
|
||||
|
||||
window.addEventListener('message', (event) => {
|
||||
if (
|
||||
(event.origin === process.env.REACT_APP_BAHA_CONSOLE ||
|
||||
event.origin === process.env.REACT_APP_DEMO_CONSOLE) &&
|
||||
event.data.type === 'SET_DATA'
|
||||
) {
|
||||
window.floatingIps = event.data.value.floatingIps;
|
||||
window.user_email = event.data.value.userEmail;
|
||||
console.log('Received floating IPs:', window.floatingIps);
|
||||
}
|
||||
});
|
||||
// we made it to puting the message intercepter in index.jsx
|
||||
}
|
||||
|
||||
get qosEndpoint() {
|
||||
|
@ -109,56 +109,32 @@ export class FlavorStore extends Base {
|
||||
|
||||
async listDidFetch(items, _, filters) {
|
||||
const { tab } = filters;
|
||||
let fetchedData = [];
|
||||
let profileCurrency = 'EUR';
|
||||
await new Promise((resolve) => {
|
||||
const messageListener = (event) => {
|
||||
if (
|
||||
(event.origin === process.env.REACT_APP_BAHA_CONSOLE ||
|
||||
event.origin === process.env.REACT_APP_DEMO_CONSOLE) &&
|
||||
event.data.type === 'SET_DATA'
|
||||
) {
|
||||
profileCurrency = event.data.value.currency || 'EUR';
|
||||
window.removeEventListener('message', messageListener);
|
||||
resolve();
|
||||
}
|
||||
};
|
||||
window.addEventListener('message', messageListener);
|
||||
window.parent.postMessage({ type: 'REQUEST_CURRENCY' }, '*');
|
||||
setTimeout(resolve, 1000);
|
||||
});
|
||||
try {
|
||||
const response = await fetch(process.env.REACT_APP_BAHA_CONSOLE);
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! Status: ${response.status}`);
|
||||
}
|
||||
const data = await response.json();
|
||||
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 price =
|
||||
match.price.find((p) => p.name === profileCurrency) ||
|
||||
match.price.find((p) => p.name === 'EUR');
|
||||
const priceValue = price ? parseFloat(price.value) : 0;
|
||||
const pricePerHour = priceValue.toFixed(3);
|
||||
const pricePerSecond = (pricePerHour / 3600).toFixed(5);
|
||||
const pricePerMonth = (pricePerHour * 24 * 30).toFixed(3);
|
||||
return {
|
||||
...item,
|
||||
pricePerSecond: `${pricePerSecond} ${profileCurrency}`,
|
||||
pricePerMonth: `${pricePerMonth} ${profileCurrency}`,
|
||||
profileCurrency,
|
||||
};
|
||||
}
|
||||
return item;
|
||||
});
|
||||
|
||||
try {
|
||||
const profileCurrency = localStorage.getItem('currency') || 'EUR';
|
||||
const flavors = JSON.parse(localStorage.getItem('computePrices'));
|
||||
newItems = newItems.map((item) => {
|
||||
const match = flavors.find((flavor) => flavor.flavor === item.name);
|
||||
if (match) {
|
||||
const price =
|
||||
match.price.find((p) => p.name === profileCurrency) ||
|
||||
match.price.find((p) => p.name === 'EUR');
|
||||
const priceValue = price ? parseFloat(price.value) : 0;
|
||||
const pricePerHour = priceValue.toFixed(3);
|
||||
const pricePerSecond = (pricePerHour / 3600).toFixed(5);
|
||||
const pricePerMonth = (pricePerHour * 24 * 30).toFixed(3);
|
||||
return {
|
||||
...item,
|
||||
pricePerSecond: `${pricePerSecond} ${profileCurrency}`,
|
||||
pricePerMonth: `${pricePerMonth} ${profileCurrency}`,
|
||||
profileCurrency,
|
||||
};
|
||||
}
|
||||
return item;
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
return newItems;
|
||||
}
|
||||
|
||||
|