custom theme and UI

This commit is contained in:
Med Mouine 2024-05-20 17:44:23 -04:00
parent b76fbfc34a
commit c4c33cae7f
11 changed files with 1027 additions and 103 deletions

View File

@ -18,12 +18,12 @@ backend:
# Uncomment the following host directive to bind to specific interfaces
# host: 127.0.0.1
csp:
connect-src: ["'self'", "http:", "https:"]
connect-src: [ "'self'", "http:", "https:" ]
# Content-Security-Policy directives follow the Helmet format: https://helmetjs.github.io/#reference
# Default Helmet Content-Security-Policy values can be removed by setting the key to false
cors:
origin: http://localhost:3000
methods: [GET, HEAD, PATCH, POST, PUT, DELETE]
methods: [ GET, HEAD, PATCH, POST, PUT, DELETE ]
credentials: true
# This is for local development only, it is not recommended to use this in production
# The production database configuration is stored in app-config.production.yaml
@ -35,7 +35,7 @@ backend:
proxy:
"/github/api":
target: https://api.github.com/repos
allowedHeaders: ["Authorization", "X-GitHub-Api-Version"]
allowedHeaders: [ "Authorization", "X-GitHub-Api-Version" ]
headers:
Accept: application/vnd.github+json
X-GitHub-Api-Version: "2022-11-28"
@ -73,7 +73,7 @@ auth:
# see https://backstage.io/docs/auth/ to learn about auth providers
providers:
# See https://backstage.io/docs/auth/guest/provider
guest: {}
guest: { }
github:
development:
clientId: Iv1.62e73edda444f42c
@ -106,7 +106,7 @@ catalog:
timeout: { seconds: 30 }
githubOrg:
id: "kheops-org"
orgs: [kheops-org]
orgs: [ kheops-org ]
githubUrl: "https://github.com/"
schedule: # same options as in TaskScheduleDefinition
frequency: { minutes: 30 }
@ -115,7 +115,7 @@ catalog:
entityFilename: catalog-info.yaml
pullRequestBranchName: backstage-integration
rules:
- allow: [Component, System, API, Resource, Location, Users, Group]
- allow: [ Component, System, API, Resource, Location, Users, Group ]
locations:
# Local example data, file locations are relative to the backend process, typically `packages/backend`
- type: file
@ -125,7 +125,7 @@ catalog:
- type: file
target: ../../examples/template/template.yaml
rules:
- allow: [Template]
- allow: [ Template ]
- type: url
target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/all.yaml
@ -156,12 +156,15 @@ catalog:
- type: url
target: https://github.com/Kheops-org/backstage-templates/blob/main/templates.yaml
rules:
- allow: [Template]
- allow: [ Template ]
# - type: file
# target: ../../../../backstage-templates/templates.yaml
# rules:
# - allow: [Template]
- type: url
target: https://github.com/redhat-developer/red-hat-developer-hub-software-templates/blob/main/templates.yaml
rules:
- allow: [Template]
- allow: [ Template ]
## Uncomment these lines to add more example data
# - type: url
# target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/all.yaml
@ -182,3 +185,6 @@ devTools:
target: "8.8.8.8"
permission:
enabled: true
notifications:
# curl -X POST http://localhost:7007/api/notifications/notifications -H "Content-Type: application/json" -H "notifications-secret: your-secret-token-shared-with-external-services" -d '{"title":"my-title","origin":"my-origin","message":"message one","topic":"my-topic"}'
externalCallerSecret: notifications-secret

View File

@ -41,17 +41,20 @@
"@backstage/plugin-user-settings": "^0.8.5",
"@backstage/theme": "^0.5.3",
"@bestsellerit/backstage-plugin-harbor": "^0.3.1",
"@janus-idp/plugin-notifications": "^1.3.0",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@roadiehq/backstage-plugin-argo-cd": "^2.6.4",
"@roadiehq/backstage-plugin-github-pull-requests": "^2.5.25",
"@veecode-platform/backstage-plugin-github-workflows": "^0.2.70",
"add": "^2.0.6",
"history": "^5.0.0",
"react": "^18.0.2",
"react-dom": "^18.0.2",
"react-router": "^6.3.0",
"react-router-dom": "^6.3.0",
"react-use": "^17.2.4"
"react-use": "^17.2.4",
"yarn": "^1.22.22"
},
"devDependencies": {
"@backstage/test-utils": "^1.5.4",

View File

@ -39,9 +39,21 @@ import { RequirePermission } from '@backstage/plugin-permission-react';
import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha';
import { githubAuthApiRef } from '@backstage/core-plugin-api';
import { DevToolsPage } from '@backstage/plugin-devtools';
import { UnifiedThemeProvider } from '@backstage/theme';
import { SreezCustomTheme } from './theme/custom';
import LightIcon from '@material-ui/icons/WbSunny';
const app = createApp({
themes: [{
id: 'my-theme',
title: 'My Custom Theme',
variant: 'dark',
icon: <LightIcon />,
Provider: ({ children }) => (
<UnifiedThemeProvider theme={SreezCustomTheme} children={children} />
)
}],
apis,
bindRoutes({ bind }) {
bind(catalogPlugin.externalRoutes, {
@ -75,7 +87,6 @@ const app = createApp({
}]}
/>
),
},
});

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,9 @@
import React from 'react';
import { makeStyles } from '@material-ui/core';
import logoIcon from './sreez_logo.png';
const useStyles = makeStyles({
svg: {
img: {
width: 'auto',
height: 28,
},
@ -13,18 +14,8 @@ const useStyles = makeStyles({
const LogoIcon = () => {
const classes = useStyles();
return (
<svg
className={classes.svg}
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 337.46 428.5"
>
<path
className={classes.path}
d="M303,166.05a80.69,80.69,0,0,0,13.45-10.37c.79-.77,1.55-1.53,2.3-2.3a83.12,83.12,0,0,0,7.93-9.38A63.69,63.69,0,0,0,333,133.23a48.58,48.58,0,0,0,4.35-16.4c1.49-19.39-10-38.67-35.62-54.22L198.56,0,78.3,115.23,0,190.25l108.6,65.91a111.59,111.59,0,0,0,57.76,16.41c24.92,0,48.8-8.8,66.42-25.69,19.16-18.36,25.52-42.12,13.7-61.87a49.22,49.22,0,0,0-6.8-8.87A89.17,89.17,0,0,0,259,178.29h.15a85.08,85.08,0,0,0,31-5.79A80.88,80.88,0,0,0,303,166.05ZM202.45,225.86c-19.32,18.51-50.4,21.23-75.7,5.9L51.61,186.15l67.45-64.64,76.41,46.38C223,184.58,221.49,207.61,202.45,225.86Zm8.93-82.22-70.65-42.89L205.14,39,274.51,81.1c25.94,15.72,29.31,37,10.55,55A60.69,60.69,0,0,1,211.38,143.64Zm29.86,190c-19.57,18.75-46.17,29.09-74.88,29.09a123.73,123.73,0,0,1-64.1-18.2L0,282.52v24.67L108.6,373.1a111.6,111.6,0,0,0,57.76,16.42c24.92,0,48.8-8.81,66.42-25.69,12.88-12.34,20-27.13,19.68-41.49v-1.79A87.27,87.27,0,0,1,241.24,333.68Zm0-39c-19.57,18.75-46.17,29.08-74.88,29.08a123.81,123.81,0,0,1-64.1-18.19L0,243.53v24.68l108.6,65.91a111.6,111.6,0,0,0,57.76,16.42c24.92,0,48.8-8.81,66.42-25.69,12.88-12.34,20-27.13,19.68-41.5v-1.78A87.27,87.27,0,0,1,241.24,294.7Zm0-39c-19.57,18.76-46.17,29.09-74.88,29.09a123.81,123.81,0,0,1-64.1-18.19L0,204.55v24.68l108.6,65.91a111.59,111.59,0,0,0,57.76,16.41c24.92,0,48.8-8.8,66.42-25.68,12.88-12.35,20-27.13,19.68-41.5v-1.82A86.09,86.09,0,0,1,241.24,255.71Zm83.7,25.74a94.15,94.15,0,0,1-60.2,25.86h0V334a81.6,81.6,0,0,0,51.74-22.37c14-13.38,21.14-28.11,21-42.64v-2.19A94.92,94.92,0,0,1,324.94,281.45Zm-83.7,91.21c-19.57,18.76-46.17,29.09-74.88,29.09a123.73,123.73,0,0,1-64.1-18.2L0,321.5v24.68l108.6,65.9a111.6,111.6,0,0,0,57.76,16.42c24.92,0,48.8-8.8,66.42-25.69,12.88-12.34,20-27.13,19.68-41.49v-1.79A86.29,86.29,0,0,1,241.24,372.66ZM327,162.45c-.68.69-1.35,1.38-2.05,2.06a94.37,94.37,0,0,1-10.64,8.65,91.35,91.35,0,0,1-11.6,7,94.53,94.53,0,0,1-26.24,8.71,97.69,97.69,0,0,1-14.16,1.57c.5,1.61.9,3.25,1.25,4.9a53.27,53.27,0,0,1,1.14,12V217h.05a84.41,84.41,0,0,0,25.35-5.55,81,81,0,0,0,26.39-16.82c.8-.77,1.5-1.56,2.26-2.34a82.08,82.08,0,0,0,7.93-9.38A63.76,63.76,0,0,0,333,172.17a48.55,48.55,0,0,0,4.32-16.45c.09-1.23.2-2.47.19-3.7V150q-1.08,1.54-2.25,3.09A96.73,96.73,0,0,1,327,162.45Zm0,77.92c-.69.7-1.31,1.41-2,2.1a94.2,94.2,0,0,1-60.2,25.86h0l0,26.67h0a81.6,81.6,0,0,0,51.74-22.37A73.51,73.51,0,0,0,333,250.13a48.56,48.56,0,0,0,4.32-16.44c.09-1.24.2-2.47.19-3.71v-2.19c-.74,1.07-1.46,2.15-2.27,3.21A95.68,95.68,0,0,1,327,240.37Zm0-39c-.69.7-1.31,1.41-2,2.1a93.18,93.18,0,0,1-10.63,8.65,91.63,91.63,0,0,1-11.63,7,95.47,95.47,0,0,1-37.94,10.18h0V256h0a81.65,81.65,0,0,0,51.74-22.37c.8-.77,1.5-1.56,2.26-2.34a82.08,82.08,0,0,0,7.93-9.38A63.76,63.76,0,0,0,333,211.15a48.56,48.56,0,0,0,4.32-16.44c.09-1.24.2-2.48.19-3.71v-2.2c-.74,1.08-1.46,2.16-2.27,3.22A95.68,95.68,0,0,1,327,201.39Z"
/>
</svg>
<img src={logoIcon} alt='Sreez' className={classes.img}/>
);
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -0,0 +1,47 @@
import {
createBaseThemeOptions,
createUnifiedTheme,
palettes,
} from '@backstage/theme';
export const SreezCustomTheme = createUnifiedTheme({
...createBaseThemeOptions({
palette: {
...palettes.light,
primary: {
main: '#4E8479',
},
secondary: {
main: '#794e84',
},
error: {
main: '#d32f2f',
},
warning: {
main: '#ed6c02',
},
info: {
main: '#0288d1',
},
success: {
main: '#2e7d32',
},
banner: {
info: '#34548a',
error: '#8c4351',
text: '#343b58',
link: '#565a6e',
},
errorBackground: '#8c4351',
warningBackground: '#8f5e15',
infoBackground: '#343b58',
navigation: {
background: '#121212',
indicator: '#8f5e15',
color: '#d5d6db',
selectedColor: '#ffffff',
},
},
}),
defaultPageTheme: 'home',
});

View File

@ -41,18 +41,23 @@
"@backstage/plugin-proxy-backend": "^0.4.15",
"@backstage/plugin-scaffolder-backend": "^1.22.4",
"@backstage/plugin-scaffolder-backend-module-github": "^0.2.7",
"@backstage/plugin-scaffolder-node": "^0.4.3",
"@backstage/plugin-search-backend": "^1.5.7",
"@backstage/plugin-search-backend-module-catalog": "^0.1.22",
"@backstage/plugin-search-backend-module-techdocs": "^0.1.22",
"@backstage/plugin-search-backend-node": "^1.2.21",
"@backstage/plugin-techdocs-backend": "^1.10.4",
"@janus-idp/plugin-notifications-backend": "^1.4.12",
"@muvaf/create-argocd-application": "^0.4.1",
"@muvaf/kubernetes-apply": "^0.1.0",
"@roadiehq/scaffolder-backend-argocd": "^1.1.26",
"app": "link:../app",
"better-sqlite3": "^9.0.0",
"dockerode": "^3.3.1",
"node-gyp": "^9.0.0",
"pg": "^8.11.3",
"winston": "^3.2.1"
"winston": "^3.2.1",
"zod": "^3.23.6"
},
"devDependencies": {
"@backstage/cli": "^0.26.3",

View File

@ -9,6 +9,13 @@
import { createBackend } from '@backstage/backend-defaults';
import { eventsModuleGithubEventRouter } from '@backstage/plugin-events-backend-module-github/alpha';
import { eventsModuleGithubWebhook } from '@backstage/plugin-events-backend-module-github/alpha';
import { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';
import {
createBackendModule,
} from '@backstage/backend-plugin-api';
import { createNewFileAction } from './plugins/scaffolder/actions/custom';
import { kubernetesApply } from "@muvaf/kubernetes-apply";
import { createArgoProjectAction } from './plugins/scaffolder/actions/argo';
const backend = createBackend();
@ -49,11 +56,6 @@ backend.add(import('@backstage/plugin-search-backend/alpha'));
backend.add(import('@backstage/plugin-devtools-backend'));
import { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';
import { createBackendModule } from '@backstage/backend-plugin-api';
import { createNewFileAction } from './plugins/scaffolder/actions/custom';
import { createArgoProjectAction } from './plugins/scaffolder/actions/argo';
const scaffolderModuleCustomExtensions = createBackendModule({
pluginId: 'scaffolder', // name of the plugin that the module is targeting
moduleId: 'custom-extensions',
@ -68,6 +70,7 @@ const scaffolderModuleCustomExtensions = createBackendModule({
// point before the plugin itself gets instantiated
scaffolder.addActions(createNewFileAction()); // just an example
scaffolder.addActions(createArgoProjectAction()); // just an example
scaffolder.addActions(kubernetesApply());
},
});
},

File diff suppressed because it is too large Load Diff