From f2b4dff972175c471849c19e7f842df98127bd02 Mon Sep 17 00:00:00 2001 From: Kumar Aditya Raj Date: Tue, 17 Sep 2024 21:27:15 +0530 Subject: [PATCH] kie-issues#2545: Create a landing page for the Jobs Service (#2592) --- packages/jobs-service-webapp/env/index.js | 33 ++++++++ packages/jobs-service-webapp/package.json | 36 +++++++++ packages/jobs-service-webapp/src/index.html | 65 ++++++++++++++++ packages/jobs-service-webapp/src/styles.css | 75 +++++++++++++++++++ .../jobs-service-webapp/static/favicon.svg | 44 +++++++++++ .../jobs-service-webapp/webpack.config.js | 45 +++++++++++ pnpm-lock.yaml | 33 ++++++++ repo/graph.dot | 2 + repo/graph.json | 7 ++ 9 files changed, 340 insertions(+) create mode 100644 packages/jobs-service-webapp/env/index.js create mode 100644 packages/jobs-service-webapp/package.json create mode 100644 packages/jobs-service-webapp/src/index.html create mode 100644 packages/jobs-service-webapp/src/styles.css create mode 100644 packages/jobs-service-webapp/static/favicon.svg create mode 100644 packages/jobs-service-webapp/webpack.config.js diff --git a/packages/jobs-service-webapp/env/index.js b/packages/jobs-service-webapp/env/index.js new file mode 100644 index 00000000000..2344426cb7a --- /dev/null +++ b/packages/jobs-service-webapp/env/index.js @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +const { varsWithName, composeEnv } = require("@kie-tools-scripts/build-env"); + +module.exports = composeEnv([require("@kie-tools/root-env/env")], { + vars: varsWithName({}), + get env() { + return { + jobsServiceWebapp: { + dev: { + port: 9028, + }, + }, + }; + }, +}); diff --git a/packages/jobs-service-webapp/package.json b/packages/jobs-service-webapp/package.json new file mode 100644 index 00000000000..1d0ab6eb247 --- /dev/null +++ b/packages/jobs-service-webapp/package.json @@ -0,0 +1,36 @@ +{ + "name": "@kie-tools/jobs-service-webapp", + "version": "0.0.0", + "description": "", + "license": "Apache-2.0", + "keywords": [], + "homepage": "https://github.com/apache/incubator-kie-tools", + "repository": { + "type": "git", + "url": "https://github.com/apache/incubator-kie-tools.git" + }, + "bugs": { + "url": "https://github.com/apache/incubator-kie-tools/issues" + }, + "types": "./dist/index.d.ts", + "main": "dist/index.js", + "scripts": { + "build:dev": "rimraf dist && webpack --env dev", + "build:prod": "pnpm lint && pnpm test && rimraf dist && webpack", + "lint": "echo 'Linting'", + "start": "webpack serve --host 0.0.0.0 --env dev", + "test": "run-script-if --ignore-errors \"$(build-env tests.ignoreFailures)\" --bool \"$(build-env tests.run)\" --then \"jest --silent --verbose --passWithNoTests\"" + }, + "devDependencies": { + "@kie-tools-core/webpack-base": "workspace:*", + "@kie-tools/root-env": "workspace:*", + "copy-webpack-plugin": "^11.0.0", + "jest": "^29.7.0", + "rimraf": "^3.0.2", + "ts-node": "^10.9.2", + "webpack": "^5.94.0", + "webpack-cli": "^4.10.0", + "webpack-dev-server": "^4.15.1", + "webpack-merge": "^5.9.0" + } +} diff --git a/packages/jobs-service-webapp/src/index.html b/packages/jobs-service-webapp/src/index.html new file mode 100644 index 00000000000..98fb32fbccd --- /dev/null +++ b/packages/jobs-service-webapp/src/index.html @@ -0,0 +1,65 @@ + + + + + + + + Jobs Service Webapp + + + + +
+
+ +
+

Your Jobs service is up and working!

+
+

+ The Job Service facilitates the scheduled execution of tasks in a cloud environment. These tasks are + implemented by independent services, and can be started by using any of the Job Service supported interaction + modes, based on Http calls or Knative Events delivery. +

+ +
+
+ + diff --git a/packages/jobs-service-webapp/src/styles.css b/packages/jobs-service-webapp/src/styles.css new file mode 100644 index 00000000000..c0d8af289e3 --- /dev/null +++ b/packages/jobs-service-webapp/src/styles.css @@ -0,0 +1,75 @@ +body { + margin: 0px; + padding: 0px; +} + +.maindiv { + font-family: "RedHatText", "Overpass", overpass, helvetica, arial, sans-serif; + background-color: #fff; + color: #fff; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; +} + +.container { + text-align: center; + background-color: #fff; + max-width: 700px; +} + +.logo img { + width: 80px; + height: auto; +} + +h1 { + font-size: 48px; + color: #e44c3b; + padding-left: 15px; +} + +h4 { + font-size: 30px; + color: #c94848; + margin-top: 10px; +} + +p { + font-size: 16px; + color: #1f1e1e; + margin-top: 5px; + margin-bottom: 40px; +} + +.btn { + padding: 10px 20px; + background-color: #e44c3b; + color: #fff; + text-decoration: none; + border-radius: 5px; + font-size: 16px; + transition: background-color 0.3s; +} + +.btn:hover { + background-color: #c73828; +} + +.linkbutton { + display: flex; + justify-content: space-around; +} + +@media (prefers-color-scheme: dark) { + .maindiv, + .container { + background-color: #232121; + } + + h4, + p { + color: #fefefe; + } +} diff --git a/packages/jobs-service-webapp/static/favicon.svg b/packages/jobs-service-webapp/static/favicon.svg new file mode 100644 index 00000000000..8806924e382 --- /dev/null +++ b/packages/jobs-service-webapp/static/favicon.svg @@ -0,0 +1,44 @@ + + + + + + + kie_icon_rgb_fullcolor_default + + + + + + + + + diff --git a/packages/jobs-service-webapp/webpack.config.js b/packages/jobs-service-webapp/webpack.config.js new file mode 100644 index 00000000000..8bfef9544ce --- /dev/null +++ b/packages/jobs-service-webapp/webpack.config.js @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +const CopyPlugin = require("copy-webpack-plugin"); +const { merge } = require("webpack-merge"); +const common = require("@kie-tools-core/webpack-base/webpack.common.config"); +const { env } = require("./env"); +const buildEnv = env; + +module.exports = async (env) => + merge(common(env), { + entry: {}, + plugins: [ + new CopyPlugin({ + patterns: [ + { from: "./src/index.html", to: "./index.html" }, + { from: "./src/styles.css", to: "./styles.css" }, + { from: "./static/favicon.svg", to: "./favicon.svg" }, + ], + }), + ], + ignoreWarnings: [/Failed to parse source map/], + devServer: { + static: { + directory: "./dist", + }, + port: buildEnv.jobsServiceWebapp.dev.port, + }, + }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d05a9a9677e..5227ed7bc23 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5228,6 +5228,39 @@ importers: specifier: ^29.7.0 version: 29.7.0(@types/node@22.5.2)(node-notifier@8.0.2)(ts-node@10.9.2(@types/node@22.5.2)) + packages/jobs-service-webapp: + devDependencies: + '@kie-tools-core/webpack-base': + specifier: workspace:* + version: link:../webpack-base + '@kie-tools/root-env': + specifier: workspace:* + version: link:../root-env + copy-webpack-plugin: + specifier: ^11.0.0 + version: 11.0.0(webpack@5.94.0(@swc/core@1.3.92)(webpack-cli@4.10.0)) + jest: + specifier: ^29.7.0 + version: 29.7.0(@types/node@22.5.2)(node-notifier@8.0.2)(ts-node@10.9.2(@swc/core@1.3.92)(@types/node@22.5.2)(typescript@5.5.3)) + rimraf: + specifier: ^3.0.2 + version: 3.0.2 + ts-node: + specifier: ^10.9.2 + version: 10.9.2(@swc/core@1.3.92)(@types/node@22.5.2)(typescript@5.5.3) + webpack: + specifier: ^5.94.0 + version: 5.94.0(@swc/core@1.3.92)(webpack-cli@4.10.0) + webpack-cli: + specifier: ^4.10.0 + version: 4.10.0(webpack-dev-server@4.15.1)(webpack@5.94.0) + webpack-dev-server: + specifier: ^4.15.1 + version: 4.15.1(webpack-cli@4.10.0)(webpack@5.94.0) + webpack-merge: + specifier: ^5.9.0 + version: 5.10.0 + packages/json-yaml-language-service: dependencies: '@kie-tools/yaml-language-server': diff --git a/repo/graph.dot b/repo/graph.dot index 178278c78b7..bfb388a4272 100644 --- a/repo/graph.dot +++ b/repo/graph.dot @@ -126,6 +126,7 @@ digraph G { "@kie-tools/import-java-classes-component" [ color = "blue", fontcolor = "blue", style = "rounded" ]; "@kie-tools-core/vscode-java-code-completion" [ color = "purple", fontcolor = "purple", style = "rounded" ]; "@kie-tools/runtime-tools-process-dev-ui-webapp" [ color = "blue", fontcolor = "blue", style = "rounded" ]; + "@kie-tools/jobs-service-webapp" [ color = "blue", fontcolor = "blue", style = "rounded" ]; "@kie-tools/yaml-language-server" [ color = "blue", fontcolor = "blue", style = "rounded" ]; "@kie-tools-core/k8s-yaml-to-apiserver-requests" [ color = "purple", fontcolor = "purple", style = "rounded" ]; "kie-editors-dev-vscode-extension" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; @@ -397,6 +398,7 @@ digraph G { "@kie-tools/jbpm-quarkus-devui" -> "@kie-tools/maven-base" [ style = "solid", color = "black" ]; "@kie-tools/jbpm-quarkus-devui" -> "@kie-tools/runtime-tools-process-dev-ui-webapp" [ style = "dashed", color = "black" ]; "@kie-tools/jest-base" -> "@kie-tools/root-env" [ style = "dashed", color = "blue" ]; + "@kie-tools/jobs-service-webapp" -> "@kie-tools-core/webpack-base" [ style = "dashed", color = "blue" ]; "@kie-tools/json-yaml-language-service" -> "@kie-tools/yaml-language-server" [ style = "solid", color = "blue" ]; "@kie-tools-core/k8s-yaml-to-apiserver-requests" -> "@kie-tools/eslint" [ style = "dashed", color = "purple" ]; "@kie-tools-core/k8s-yaml-to-apiserver-requests" -> "@kie-tools/root-env" [ style = "dashed", color = "purple" ]; diff --git a/repo/graph.json b/repo/graph.json index 9dd90d59e50..3e5b4cfb333 100644 --- a/repo/graph.json +++ b/repo/graph.json @@ -138,6 +138,7 @@ { "id": "@kie-tools/import-java-classes-component" }, { "id": "@kie-tools/runtime-tools-process-webapp-components" }, { "id": "@kie-tools/runtime-tools-shared-webapp-components" }, + { "id": "@kie-tools/jobs-service-webapp" }, { "id": "@kie-tools-core/k8s-yaml-to-apiserver-requests" }, { "id": "kie-editors-dev-vscode-extension" }, { "id": "@kie-tools/pmml-editor" }, @@ -1702,6 +1703,11 @@ "target": "@kie-tools/runtime-tools-components", "weight": 1 }, + { + "source": "@kie-tools/jobs-service-webapp", + "target": "@kie-tools-core/webpack-base", + "weight": 1 + }, { "source": "@kie-tools-core/k8s-yaml-to-apiserver-requests", "target": "@kie-tools/eslint", @@ -2569,6 +2575,7 @@ ["@kie-tools/import-java-classes-component", "packages/import-java-classes-component"], ["@kie-tools/jbpm-quarkus-devui", "packages/jbpm-quarkus-devui"], ["@kie-tools/jest-base", "packages/jest-base"], + ["@kie-tools/jobs-service-webapp", "packages/jobs-service-webapp"], ["@kie-tools/json-yaml-language-service", "packages/json-yaml-language-service"], ["@kie-tools-core/k8s-yaml-to-apiserver-requests", "packages/k8s-yaml-to-apiserver-requests"], ["@kie-tools-core/keyboard-shortcuts", "packages/keyboard-shortcuts"],