Skip to content
This repository has been archived by the owner on Feb 21, 2022. It is now read-only.

Replace UI with Backstage #302

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
FROM node:12-alpine as fe-builder

ENV NODE_OPTIONS="--max-old-space-size=2048"

WORKDIR /app/webpack
COPY webpack ./
RUN yarn install --frozen-lockfile && \
yarn cache clean

COPY zoo/ source/
RUN yarn production

FROM python:3.7-slim

ENV DJANGO_SETTINGS_MODULE=zoo.base.settings
Expand All @@ -18,7 +6,6 @@ RUN addgroup --system macaque && \

WORKDIR /app

COPY --from=fe-builder /app/zoo ./zoo
COPY requirements/*.txt ./

RUN apt update && \
Expand Down
9 changes: 0 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,9 @@ services:
- ./zoo:/app/zoo
depends_on:
- postgres
- webpack
- redis
restart: on-failure

webpack:
build: webpack
volumes:
- ./zoo/:/app/source
- ./webpack/config:/app/config
command:
["yarn", "development"]

postgres:
image: postgres:10.1-alpine
volumes:
Expand Down
3 changes: 3 additions & 0 deletions frontend/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: [require.resolve('@backstage/cli/config/eslint.js')],
};
3 changes: 3 additions & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# [Backstage](https://backstage.io)

This is your newly scaffolded Backstage App, Good Luck!
6 changes: 6 additions & 0 deletions frontend/lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"packages": ["packages/*", "plugins/*"],
"npmClient": "yarn",
"useWorkspaces": true,
"version": "0.1.0"
}
29 changes: 29 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "root",
"version": "1.0.0",
"private": true,
"engines": {
"node": ">=12.0.0"
},
"scripts": {
"start": "yarn workspace app start",
"bundle": "yarn build && yarn workspace app bundle",
"build": "lerna run build",
"test": "yarn build && lerna run test --since origin/master -- --coverage",
"test:all": "yarn build && lerna run test -- --coverage",
"lint": "lerna run lint --since origin/master --",
"lint:all": "lerna run lint --",
"create-plugin": "backstage-cli create-plugin"
},
"workspaces": {
"packages": [
"packages/*",
"plugins/*"
]
},
"devDependencies": {
"@backstage/cli": "^0.1.1-alpha.4",
"lerna": "^3.20.2",
"prettier": "^1.19.1"
}
}
45 changes: 45 additions & 0 deletions frontend/packages/app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "app",
"version": "0.0.0",
"private": true,
"dependencies": {
"@backstage/cli": "^0.1.1-alpha.4",
"@backstage/core": "^0.1.1-alpha.4",
"@backstage/plugin-issues": "^0.1.1-alpha.4",
"@backstage/plugin-resources": "^0.1.1-alpha.4",
"@backstage/plugin-services": "^0.1.1-alpha.4",
"@backstage/theme": "^0.1.1-alpha.4",
"@material-ui/core": "^4.9.1",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "^4.0.0-alpha.52",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"@types/jest": "^24.0.0",
"@types/node": "^12.0.0",
"@types/react-router-dom": "^5.1.3",
"plugin-welcome": "0.0.0",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-router-dom": "^5.1.2",
"react-use": "^14.2.0"
},
"scripts": {
"start": "backstage-cli app:serve",
"bundle": "backstage-cli app:build",
"test": "backstage-cli test",
"lint": "backstage-cli lint"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/packages/app/public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/packages/app/public/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/packages/app/public/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/packages/app/public/favicon.ico
Binary file not shown.
93 changes: 93 additions & 0 deletions frontend/packages/app/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Backstage is an open platform for building developer portals"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link
rel="manifest"
href="%PUBLIC_URL%/manifest.json"
crossorigin="use-credentials"
/>
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<link
rel="apple-touch-icon"
sizes="180x180"
href="%PUBLIC_URL%/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="%PUBLIC_URL%/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="%PUBLIC_URL%/favicon-16x16.png"
/>
<link
rel="mask-icon"
href="%PUBLIC_URL%/safari-pinned-tab.svg"
color="#5bbad5"
/>
<style>
@media only screen {
html {
zoom: 0.7;
}
}

@media only screen and (min-width: 800px) {
html {
zoom: 0.85;
}
}

@media only screen and (min-width: 1200px) {
html {
zoom: 1;
}
}

#root {
min-height: 100%;
}
</style>
<title>Backstage</title>
</head>
<body style="margin: 0">
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
15 changes: 15 additions & 0 deletions frontend/packages/app/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"short_name": "Backstage",
"name": "Backstage",
"icons": [
{
"src": "favicon.ico",
"sizes": "48x48",
"type": "image/png"
}
],
"start_url": "./index.html",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
2 changes: 2 additions & 0 deletions frontend/packages/app/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
28 changes: 28 additions & 0 deletions frontend/packages/app/public/safari-pinned-tab.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions frontend/packages/app/src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';
import { render } from '@testing-library/react';
import App from './App';

describe('App', () => {
it('should render', () => {
const rendered = render(<App />);
expect(rendered.baseElement).toBeInTheDocument();
});
});
43 changes: 43 additions & 0 deletions frontend/packages/app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { CssBaseline, makeStyles, ThemeProvider } from '@material-ui/core';
import { createApp } from '@backstage/core';
import { BackstageTheme } from '@backstage/theme';
import React, { FC } from 'react';
import { BrowserRouter as Router } from 'react-router-dom';
import * as plugins from './plugins';

const useStyles = makeStyles(theme => ({
'@global': {
html: {
height: '100%',
fontFamily: theme.typography.fontFamily,
},
body: {
height: '100%',
fontFamily: theme.typography.fontFamily,
'overscroll-behavior-y': 'none',
},
a: {
color: 'inherit',
textDecoration: 'none',
},
},
}));

const app = createApp();
app.registerPlugin(...Object.values(plugins));
const AppComponent = app.build();

const App: FC<{}> = () => {
useStyles();
return (
<CssBaseline>
<ThemeProvider theme={BackstageTheme}>
<Router>
<AppComponent />
</Router>
</ThemeProvider>
</CssBaseline>
);
};

export default App;
5 changes: 5 additions & 0 deletions frontend/packages/app/src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(<App />, document.getElementById('root'));
7 changes: 7 additions & 0 deletions frontend/packages/app/src/plugins.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export { plugin as WelcomePlugin } from 'plugin-welcome';
import { plugin as Resources } from '@backstage/plugin-resources';
export { Resources };
import { plugin as Issues } from '@backstage/plugin-issues';
export { Issues };
import { plugin as Services } from '@backstage/plugin-services';
export { Services };
1 change: 1 addition & 0 deletions frontend/packages/app/src/react-app-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="react-scripts" />
1 change: 1 addition & 0 deletions frontend/packages/app/src/setupTests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/jest-dom/extend-expect';
20 changes: 20 additions & 0 deletions frontend/packages/app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"extends": "@spotify/web-scripts/config/tsconfig.json",
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react",
"incremental": false
},
"include": ["src"]
}
3 changes: 3 additions & 0 deletions frontend/plugins/issues/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: [require.resolve('@backstage/cli/config/eslint.js')],
};
6 changes: 6 additions & 0 deletions frontend/plugins/issues/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Title
Welcome to the issues plugin!

## Sub-section 1

## Sub-section 2
Loading