Skip to content

Commit 16bd974

Browse files
author
Zachary Seguin
committed
feat(frontend): Add jupyter frontend
1 parent e3bcdf7 commit 16bd974

File tree

149 files changed

+15752
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+15752
-7
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
deploy/
2+
Dockerfile

Dockerfile

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1-
# Build with the golang image
2-
FROM golang:1.14-alpine AS build
1+
# Stage 0: UI Build Stage
2+
FROM node:10 as frontend
3+
4+
WORKDIR /app
5+
6+
COPY ./frontend/package*.json /app/
7+
RUN npm install
8+
9+
COPY ./frontend/ /app/
10+
11+
# Build the default frontends
12+
RUN npm run build frontend -- --output-path=./dist/out/default --configuration=production
13+
14+
# Stage 1: Build with the golang image
15+
FROM golang:1.14-alpine AS backend
316

417
# Add git
518
RUN apk add git
@@ -18,5 +31,6 @@ RUN CGO_ENABLED=0 go install .
1831

1932
# Generate final image
2033
FROM scratch
21-
COPY --from=build /go/bin/jupyter-apis /jupyter-apis
34+
COPY --from=frontend /app/dist/out/default /static/
35+
COPY --from=backend /go/bin/jupyter-apis /jupyter-apis
2236
ENTRYPOINT [ "/jupyter-apis" ]

frontend/.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Editor configuration, see https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
max_line_length = off
13+
trim_trailing_whitespace = false

frontend/.gitignore

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
8+
# dependencies
9+
/node_modules
10+
11+
# profiling files
12+
chrome-profiler-events.json
13+
speed-measure-plugin.json
14+
15+
# IDEs and editors
16+
/.idea
17+
.project
18+
.classpath
19+
.c9/
20+
*.launch
21+
.settings/
22+
*.sublime-workspace
23+
24+
# IDE - VSCode
25+
.vscode/*
26+
!.vscode/settings.json
27+
!.vscode/tasks.json
28+
!.vscode/launch.json
29+
!.vscode/extensions.json
30+
.history/*
31+
32+
# misc
33+
/.sass-cache
34+
/connect.lock
35+
/coverage
36+
/libpeerconnection.log
37+
npm-debug.log
38+
yarn-error.log
39+
testem.log
40+
/typings
41+
42+
# System Files
43+
.DS_Store
44+
Thumbs.db

frontend/.prettierrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
printWidth: 80,
3+
useTabs: false,
4+
tabWidth: 2,
5+
semi: true,
6+
singleQuote: true,
7+
trailingComma: 'all',
8+
bracketSpacing: true,
9+
arrowParens: 'avoid',
10+
proseWrap: 'preserve',
11+
}

frontend/angular.json

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"frontend": {
7+
"root": "",
8+
"sourceRoot": "src",
9+
"projectType": "application",
10+
"prefix": "app",
11+
"schematics": {
12+
"@schematics/angular:component": {
13+
"style": "scss"
14+
}
15+
},
16+
"architect": {
17+
"build": {
18+
"builder": "@angular-devkit/build-angular:browser",
19+
"options": {
20+
"outputPath": "dist/frontend",
21+
"index": "src/index.html",
22+
"main": "src/main.ts",
23+
"polyfills": "src/polyfills.ts",
24+
"tsConfig": "src/tsconfig.app.json",
25+
"assets": [
26+
"src/favicon.ico",
27+
"src/assets"
28+
],
29+
"styles": [
30+
"src/styles.scss"
31+
],
32+
"scripts": [],
33+
"es5BrowserSupport": true
34+
},
35+
"configurations": {
36+
"production": {
37+
"fileReplacements": [
38+
{
39+
"replace": "src/environments/environment.ts",
40+
"with": "src/environments/environment.prod.ts"
41+
}
42+
],
43+
"optimization": true,
44+
"outputHashing": "all",
45+
"sourceMap": false,
46+
"extractCss": true,
47+
"namedChunks": false,
48+
"aot": true,
49+
"extractLicenses": true,
50+
"vendorChunk": false,
51+
"buildOptimizer": true,
52+
"budgets": [
53+
{
54+
"type": "initial",
55+
"maximumWarning": "2mb",
56+
"maximumError": "5mb"
57+
}
58+
]
59+
},
60+
"rok": {
61+
"fileReplacements": [
62+
{
63+
"replace": "src/environments/environment.ts",
64+
"with": "src/environments/environment.rok.ts"
65+
}
66+
]
67+
},
68+
"rok-prod": {
69+
"fileReplacements": [
70+
{
71+
"replace": "src/environments/environment.ts",
72+
"with": "src/environments/environment.rok.prod.ts"
73+
}
74+
],
75+
"optimization": true,
76+
"outputHashing": "all",
77+
"sourceMap": false,
78+
"extractCss": true,
79+
"namedChunks": false,
80+
"aot": true,
81+
"extractLicenses": true,
82+
"vendorChunk": false,
83+
"buildOptimizer": true,
84+
"budgets": [
85+
{
86+
"type": "initial",
87+
"maximumWarning": "2mb",
88+
"maximumError": "5mb"
89+
}
90+
]
91+
}
92+
}
93+
},
94+
"serve": {
95+
"builder": "@angular-devkit/build-angular:dev-server",
96+
"options": {
97+
"browserTarget": "frontend:build"
98+
},
99+
"configurations": {
100+
"production": {
101+
"browserTarget": "frontend:build:production"
102+
},
103+
"rok": {
104+
"browserTarget": "frontend:build:rok"
105+
},
106+
"rok-prod": {
107+
"browserTarget": "frontend:build:rok-prod"
108+
}
109+
}
110+
},
111+
"extract-i18n": {
112+
"builder": "@angular-devkit/build-angular:extract-i18n",
113+
"options": {
114+
"browserTarget": "frontend:build"
115+
}
116+
},
117+
"test": {
118+
"builder": "@angular-devkit/build-angular:karma",
119+
"options": {
120+
"main": "src/test.ts",
121+
"polyfills": "src/polyfills.ts",
122+
"tsConfig": "src/tsconfig.spec.json",
123+
"karmaConfig": "src/karma.conf.js",
124+
"styles": [
125+
"src/styles.scss"
126+
],
127+
"scripts": [],
128+
"assets": [
129+
"src/favicon.ico",
130+
"src/assets"
131+
]
132+
}
133+
},
134+
"lint": {
135+
"builder": "@angular-devkit/build-angular:tslint",
136+
"options": {
137+
"tsConfig": [
138+
"src/tsconfig.app.json",
139+
"src/tsconfig.spec.json"
140+
],
141+
"exclude": [
142+
"**/node_modules/**"
143+
]
144+
}
145+
}
146+
}
147+
},
148+
"frontend-e2e": {
149+
"root": "e2e/",
150+
"projectType": "application",
151+
"prefix": "",
152+
"architect": {
153+
"e2e": {
154+
"builder": "@angular-devkit/build-angular:protractor",
155+
"options": {
156+
"protractorConfig": "e2e/protractor.conf.js",
157+
"devServerTarget": "frontend:serve"
158+
},
159+
"configurations": {
160+
"production": {
161+
"devServerTarget": "frontend:serve:production"
162+
}
163+
}
164+
},
165+
"lint": {
166+
"builder": "@angular-devkit/build-angular:tslint",
167+
"options": {
168+
"tsConfig": "e2e/tsconfig.e2e.json",
169+
"exclude": [
170+
"**/node_modules/**"
171+
]
172+
}
173+
}
174+
}
175+
}
176+
},
177+
"defaultProject": "frontend"
178+
}

frontend/e2e/protractor.conf.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Protractor configuration file, see link for more information
2+
// https://github.com/angular/protractor/blob/master/lib/config.ts
3+
4+
const { SpecReporter } = require('jasmine-spec-reporter');
5+
6+
exports.config = {
7+
allScriptsTimeout: 11000,
8+
specs: [
9+
'./src/**/*.e2e-spec.ts'
10+
],
11+
capabilities: {
12+
'browserName': 'chrome'
13+
},
14+
directConnect: true,
15+
baseUrl: 'http://localhost:4200/',
16+
framework: 'jasmine',
17+
jasmineNodeOpts: {
18+
showColors: true,
19+
defaultTimeoutInterval: 30000,
20+
print: function() {}
21+
},
22+
onPrepare() {
23+
require('ts-node').register({
24+
project: require('path').join(__dirname, './tsconfig.e2e.json')
25+
});
26+
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
27+
}
28+
};

frontend/e2e/src/app.e2e-spec.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { AppPage } from "./app.po";
2+
import { browser, logging } from "protractor";
3+
4+
describe("workspace-project App", () => {
5+
let page: AppPage;
6+
7+
beforeEach(() => {
8+
page = new AppPage();
9+
});
10+
11+
it("should display welcome message", () => {
12+
page.navigateTo();
13+
expect(page.getTitleText()).toEqual("Welcome to frontend!");
14+
});
15+
16+
afterEach(async () => {
17+
// Assert that there are no errors emitted from the browser
18+
const logs = await browser
19+
.manage()
20+
.logs()
21+
.get(logging.Type.BROWSER);
22+
expect(logs).not.toContain(
23+
jasmine.objectContaining({
24+
level: logging.Level.SEVERE
25+
})
26+
);
27+
});
28+
});

frontend/e2e/src/app.po.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { browser, by, element } from "protractor";
2+
3+
export class AppPage {
4+
navigateTo() {
5+
return browser.get(browser.baseUrl) as Promise<any>;
6+
}
7+
8+
getTitleText() {
9+
return element(by.css("app-root h1")).getText() as Promise<string>;
10+
}
11+
}

frontend/e2e/tsconfig.e2e.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../out-tsc/app",
5+
"module": "commonjs",
6+
"target": "es5",
7+
"types": [
8+
"jasmine",
9+
"jasminewd2",
10+
"node"
11+
]
12+
}
13+
}

0 commit comments

Comments
 (0)