Skip to content

Commit b5d9654

Browse files
authored
Merge pull request #14 from layer5io/ui-packages
UI packages updated to include Kanvas SVG components and animations
2 parents a8f92ea + 809bd0d commit b5d9654

File tree

11 files changed

+2029
-1634
lines changed

11 files changed

+2029
-1634
lines changed

ui/config-overrides.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const webpack = require('webpack');
2+
23
module.exports = function override(config, env) {
34
config.resolve.fallback = {
45
url: require.resolve('url'),
@@ -11,6 +12,30 @@ module.exports = function override(config, env) {
1112
buffer: require.resolve('buffer'),
1213
stream: require.resolve('stream-browserify'),
1314
};
15+
16+
// Handle the @docker/docker-mui-theme ES6 module issue
17+
config.module.rules.unshift({
18+
test: /\.js$/,
19+
include: /node_modules\/@docker\/docker-mui-theme/,
20+
use: {
21+
loader: 'babel-loader',
22+
options: {
23+
presets: [
24+
['@babel/preset-env', {
25+
modules: 'auto',
26+
targets: {
27+
browsers: ['last 2 versions']
28+
}
29+
}],
30+
'@babel/preset-react'
31+
],
32+
plugins: [
33+
'@babel/plugin-transform-modules-commonjs'
34+
]
35+
}
36+
}
37+
});
38+
1439
config.plugins.push(
1540
new webpack.ProvidePlugin({
1641
process: 'process/browser',

ui/package-lock.json

Lines changed: 1880 additions & 1604 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
"description": "the cloud native management plane",
66
"main": "index.js",
77
"dependencies": {
8-
"@docker/docker-mui-theme": "^0.0.4",
8+
"@docker/docker-mui-theme": "^0.0.13",
99
"@emotion/react": "^11.8.2",
1010
"@emotion/styled": "^11.8.1",
1111
"@fortawesome/fontawesome-svg-core": "^6.1.1",
1212
"@fortawesome/free-solid-svg-icons": "^6.1.1",
1313
"@fortawesome/react-fontawesome": "^0.1.18",
14-
"@sistent/sistent": "0.14.201",
1514
"@mui/icons-material": "^5.5.1",
1615
"@mui/material": "^5.5.3",
1716
"@mui/styled-engine-sc": "^5.5.2",
1817
"@mui/styles": "^5.5.3",
18+
"@sistent/sistent": "0.14.201",
1919
"@testing-library/jest-dom": "^5.16.2",
2020
"@testing-library/react": "^12.1.4",
2121
"@testing-library/user-event": "^13.5.0",
@@ -68,6 +68,13 @@
6868
]
6969
},
7070
"devDependencies": {
71+
"@babel/plugin-proposal-class-properties": "^7.18.6",
72+
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
73+
"@babel/plugin-transform-class-properties": "^7.27.1",
74+
"@babel/plugin-transform-modules-commonjs": "^7.27.1",
75+
"@babel/plugin-transform-runtime": "^7.28.0",
76+
"@babel/preset-env": "^7.28.0",
77+
"@babel/preset-react": "^7.27.1",
7178
"path-browserify": "^1.0.1"
7279
}
7380
}

ui/src/components/ExtensionComponent/ExtensionComponent.js

Lines changed: 53 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import React, { useState, useEffect } from "react";
2-
import { Typography, Button, Tooltip, Grid } from "@mui/material";
2+
import { Typography, Button, Tooltip } from "@mui/material";
3+
import { createTheme, ThemeProvider } from "@mui/material/styles";
34
import OpenInNewIcon from "@mui/icons-material/OpenInNew";
45
// import ConsulIcon from '../../img/SVGs/consulIcon'
56
// import IstioIcon from '../../img/SVGs/IstioIcon'
67
// import KumaIcon from '../../img/SVGs/kumaIcon'
78
// import LinkerdIcon from '../../img/SVGs/linkerdIcon'
89
import Tour from "../Walkthrough/Tour";
9-
import PublishIcon from "../../assets/design";
1010
import { Avatar } from "@mui/material";
1111
// import NginxIcon from '../../img/SVGs/nginxIcon'
1212
// import AppmeshIcon from '../../img/SVGs/appmeshIcon'
1313
// import CiliumIcon from '../../img/SVGs/ciliumIcon'
1414
// import TraefikIcon from '../../img/SVGs/traefikIcon'
15-
import Meshery from "../../img/SVGs/meshery";
16-
import KanvasIcon from "../../img/meshery-logo/CustomKanvasLogo";
15+
import Kanvas from "../../img/SVGs/Kanvas";
16+
import KanvasIcon from "../../img/kanvas-logo/CustomKanvasLogo";
1717
import { DockerMuiThemeProvider } from "@docker/docker-mui-theme";
1818
import CssBaseline from "@mui/material/CssBaseline";
1919
import { LoadComp } from "../LoadingComponent/LoadComp";
@@ -28,23 +28,50 @@ import {
2828
LogoutButton,
2929
StyledButton,
3030
StyledLink,
31-
MeshModels,
32-
PublishCard,
3331
} from "./styledComponents";
34-
import { MesheryAnimation } from "../MesheryAnimation/MesheryAnimation";
32+
import { KanvasAnimation } from "../KanvasAnimation/KanvasAnimation";
3533
import { randomApplicationNameGenerator } from "../../utils";
36-
import CatalogChart from "../Catalog/Chart";
3734
import {
38-
CatalogCard,
39-
FeedbackButton,
4035
SistentThemeProviderWithoutBaseLine,
4136
} from "@sistent/sistent";
4237
import {
43-
MESHMAP,
4438
providerUrl,
4539
SELECTED_PROVIDER_NAME,
4640
} from "../utils/constants";
4741

42+
// Fallback theme provider for when Docker extension themes aren't available
43+
const DockerMuiThemeProviderWithFallback = ({ children }) => {
44+
const isDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
45+
46+
// Check if Docker extension themes are available
47+
if (window.__ddMuiV5Themes) {
48+
try {
49+
return React.createElement(DockerMuiThemeProvider, {}, children);
50+
} catch (error) {
51+
console.warn('Docker MUI theme provider failed, falling back to default theme:', error);
52+
}
53+
}
54+
55+
// Fallback theme configuration
56+
const fallbackTheme = createTheme({
57+
palette: {
58+
mode: isDarkMode ? 'dark' : 'light',
59+
primary: {
60+
main: '#00B39F',
61+
},
62+
secondary: {
63+
main: '#00D3A9',
64+
},
65+
background: {
66+
default: isDarkMode ? '#121212' : '#ffffff',
67+
paper: isDarkMode ? '#1e1e1e' : '#ffffff',
68+
},
69+
},
70+
});
71+
72+
return React.createElement(ThemeProvider, { theme: fallbackTheme }, children);
73+
};
74+
4875
const AuthenticatedMsg = "Authenticated";
4976
const UnauthenticatedMsg = "Unauthenticated";
5077
const proxyUrl = "http://127.0.0.1:7877";
@@ -211,7 +238,7 @@ const ExtensionsComponent = () => {
211238
// )
212239
// }
213240
// }, [meshAdapters])
214-
const [mesheryVersion, setMesheryVersion] = useState(null);
241+
const [KanvasVersion, setKanvasVersion] = useState(null);
215242

216243
const logout = () => {
217244
fetch(proxyUrl + "/token", { method: httpDelete })
@@ -298,7 +325,7 @@ const ExtensionsComponent = () => {
298325
// .catch(console.err)
299326
fetch(proxyUrl + "/api/system/version")
300327
.then((result) => result.text())
301-
.then((result) => setMesheryVersion(JSON.parse(result)?.build))
328+
.then((result) => setKanvasVersion(JSON.parse(result)?.build))
302329
.catch(console.error);
303330
fetch(`${providerUrl}/api/catalog/content/pattern`)
304331
.then((result) => result.text())
@@ -445,17 +472,17 @@ const ExtensionsComponent = () => {
445472
const OpenDocs = () => {
446473
// window.location.href = proxyUrl;
447474
window.ddClient.host.openExternal(
448-
`https://docs.meshery.io/installation/docker/docker-extension`,
475+
`https://docs.layer5.io/kanvas/`,
449476
);
450477
};
451478

452-
const launchMeshery = () => {
453-
console.log("Launching Meshery...");
479+
const launchKanvas = () => {
480+
console.log("Launching Kanvas...");
454481
window.location.href = proxyUrl;
455482
};
456483

457484
return (
458-
<DockerMuiThemeProvider>
485+
<DockerMuiThemeProviderWithFallback>
459486
<CssBaseline />
460487
{changing && (
461488
<LoadingDiv sx={{ opacity: "1" }}>
@@ -516,17 +543,17 @@ const ExtensionsComponent = () => {
516543
onMouseOver={onMouseOver}
517544
>
518545
{isHovered ? (
519-
<MesheryAnimation height={70} width={72} />
546+
<KanvasAnimation height={70} width={72} />
520547
) : (
521-
<Meshery height={70} width={72} />
548+
<Kanvas height={70} width={72} />
522549
)}
523550
</div>
524551
) : (
525-
<Meshery height={70} width={72} />
552+
<Kanvas height={70} width={72} />
526553
)}
527554
</a>
528555
{isLoggedIn ? (
529-
<LinkButton onClick={launchMeshery}>
556+
<LinkButton onClick={launchKanvas}>
530557
<StyledLink
531558
style={{ textDecoration: "none", color: "white" }}
532559
// href={
@@ -536,7 +563,7 @@ const ExtensionsComponent = () => {
536563
// "&provider=${SELECTED_PROVIDER_NAME}`
537564
// }
538565
>
539-
Launch Meshery
566+
Launch Kanvas
540567
</StyledLink>
541568
</LinkButton>
542569
) : (
@@ -663,13 +690,13 @@ const ExtensionsComponent = () => {
663690
<SectionWrapper>
664691
{isLoggedIn && (
665692
<div style={{ paddingTop: isLoggedIn ? "1.2rem" : null }}>
666-
<Tooltip title="Meshery Server version">
693+
<Tooltip title="Kanvas Server version">
667694
<VersionText variant="span" component="span" align="end">
668-
{mesheryVersion}
695+
{KanvasVersion}
669696
</VersionText>
670697
</Tooltip>
671698
<a
672-
href={`https://docs.meshery.io/project/releases/${mesheryVersion}`}
699+
href={`https://docs.Kanvas.io/project/releases/${KanvasVersion}`}
673700
target="_blank"
674701
rel="noreferrer"
675702
style={{ color: isDarkTheme ? "white" : "black" }}
@@ -682,7 +709,7 @@ const ExtensionsComponent = () => {
682709
)}
683710
</SectionWrapper>
684711
</ComponentWrapper>
685-
</DockerMuiThemeProvider>
712+
</DockerMuiThemeProviderWithFallback>
686713
);
687714
};
688715

ui/src/components/MesheryAnimation/MesheryAnimation.js renamed to ui/src/components/KanvasAnimation/KanvasAnimation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState, useEffect } from "react";
2-
import "./mesheryAnimation.css";
2+
import "./kanvasAnimation.css";
33

44

55
function getClassName(className, isActive) {
@@ -10,7 +10,7 @@ function getClassName(className, isActive) {
1010
return `${className} active`;
1111
}
1212

13-
export const MesheryAnimation = (props) => {
13+
export const KanvasAnimation = (props) => {
1414
const [isActive, setIsActive] = useState(true);
1515

1616
useEffect(() => {

ui/src/img/SVGs/Kanvas.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import React from "react";
2+
3+
const Kanvas = ({ height = 70, width = 72, ...props }) => {
4+
return (
5+
<svg
6+
xmlns="http://www.w3.org/2000/svg"
7+
viewBox="0 0 135 136"
8+
height={height}
9+
width={width}
10+
fill="none"
11+
{...props}
12+
>
13+
<defs>
14+
<linearGradient id="paint0_linear_4485_12569" x1="47.8243" y1="132.582" x2="112.578" y2="2.09647" gradientUnits="userSpaceOnUse">
15+
<stop stopColor="#00B39F"/>
16+
<stop offset="1" stopColor="#00D3A9"/>
17+
</linearGradient>
18+
</defs>
19+
<path
20+
d="M0 0H107.969C123.574 0 135 11.4264 135 27.0312V135.188H27.0312C11.4264 135.188 0 123.761 0 108.156V0Z"
21+
fill="url(#paint0_linear_4485_12569)"
22+
/>
23+
<path
24+
d="M41.3506 26.7969H54.1025V48.4219H48.2822V32.6172H41.3506V26.7969Z"
25+
fill="white"
26+
/>
27+
<path
28+
d="M41.3506 63.8906H54.1025V69.7109H41.3506V63.8906Z"
29+
fill="white"
30+
/>
31+
<path
32+
d="M41.3506 85.5156H54.1025V91.3359H41.3506V85.5156Z"
33+
fill="white"
34+
/>
35+
<path
36+
d="M69.7109 26.7969H82.4629V48.4219H76.6426V32.6172H69.7109V26.7969Z"
37+
fill="white"
38+
/>
39+
<path
40+
d="M69.7109 63.8906H82.4629V69.7109H69.7109V63.8906Z"
41+
fill="white"
42+
/>
43+
<path
44+
d="M69.7109 85.5156H82.4629V91.3359H69.7109V85.5156Z"
45+
fill="white"
46+
/>
47+
</svg>
48+
);
49+
};
50+
51+
export default Kanvas;

ui/src/img/SVGs/docsIcon.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from "react";
2+
3+
const DocsIcon = ({ width, height }) => (
4+
<svg width={width} height={height} viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg" stylefont-size="unset" ><title>Documentation</title><path d="M416 221.25V416a48 48 0 01-48 48H144a48 48 0 01-48-48V96a48 48 0 0148-48h98.75a32 32 0 0122.62 9.37l141.26 141.26a32 32 0 019.37 22.62z" fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="32"></path><path d="M256 56v120a32 32 0 0032 32h120M176 288h160M176 368h160" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32"></path></svg>
5+
6+
7+
);
8+
9+
export default DocsIcon;

0 commit comments

Comments
 (0)