Skip to content

Commit c0c80ae

Browse files
committed
Breakout the UI from genie-web into genie-ui module
Move all the UI code from genie-web into a standalone genie-ui module. While not truly standalone due to some legacy `UIController` this sets us up to either develop a new independent UI or remove UI entirely. In terms of improvements to the project overall moving the UI code out of `src/main/resources` into `src/main/web` and modifying the NPM tasks to property analyze the intput and output directories allows the build to properly understand if the NPM build task needs to be invoked or not. Also the compiled JS bundle is moved into the project build directory instead of dumped back into `src` which seems more proper. The final results are build into a webjar and the resources are namespaced under `webjars/genie-ui` to avoid conflicts with any other bundles placed in the deployed space. The `index.html` template isn't namespaced properly still though. Removed unnecessary images `GenieLogo.png` and `netflix-oss-logo.png` which weren't used by the UI. Disabled gRPC for the UI integration tests. Updated travis configuration for new cache locations.
1 parent 90a2b64 commit c0c80ae

Some content is hidden

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

67 files changed

+172
-78
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ genie-client/src/main/python/build
9999
genie-client/src/main/python/nflx_genie_client.egg-info
100100
genie-client/src/main/python/MANIFEST
101101
genie-common/src/generated
102-
genie-web/src/main/resources/static/build/
102+
/genie-ui/src/main/resources/static/build/
103103
node_modules
104104
node-v4.4.0-darwin-x64
105105

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ cache:
3434
directories:
3535
- $HOME/.gradle/caches/
3636
- $HOME/.gradle/wrapper/
37-
- genie-web/node_modules/
38-
- genie-web/.gradle/nodejs
39-
- genie-web/.gradle/npm
37+
- genie-ui/node_modules/
38+
- genie-ui/.gradle/nodejs
39+
- genie-ui/.gradle/npm
4040
timeout: 1000
4141
env:
4242
global:

genie-app/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ dependencies {
55
* Compile Dependencies
66
*******************************/
77

8-
compile(project(":genie-web"))
98
compile(project(":genie-security"))
9+
compile(project(":genie-web"))
10+
compile(project(":genie-ui"))
1011

1112
/*******************************
1213
* Provided Dependencies

genie-security/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ dependencies {
44
*******************************/
55

66
compile(project(":genie-web"))
7+
compile(project(":genie-ui"))
78
compile("org.bitbucket.b_c:jose4j")
89
compile("org.springframework.boot:spring-boot-starter-security")
910
compile("org.springframework.security:spring-security-jwt")
@@ -23,6 +24,7 @@ dependencies {
2324
/*******************************
2425
* Optional Dependencies
2526
*******************************/
27+
2628
compileOnly("org.springframework.boot:spring-boot-configuration-processor")
2729

2830
/*******************************

genie-web/README.md renamed to genie-ui/README.md

Lines changed: 2 additions & 2 deletions

genie-ui/build.gradle

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
plugins {
2+
id "com.moowork.node" version "1.2.0"
3+
}
4+
5+
dependencies {
6+
/*******************************
7+
* Compile Dependencies
8+
*******************************/
9+
10+
compile(project(":genie-web"))
11+
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
12+
compile("org.springframework.boot:spring-boot-starter-web")
13+
14+
/*******************************
15+
* Provided Dependencies
16+
*******************************/
17+
18+
/*******************************
19+
* Optional Dependencies
20+
*******************************/
21+
22+
/*******************************
23+
* Runtime Dependencies
24+
*******************************/
25+
26+
/*******************************
27+
* Test Dependencies
28+
*******************************/
29+
30+
testCompile(project(":genie-test"))
31+
}
32+
33+
license {
34+
exclude "templates/*"
35+
}
36+
37+
node {
38+
version = "8.11.1"
39+
npmVersion = "5.8.0"
40+
download = true
41+
}
42+
43+
task bundle(type: NpmTask) {
44+
inputs.files(fileTree("node_modules"))
45+
inputs.files(fileTree("src/main/web"))
46+
inputs.file("npm-shrinkwrap.json")
47+
inputs.file("package.json")
48+
inputs.file("server.js")
49+
inputs.file("webpack.config.js")
50+
51+
outputs.dir file("${project.buildDir}/web/bundle")
52+
53+
dependsOn npmInstall
54+
args = ["run", "build"]
55+
}
56+
57+
jar {
58+
dependsOn bundle
59+
60+
from(file("${project.buildDir}/web/bundle")) {
61+
into "META-INF/resources/webjars/${project.name}"
62+
}
63+
64+
from(file("${project.projectDir}/src/main/web/images")) {
65+
into "META-INF/resources/webjars/${project.name}/images"
66+
}
67+
68+
manifest {
69+
attributes(
70+
"Implementation-Title": project.name,
71+
"Implementation-Version": project.version,
72+
)
73+
}
74+
}

genie-web/npm-shrinkwrap.json renamed to genie-ui/npm-shrinkwrap.json

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

genie-web/package.json renamed to genie-ui/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "genie-web",
3-
"version": "3.2.0",
2+
"name": "genie-ui",
3+
"version": "4.0.0",
44
"description": "UI for Genie",
55
"main": "index.js",
66
"scripts": {
@@ -14,7 +14,7 @@
1414
"url": "https://github.com/Netflix/genie.git"
1515
},
1616
"author": "Netflix",
17-
"license": "Apache License, Version 2.0",
17+
"license": "Apache-2.0",
1818
"bugs": {
1919
"url": "https://github.com/Netflix/genie/issues"
2020
},
File renamed without changes.

genie-web/src/main/java/com/netflix/genie/web/controllers/UIController.java renamed to genie-ui/src/main/java/com/netflix/genie/ui/controllers/UIController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
* limitations under the License.
1616
*
1717
*/
18-
package com.netflix.genie.web.controllers;
18+
package com.netflix.genie.ui.controllers;
1919

20+
import com.netflix.genie.web.controllers.ControllerUtils;
2021
import org.springframework.stereotype.Controller;
2122
import org.springframework.web.bind.annotation.GetMapping;
2223
import org.springframework.web.bind.annotation.PathVariable;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
*
3+
* Copyright 2018 Netflix, Inc.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
*/
18+
19+
/**
20+
* Controllers for MVC.
21+
*
22+
* @author tgianos
23+
* @since 4.0.0
24+
*/
25+
@ParametersAreNonnullByDefault
26+
package com.netflix.genie.ui.controllers;
27+
28+
import javax.annotation.ParametersAreNonnullByDefault;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<html lang="en-US">
2+
<head>
3+
<meta charset="utf-8">
4+
<title>Genie</title>
5+
<link rel="shortcut icon" href="webjars/genie-ui/images/favicon.ico"/>
6+
</meta>
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<script src="webjars/genie-ui/bundle.js" type="text/javascript"></script>
11+
</body>
12+
</html>

genie-web/src/main/resources/static/scripts/components/SearchForm.js renamed to genie-ui/src/main/web/scripts/components/SearchForm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Picker from "rc-calendar/lib/Picker";
77
import enUS from "rc-calendar/lib/locale/en_US";
88
import Panel from "rc-time-picker/lib/Panel";
99

10-
import { momentFormat, milliSeconds, nowUtc } from "./../utils";
10+
import { momentFormat, milliSeconds, nowUtc } from "../utils";
1111

1212
import T from "prop-types";
1313

genie-web/src/test/java/com/netflix/genie/web/controllers/UIControllerIntegrationTest.java renamed to genie-ui/src/test/java/com/netflix/genie/ui/controllers/UIControllerIntegrationTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.netflix.genie.web.controllers;
1+
package com.netflix.genie.ui.controllers;
22

33
import com.netflix.genie.GenieWeb;
44
import com.netflix.genie.test.categories.IntegrationTest;
@@ -12,7 +12,7 @@
1212
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
1313
import org.springframework.boot.test.context.SpringBootTest;
1414
import org.springframework.http.MediaType;
15-
import org.springframework.test.context.ActiveProfiles;
15+
import org.springframework.test.context.TestPropertySource;
1616
import org.springframework.test.context.junit4.SpringRunner;
1717
import org.springframework.test.web.servlet.MockMvc;
1818
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
@@ -33,8 +33,8 @@
3333
@Category(IntegrationTest.class)
3434
@RunWith(SpringRunner.class)
3535
@SpringBootTest(classes = GenieWeb.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
36-
@ActiveProfiles(resolver = IntegrationTestActiveProfilesResolver.class)
3736
@AutoConfigureMockMvc
37+
@TestPropertySource(properties = {"genie.grpc.server.enabled = false"})
3838
@Slf4j
3939
public class UIControllerIntegrationTest {
4040

genie-web/src/test/java/com/netflix/genie/web/controllers/UIControllerUnitTests.java renamed to genie-ui/src/test/java/com/netflix/genie/ui/controllers/UIControllerUnitTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*
1717
*/
18-
package com.netflix.genie.web.controllers;
18+
package com.netflix.genie.ui.controllers;
1919

2020
import com.netflix.genie.test.categories.UnitTest;
2121
import org.hamcrest.Matchers;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
*
3+
* Copyright 2018 Netflix, Inc.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
*/
18+
19+
/**
20+
* Tests for MVC controllers.
21+
*
22+
* @author tgianos
23+
* @since 4.0.0
24+
*/
25+
@ParametersAreNonnullByDefault
26+
package com.netflix.genie.ui.controllers;
27+
28+
import javax.annotation.ParametersAreNonnullByDefault;

genie-web/webpack.config.js renamed to genie-ui/webpack.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
var webpack = require("webpack");
22
var path = require("path");
33

4-
var APP_DIR = path.resolve(__dirname, "src/main/resources/static");
5-
var BUILD_DIR = APP_DIR + "/build";
4+
var APP_DIR = path.resolve(__dirname, "src/main/web");
5+
var BUILD_DIR = path.resolve(__dirname, "build/web/bundle");
66

77
var config = {
88
entry: { app: [ APP_DIR + "/index.js" ] },
9-
output: { path: BUILD_DIR, filename: "bundle.js", publicPath: "/build/" },
9+
output: { path: BUILD_DIR, filename: "bundle.js", publicPath: "webjars/genie-ui/" },
1010
plugins: [
1111
new webpack.optimize.DedupePlugin(),
1212
new webpack.optimize.UglifyJsPlugin({ compressor: { warnings: false } }),

genie-war/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ dependencies {
55
* Compile Dependencies
66
*******************************/
77

8-
compile(project(":genie-web"))
98
compile(project(":genie-security"))
9+
compile(project(":genie-web"))
10+
compile(project(":genie-ui"))
1011

1112
/*******************************
1213
* Provided Dependencies

genie-web/build.gradle

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
plugins {
2-
id "com.moowork.node" version "1.2.0"
3-
}
4-
51
apply plugin: "org.asciidoctor.convert"
62

73
project.parent.tasks.collectDocumentation.dependsOn project.tasks.asciidoctor
84

95
ext {
106
metaModelIgnorePattern = "**/com/netflix/genie/web/jpa/entities/*_.java"
117
snippetsDir = new File(project.buildDir, "generated-snippets")
12-
static_build_dir = new File(project.projectDir, "/src/main/resources/static/build")
13-
static_project_dir = new File(project.projectDir, "/src/main/resources/static")
148
}
159

1610
dependencies {
@@ -49,7 +43,6 @@ dependencies {
4943
compile("org.springframework.boot:spring-boot-starter-mail")
5044
compile("org.springframework.boot:spring-boot-starter-hateoas")
5145
compile("org.springframework.boot:spring-boot-starter-integration")
52-
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
5346
compile("org.springframework.boot:spring-boot-starter-tomcat")
5447
compile("org.springframework.boot:spring-boot-starter-web")
5548
compile("org.springframework.cloud:spring-cloud-starter-aws")
@@ -98,8 +91,6 @@ dependencies {
9891
}
9992

10093
license {
101-
exclude "static/*"
102-
exclude "templates/*"
10394
exclude "*.yml"
10495
exclude "genie-banner.txt"
10596
exclude "db/**/*.sql"
@@ -153,43 +144,10 @@ compileJava {
153144
dependsOn processResources
154145
}
155146

156-
node {
157-
version = "4.4.0"
158-
npmVersion = "3.8.6"
159-
download = true
160-
}
161-
162-
clean {
163-
delete static_build_dir
164-
}
165-
166-
task bundle(type: NpmTask) {
167-
inputs.files(fileTree("node_modules"))
168-
inputs.file("npm-shrinkwrap.json")
169-
inputs.file("package.json")
170-
inputs.file("server.js")
171-
inputs.file("webpack.config.js")
172-
inputs.dir static_project_dir
173-
174-
outputs.dir static_build_dir
175-
176-
dependsOn npm_install
177-
args = ["run", "build"]
178-
}
179-
180-
npm_install.args = ["--loglevel", "error"]
181-
npmInstall.args = ["--loglevel", "error"]
182-
183147
jar {
184-
dependsOn bundle
185-
186148
manifest {
187149
attributes("Implementation-Version": genieVersion)
188150
}
189-
190-
from(static_build_dir) {
191-
into "static"
192-
}
193151
}
194152

195153
//Ignore the generated classes from all our style/coverage/bug finding tools

0 commit comments

Comments
 (0)