Skip to content

Commit 2416fca

Browse files
authored
Merge pull request #72 from OS2iot/feature/1284_application-metadata
Optional metadata fields when managing an application
2 parents ced9d30 + 1b8bd26 commit 2416fca

31 files changed

+582
-45
lines changed

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@angular/forms": "~9.1.11",
2020
"@angular/localize": "^9.1.11",
2121
"@angular/material": "^9.2.4",
22+
"@angular/material-moment-adapter": "^9.2.4",
2223
"@angular/platform-browser": "~9.1.11",
2324
"@angular/platform-browser-dynamic": "~9.1.11",
2425
"@angular/router": "~9.1.11",

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,23 @@
99
<div *ngIf="errorMessage" class="error-messages p-3 my-3">
1010
{{errorMessage | translate}}
1111
</div>
12-
<h3>Detaljer</h3>
12+
<h3>{{ 'APPLICATION.DETAILS' | translate }}</h3>
1313
<app-general-details [data]="application"></app-general-details>
1414
<p *ngIf="application.description">
1515
<strong>{{ 'APPLICATION.DESCRIPTION' | translate }}</strong></p>
1616
<pre><p>{{application.description}}</p></pre>
17+
<app-metadata-details [status]="application.status" [startDate]="application.startDate"
18+
[endDate]="application.endDate"
19+
[category]="application.category"
20+
[owner]="application.owner"
21+
[contactPerson]="application.contactPerson"
22+
[contactEmail]="application.contactEmail"
23+
[contactPhone]="application.contactPhone"
24+
[personalData]="application.personalData"
25+
[hardware]="application.hardware"
26+
[controlledProperties]="application.controlledProperties"
27+
[deviceTypes]="application.deviceTypes"
28+
></app-metadata-details>
1729
</div>
1830
</div>
1931
</div>
@@ -81,4 +93,4 @@ <h3>Detaljer</h3>
8193
</mat-tab>
8294
</mat-tab-group>
8395
</div>
84-
</div>
96+
</div>

src/app/applications/application.model.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
import { ControlledPropertyTypes } from '@app/device-model/Enums/controlled-propperty.enum';
2+
import { ApplicationDeviceTypeUnion } from '@shared/enums/device-type';
3+
import { ControlledProperty } from '@shared/models/controlled-property.model';
14
import { Organisation } from '../admin/organisation/organisation.model';
5+
import { ApplicationStatus } from './enums/status.enum';
26
import { IotDevice } from './iot-devices/iot-device.model';
7+
import { ApplicationDeviceType } from './models/application-device-type.model';
38

49
export class Application {
510
public id: number;
@@ -13,12 +18,36 @@ export class Application {
1318
public updatedBy: number;
1419
public createdByName: string;
1520
public updatedByName: string;
21+
public status?: ApplicationStatus;
22+
public startDate?: Date;
23+
public endDate?: Date;
24+
public category?: string;
25+
public owner?: string;
26+
public contactPerson?: string;
27+
public contactEmail?: string;
28+
public contactPhone?: string;
29+
public personalData?: boolean;
30+
public hardware?: string;
31+
public controlledProperties?: ControlledProperty[];
32+
public deviceTypes?: ApplicationDeviceType[];
1633
}
1734

1835
export class ApplicationRequest {
1936
public name: string;
2037
public description: string;
2138
public organizationId: number;
39+
public status?: ApplicationStatus;
40+
public startDate?: Date;
41+
public endDate?: Date;
42+
public category?: string;
43+
public owner?: string;
44+
public contactPerson?: string;
45+
public contactEmail?: string;
46+
public contactPhone?: string;
47+
public personalData?: boolean;
48+
public hardware?: string;
49+
public controlledProperties?: ControlledPropertyTypes[];
50+
public deviceTypes?: ApplicationDeviceTypeUnion[];
2251
}
2352

2453
export interface ApplicationData {

src/app/applications/bulk-import/bulkMapping.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class BulkMapping {
88
switch (data.type.toUpperCase()) {
99
case DeviceType.LORAWAN:
1010
return this.lorawanMapper(data, applicationId);
11-
case DeviceType.GENERICHTTP:
11+
case DeviceType.GENERIC_HTTP:
1212
return this.baseMapper(data, applicationId);
1313
default:
1414
break;
@@ -53,7 +53,7 @@ export class BulkMapping {
5353
location: undefined,
5454
commentOnLocation: data.commentOnLocation,
5555
comment: data.comment,
56-
type: DeviceType.GENERICHTTP,
56+
type: DeviceType.GENERIC_HTTP,
5757
receivedMessagesMetadata: undefined,
5858
metadata: undefined,
5959
apiKey: undefined,
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { recordToEntries } from '@shared/helpers/record.helper';
2+
3+
export enum ApplicationStatus {
4+
'NONE' = 'NONE',
5+
'IN-OPERATION' = 'IN-OPERATION',
6+
'PROJECT' = 'PROJECT',
7+
'PROTOTYPE' = 'PROTOTYPE',
8+
'OTHER' = 'OTHER',
9+
}
10+
11+
export const ApplicationStatusEntries = recordToEntries(ApplicationStatus);

src/app/applications/iot-devices/iot-device-edit/iot-device-edit.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ export class IotDeviceEditComponent implements OnInit, OnDestroy {
230230
this.iotDevice.deviceModelId = null
231231
}
232232
switch (this.iotDevice.type) {
233-
case DeviceType.GENERICHTTP: {
233+
case DeviceType.GENERIC_HTTP: {
234234
this.iotDevice.lorawanSettings = undefined;
235235
this.iotDevice.sigfoxSettings = undefined;
236236
break;

src/app/applications/iot-devices/iot-device.model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class IotDevice {
1313
location: JsonLocation;
1414
commentOnLocation: string;
1515
comment: string;
16-
type: DeviceType = DeviceType.GENERICHTTP;
16+
type: DeviceType = DeviceType.GENERIC_HTTP;
1717
receivedMessagesMetadata: ReceivedMessageMetadata[];
1818
metadata?: string;
1919
apiKey?: string;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Application } from '@applications/application.model';
2+
import { ApplicationDeviceTypeUnion } from '@shared/enums/device-type';
3+
4+
export class ApplicationDeviceType {
5+
public applications: Application[];
6+
public type: ApplicationDeviceTypeUnion;
7+
}

src/app/device-model/Enums/controlled-propperty.enum.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export enum ControlledPropperty {
1+
export enum ControlledPropertyTypes {
22
AIRPOLLUTION = "airPollution",
33
ATMOSPHERICPRESSURE = "atmosphericPressure",
44
CDOM = "cdom",

0 commit comments

Comments
 (0)