+
{{ total }} states of {{ twin.name }}
+
from:
to:
diff --git a/src/app/pages/admin/twins/states/twins.states.component.scss b/src/app/pages/admin/twins/states/twins.states.component.scss
index feecb8c2..e988af47 100644
--- a/src/app/pages/admin/twins/states/twins.states.component.scss
+++ b/src/app/pages/admin/twins/states/twins.states.component.scss
@@ -1,3 +1,3 @@
-.col-10 {
+.col-md-10 {
text-align: right;
}
diff --git a/src/app/pages/admin/twins/states/twins.states.component.ts b/src/app/pages/admin/twins/states/twins.states.component.ts
index 5383ce78..c8e402f1 100644
--- a/src/app/pages/admin/twins/states/twins.states.component.ts
+++ b/src/app/pages/admin/twins/states/twins.states.component.ts
@@ -145,4 +145,5 @@ export class TwinsStatesComponent implements OnInit, OnDestroy {
ngOnDestroy() {
window.clearInterval(this.intervalID);
}
+
}
diff --git a/src/app/pages/admin/twins/twins.component.html b/src/app/pages/admin/twins/twins.component.html
index a9fe02c3..5fda3543 100644
--- a/src/app/pages/admin/twins/twins.component.html
+++ b/src/app/pages/admin/twins/twins.component.html
@@ -1,21 +1,36 @@
-
-
-
-
+
+
+
+
{{ twinsNumber }} Twins
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+ (deleteConfirm)="onDeleteConfirm($event)">
diff --git a/src/app/pages/admin/twins/twins.component.scss b/src/app/pages/admin/twins/twins.component.scss
index e69de29b..e90dce65 100644
--- a/src/app/pages/admin/twins/twins.component.scss
+++ b/src/app/pages/admin/twins/twins.component.scss
@@ -0,0 +1,7 @@
+nb-card-header {
+ text-align: center;
+}
+
+button {
+ width: 100%;
+}
diff --git a/src/app/pages/admin/twins/twins.component.ts b/src/app/pages/admin/twins/twins.component.ts
index acdd023c..5134e807 100644
--- a/src/app/pages/admin/twins/twins.component.ts
+++ b/src/app/pages/admin/twins/twins.component.ts
@@ -8,9 +8,9 @@ import { ConfirmationComponent } from 'app/shared/confirmation/confirmation.comp
import { DetailsComponent } from 'app/shared/details/details.component';
import { TwinsService } from 'app/common/services/twins/twins.service';
+import { FsService } from 'app/common/services/fs/fs.service';
import { Twin } from 'app/common/interfaces/mainflux.interface';
-
@Component({
selector: 'ngx-twins',
templateUrl: './twins.component.html',
@@ -35,23 +35,42 @@ export class TwinsComponent implements OnInit {
confirmDelete: true,
},
columns: {
+ details: {
+ type: 'custom',
+ renderComponent: DetailsComponent,
+ valuePrepareFunction: (cell, row) => {
+ return row;
+ },
+ editable: false,
+ addable: false,
+ filter: false,
+ },
name: {
title: 'Name',
editable: true,
addable: true,
+ filter: false,
},
- id: {
- title: 'ID',
+ created: {
+ title: 'Created',
editable: false,
addable: false,
+ filter: false,
+ valuePrepareFunction: (cell, row) => {
+ return new Date(cell).toLocaleString();
+ },
},
- details: {
- title: 'Details',
- type: 'custom',
- renderComponent: DetailsComponent,
+ updated: {
+ title: 'Updated',
+ editable: false,
+ addable: false,
+ filter: false,
valuePrepareFunction: (cell, row) => {
- return row;
+ return new Date(cell).toLocaleString();
},
+ },
+ revision: {
+ title: 'Revision',
editable: false,
addable: false,
filter: false,
@@ -68,9 +87,12 @@ export class TwinsComponent implements OnInit {
twinsNumber = 0;
+ searchTime = 0;
+
constructor(
private dialogService: NbDialogService,
private twinsService: TwinsService,
+ private fsService: FsService,
) { }
ngOnInit() {
@@ -104,6 +126,8 @@ export class TwinsComponent implements OnInit {
onEditConfirm(event): void {
// close edditable row
event.confirm.resolve();
+
+ this.twinsService.editTwin(event.newData).subscribe();
}
onDeleteConfirm(event): void {
@@ -122,6 +146,13 @@ export class TwinsComponent implements OnInit {
);
}
- onSelection(event): void {
+ onSaveFile() {
+ this.fsService.exportToCsv('twins.csv', this.twins);
+ }
+
+ onFileSelected(files: FileList) {
+ }
+
+ searchThing(input) {
}
}
diff --git a/src/app/pages/dashboard/dashboard.component.html b/src/app/pages/dashboard/dashboard.component.html
index 6c8b5ca4..b0e5a8c9 100644
--- a/src/app/pages/dashboard/dashboard.component.html
+++ b/src/app/pages/dashboard/dashboard.component.html
@@ -10,7 +10,7 @@
- {{ thingsNumber }} Things
+ {{ thingsNum }} Things
@@ -18,7 +18,7 @@
- {{ totalChanNumber }} Channels
+ {{ chansNum }} Channels
diff --git a/src/app/pages/dashboard/dashboard.component.ts b/src/app/pages/dashboard/dashboard.component.ts
index d2a5fc8b..93f721ae 100644
--- a/src/app/pages/dashboard/dashboard.component.ts
+++ b/src/app/pages/dashboard/dashboard.component.ts
@@ -1,6 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { VersionsService } from 'app/common/services/versions/versions.service';
+import { UsersService } from 'app/common/services/users/users.service';
import { ThingsService } from 'app/common/services/things/things.service';
import { LoraService } from 'app/common/services/lora/lora.service';
import { ChannelsService } from 'app/common/services/channels/channels.service';
@@ -14,15 +15,12 @@ import { Router } from '@angular/router';
})
export class DashboardComponent implements OnInit {
version: number;
- addons = [];
- thingsNumber = 0;
+
+ thingsNum = 0;
gatewaysNumber = 0;
loraDevNumber = 0;
- totalChanNumber = 0;
- options: any = {};
+ chansNum = 0;
gateways = [];
- offset = 0;
- limit = 20;
messages = [];
messages2 = [];
@@ -32,51 +30,57 @@ export class DashboardComponent implements OnInit {
private thingsService: ThingsService,
private loraService: LoraService,
private channelsService: ChannelsService,
+ private usersService: UsersService,
private router: Router,
) { }
ngOnInit() {
- this.thingsService.getThings(this.offset, this.limit).subscribe(
- (resp: any) => {
- this.thingsNumber = resp.total;
- },
- );
+ // If Token is valid
+ this.usersService.getUser().subscribe(
+ respUser => {
+ this.thingsService.getThings().subscribe(
+ (resp: any) => {
+ this.thingsNum = resp.total;
+ },
+ );
- this.loraService.getDevices(this.offset, this.limit).subscribe(
- (resp: any) => {
- this.loraDevNumber = resp.total;
- },
- );
+ this.loraService.getDevices().subscribe(
+ (resp: any) => {
+ this.loraDevNumber = resp.total;
+ },
+ );
- this.gatewaysService.getGateways(this.offset, this.limit).subscribe(
- (resp: any) => {
- this.gatewaysNumber = resp.total;
- this.gateways = resp.things;
- },
- );
+ this.gatewaysService.getGateways().subscribe(
+ (resp: any) => {
+ this.gatewaysNumber = resp.total;
+ this.gateways = resp.things;
+ },
+ );
- this.channelsService.getChannels(this.offset, this.limit).subscribe(
- (resp: any) => {
- this.totalChanNumber = resp.total;
- },
- );
+ this.channelsService.getChannels().subscribe(
+ (resp: any) => {
+ this.chansNum = resp.total;
+ },
+ );
- this.versionsService.getUsersVersion().subscribe(
- (resp: any) => {
- this.version = resp.version;
+ this.versionsService.getUsersVersion().subscribe(
+ (resp: any) => {
+ this.version = resp.version;
+ },
+ );
+
+ for (let i = 0; i < 61; i++) {
+ const vGas = 125 + 5 * Math.random();
+ const vPress = 1 + 0.1 * Math.random();
+ const vTemp = 25 + 1 * Math.random();
+ const vHum = 45 + 20 * Math.random();
+ this.messages.push({time: i, value: vTemp, publisher: 'mock', name: 'temperature'});
+ this.messages.push({time: i, value: vHum, publisher: 'mock2', name: 'humidity'});
+ this.messages.push({time: i, value: vPress, publisher: 'mock3', name: 'pressure'});
+ this.messages.push({time: i, value: vGas, publisher: 'mock4', name: 'gas'});
+ }
},
);
-
- for (let i = 0; i < 61; i++) {
- const vGas = 125 + 5 * Math.random();
- const vPress = 1 + 0.1 * Math.random();
- const vTemp = 25 + 1 * Math.random();
- const vHum = 45 + 20 * Math.random();
- this.messages.push({time: i, value: vTemp, publisher: 'mock', name: 'temperature'});
- this.messages.push({time: i, value: vHum, publisher: 'mock2', name: 'humidity'});
- this.messages.push({time: i, value: vPress, publisher: 'mock3', name: 'pressure'});
- this.messages.push({time: i, value: vGas, publisher: 'mock4', name: 'gas'});
- }
}
toThingsList() {
diff --git a/src/app/pages/login/login.component.html b/src/app/pages/login/login.component.html
new file mode 100644
index 00000000..92d717a7
--- /dev/null
+++ b/src/app/pages/login/login.component.html
@@ -0,0 +1,106 @@
+
Sign In
+
Hello! Sign in with your username or email.
+
+
+ Oh snap!
+
+
+
+
+ Hooray!
+
+
+
+
+
+
0" class="links" aria-label="Social sign in">
+ Or connect with:
+
+
+
+
diff --git a/src/app/pages/login/login.component.ts b/src/app/pages/login/login.component.ts
new file mode 100644
index 00000000..39667e54
--- /dev/null
+++ b/src/app/pages/login/login.component.ts
@@ -0,0 +1,20 @@
+import { Component, ChangeDetectorRef, Inject } from '@angular/core';
+
+import { NbAuthService, NB_AUTH_OPTIONS, NbLoginComponent } from '@nebular/auth';
+import { Router } from '@angular/router';
+
+@Component({
+ selector: 'ngx-login',
+ templateUrl: 'login.component.html',
+})
+export class LoginComponent extends NbLoginComponent {
+
+ constructor(
+ @Inject(NB_AUTH_OPTIONS) protected options: {},
+ protected authService: NbAuthService,
+ protected cd: ChangeDetectorRef,
+ protected router: Router,
+ ) {
+ super(authService, options, cd, router);
+ }
+}
diff --git a/src/app/pages/things/channels/channels.component.html b/src/app/pages/things/channels/channels.component.html
index 8ea3d17a..ebd25426 100644
--- a/src/app/pages/things/channels/channels.component.html
+++ b/src/app/pages/things/channels/channels.component.html
@@ -1,21 +1,21 @@
-
- {{ totalChanNumber }} Channels
+
+ {{ chansNum }} Channels
-
+
-
+
-
+
-
+
{{con.name}}
-
+
diff --git a/src/app/pages/things/channels/details/channels.details.component.scss b/src/app/pages/things/channels/details/channels.details.component.scss
index 710e4662..da771879 100644
--- a/src/app/pages/things/channels/details/channels.details.component.scss
+++ b/src/app/pages/things/channels/details/channels.details.component.scss
@@ -2,7 +2,7 @@ nb-icon {
vertical-align: middle;
}
-.col-2 {
+.col-md-2 {
text-align: right;
padding: 0;
font-weight: bold;
diff --git a/src/app/pages/things/channels/details/channels.details.component.ts b/src/app/pages/things/channels/details/channels.details.component.ts
index e455d539..7f52a50f 100644
--- a/src/app/pages/things/channels/details/channels.details.component.ts
+++ b/src/app/pages/things/channels/details/channels.details.component.ts
@@ -88,28 +88,22 @@ export class ChannelsDetailsComponent implements OnInit {
}
findDisconnectedThings() {
- this.things = [];
-
this.channelsService.connectedThings(this.channel.id).subscribe(
(respConns: any) => {
this.connections = respConns.things;
- this.thingsService.getThings(this.offset, this.limit).subscribe(
- (respThings: any) => {
- respThings.things.forEach(thing => {
- // Filter get Things resp and keep only disconnected ones.
- if (!(this.connections.filter(c => c.id === thing.id).length > 0)) {
- this.things.push(thing);
- }
- });
-
- this.getchannelMessages();
- },
- );
+
+ this.getChannelMessages();
+ },
+ );
+
+ this.channelsService.disconnectedThings(this.channel.id).subscribe(
+ (respDisconns: any) => {
+ this.things = respDisconns.things;
},
);
}
- getchannelMessages() {
+ getChannelMessages() {
if (this.connections.length) {
this.messagesService.getMessages(this.channel.id, this.connections[0].key).subscribe(
(respMsg: any) => {
diff --git a/src/app/pages/things/devices/details/devices.details.component.html b/src/app/pages/things/devices/details/devices.details.component.html
index 02b08402..a52dd291 100644
--- a/src/app/pages/things/devices/details/devices.details.component.html
+++ b/src/app/pages/things/devices/details/devices.details.component.html
@@ -6,9 +6,9 @@
-
Name:
{{ thing.name }}
-
ID:
{{ thing.id }}
-
Key:
{{ thing.key }}
+
Name:
{{ thing.name }}
+
ID:
{{ thing.id }}
+
Key:
{{ thing.key }}
@@ -62,11 +62,11 @@
-
+
{{con.name}}
-
+
diff --git a/src/app/pages/things/devices/details/devices.details.component.scss b/src/app/pages/things/devices/details/devices.details.component.scss
index 710e4662..da771879 100644
--- a/src/app/pages/things/devices/details/devices.details.component.scss
+++ b/src/app/pages/things/devices/details/devices.details.component.scss
@@ -2,7 +2,7 @@ nb-icon {
vertical-align: middle;
}
-.col-2 {
+.col-md-2 {
text-align: right;
padding: 0;
font-weight: bold;
diff --git a/src/app/pages/things/devices/details/devices.details.component.ts b/src/app/pages/things/devices/details/devices.details.component.ts
index 61f50bd9..ca47207a 100644
--- a/src/app/pages/things/devices/details/devices.details.component.ts
+++ b/src/app/pages/things/devices/details/devices.details.component.ts
@@ -87,28 +87,30 @@ export class DevicesDetailsComponent implements OnInit {
);
}
+ getChannelMessages() {
+ this.connections.forEach(chan => {
+ this.messagesService.getMessages(chan.id, this.thing.key, this.thing.id).subscribe(
+ (respMsg: any) => {
+ this.messages = respMsg.messages || this.messages;
+ },
+ );
+ });
+ }
+
findDisconnectedChans() {
- this.channels = [];
this.messages = [];
this.thingsService.connectedChannels(this.thing.id).subscribe(
(respConns: any) => {
this.connections = respConns.channels;
- this.channelsService.getChannels(this.offset, this.limit).subscribe(
- (respChans: any) => {
- respChans.channels.forEach(chan => {
- if (!(this.connections.filter(c => c.id === chan.id).length > 0)) {
- this.channels.push(chan);
- } else {
- this.messagesService.getMessages(chan.id, this.thing.key, this.thing.id).subscribe(
- (respMsg: any) => {
- this.messages = respMsg.messages || this.messages;
- },
- );
- }
- });
- },
- );
+
+ this.getChannelMessages();
+ },
+ );
+
+ this.thingsService.disconnectedChannels(this.thing.id).subscribe(
+ (respDisconn: any) => {
+ this.channels = respDisconn.channels;
},
);
}
diff --git a/src/app/pages/things/devices/devices.component.html b/src/app/pages/things/devices/devices.component.html
index 577af27b..af7acdb7 100644
--- a/src/app/pages/things/devices/devices.component.html
+++ b/src/app/pages/things/devices/devices.component.html
@@ -1,21 +1,21 @@
-
- {{ thingsNumber }} Devices
+
+ {{ thingsNum }} Devices
-
+
-
+
-
+