Skip to content

Commit

Permalink
Merge pull request #179 from OS2iot/feature/IOT-1209-MoveGateway
Browse files Browse the repository at this point in the history
Feature/iot 1209 move gateway
  • Loading branch information
fcv-iteratorIt authored Sep 26, 2024
2 parents 40e11d7 + 9b4bfa9 commit e3df8dd
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h1 mat-dialog-title>{{ "GATEWAY.CHANGE-ORGANIZATION.TITLE" | translate }}</h1>
</mat-option>
</mat-select>
</div>
<div mat-dialog-actions class="d-flex flex-row">
<div mat-dialog-actions class="d-flex flex-row mat-dialog-actions">
<button (click)="onSubmit()" class="btn btn-primary">
{{ "GEN.SAVE" | translate }}
</button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
.gateway-change-organization-dialog {
width: 50vw;
}

.mat-dialog-actions {
margin-left: 13px;
margin-bottom: 13px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class GatewayChangeOrganizationDialogComponent implements OnInit {

getOrganizations() {
this.organizationsSubscription = this.organizationService.getMultipleWithGatewayAdmin().subscribe(res => {
this.organizations = res.data;
this.organizations = res.data.sort((a, b) => a.name.localeCompare(b.name, "da-DK", { numeric: true }));
this.filteredOrganizations.next(this.organizations.slice());
});
}
Expand All @@ -61,12 +61,13 @@ export class GatewayChangeOrganizationDialogComponent implements OnInit {
gatewayName: gateway.name,
organizationName: gateway.organization.name,
}),
"",
this.translate.instant("DIALOG.OK"),
{
duration: 10000,
}
);
this.dialog.close(true);
this.snackBar._openedSnackBarRef.afterDismissed().subscribe(() => location.reload());
});
}
}
8 changes: 1 addition & 7 deletions src/app/gateway/gateway-detail/gateway-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,18 +202,12 @@ export class GatewayDetailComponent implements OnInit, OnDestroy, AfterViewInit
}

onOpenChangeOrganizationDialog() {
const dialog = this.changeOrganizationDialog.open(GatewayChangeOrganizationDialogComponent, {
this.changeOrganizationDialog.open(GatewayChangeOrganizationDialogComponent, {
data: {
gatewayDbId: this.gateway.id,
organizationId: this.gateway.organizationId,
} as GatewayDialogModel,
});

dialog.afterClosed().subscribe(res => {
if (!res) return;

location.reload();
});
}

ngOnDestroy() {
Expand Down
8 changes: 1 addition & 7 deletions src/app/gateway/gateway-table/gateway-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,17 +259,11 @@ export class GatewayTableComponent implements AfterViewInit, OnDestroy, OnInit {
}

onOpenChangeOrganizationDialog(id: number) {
const dialog = this.changeOrganizationDialog.open(GatewayChangeOrganizationDialogComponent, {
this.changeOrganizationDialog.open(GatewayChangeOrganizationDialogComponent, {
data: {
gatewayDbId: id,
} as GatewayDialogModel,
});

dialog.afterClosed().subscribe(res => {
if (!res) return;

location.reload();
});
}

protected readonly columnDefinitions = columnDefinitions;
Expand Down

0 comments on commit e3df8dd

Please sign in to comment.