Skip to content

Commit e3df8dd

Browse files
Merge pull request #179 from OS2iot/feature/IOT-1209-MoveGateway
Feature/iot 1209 move gateway
2 parents 40e11d7 + 9b4bfa9 commit e3df8dd

File tree

5 files changed

+11
-17
lines changed

5 files changed

+11
-17
lines changed

src/app/gateway/gateway-change-organization-dialog/gateway-change-organization-dialog.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ <h1 mat-dialog-title>{{ "GATEWAY.CHANGE-ORGANIZATION.TITLE" | translate }}</h1>
1616
</mat-option>
1717
</mat-select>
1818
</div>
19-
<div mat-dialog-actions class="d-flex flex-row">
19+
<div mat-dialog-actions class="d-flex flex-row mat-dialog-actions">
2020
<button (click)="onSubmit()" class="btn btn-primary">
2121
{{ "GEN.SAVE" | translate }}
2222
</button>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
.gateway-change-organization-dialog {
22
width: 50vw;
33
}
4+
5+
.mat-dialog-actions {
6+
margin-left: 13px;
7+
margin-bottom: 13px;
8+
}

src/app/gateway/gateway-change-organization-dialog/gateway-change-organization-dialog.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class GatewayChangeOrganizationDialogComponent implements OnInit {
4343

4444
getOrganizations() {
4545
this.organizationsSubscription = this.organizationService.getMultipleWithGatewayAdmin().subscribe(res => {
46-
this.organizations = res.data;
46+
this.organizations = res.data.sort((a, b) => a.name.localeCompare(b.name, "da-DK", { numeric: true }));
4747
this.filteredOrganizations.next(this.organizations.slice());
4848
});
4949
}
@@ -61,12 +61,13 @@ export class GatewayChangeOrganizationDialogComponent implements OnInit {
6161
gatewayName: gateway.name,
6262
organizationName: gateway.organization.name,
6363
}),
64-
"",
64+
this.translate.instant("DIALOG.OK"),
6565
{
6666
duration: 10000,
6767
}
6868
);
6969
this.dialog.close(true);
70+
this.snackBar._openedSnackBarRef.afterDismissed().subscribe(() => location.reload());
7071
});
7172
}
7273
}

src/app/gateway/gateway-detail/gateway-detail.component.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,18 +202,12 @@ export class GatewayDetailComponent implements OnInit, OnDestroy, AfterViewInit
202202
}
203203

204204
onOpenChangeOrganizationDialog() {
205-
const dialog = this.changeOrganizationDialog.open(GatewayChangeOrganizationDialogComponent, {
205+
this.changeOrganizationDialog.open(GatewayChangeOrganizationDialogComponent, {
206206
data: {
207207
gatewayDbId: this.gateway.id,
208208
organizationId: this.gateway.organizationId,
209209
} as GatewayDialogModel,
210210
});
211-
212-
dialog.afterClosed().subscribe(res => {
213-
if (!res) return;
214-
215-
location.reload();
216-
});
217211
}
218212

219213
ngOnDestroy() {

src/app/gateway/gateway-table/gateway-table.component.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -259,17 +259,11 @@ export class GatewayTableComponent implements AfterViewInit, OnDestroy, OnInit {
259259
}
260260

261261
onOpenChangeOrganizationDialog(id: number) {
262-
const dialog = this.changeOrganizationDialog.open(GatewayChangeOrganizationDialogComponent, {
262+
this.changeOrganizationDialog.open(GatewayChangeOrganizationDialogComponent, {
263263
data: {
264264
gatewayDbId: id,
265265
} as GatewayDialogModel,
266266
});
267-
268-
dialog.afterClosed().subscribe(res => {
269-
if (!res) return;
270-
271-
location.reload();
272-
});
273267
}
274268

275269
protected readonly columnDefinitions = columnDefinitions;

0 commit comments

Comments
 (0)