Commit 439a6fcf authored by Vitali Stupin's avatar Vitali Stupin
Browse files

Updating node packages, support for multiple instances, refactoring

parent ff845a4c
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"@angular-devkit/architect": { "@angular-devkit/architect": {
"version": "0.13.2", "version": "0.13.3",
"resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.13.2.tgz", "resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.13.3.tgz",
"integrity": "sha512-wcUdMzcpsxzscEa+wrhV1SE2PsHS6FnHJlRURFOtQmKvQAq3Y8gVw28l008SMt5d0bTrRV4xLL2lgvwJJoc7LA==", "integrity": "sha512-89VL75bq3+h3m0jhzWNqXqW+HQcrihnM3i6eiUE6P81LcllP159JMlusAvB1LHLNc6Cc62wTq4BJr7KDILkPOA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@angular-devkit/core": "7.3.2", "@angular-devkit/core": "7.3.3",
"rxjs": "6.3.3" "rxjs": "6.3.3"
}, },
"dependencies": { "dependencies": {
...@@ -26,16 +26,16 @@ ...@@ -26,16 +26,16 @@
} }
}, },
"@angular-devkit/build-angular": { "@angular-devkit/build-angular": {
"version": "0.13.2", "version": "0.13.3",
"resolved": "https://registry.npmjs.org/@angular-devkit/build-angular/-/build-angular-0.13.2.tgz", "resolved": "https://registry.npmjs.org/@angular-devkit/build-angular/-/build-angular-0.13.3.tgz",
"integrity": "sha512-zRrV/dknx8891XSjXTh5JcTZnX4h+YsCHi6u8GABnIZW9JyiCl9QZpv0mRIyGTEaK2udmfMo2Yp5qZo1sd8jeQ==", "integrity": "sha512-UxD6UR/tXypMA4lqCiXLtcStI4wuIHLOJLwADmazndFjg1oLqH1onO6UQPHJ1drAUl+AzA5zTQZHzWYokxaLtg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@angular-devkit/architect": "0.13.2", "@angular-devkit/architect": "0.13.3",
"@angular-devkit/build-optimizer": "0.13.2", "@angular-devkit/build-optimizer": "0.13.3",
"@angular-devkit/build-webpack": "0.13.2", "@angular-devkit/build-webpack": "0.13.3",
"@angular-devkit/core": "7.3.2", "@angular-devkit/core": "7.3.3",
"@ngtools/webpack": "7.3.2", "@ngtools/webpack": "7.3.3",
"ajv": "6.9.1", "ajv": "6.9.1",
"autoprefixer": "9.4.6", "autoprefixer": "9.4.6",
"circular-dependency-plugin": "5.0.2", "circular-dependency-plugin": "5.0.2",
...@@ -90,9 +90,9 @@ ...@@ -90,9 +90,9 @@
} }
}, },
"@angular-devkit/build-optimizer": { "@angular-devkit/build-optimizer": {
"version": "0.13.2", "version": "0.13.3",
"resolved": "https://registry.npmjs.org/@angular-devkit/build-optimizer/-/build-optimizer-0.13.2.tgz", "resolved": "https://registry.npmjs.org/@angular-devkit/build-optimizer/-/build-optimizer-0.13.3.tgz",
"integrity": "sha512-pM3t+6VD+gdcesgwuThR41DFdsZ9ZVQ97Hhr0JXHLbLyRt4eXxWi2+B5VL0jjAaX0RIiUIe8wgScwE6m/dxemg==", "integrity": "sha512-lxM1icVFy3jyoQfWEGW8TG1M7LTl/Djc98MFBYp/lXoVo2JZoLxy7eo51sRuJFaB7/0mgMP2gs0FcU/Lr4gK+Q==",
"dev": true, "dev": true,
"requires": { "requires": {
"loader-utils": "1.2.3", "loader-utils": "1.2.3",
...@@ -110,13 +110,13 @@ ...@@ -110,13 +110,13 @@
} }
}, },
"@angular-devkit/build-webpack": { "@angular-devkit/build-webpack": {
"version": "0.13.2", "version": "0.13.3",
"resolved": "https://registry.npmjs.org/@angular-devkit/build-webpack/-/build-webpack-0.13.2.tgz", "resolved": "https://registry.npmjs.org/@angular-devkit/build-webpack/-/build-webpack-0.13.3.tgz",
"integrity": "sha512-Uemur2KhFu7VGU2QQmfRiMwmoSKprZrMZRZXwZdCQPN5srIcMAgGjm1PGbZuCUddhwd2XRP9dKY6zOZpMzm84Q==", "integrity": "sha512-o2ymctVCuz5GhKJH3LO1sl3AUbA4j7zlrqSGB5ToVRBn3GckJJnmfCZzr2SX5Ya4VofxVsIidsiZcawy4FpB2w==",
"dev": true, "dev": true,
"requires": { "requires": {
"@angular-devkit/architect": "0.13.2", "@angular-devkit/architect": "0.13.3",
"@angular-devkit/core": "7.3.2", "@angular-devkit/core": "7.3.3",
"rxjs": "6.3.3" "rxjs": "6.3.3"
}, },
"dependencies": { "dependencies": {
...@@ -132,9 +132,9 @@ ...@@ -132,9 +132,9 @@
} }
}, },
"@angular-devkit/core": { "@angular-devkit/core": {
"version": "7.3.2", "version": "7.3.3",
"resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-7.3.2.tgz", "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-7.3.3.tgz",
"integrity": "sha512-W5KjkHRNVBcZRUNJamAn52IAj9Gl1zUjPA2r75JJK7k199xOA8UZqcIukQOgM1N7rwKCWht08i4FsdcTDghMhQ==", "integrity": "sha512-fosULDtMoDWrOyUzTmBkJccOy7zodo02kENyKai7vOv9EWfv9jytkVdNc+jl0ys9OE2QadvSYBo49jhnZxFXfQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"ajv": "6.9.1", "ajv": "6.9.1",
...@@ -190,9 +190,9 @@ ...@@ -190,9 +190,9 @@
} }
}, },
"@angular/animations": { "@angular/animations": {
"version": "7.2.6", "version": "7.2.7",
"resolved": "https://registry.npmjs.org/@angular/animations/-/animations-7.2.6.tgz", "resolved": "https://registry.npmjs.org/@angular/animations/-/animations-7.2.7.tgz",
"integrity": "sha512-ICKPS+bKabhQNqnPoVZegUAhgNPbVFlrxHoJ+ZZeVGxw5iBE8TnP3a2sRvakdMTKhykDlwVVGMKLxu2Y34uhmg==", "integrity": "sha512-eU/wSkBmukZXCCe/epUl02xsKPauF+deMbncxBE+w/NmmWjJ77Q09iZAcgzM92RVXj2LsVYQXsNEBGT3X0hRZw==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }
...@@ -253,25 +253,25 @@ ...@@ -253,25 +253,25 @@
} }
}, },
"@angular/common": { "@angular/common": {
"version": "7.2.6", "version": "7.2.7",
"resolved": "https://registry.npmjs.org/@angular/common/-/common-7.2.6.tgz", "resolved": "https://registry.npmjs.org/@angular/common/-/common-7.2.7.tgz",
"integrity": "sha512-jzWUgsgS0dmPy7yDHX4qCqVpt7ZZmHhApgkg5RkzTAlp+0cvZ/KsDpBgHXnZUIfmk/5g1/EtTbkbClgp1kCkIg==", "integrity": "sha512-U1l2CIcmpTAJMWcyTXI9qt1E8CxwKNW1vr6XWZo4X5ziCIzf7RvClzK7Ci5KZKkoPJrJqBJu661Q75Yt22dJsg==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }
}, },
"@angular/compiler": { "@angular/compiler": {
"version": "7.2.6", "version": "7.2.7",
"resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-7.2.6.tgz", "resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-7.2.7.tgz",
"integrity": "sha512-GXdvgH8oxK8HRh/FelN3U5p0tsTUwGh8b/iuuJKaunBSSDDjIy7pPnn3zT+lN4YeEi6qN1XWudt+HpWHYHyymg==", "integrity": "sha512-e61YVxW5x4w+X4yjGaptYoJIja7HwH0+8FFEaH6VuPl/DrK8wP4HDMhLo4NzdgeZKLR2jBIQSqLmoM8W7UXcqw==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }
}, },
"@angular/compiler-cli": { "@angular/compiler-cli": {
"version": "7.2.6", "version": "7.2.7",
"resolved": "https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-7.2.6.tgz", "resolved": "https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-7.2.7.tgz",
"integrity": "sha512-sB0Bc5hE1zoXKwK4E9pC/UblCEHi3CwLBT/1nmVMYBdGzSSUxO4FaioJi+SCeGJJ+kk85Vny2up08gnupmLKqA==", "integrity": "sha512-UPWROJzBLejgNf+aqgEUXYts8UiFOl2IavDhS/olA9irszv2lNFj9Yqr8OKdy0jK/lKaipZog3VZEx8g5dNeBA==",
"dev": true, "dev": true,
"requires": { "requires": {
"canonical-path": "1.0.0", "canonical-path": "1.0.0",
...@@ -501,47 +501,47 @@ ...@@ -501,47 +501,47 @@
} }
}, },
"@angular/core": { "@angular/core": {
"version": "7.2.6", "version": "7.2.7",
"resolved": "https://registry.npmjs.org/@angular/core/-/core-7.2.6.tgz", "resolved": "https://registry.npmjs.org/@angular/core/-/core-7.2.7.tgz",
"integrity": "sha512-MZg17DWH1KUoDa9wFYK9Z+3F7DnUW2DjSwGyIi9U4cB54IWFhgt1JsA0mcuSYuRSRpvwaArCDC2AN90f+0/EFA==", "integrity": "sha512-E7qjMQdS77SbRROKu13VsfL+MJN52eTlrU0SzEAFGUOgdvbmDYJOaEwjqrouKpYZ0pul8KOoalvlPB7oVflC7A==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }
}, },
"@angular/forms": { "@angular/forms": {
"version": "7.2.6", "version": "7.2.7",
"resolved": "https://registry.npmjs.org/@angular/forms/-/forms-7.2.6.tgz", "resolved": "https://registry.npmjs.org/@angular/forms/-/forms-7.2.7.tgz",
"integrity": "sha512-At72AJNGe+Zzmryb7DDIG+iws7zKdgZx/eEVjZ/Obu/yREefbZY4R7q83U90Vljtn97BwJPx9ur9ttxE9WpnlA==", "integrity": "sha512-2gBs+BG2cMPsHq9JVEzmu2Ev539zjfHmr6cna2W38KLXeGbNf42rbbMUXpYD8cndY0QTYcnwfMpRNIl9zKRZnw==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }
}, },
"@angular/language-service": { "@angular/language-service": {
"version": "7.2.6", "version": "7.2.7",
"resolved": "https://registry.npmjs.org/@angular/language-service/-/language-service-7.2.6.tgz", "resolved": "https://registry.npmjs.org/@angular/language-service/-/language-service-7.2.7.tgz",
"integrity": "sha512-iFKgaat5MZlixsO5dqy1Km3tb4q3iAU+ZPMJCk7DN419aizF38UFnQY1gCYkw3dxZLZGIkXnwy8szGXUEhra/A==", "integrity": "sha512-d3iCBpOfgLNSGMrtqZvN6NHZIEnKD2MV8Hz4WsRLU4WY0RbshZj5dqx2nO3YRT2tACpAvhWBQoYvtLpTCPzsMA==",
"dev": true "dev": true
}, },
"@angular/platform-browser": { "@angular/platform-browser": {
"version": "7.2.6", "version": "7.2.7",
"resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-7.2.6.tgz", "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-7.2.7.tgz",
"integrity": "sha512-VE4yS4l8Cdx6DlvrbOFOZDKmQuyz1RhVcshgSt9hKlkehvAXMtX8Sqnp6po7z0aPykTh0TZZtMtLEerkFEe+DA==", "integrity": "sha512-9C3ffZs0ZUw+dYg1oJKiONf64UKTdAzIOaTQXTrVrCa3oN7Jb2tUfmpenmB+ATRxwhL2n7Yi725YWwxY2FwqvQ==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }
}, },
"@angular/platform-browser-dynamic": { "@angular/platform-browser-dynamic": {
"version": "7.2.6", "version": "7.2.7",
"resolved": "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-7.2.6.tgz", "resolved": "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-7.2.7.tgz",
"integrity": "sha512-/co/q4v11nKin2MFscCMZyixbW103I2FxbPgCAYBN5NSvfIwTrt5J6xWmDoKJ8HkZBqL3R9B+uhYdzsRN/pQxg==", "integrity": "sha512-3nlcwCZOzlKw/4CMJ4zy1JEVy8Ky4KyLRRePLledOMdsGbuDIoq/kyAnBzg295Xe9ovBxv8cmuSkShci+s/x8g==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }
}, },
"@angular/router": { "@angular/router": {
"version": "7.2.6", "version": "7.2.7",
"resolved": "https://registry.npmjs.org/@angular/router/-/router-7.2.6.tgz", "resolved": "https://registry.npmjs.org/@angular/router/-/router-7.2.7.tgz",
"integrity": "sha512-ayMVor4Mu4wk7JKpt51UxHovnLB4munZ8ELR1CA4w+s0rJsSSwyB4WXElC+DbgCyl7BYLAaGui2c5DbTAJ9jlw==", "integrity": "sha512-59+M8+IH7V2NPPqWw2mwdg+kh/jfwQcXE0tB8iZ5V2ldACPucY/Td6qiT5H6t7EkELtvkKJwS6vKFV22qdRp3w==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }
...@@ -707,12 +707,12 @@ ...@@ -707,12 +707,12 @@
} }
}, },
"@ngtools/webpack": { "@ngtools/webpack": {
"version": "7.3.2", "version": "7.3.3",
"resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-7.3.2.tgz", "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-7.3.3.tgz",
"integrity": "sha512-q98nt7HUTcdEtP+aJjsm5HUMDL+BXwLz80TthtFlu/f7JYdKxMSWZRHEv+q8Rs69pWMpwxj8RuHm8XiKD/8Cpg==", "integrity": "sha512-G/1P00XHWVrKT3qoSyy7yAPT5/fuja84YifcGg/2SwmNNo4hTXxWhqec0/uHwgQr6nYhGDyzwwXYeKKyQkcfgw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@angular-devkit/core": "7.3.2", "@angular-devkit/core": "7.3.3",
"enhanced-resolve": "4.1.0", "enhanced-resolve": "4.1.0",
"rxjs": "6.3.3", "rxjs": "6.3.3",
"tree-kill": "1.2.1", "tree-kill": "1.2.1",
...@@ -1081,9 +1081,9 @@ ...@@ -1081,9 +1081,9 @@
} }
}, },
"acorn": { "acorn": {
"version": "6.1.0", "version": "6.1.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.1.0.tgz", "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.1.1.tgz",
"integrity": "sha512-MW/FjM+IvU9CgBzjO3UIPCE2pyEwUsoFl+VGdczOPEdxfGFjuKny/gN54mOuX7Qxmb9Rg9MCn2oKiSUeW+pjrw==", "integrity": "sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA==",
"dev": true "dev": true
}, },
"acorn-dynamic-import": { "acorn-dynamic-import": {
...@@ -1878,14 +1878,14 @@ ...@@ -1878,14 +1878,14 @@
} }
}, },
"browserslist": { "browserslist": {
"version": "4.4.1", "version": "4.4.2",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.4.1.tgz", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.4.2.tgz",
"integrity": "sha512-pEBxEXg7JwaakBXjATYw/D1YZh4QUSCX/Mnd/wnqSRPPSi1U39iDhDoKGoBUcraKdxDlrYqJxSI5nNvD+dWP2A==", "integrity": "sha512-ISS/AIAiHERJ3d45Fz0AVYKkgcy+F/eJHzKEvv1j0wwKGKD9T3BrwKr/5g45L+Y4XIK5PlTqefHciRFcfE1Jxg==",
"dev": true, "dev": true,
"requires": { "requires": {
"caniuse-lite": "^1.0.30000929", "caniuse-lite": "^1.0.30000939",
"electron-to-chromium": "^1.3.103", "electron-to-chromium": "^1.3.113",
"node-releases": "^1.1.3" "node-releases": "^1.1.8"
} }
}, },
"browserstack": { "browserstack": {
...@@ -2035,9 +2035,9 @@ ...@@ -2035,9 +2035,9 @@
} }
}, },
"caniuse-lite": { "caniuse-lite": {
"version": "1.0.30000938", "version": "1.0.30000939",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000938.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000939.tgz",
"integrity": "sha512-ekW8NQ3/FvokviDxhdKLZZAx7PptXNwxKgXtnR5y+PR3hckwuP3yJ1Ir+4/c97dsHNqtAyfKUGdw8P4EYzBNgw==", "integrity": "sha512-oXB23ImDJOgQpGjRv1tCtzAvJr4/OvrHi5SO2vUgB0g0xpdZZoA/BxfImiWfdwoYdUTtQrPsXsvYU/dmCSM8gg==",
"dev": true "dev": true
}, },
"canonical-path": { "canonical-path": {
...@@ -6926,9 +6926,9 @@ ...@@ -6926,9 +6926,9 @@
} }
}, },
"on-headers": { "on-headers": {
"version": "1.0.1", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.1.tgz", "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz",
"integrity": "sha1-ko9dD0cNSTQmUepnlLCFfBAGk/c=", "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==",
"dev": true "dev": true
}, },
"once": { "once": {
......
...@@ -11,14 +11,14 @@ ...@@ -11,14 +11,14 @@
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@angular/animations": "~7.2.0", "@angular/animations": "^7.2.7",
"@angular/common": "~7.2.0", "@angular/common": "^7.2.7",
"@angular/compiler": "~7.2.0", "@angular/compiler": "^7.2.7",
"@angular/core": "~7.2.0", "@angular/core": "^7.2.7",
"@angular/forms": "~7.2.0", "@angular/forms": "^7.2.7",
"@angular/platform-browser": "~7.2.0", "@angular/platform-browser": "^7.2.7",
"@angular/platform-browser-dynamic": "~7.2.0", "@angular/platform-browser-dynamic": "^7.2.7",
"@angular/router": "~7.2.0", "@angular/router": "^7.2.7",
"bootstrap": "^4.3.1", "bootstrap": "^4.3.1",
"core-js": "^2.5.4", "core-js": "^2.5.4",
"rxjs": "~6.4.0", "rxjs": "~6.4.0",
...@@ -26,13 +26,13 @@ ...@@ -26,13 +26,13 @@
"zone.js": "~0.8.26" "zone.js": "~0.8.26"
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "~0.13.0", "@angular-devkit/build-angular": "^0.13.3",
"@angular/cli": "~7.3.3", "@angular/cli": "~7.3.3",
"@angular/compiler-cli": "~7.2.0", "@angular/compiler-cli": "^7.2.7",
"@angular/language-service": "~7.2.0", "@angular/language-service": "^7.2.7",
"@types/node": "~8.9.4",
"@types/jasmine": "~2.8.8", "@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3", "@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.5.0", "codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1", "jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1", "jasmine-spec-reporter": "~4.2.1",
......
...@@ -5,7 +5,8 @@ import { SubsystemComponent } from './subsystem/subsystem.component'; ...@@ -5,7 +5,8 @@ import { SubsystemComponent } from './subsystem/subsystem.component';
const routes: Routes = [ const routes: Routes = [
{ path: '', component: SubsystemListComponent }, { path: '', component: SubsystemListComponent },
{ path: 'subsystem/:id', component: SubsystemComponent }, { path: ':instance', component: SubsystemListComponent },
{ path: ':instance/:class/:member/:subsystem', component: SubsystemComponent },
]; ];
@NgModule({ @NgModule({
......
...@@ -9,7 +9,6 @@ import { SearchComponent } from './search/search.component'; ...@@ -9,7 +9,6 @@ import { SearchComponent } from './search/search.component';
import { SubsystemItemComponent } from './subsystem-list/subsystem-item/subsystem-item.component'; import { SubsystemItemComponent } from './subsystem-list/subsystem-item/subsystem-item.component';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
import { SubsystemComponent } from './subsystem/subsystem.component'; import { SubsystemComponent } from './subsystem/subsystem.component';
import { MessageComponent } from './message/message.component';
@NgModule({ @NgModule({
declarations: [ declarations: [
...@@ -17,8 +16,7 @@ import { MessageComponent } from './message/message.component'; ...@@ -17,8 +16,7 @@ import { MessageComponent } from './message/message.component';
SubsystemListComponent, SubsystemListComponent,
SearchComponent, SearchComponent,
SubsystemItemComponent, SubsystemItemComponent,
SubsystemComponent, SubsystemComponent
MessageComponent
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
......
<div class="alert alert-warning" role="alert" *ngIf="message">
{{message}}
</div>
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MessageComponent } from './message.component';
describe('MessageComponent', () => {
let component: MessageComponent;
let fixture: ComponentFixture<MessageComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ MessageComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(MessageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { MethodsService } from '../methods.service';
@Component({
selector: 'app-message',
templateUrl: './message.component.html',
styleUrls: ['./message.component.css']
})
export class MessageComponent implements OnInit {
message: string = ''
constructor(private methodsService: MethodsService) { }
ngOnInit() {
// Service will tell when updated data is available!
this.methodsService.newMessage.subscribe(signal => {
this.message = signal;
});
// This line must be after subscription (data may be changed while we start subscription)
this.message = this.methodsService.getMessage();
}
}
...@@ -6,38 +6,33 @@ import { Subsystem } from './subsystem'; ...@@ -6,38 +6,33 @@ import { Subsystem } from './subsystem';
import { Method } from './method'; import { Method } from './method';
const MAX_LIMIT: number = 1000000; const MAX_LIMIT: number = 1000000;
const CONFIG = {
'EE': 'https://www.x-tee.ee/catalogue/EE/wsdls/',
'ee-test': 'https://www.x-tee.ee/catalogue/ee-test/wsdls/',
'ee-dev': 'https://www.x-tee.ee/catalogue/ee-dev/wsdls/'
}
const API_SERVICE = 'index.json';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class MethodsService { export class MethodsService {
private apiUrlBase = 'https://www.x-tee.ee/catalogue/EE/wsdls/'; private apiUrlBase = '';
//public apiUrlBase = 'http://localhost/';
private limit: number = 10; private limit: number = 10;
private offset: number = 0; private offset: number = 0;
private nonEmpty: boolean = false; private nonEmpty: boolean = false;
private filter: string = ""; private filter: string = "";
private apiService = 'index.json';
private apiUrl = this.apiUrlBase + this.apiService;
private subsystems: Subsystem[] = []; private subsystems: Subsystem[] = [];
private loadingDone: boolean = false; private loadingDone: boolean = false;
private lastMessage: string = ''; private loadingError: boolean = false;
private instance: string = '';
private instanceData = new Object();
@Output() subsystemsUpdated: EventEmitter<any> = new EventEmitter(); @Output() subsystemsUpdated: EventEmitter<any> = new EventEmitter();
@Output() newMessage: EventEmitter<string> = new EventEmitter(); @Output() warnings: EventEmitter<string> = new EventEmitter();
constructor(private http: HttpClient) { constructor(private http: HttpClient) {}
this.http.get<Subsystem[]>(this.apiUrl)
.pipe(
catchError(this.handleError('getMethods', []))
).subscribe(subsystems => {
this.subsystems = subsystems;
this.setFullNames();
this.loadingDone = true;
this.signalRefresh();
})
}
private signalRefresh() { private signalRefresh() {
this.subsystemsUpdated.emit(null); this.subsystemsUpdated.emit(null);
...@@ -112,14 +107,54 @@ export class MethodsService { ...@@ -112,14 +107,54 @@ export class MethodsService {
*/ */
private handleError<T> (operation = 'operation', result?: T) { private handleError<T> (operation = 'operation', result?: T) {
return (error: any): Observable<T> => { return (error: any): Observable<T> => {
this.lastMessage = 'Error loading data!' this.loadingError = true
this.newMessage.emit(this.lastMessage); this.emitWarning('Error while loading data from server!')
// Let the app keep running by returning an empty result. // Let the app keep running by returning an empty result.
return of(result as T); return of(result as T);
}; };
} }
getDefaultInstance(): string {
return Object.keys(CONFIG)[0]