Skip to content

Commit 54244cc

Browse files
Merge branch 'stage' for release v.1.5.1
2 parents 874c661 + 5268542 commit 54244cc

File tree

10 files changed

+221
-111
lines changed

10 files changed

+221
-111
lines changed

src/app/admin/permission/permission-edit/permission-edit.component.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,15 @@
6767
<mat-form-field>
6868
<label class="form-label" for="name">{{'PERMISSION.EDIT.APPS' | translate}}</label>
6969
<div class="col-12">
70-
<mat-select [formControl]="applicationMultiCtrl" [multiple]="true"
71-
panelClass="overflow-x-hidden" [(value)]="permission.applicationIds" id="applicationIds"
72-
name="applicationIds" #multiSelect [compareWith]="compare">
70+
<mat-select
71+
id="applicationIds"
72+
[formControl]="applicationMultiCtrl"
73+
[multiple]="true"
74+
panelClass="overflow-x-hidden"
75+
[(value)]="permission.applicationIds"
76+
name="applicationIds"
77+
#multiSelect
78+
[compareWith]="compare">
7379
<app-mat-select-search [formControl]="applicationMultiFilterCtrl"></app-mat-select-search>
7480
<mat-option *ngFor="let app of filteredApplicationsMulti | async" [value]="app.id">
7581
{{app.name}}

src/app/admin/permission/permission.service.ts

Lines changed: 75 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -2,94 +2,94 @@ import { Injectable } from '@angular/core';
22
import { RestService } from '../../shared/services/rest.service';
33
import { Observable } from 'rxjs';
44
import {
5-
PermissionGetManyResponse,
6-
PermissionResponse,
7-
PermissionRequest,
8-
PermissionRequestAcceptUser,
5+
PermissionGetManyResponse,
6+
PermissionResponse,
7+
PermissionRequest,
8+
PermissionRequestAcceptUser,
99
} from './permission.model';
1010
import { map } from 'rxjs/operators';
1111
import { UserMinimalService } from '../users/user-minimal.service';
1212

1313
@Injectable({
14-
providedIn: 'root',
14+
providedIn: 'root',
1515
})
1616
export class PermissionService {
17-
endpoint = 'permission';
18-
constructor(
19-
private restService: RestService,
20-
private userMinimalService: UserMinimalService
21-
) {}
17+
endpoint = 'permission';
18+
constructor(
19+
private restService: RestService,
20+
private userMinimalService: UserMinimalService
21+
) {}
2222

23-
createPermission(body: PermissionRequest): Observable<PermissionResponse> {
24-
return this.restService.post(this.endpoint, body, {
25-
observe: 'response',
26-
});
27-
}
23+
createPermission(body: PermissionRequest): Observable<PermissionResponse> {
24+
return this.restService.post(this.endpoint, body, {
25+
observe: 'response',
26+
});
27+
}
2828

29-
createPermissionAcceptUser(body: PermissionRequestAcceptUser): Observable<PermissionResponse> {
30-
return this.restService.put(this.endpoint + '/acceptUser', body, undefined, {
31-
observe: 'response',
32-
});
33-
}
29+
createPermissionAcceptUser(
30+
body: PermissionRequestAcceptUser
31+
): Observable<PermissionResponse> {
32+
return this.restService.put(
33+
this.endpoint + '/acceptUser',
34+
body,
35+
undefined,
36+
{
37+
observe: 'response',
38+
}
39+
);
40+
}
3441

35-
updatePermission(
36-
body: PermissionRequest,
37-
id: number
38-
): Observable<PermissionResponse> {
39-
return this.restService.put(this.endpoint, body, id, {
40-
observe: 'response',
41-
});
42-
}
42+
updatePermission(
43+
body: PermissionRequest,
44+
id: number
45+
): Observable<PermissionResponse> {
46+
return this.restService.put(this.endpoint, body, id, {
47+
observe: 'response',
48+
});
49+
}
4350

44-
getPermission(id: number): Observable<PermissionResponse> {
45-
return this.restService.get(this.endpoint, {}, id).pipe(
46-
map((response: PermissionResponse) => {
47-
response.createdByName = this.userMinimalService.getUserNameFrom(
48-
response.createdBy
49-
);
50-
response.updatedByName = this.userMinimalService.getUserNameFrom(
51-
response.updatedBy
52-
);
53-
return response;
54-
})
51+
getPermission(id: number): Observable<PermissionResponse> {
52+
return this.restService.get(this.endpoint, {}, id).pipe(
53+
map((response: PermissionResponse) => {
54+
response.createdByName = this.userMinimalService.getUserNameFrom(
55+
response.createdBy
5556
);
56-
}
57+
response.updatedByName = this.userMinimalService.getUserNameFrom(
58+
response.updatedBy
59+
);
60+
return response;
61+
})
62+
);
63+
}
5764

58-
getPermissions(
59-
limit: number = 1000,
60-
offset: number = 0,
61-
orderByColumn?: string,
62-
orderByDirection?: string,
63-
userId?: number,
64-
organisationId?: number
65-
): Observable<PermissionGetManyResponse> {
66-
if (userId) {
67-
return this.restService.get(this.endpoint, {
68-
limit: limit,
69-
offset: offset,
70-
orderOn: orderByColumn,
71-
sort: orderByDirection,
72-
userId: userId,
73-
});
74-
} else if (organisationId) {
75-
return this.restService.get(this.endpoint, {
76-
limit: limit,
77-
offset: offset,
78-
orderOn: orderByColumn,
79-
sort: orderByDirection,
80-
organisationId: organisationId,
81-
});
82-
} else {
83-
return this.restService.get(this.endpoint, {
84-
limit: limit,
85-
offset: offset,
86-
orderOn: orderByColumn,
87-
sort: orderByDirection,
88-
});
89-
}
65+
getPermissions(
66+
limit: number = 1000,
67+
offset: number = 0,
68+
orderByColumn?: string,
69+
orderByDirection?: string,
70+
userId?: number,
71+
organisationId?: number
72+
): Observable<PermissionGetManyResponse> {
73+
if (userId || organisationId) {
74+
return this.restService.get(this.endpoint, {
75+
limit: limit,
76+
offset: offset,
77+
orderOn: orderByColumn,
78+
sort: orderByDirection,
79+
userId: userId,
80+
organisationId: organisationId,
81+
});
82+
} else {
83+
return this.restService.get(this.endpoint, {
84+
limit: limit,
85+
offset: offset,
86+
orderOn: orderByColumn,
87+
sort: orderByDirection,
88+
});
9089
}
90+
}
9191

92-
deletePermission(id: number) {
93-
return this.restService.delete(this.endpoint, id);
94-
}
92+
deletePermission(id: number) {
93+
return this.restService.delete(this.endpoint, id);
94+
}
9595
}

src/app/applications/application-detail/application-detail.component.html

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<div *ngIf="application">
22
<app-top-bar [data]="application" [backButton]="backButton" [subPage]="true"
3-
[addDetailDowndown]="true" [dropDownButton]="dropdownButton" (deleteSelectedInDropdown)="onDeleteApplication()"
4-
[canEdit]="canEdit">
3+
[addDetailDowndown]="true" [dropDownButton]="dropdownButton"
4+
(deleteSelectedInDropdown)="onDeleteApplication()"
5+
[canEdit]="canEdit">
56
</app-top-bar>
67
<div class="container-fluid">
78
<div class="row">
@@ -15,17 +16,20 @@ <h3>{{ 'APPLICATION.DETAILS' | translate }}</h3>
1516
<p *ngIf="application.description">
1617
<strong>{{ 'APPLICATION.DESCRIPTION' | translate }}</strong></p>
1718
<pre><p>{{application.description}}</p></pre>
18-
<app-metadata-details [status]="application.status" [startDate]="application.startDate"
19-
[endDate]="application.endDate"
20-
[category]="application.category"
21-
[owner]="application.owner"
22-
[contactPerson]="application.contactPerson"
23-
[contactEmail]="application.contactEmail"
24-
[contactPhone]="application.contactPhone"
25-
[personalData]="application.personalData"
26-
[hardware]="application.hardware"
27-
[controlledProperties]="application.controlledProperties"
28-
[deviceTypes]="application.deviceTypes"
19+
<app-metadata-details
20+
[permissions]="application.permissions"
21+
[status]="application.status"
22+
[startDate]="application.startDate"
23+
[endDate]="application.endDate"
24+
[category]="application.category"
25+
[owner]="application.owner"
26+
[contactPerson]="application.contactPerson"
27+
[contactEmail]="application.contactEmail"
28+
[contactPhone]="application.contactPhone"
29+
[personalData]="application.personalData"
30+
[hardware]="application.hardware"
31+
[controlledProperties]="application.controlledProperties"
32+
[deviceTypes]="application.deviceTypes"
2933
></app-metadata-details>
3034
</div>
3135
</div>
@@ -36,7 +40,7 @@ <h3>{{ 'APPLICATION.DETAILS' | translate }}</h3>
3640
[routerLink]="link.link"
3741
routerLinkActive #rla="routerLinkActive"
3842
[active]="rla.isActive"
39-
>{{ link.label | translate }}</a>
43+
>{{ link.label | translate }}</a>
4044
</nav>
4145
<router-outlet></router-outlet>
4246
</div>

src/app/applications/application.model.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Organisation } from '../admin/organisation/organisation.model';
55
import { ApplicationStatus } from './enums/status.enum';
66
import { IotDevice } from './iot-devices/iot-device.model';
77
import { ApplicationDeviceType } from './models/application-device-type.model';
8+
import { PermissionResponse } from '@app/admin/permission/permission.model';
89

910
export class Application {
1011
public id: number;
@@ -30,6 +31,8 @@ export class Application {
3031
public hardware?: string;
3132
public controlledProperties?: ControlledProperty[];
3233
public deviceTypes?: ApplicationDeviceType[];
34+
public permissions: PermissionResponse[];
35+
public permissionIds: number[];
3336
}
3437

3538
export class ApplicationRequest {
@@ -48,6 +51,7 @@ export class ApplicationRequest {
4851
public hardware?: string;
4952
public controlledProperties?: ControlledPropertyTypes[];
5053
public deviceTypes?: ApplicationDeviceTypeUnion[];
54+
public permissionIds: number[];
5155
}
5256

5357
export interface ApplicationData {

src/app/shared/components/forms/form-body-application/form-body-application.component.html

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,27 @@
2424
[ngClass]="{'is-invalid' : formFailedSubmit && errorFields.includes('description'), 'is-valid' : formFailedSubmit && !errorFields.includes('description')}"></textarea>
2525
</div>
2626

27+
<div class="form-group mt-3 col-12">
28+
<label class="form-label" for="userGroup">{{'QUESTION.APPLICATION.ADD-PERMISSION' | translate}}</label>
29+
<mat-select
30+
id="userGroup"
31+
class="form-control"
32+
[formControl]="permissionMultiCtrl"
33+
[multiple]="true"
34+
panelClass="overflow-x-hidden"
35+
[(value)]="application.permissionIds"
36+
[compareWith]="compare">
37+
<app-mat-select-search [formControl]="permissionMultiFilterCtrl"></app-mat-select-search>
38+
<mat-option *ngFor="let permission of filteredPermissionsMulti | async" [value]="permission.id">
39+
{{permission.name}}
40+
</mat-option>
41+
</mat-select>
42+
<mat-hint>{{'QUESTION.APPLICATION.PERMISSION-HINT' | translate}}</mat-hint>
43+
</div>
44+
2745
<div class="form-group mt-3">
28-
<label class="form-label" for="application.status">{{'APPLICATION.METADATA-FIELD.STATUS' | translate}}</label>
29-
<mat-select class="form-control" name="application.statusOptions" [(ngModel)]="application.status"
46+
<label class="form-label" for="application.statusOptions">{{'APPLICATION.METADATA-FIELD.STATUS' | translate}}</label>
47+
<mat-select class="form-control" id="application.statusOptions" name="application.statusOptions" [(ngModel)]="application.status"
3048
[ngClass]="{'is-invalid' : formFailedSubmit && errorFields.includes('application.status'), 'is-valid' : formFailedSubmit && !errorFields.includes('application.status')}">
3149
<mat-option *ngFor="let statusOption of statuses" [value]="statusOption.value">
3250
{{statusOption.label}}
@@ -37,7 +55,7 @@
3755
<div class="form-group mt-3">
3856
<label class="form-label" for="application.startDate">{{'APPLICATION.METADATA-FIELD.START-DATE' |
3957
translate}}</label>
40-
<mat-form-field appearance="fill">
58+
<mat-form-field appearance="fill" id="application.startDate">
4159
<mat-label>{{'QUESTION.APPLICATION.START-DATE-PLACEHOLDER' | translate}}</mat-label>
4260
<input matInput [max]="serializedEndDate.value" [matDatepicker]="startDatePicker"
4361
[formControl]="serializedStartDate"
@@ -50,7 +68,7 @@
5068

5169
<div class="form-group mt-3">
5270
<label class="form-label" for="application.endDate">{{'APPLICATION.METADATA-FIELD.END-DATE' | translate}}</label>
53-
<mat-form-field appearance="fill">
71+
<mat-form-field appearance="fill" id="application.endDate">
5472
<mat-label>{{'QUESTION.APPLICATION.END-DATE-PLACEHOLDER' | translate}}</mat-label>
5573
<input matInput [min]="serializedStartDate.value" [matDatepicker]="endDatePicker"
5674
[formControl]="serializedEndDate"
@@ -62,23 +80,23 @@
6280
</div>
6381

6482
<div class="form-group mt-3">
65-
<label class="form-label" for="application.category">{{'APPLICATION.METADATA-FIELD.CATEGORY' | translate}}</label>
83+
<label class="form-label" for="category">{{'APPLICATION.METADATA-FIELD.CATEGORY' | translate}}</label>
6684
<input type="text" class="form-control" id="category" name="category"
6785
[placeholder]="'QUESTION.APPLICATION.CATEGORY-PLACEHOLDER' | translate" maxlength="100"
6886
[(ngModel)]="application.category"
6987
[ngClass]="{'is-invalid' : formFailedSubmit && errorFields.includes('application.category'), 'is-valid' : formFailedSubmit && !errorFields.includes('application.category')}">
7088
</div>
7189

7290
<div class="form-group mt-3">
73-
<label class="form-label" for="application.owner">{{'APPLICATION.METADATA-FIELD.OWNER' | translate}}</label>
91+
<label class="form-label" for="owner">{{'APPLICATION.METADATA-FIELD.OWNER' | translate}}</label>
7492
<input type="text" class="form-control" id="owner" name="owner"
7593
[placeholder]="'QUESTION.APPLICATION.OWNER-PLACEHOLDER' | translate" maxlength="100"
7694
[(ngModel)]="application.owner"
7795
[ngClass]="{'is-invalid' : formFailedSubmit && errorFields.includes('application.owner'), 'is-valid' : formFailedSubmit && !errorFields.includes('application.owner')}">
7896
</div>
7997

8098
<div class="form-group mt-3">
81-
<label class="form-label" for="application.contactPerson">{{'APPLICATION.METADATA-FIELD.CONTACT-PERSON' |
99+
<label class="form-label" for="contactPerson">{{'APPLICATION.METADATA-FIELD.CONTACT-PERSON' |
82100
translate}}</label>
83101
<input type="text" class="form-control" id="contactPerson" name="contactPerson"
84102
[placeholder]="'QUESTION.APPLICATION.CONTACT-PERSON-PLACEHOLDER' | translate" maxlength="100"
@@ -87,7 +105,7 @@
87105
</div>
88106

89107
<div class="form-group mt-3">
90-
<label class="form-label" for="application.contactEmail">{{'APPLICATION.METADATA-FIELD.CONTACT-EMAIL' |
108+
<label class="form-label" for="contactEmail">{{'APPLICATION.METADATA-FIELD.CONTACT-EMAIL' |
91109
translate}}</label>
92110
<input type="email" class="form-control" id="contactEmail" name="contactEmail"
93111
[placeholder]="'QUESTION.APPLICATION.CONTACT-EMAIL-PLACEHOLDER' | translate" maxlength="50" [email]="true"
@@ -96,7 +114,7 @@
96114
</div>
97115

98116
<div class="form-group mt-3">
99-
<label class="form-label" for="application.contactPhone">{{'APPLICATION.METADATA-FIELD.CONTACT-PHONE' |
117+
<label class="form-label" for="contactPhone">{{'APPLICATION.METADATA-FIELD.CONTACT-PHONE' |
100118
translate}}</label>
101119
<input type="text" class="form-control" id="contactPhone" name="contactPhone" [formControl]="phoneCtrl"
102120
[placeholder]="'QUESTION.APPLICATION.CONTACT-PHONE-PLACEHOLDER' | translate" maxlength="12"
@@ -126,7 +144,7 @@
126144
<label class="form-label" for="application.controlledProperty">{{'APPLICATION.METADATA-FIELD.CONTROLLED-PROPERTY'
127145
|
128146
translate}}</label>
129-
<mat-select class="form-control" name="application.controlledProperty" multiple="true"
147+
<mat-select class="form-control" name="application.controlledProperty" id="application.controlledProperty" multiple="true"
130148
[(ngModel)]="application.controlledProperties"
131149
[placeholder]="'QUESTION.APPLICATION.CONTROLLED-PROPERTY-PLACEHOLDER' | translate"
132150
[ngClass]="{'is-invalid' : formFailedSubmit && errorFields.includes('application.controlledProperty'), 'is-valid' : formFailedSubmit && !errorFields.includes('application.controlledProperty')}">
@@ -139,7 +157,7 @@
139157
<div class="form-group mt-3">
140158
<label class="form-label" for="application.deviceType">{{'APPLICATION.METADATA-FIELD.DEVICE-TYPE' |
141159
translate}}</label>
142-
<mat-select class="form-control" name="application.deviceType" multiple="true"
160+
<mat-select class="form-control" name="application.deviceType" id="application.deviceType" multiple="true"
143161
[(ngModel)]="application.deviceTypes" [placeholder]="'QUESTION.APPLICATION.DEVICE-TYPE-PLACEHOLDER' | translate"
144162
[ngClass]="{'is-invalid' : formFailedSubmit && errorFields.includes('application.deviceType'), 'is-valid' : formFailedSubmit && !errorFields.includes('application.deviceType')}">
145163
<mat-option *ngFor="let deviceType of deviceTypes" [value]="deviceType.value">

0 commit comments

Comments
 (0)