Commit fd02c9b96f71d8c2fa9324d2901fffa497b34e33

Authored by Igor Kulikov
1 parent cae1f026

ThingsBoard UI - Angular 8 - Initial structure.

Too many changes to show.

To preserve performance only 11 of 53 files are displayed.

@@ -116,7 +116,7 @@ @@ -116,7 +116,7 @@
116 </dependency> 116 </dependency>
117 <dependency> 117 <dependency>
118 <groupId>org.thingsboard</groupId> 118 <groupId>org.thingsboard</groupId>
119 - <artifactId>ui</artifactId> 119 + <artifactId>ui-ngx</artifactId>
120 <version>${project.version}</version> 120 <version>${project.version}</version>
121 <scope>runtime</scope> 121 <scope>runtime</scope>
122 </dependency> 122 </dependency>
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 <dependencies> 46 <dependencies>
47 <dependency> 47 <dependency>
48 <groupId>org.thingsboard</groupId> 48 <groupId>org.thingsboard</groupId>
49 - <artifactId>ui</artifactId> 49 + <artifactId>ui-ngx</artifactId>
50 <version>${project.version}</version> 50 <version>${project.version}</version>
51 <type>jar</type> 51 <type>jar</type>
52 <scope>provided</scope> 52 <scope>provided</scope>
@@ -105,7 +105,7 @@ @@ -105,7 +105,7 @@
105 <artifactItems> 105 <artifactItems>
106 <artifactItem> 106 <artifactItem>
107 <groupId>org.thingsboard</groupId> 107 <groupId>org.thingsboard</groupId>
108 - <artifactId>ui</artifactId> 108 + <artifactId>ui-ngx</artifactId>
109 <type>jar</type> 109 <type>jar</type>
110 <overWrite>false</overWrite> 110 <overWrite>false</overWrite>
111 <outputDirectory>${project.build.directory}/web</outputDirectory> 111 <outputDirectory>${project.build.directory}/web</outputDirectory>
@@ -100,10 +100,11 @@ @@ -100,10 +100,11 @@
100 <module>rule-engine</module> 100 <module>rule-engine</module>
101 <module>dao</module> 101 <module>dao</module>
102 <module>transport</module> 102 <module>transport</module>
103 - <module>ui</module> 103 + <module>ui-ngx</module>
104 <module>tools</module> 104 <module>tools</module>
105 <module>application</module> 105 <module>application</module>
106 <module>msa</module> 106 <module>msa</module>
  107 + <module>ui</module>
107 </modules> 108 </modules>
108 109
109 <profiles> 110 <profiles>
  1 +#
  2 +# Copyright © 2016-2019 The Thingsboard Authors
  3 +#
  4 +# Licensed under the Apache License, Version 2.0 (the "License");
  5 +# you may not use this file except in compliance with the License.
  6 +# You may obtain a copy of the License at
  7 +#
  8 +# http://www.apache.org/licenses/LICENSE-2.0
  9 +#
  10 +# Unless required by applicable law or agreed to in writing, software
  11 +# distributed under the License is distributed on an "AS IS" BASIS,
  12 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 +# See the License for the specific language governing permissions and
  14 +# limitations under the License.
  15 +#
  16 +
  17 +# Editor configuration, see https://editorconfig.org
  18 +root = true
  19 +
  20 +[*]
  21 +charset = utf-8
  22 +indent_style = space
  23 +indent_size = 2
  24 +insert_final_newline = true
  25 +trim_trailing_whitespace = true
  26 +
  27 +[*.md]
  28 +max_line_length = off
  29 +trim_trailing_whitespace = false
  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 +# Only exists if Bazel was run
  8 +/bazel-out
  9 +
  10 +# dependencies
  11 +/node_modules
  12 +
  13 +# profiling files
  14 +chrome-profiler-events.json
  15 +speed-measure-plugin.json
  16 +
  17 +# IDEs and editors
  18 +/.idea
  19 +.project
  20 +.classpath
  21 +.c9/
  22 +*.launch
  23 +.settings/
  24 +*.sublime-workspace
  25 +
  26 +# IDE - VSCode
  27 +.vscode/*
  28 +!.vscode/settings.json
  29 +!.vscode/tasks.json
  30 +!.vscode/launch.json
  31 +!.vscode/extensions.json
  32 +.history/*
  33 +
  34 +# misc
  35 +/.sass-cache
  36 +/connect.lock
  37 +/coverage
  38 +/libpeerconnection.log
  39 +npm-debug.log
  40 +yarn-error.log
  41 +testem.log
  42 +/typings
  43 +
  44 +# System Files
  45 +.DS_Store
  46 +Thumbs.db
  1 +{
  2 + "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  3 + "version": 1,
  4 + "newProjectRoot": "projects",
  5 + "projects": {
  6 + "thingsboard": {
  7 + "root": "",
  8 + "sourceRoot": "src",
  9 + "projectType": "application",
  10 + "prefix": "tb",
  11 + "schematics": {
  12 + "@schematics/angular:component": {
  13 + "style": "scss"
  14 + }
  15 + },
  16 + "architect": {
  17 + "build": {
  18 + "builder": "@angular-builders/custom-webpack:browser",
  19 + "options": {
  20 + "outputPath": "target/generated-resources/public",
  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/thingsboard.ico",
  27 + "src/assets"
  28 + ],
  29 + "styles": [
  30 + "src/styles.scss"
  31 + ],
  32 + "scripts": [
  33 + "node_modules/ace-builds/src-min/ace.js",
  34 + "node_modules/ace-builds/src-min/ext-language_tools.js",
  35 + "node_modules/ace-builds/src-min/ext-searchbox.js",
  36 + "node_modules/ace-builds/src-min/theme-github.js",
  37 + "node_modules/ace-builds/src-min/mode-text.js",
  38 + "node_modules/ace-builds/src-min/mode-markdown.js",
  39 + "node_modules/ace-builds/src-min/mode-html.js",
  40 + "node_modules/ace-builds/src-min/mode-css.js",
  41 + "node_modules/ace-builds/src-min/mode-json.js",
  42 + "node_modules/ace-builds/src-min/mode-java.js",
  43 + "node_modules/ace-builds/src-min/mode-javascript.js",
  44 + "node_modules/ace-builds/src-min/snippets/text.js",
  45 + "node_modules/ace-builds/src-min/snippets/markdown.js",
  46 + "node_modules/ace-builds/src-min/snippets/html.js",
  47 + "node_modules/ace-builds/src-min/snippets/css.js",
  48 + "node_modules/ace-builds/src-min/snippets/json.js",
  49 + "node_modules/ace-builds/src-min/snippets/java.js",
  50 + "node_modules/ace-builds/src-min/snippets/javascript.js",
  51 + { "bundleName": "worker-html", "input": "node_modules/ace-builds/src-min/worker-html.js" },
  52 + { "bundleName": "worker-css", "input": "node_modules/ace-builds/src-min/worker-css.js" },
  53 + { "bundleName": "worker-json", "input": "node_modules/ace-builds/src-min/worker-json.js" },
  54 + { "bundleName": "worker-javascript", "input": "node_modules/ace-builds/src-min/worker-javascript.js" }
  55 + ],
  56 + "es5BrowserSupport": true,
  57 + "customWebpackConfig": {
  58 + "path": "./extra-webpack.config.js"
  59 + }
  60 + },
  61 + "configurations": {
  62 + "production": {
  63 + "fileReplacements": [
  64 + {
  65 + "replace": "src/environments/environment.ts",
  66 + "with": "src/environments/environment.prod.ts"
  67 + }
  68 + ],
  69 + "optimization": true,
  70 + "outputHashing": "all",
  71 + "sourceMap": false,
  72 + "extractCss": true,
  73 + "namedChunks": false,
  74 + "aot": true,
  75 + "extractLicenses": true,
  76 + "vendorChunk": false,
  77 + "buildOptimizer": true,
  78 + "budgets": [
  79 + {
  80 + "type": "initial",
  81 + "maximumWarning": "2mb",
  82 + "maximumError": "5mb"
  83 + }
  84 + ]
  85 + }
  86 + }
  87 + },
  88 + "serve": {
  89 + "builder": "@angular-builders/dev-server:generic",
  90 + "options": {
  91 + "browserTarget": "thingsboard:build",
  92 + "proxyConfig": "proxy.conf.json"
  93 + },
  94 + "configurations": {
  95 + "production": {
  96 + "browserTarget": "thingsboard:build:production"
  97 + }
  98 + }
  99 + },
  100 + "extract-i18n": {
  101 + "builder": "@angular-devkit/build-angular:extract-i18n",
  102 + "options": {
  103 + "browserTarget": "thingsboard:build"
  104 + }
  105 + },
  106 + "test": {
  107 + "builder": "@angular-devkit/build-angular:karma",
  108 + "options": {
  109 + "main": "src/test.ts",
  110 + "polyfills": "src/polyfills.ts",
  111 + "tsConfig": "src/tsconfig.spec.json",
  112 + "karmaConfig": "src/karma.conf.js",
  113 + "styles": [
  114 + "src/styles.scss"
  115 + ],
  116 + "scripts": [],
  117 + "assets": [
  118 + "src/favicon.ico",
  119 + "src/assets"
  120 + ]
  121 + }
  122 + },
  123 + "lint": {
  124 + "builder": "@angular-devkit/build-angular:tslint",
  125 + "options": {
  126 + "tsConfig": [
  127 + "src/tsconfig.app.json",
  128 + "src/tsconfig.spec.json"
  129 + ],
  130 + "exclude": [
  131 + "**/node_modules/**"
  132 + ]
  133 + }
  134 + }
  135 + }
  136 + },
  137 + "thingsboard-e2e": {
  138 + "root": "e2e/",
  139 + "projectType": "application",
  140 + "prefix": "",
  141 + "architect": {
  142 + "e2e": {
  143 + "builder": "@angular-devkit/build-angular:protractor",
  144 + "options": {
  145 + "protractorConfig": "e2e/protractor.conf.js",
  146 + "devServerTarget": "thingsboard:serve"
  147 + },
  148 + "configurations": {
  149 + "production": {
  150 + "devServerTarget": "thingsboard:serve:production"
  151 + }
  152 + }
  153 + },
  154 + "lint": {
  155 + "builder": "@angular-devkit/build-angular:tslint",
  156 + "options": {
  157 + "tsConfig": "e2e/tsconfig.e2e.json",
  158 + "exclude": [
  159 + "**/node_modules/**"
  160 + ]
  161 + }
  162 + }
  163 + }
  164 + }
  165 + },
  166 + "defaultProject": "thingsboard"
  167 +}
  1 +/*
  2 + * Copyright © 2016-2019 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +// Protractor configuration file, see link for more information
  17 +// https://github.com/angular/protractor/blob/master/lib/config.ts
  18 +
  19 +const { SpecReporter } = require('jasmine-spec-reporter');
  20 +
  21 +exports.config = {
  22 + allScriptsTimeout: 11000,
  23 + specs: [
  24 + './src/**/*.e2e-spec.ts'
  25 + ],
  26 + capabilities: {
  27 + 'browserName': 'chrome'
  28 + },
  29 + directConnect: true,
  30 + baseUrl: 'http://localhost:4200/',
  31 + framework: 'jasmine',
  32 + jasmineNodeOpts: {
  33 + showColors: true,
  34 + defaultTimeoutInterval: 30000,
  35 + print: function() {}
  36 + },
  37 + onPrepare() {
  38 + require('ts-node').register({
  39 + project: require('path').join(__dirname, './tsconfig.e2e.json')
  40 + });
  41 + jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
  42 + }
  43 +};
  1 +///
  2 +/// Copyright © 2016-2019 The Thingsboard Authors
  3 +///
  4 +/// Licensed under the Apache License, Version 2.0 (the "License");
  5 +/// you may not use this file except in compliance with the License.
  6 +/// You may obtain a copy of the License at
  7 +///
  8 +/// http://www.apache.org/licenses/LICENSE-2.0
  9 +///
  10 +/// Unless required by applicable law or agreed to in writing, software
  11 +/// distributed under the License is distributed on an "AS IS" BASIS,
  12 +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 +/// See the License for the specific language governing permissions and
  14 +/// limitations under the License.
  15 +///
  16 +
  17 +import { AppPage } from './app.po';
  18 +import { browser, logging } from 'protractor';
  19 +
  20 +describe('workspace-project App', () => {
  21 + let page: AppPage;
  22 +
  23 + beforeEach(() => {
  24 + page = new AppPage();
  25 + });
  26 +
  27 + it('should display welcome message', () => {
  28 + page.navigateTo();
  29 + expect(page.getTitleText()).toEqual('Welcome to tb-license-server!');
  30 + });
  31 +
  32 + afterEach(async () => {
  33 + // Assert that there are no errors emitted from the browser
  34 + const logs = await browser.manage().logs().get(logging.Type.BROWSER);
  35 + expect(logs).not.toContain(jasmine.objectContaining({
  36 + level: logging.Level.SEVERE,
  37 + } as logging.Entry));
  38 + });
  39 +});
  1 +///
  2 +/// Copyright © 2016-2019 The Thingsboard Authors
  3 +///
  4 +/// Licensed under the Apache License, Version 2.0 (the "License");
  5 +/// you may not use this file except in compliance with the License.
  6 +/// You may obtain a copy of the License at
  7 +///
  8 +/// http://www.apache.org/licenses/LICENSE-2.0
  9 +///
  10 +/// Unless required by applicable law or agreed to in writing, software
  11 +/// distributed under the License is distributed on an "AS IS" BASIS,
  12 +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 +/// See the License for the specific language governing permissions and
  14 +/// limitations under the License.
  15 +///
  16 +
  17 +import { browser, by, element } from 'protractor';
  18 +
  19 +export class AppPage {
  20 + navigateTo() {
  21 + return browser.get(browser.baseUrl) as Promise<any>;
  22 + }
  23 +
  24 + getTitleText() {
  25 + return element(by.css('tb-root h1')).getText() as Promise<string>;
  26 + }
  27 +}
  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 +}
  1 +/*
  2 + * Copyright © 2016-2019 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +const CompressionPlugin = require('compression-webpack-plugin');
  17 +const webpack = require('webpack');
  18 +const dirTree = require('directory-tree');
  19 +
  20 +var langs = [];
  21 +
  22 +dirTree('./src/assets/locale/', {extensions:/\.json$/}, (item) => {
  23 + /* It is expected what the name of a locale file has the following format: */
  24 + /* 'locale.constant-LANG_CODE[_REGION_CODE].json', e.g. locale.constant-es.json or locale.constant-zh_CN.json*/
  25 + langs.push(item.name.slice(item.name.lastIndexOf('-') + 1, -5));
  26 +});
  27 +
  28 +module.exports = {
  29 + plugins: [
  30 + new webpack.DefinePlugin({
  31 + TB_VERSION: JSON.stringify(require('./package.json').version),
  32 + SUPPORTED_LANGS: JSON.stringify(langs)
  33 + }),
  34 + new CompressionPlugin({
  35 + filename: "[path].gz[query]",
  36 + algorithm: "gzip",
  37 + test: /\.js$|\.css$|\.svg$|\.ttf$|\.woff$|\.woff2$|\.eot$|\.json$/,
  38 + threshold: 10240,
  39 + minRatio: 0.8,
  40 + deleteOriginalAssets: false
  41 + })
  42 + ]
  43 +};