Skip to content

Commit

Permalink
Merge pull request absmach#25 from manuio/versions
Browse files Browse the repository at this point in the history
NOISSUE - Simplify version urls
  • Loading branch information
drasko authored Jan 6, 2020
2 parents c6892da + f1b8720 commit b428b6d
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 113 deletions.
74 changes: 18 additions & 56 deletions proxy-config.json
Original file line number Diff line number Diff line change
@@ -1,60 +1,4 @@
{
"/things/version": {
"target": "http://localhost:8182",
"secure": false,
"pathRewrite": {
"^/things": ""
}
},
"/users/version": {
"target": "http://localhost:8180",
"secure": false,
"pathRewrite": {
"^/users": ""
}
},
"/normalizer/version": {
"target": "http://localhost:8184",
"secure": false,
"pathRewrite": {
"^/normalizer": ""
}
},
"/http/version": {
"target": "http://localhost:8185",
"secure": false,
"pathRewrite": {
"^/http": ""
}
},
"/ws/version": {
"target": "http://localhost:8186",
"secure": false,
"pathRewrite": {
"^/ws": ""
}
},
"/writer/channels/*": {
"target": "http://localhost:8185",
"secure": false,
"pathRewrite": {
"^/writer": ""
}
},
"/reader/version": {
"target": "http://localhost:8905",
"secure": false,
"pathRewrite": {
"^/reader": ""
}
},
"/reader/channels/*": {
"target": "http://localhost:8905",
"secure": false,
"pathRewrite": {
"^/reader": ""
}
},
"/password/*": {
"target": "http://localhost:8180",
"secure": false
Expand All @@ -63,6 +7,10 @@
"target": "http://localhost:8180",
"secure": false
},
"/version": {
"target": "http://localhost:8180",
"secure": false
},
"/tokens": {
"target": "http://localhost:8180",
"secure": false
Expand All @@ -79,6 +27,20 @@
"target": "http://localhost:8182",
"secure": false
},
"/writer/channels/*": {
"target": "http://localhost:8185",
"secure": false,
"pathRewrite": {
"^/writer": ""
}
},
"/reader/channels/*": {
"target": "http://localhost:8905",
"secure": false,
"pathRewrite": {
"^/reader": ""
}
},
"/bootstrap/*": {
"target": "http://localhost:8202",
"secure": false,
Expand Down
1 change: 0 additions & 1 deletion src/app/auth/auth.token.interceptor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export class TokenInterceptor implements HttpInterceptor {
if (err instanceof HttpErrorResponse &&
!request.url.startsWith(environment.writerChannelsUrl) &&
!request.url.startsWith(environment.readerChannelsUrl) &&
!request.url.startsWith(environment.readerVersionUrl) &&
!request.url.startsWith(environment.bootstrapUrl) &&
(err.status === 403 || err.status === 504)) {
localStorage.removeItem('auth_app_token');
Expand Down
25 changes: 0 additions & 25 deletions src/app/common/services/versions/versions.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,4 @@ export class VersionsService {
getUsersVersion() {
return this.http.get(environment.usersVersionUrl);
}

getThingsVersion() {
return this.http.get(environment.thingsVersionUrl);
}

getNormalizerVersion() {
return this.http.get(environment.normalizerVersionUrl);
}

getHTTPVersion() {
return this.http.get(environment.httpVersionUrl);
}

getWebsocketVersion() {
return this.http.get(environment.websocketVersionUrl);
}

getWriterVersion() {
return this.http.get(environment.writerVersionUrl);
}

getReaderVersion() {
return this.http.get(environment.readerVersionUrl);
}

}
2 changes: 1 addition & 1 deletion src/app/pages/dashboard/dashboard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class DashboardComponent implements OnInit {
},
);

this.versionsService.getThingsVersion().subscribe(
this.versionsService.getUsersVersion().subscribe(
(resp: any) => {
this.version = resp.version;
},
Expand Down
2 changes: 0 additions & 2 deletions src/app/pages/things/opcua/opcua.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@
<nb-card-header>
{{ opcuaNodes.length }} &nbsp; OPC-UA Server Subscription
</nb-card-header>
</nb-card>

<nb-card>
<nb-card-body>
<ng2-smart-table [settings]="settings"
[source]="source"
Expand Down
16 changes: 2 additions & 14 deletions src/app/shared/map/leaflet/map.leaflet.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Component, Input, OnChanges } from '@angular/core';
import { MessagesService } from 'app/common/services/messages/messages.service';
import { NotificationsService } from 'app/common/services/notifications/notifications.service';
import * as L from 'leaflet';
import { VersionsService } from 'app/common/services/versions/versions.service';
import { MqttService, IMqttMessage } from 'ngx-mqtt';
import { Gateway } from 'app/common/interfaces/gateway.interface';

Expand All @@ -15,7 +14,6 @@ import { Gateway } from 'app/common/interfaces/gateway.interface';
export class MapComponent implements OnChanges {
map: L.Map;
markersGroup = new L.LayerGroup();
msgServiceON = false;

options = {
layers: [
Expand Down Expand Up @@ -50,18 +48,8 @@ export class MapComponent implements OnChanges {
constructor(
private msgService: MessagesService,
private notificationsService: NotificationsService,
private versionService: VersionsService,
private mqttService: MqttService,
) {
this.versionService.getReaderVersion().subscribe(
resp => {
this.msgServiceON = true;
},
err => {
this.msgServiceON = false;
},
);
}
) {}

addMarker(lon, lat, gw: Gateway) {
const msg = `
Expand Down Expand Up @@ -93,7 +81,7 @@ export class MapComponent implements OnChanges {
}

ngOnChanges() {
if (this.gateways && this.msgServiceON) {
if (this.gateways) {
this.gateways.forEach((gw) => {
const key: string = gw.key ? gw.key : '';
const channelID: string = gw.metadata ? gw.metadata.dataChannelID : '';
Expand Down
8 changes: 1 addition & 7 deletions src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
export const environment = {
production: true,
usersUrl: '/users',
usersVersionUrl: '/version',
loginUrl: '/tokens',
requestPassUrl: '/password/reset-request',
resetPassUrl: '/password/reset',
Expand All @@ -17,14 +18,7 @@ export const environment = {
connectUrl: '/connect',
browseUrl: '/browse',

usersVersionUrl: '/users/version',
thingsVersionUrl: '/things/version',
normalizerVersionUrl: '/normalizer/version',
httpVersionUrl: '/http/version',
websocketVersionUrl: '/ws/version',
writerVersionUrl: '/writer/version',
writerChannelsUrl: '/writer/channels',
readerVersionUrl: '/reader/version',
readerChannelsUrl: '/reader/channels',

grafanaHome: 'http://localhost:3001/?orgId=1&kiosk',
Expand Down
8 changes: 1 addition & 7 deletions src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
export const environment = {
production: false,
usersUrl: '/users',
usersVersionUrl: '/version',
loginUrl: '/tokens',
requestPassUrl: '/password/reset-request',
resetPassUrl: '/password/reset',
Expand All @@ -22,14 +23,7 @@ export const environment = {
connectUrl: '/connect',
browseUrl: '/browse',

usersVersionUrl: '/users/version',
thingsVersionUrl: '/things/version',
normalizerVersionUrl: '/normalizer/version',
httpVersionUrl: '/http/version',
websocketVersionUrl: '/ws/version',
writerVersionUrl: '/writer/version',
writerChannelsUrl: '/writer/channels',
readerVersionUrl: '/reader/version',
readerChannelsUrl: '/reader/channels',

grafanaHome: 'http://localhost:3001/?orgId=1&kiosk',
Expand Down

0 comments on commit b428b6d

Please sign in to comment.