[release] v0.12.0-unstable36

This commit is contained in:
Yann Stepienik 2023-11-03 11:42:12 +00:00
parent 19d69d6dd2
commit 798505f7a7
8 changed files with 48 additions and 12 deletions

View file

@ -8,6 +8,7 @@
- Added lazyloading to URL and Servapp pages images
- Added a dangerous IP detector that stops sending HTTP response to IPs that are abusing various shields features
- Added a button in the servapp page to easily download the docker backup
- Redirect static folder to host if possible
- Improve display or icons [fixes #121]
- Refactored Mongo connection code [fixes #111]
- Forward simultaneously TCP and UDP [fixes #122]

View file

@ -52,14 +52,14 @@ const RouteOverview = ({ routeConfig }) => {
<div><RouteSecurity route={routeConfig} /></div>
<strong><DashboardOutlined/> Monitoring</strong>
<div>
<MiniPlotComponent metrics={[
<MiniPlotComponent agglo metrics={[
"cosmos.proxy.route.success." + routeConfig.Name,
"cosmos.proxy.route.error." + routeConfig.Name,
]} labels={{
["cosmos.proxy.route.error." + routeConfig.Name]: "Error",
["cosmos.proxy.route.success." + routeConfig.Name]: "Succ."
}}/>
<MiniPlotComponent metrics={[
<MiniPlotComponent agglo metrics={[
"cosmos.proxy.route.bytes." + routeConfig.Name,
"cosmos.proxy.route.time." + routeConfig.Name,
]} labels={{

View file

@ -30,7 +30,7 @@ import { FormaterForMetric, formatDate, toUTC } from './utils';
import * as API from '../../../api';
const _MiniPlotComponent = ({metrics, labels, noLabels, noBackground}) => {
const _MiniPlotComponent = ({metrics, labels, noLabels, noBackground, agglo}) => {
const theme = useTheme();
const { primary, secondary } = theme.palette.text;
const [dataMetrics, setDataMetrics] = useState([]);
@ -168,6 +168,35 @@ const _MiniPlotComponent = ({metrics, labels, noLabels, noBackground}) => {
};
const formaters = dataMetrics.map((data) => FormaterForMetric(data));
const getShowValue = (agglo, dataMetric, di) => {
let showValue;
if(dataMetric.Values.length) {
if(agglo) {
let now = new Date();
now.setHours(now.getHours());
now.setMinutes(0);
now.setSeconds(0);
let key = "hour_" + toUTC(now, true);
if(key in dataMetric.ValuesAggl) {
showValue = dataMetric.ValuesAggl[key].Value
} else {
showValue = 0;
}
} else {
showValue = dataMetric.Values[dataMetric.Values.length - 1].Value
}
return formaters[di](showValue);
} else {
showValue = formaters[di](0)
}
return showValue;
}
return <Stack direction='row' spacing={3}
alignItems='center' sx={{padding: '0px 20px', width: '100%', backgroundColor: noBackground ? '' : 'rgba(0,0,0,0.1)'}}
@ -177,11 +206,11 @@ const _MiniPlotComponent = ({metrics, labels, noLabels, noBackground}) => {
<Stack direction='column' justifyContent={'center'} alignItems={'center'} spacing={0} style={{
width: '60px',
}}>
{dataMetric.Values.length ? <div style={{
{<div style={{
fontWeight: 'bold',
fontSize: '110%',
whiteSpace: 'nowrap',
}}>{formaters[di](dataMetric.Values[dataMetric.Values.length - 1].Value)}</div> : formaters[di](0)
}}>{getShowValue(agglo, dataMetric, di)}</div>
}
<div>
<div style={{
@ -205,8 +234,8 @@ const _MiniPlotComponent = ({metrics, labels, noLabels, noBackground}) => {
</Stack>
}
const MiniPlotComponent = ({ metrics, labels, noLabels, noBackground }) => {
const memoizedComponent = useMemo(() => <_MiniPlotComponent noBackground={noBackground} noLabels={noLabels} metrics={metrics} labels={labels} />, [metrics]);
const MiniPlotComponent = ({ metrics, labels, noLabels, noBackground, agglo }) => {
const memoizedComponent = useMemo(() => <_MiniPlotComponent noBackground={noBackground} agglo={agglo} noLabels={noLabels} metrics={metrics} labels={labels} />, [metrics]);
return memoizedComponent;
};

View file

@ -254,7 +254,7 @@ const HomePage = () => {
};
const bigNb = {
fontSize: '24px',
fontSize: '23px',
fontWeight: "bold",
textAlign: "center",
color: isDark ? "white" : "black",

View file

@ -171,14 +171,14 @@ const ContainerOverview = ({ containerInfo, config, refresh, updatesAvailable, s
</div>
<strong><DashboardOutlined /> Monitoring</strong>
<div style={{ width: '96%' }}>
<MiniPlotComponent metrics={[
<MiniPlotComponent agglo metrics={[
"cosmos.system.docker.cpu." + Name.replace('/', ''),
"cosmos.system.docker.ram." + Name.replace('/', ''),
]} labels={{
["cosmos.system.docker.cpu." + Name.replace('/', '')]: "CPU",
["cosmos.system.docker.ram." + Name.replace('/', '')]: "RAM"
}}/>
<MiniPlotComponent metrics={[
<MiniPlotComponent agglo metrics={[
"cosmos.system.docker.netTx." + Name.replace('/', ''),
"cosmos.system.docker.netRx." + Name.replace('/', ''),
]} labels={{

View file

@ -304,7 +304,7 @@ const ServApps = () => {
</Stack>
</Stack>
<div>
<MiniPlotComponent metrics={[
<MiniPlotComponent agglo metrics={[
"cosmos.system.docker.cpu." + app.Names[0].replace('/', ''),
"cosmos.system.docker.ram." + app.Names[0].replace('/', ''),
]} labels={{

View file

@ -1,6 +1,6 @@
{
"name": "cosmos-server",
"version": "0.12.0-unstable35",
"version": "0.12.0-unstable36",
"description": "",
"main": "test-server.js",
"bugs": {

View file

@ -184,6 +184,12 @@ func RouteTo(route utils.ProxyRouteConfig) http.Handler {
destination := route.Target
routeType := route.Mode
if (routeType == "STATIC" || routeType == "SPA") && os.Getenv("HOSTNAME") != "" {
if _, err := os.Stat("/mnt/host"); err == nil {
destination = "/mnt/host" + destination
}
}
if(routeType == "SERVAPP" || routeType == "PROXY") {
proxy, err := NewProxy(destination, route.AcceptInsecureHTTPSTarget, route.VerboseForwardHeader, route.DisableHeaderHardening, route.CORSOrigin, route)
if err != nil {