1
1
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" ;
3
4
import OpenInNewIcon from "@mui/icons-material/OpenInNew" ;
4
5
// import ConsulIcon from '../../img/SVGs/consulIcon'
5
6
// import IstioIcon from '../../img/SVGs/IstioIcon'
6
7
// import KumaIcon from '../../img/SVGs/kumaIcon'
7
8
// import LinkerdIcon from '../../img/SVGs/linkerdIcon'
8
9
import Tour from "../Walkthrough/Tour" ;
9
- import PublishIcon from "../../assets/design" ;
10
10
import { Avatar } from "@mui/material" ;
11
11
// import NginxIcon from '../../img/SVGs/nginxIcon'
12
12
// import AppmeshIcon from '../../img/SVGs/appmeshIcon'
13
13
// import CiliumIcon from '../../img/SVGs/ciliumIcon'
14
14
// 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" ;
17
17
import { DockerMuiThemeProvider } from "@docker/docker-mui-theme" ;
18
18
import CssBaseline from "@mui/material/CssBaseline" ;
19
19
import { LoadComp } from "../LoadingComponent/LoadComp" ;
@@ -28,23 +28,50 @@ import {
28
28
LogoutButton ,
29
29
StyledButton ,
30
30
StyledLink ,
31
- MeshModels ,
32
- PublishCard ,
33
31
} from "./styledComponents" ;
34
- import { MesheryAnimation } from "../MesheryAnimation/MesheryAnimation " ;
32
+ import { KanvasAnimation } from "../KanvasAnimation/KanvasAnimation " ;
35
33
import { randomApplicationNameGenerator } from "../../utils" ;
36
- import CatalogChart from "../Catalog/Chart" ;
37
34
import {
38
- CatalogCard ,
39
- FeedbackButton ,
40
35
SistentThemeProviderWithoutBaseLine ,
41
36
} from "@sistent/sistent" ;
42
37
import {
43
- MESHMAP ,
44
38
providerUrl ,
45
39
SELECTED_PROVIDER_NAME ,
46
40
} from "../utils/constants" ;
47
41
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
+
48
75
const AuthenticatedMsg = "Authenticated" ;
49
76
const UnauthenticatedMsg = "Unauthenticated" ;
50
77
const proxyUrl = "http://127.0.0.1:7877" ;
@@ -211,7 +238,7 @@ const ExtensionsComponent = () => {
211
238
// )
212
239
// }
213
240
// }, [meshAdapters])
214
- const [ mesheryVersion , setMesheryVersion ] = useState ( null ) ;
241
+ const [ KanvasVersion , setKanvasVersion ] = useState ( null ) ;
215
242
216
243
const logout = ( ) => {
217
244
fetch ( proxyUrl + "/token" , { method : httpDelete } )
@@ -298,7 +325,7 @@ const ExtensionsComponent = () => {
298
325
// .catch(console.err)
299
326
fetch ( proxyUrl + "/api/system/version" )
300
327
. then ( ( result ) => result . text ( ) )
301
- . then ( ( result ) => setMesheryVersion ( JSON . parse ( result ) ?. build ) )
328
+ . then ( ( result ) => setKanvasVersion ( JSON . parse ( result ) ?. build ) )
302
329
. catch ( console . error ) ;
303
330
fetch ( `${ providerUrl } /api/catalog/content/pattern` )
304
331
. then ( ( result ) => result . text ( ) )
@@ -445,17 +472,17 @@ const ExtensionsComponent = () => {
445
472
const OpenDocs = ( ) => {
446
473
// window.location.href = proxyUrl;
447
474
window . ddClient . host . openExternal (
448
- `https://docs.meshery .io/installation/docker/docker-extension ` ,
475
+ `https://docs.layer5 .io/kanvas/ ` ,
449
476
) ;
450
477
} ;
451
478
452
- const launchMeshery = ( ) => {
453
- console . log ( "Launching Meshery ..." ) ;
479
+ const launchKanvas = ( ) => {
480
+ console . log ( "Launching Kanvas ..." ) ;
454
481
window . location . href = proxyUrl ;
455
482
} ;
456
483
457
484
return (
458
- < DockerMuiThemeProvider >
485
+ < DockerMuiThemeProviderWithFallback >
459
486
< CssBaseline />
460
487
{ changing && (
461
488
< LoadingDiv sx = { { opacity : "1" } } >
@@ -516,17 +543,17 @@ const ExtensionsComponent = () => {
516
543
onMouseOver = { onMouseOver }
517
544
>
518
545
{ isHovered ? (
519
- < MesheryAnimation height = { 70 } width = { 72 } />
546
+ < KanvasAnimation height = { 70 } width = { 72 } />
520
547
) : (
521
- < Meshery height = { 70 } width = { 72 } />
548
+ < Kanvas height = { 70 } width = { 72 } />
522
549
) }
523
550
</ div >
524
551
) : (
525
- < Meshery height = { 70 } width = { 72 } />
552
+ < Kanvas height = { 70 } width = { 72 } />
526
553
) }
527
554
</ a >
528
555
{ isLoggedIn ? (
529
- < LinkButton onClick = { launchMeshery } >
556
+ < LinkButton onClick = { launchKanvas } >
530
557
< StyledLink
531
558
style = { { textDecoration : "none" , color : "white" } }
532
559
// href={
@@ -536,7 +563,7 @@ const ExtensionsComponent = () => {
536
563
// "&provider=${SELECTED_PROVIDER_NAME}`
537
564
// }
538
565
>
539
- Launch Meshery
566
+ Launch Kanvas
540
567
</ StyledLink >
541
568
</ LinkButton >
542
569
) : (
@@ -663,13 +690,13 @@ const ExtensionsComponent = () => {
663
690
< SectionWrapper >
664
691
{ isLoggedIn && (
665
692
< div style = { { paddingTop : isLoggedIn ? "1.2rem" : null } } >
666
- < Tooltip title = "Meshery Server version" >
693
+ < Tooltip title = "Kanvas Server version" >
667
694
< VersionText variant = "span" component = "span" align = "end" >
668
- { mesheryVersion }
695
+ { KanvasVersion }
669
696
</ VersionText >
670
697
</ Tooltip >
671
698
< a
672
- href = { `https://docs.meshery .io/project/releases/${ mesheryVersion } ` }
699
+ href = { `https://docs.Kanvas .io/project/releases/${ KanvasVersion } ` }
673
700
target = "_blank"
674
701
rel = "noreferrer"
675
702
style = { { color : isDarkTheme ? "white" : "black" } }
@@ -682,7 +709,7 @@ const ExtensionsComponent = () => {
682
709
) }
683
710
</ SectionWrapper >
684
711
</ ComponentWrapper >
685
- </ DockerMuiThemeProvider >
712
+ </ DockerMuiThemeProviderWithFallback >
686
713
) ;
687
714
} ;
688
715
0 commit comments