Skip to content

Commit 52770e9

Browse files
PR fixes
1 parent cdc7f14 commit 52770e9

File tree

8 files changed

+145
-31
lines changed

8 files changed

+145
-31
lines changed

src/app/applications/datatarget/datatarget-detail/datatarget-detail-tabs-common.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ import { NavTab } from "@shared/types/nav-tabs.type";
1515
import { Subscription } from "rxjs";
1616

1717
export abstract class DatatargetDetailTabsCommon implements DatatargetDetail {
18-
protected abstract getDetailsLink(): string;
19-
2018
faExclamationTriangle = faExclamationTriangle;
21-
2219
logLink: "datatarget-log" = "datatarget-log";
2320
testConnectionLink: "datatarget-test-connection" = "datatarget-test-connection";
2421
navTabs: NavTab[] = [
@@ -33,17 +30,15 @@ export abstract class DatatargetDetailTabsCommon implements DatatargetDetail {
3330
index: 1,
3431
},
3532
{
36-
label: "Test forbindelse",
33+
label: "DATATARGET.TEST_CONNECTION.TEST-CONNECTION",
3734
link: this.testConnectionLink,
3835
index: 2,
3936
},
4037
];
41-
4238
datatarget: Datatarget;
4339
backButton: BackButton = { label: "", routerLink: undefined };
4440
dropdownButton: DropdownButton;
4541
canEdit: boolean;
46-
4742
private subscriptions: Subscription[] = [];
4843
private deleteDialogSubscription: Subscription;
4944

@@ -85,16 +80,6 @@ export abstract class DatatargetDetailTabsCommon implements DatatargetDetail {
8580
this.canEdit = meService.hasAccessToTargetOrganization(OrganizationAccessScope.ApplicationWrite, undefined, appId);
8681
}
8782

88-
protected onDestroy(): void {
89-
this.subscriptions?.forEach(s => s?.unsubscribe());
90-
this.deleteDialogSubscription?.unsubscribe();
91-
}
92-
93-
private getDatatarget = (id: number) =>
94-
this.datatargetService.get(id).subscribe((dataTarget: Datatarget) => {
95-
this.datatarget = dataTarget;
96-
});
97-
9883
onDeleteDatatarget() {
9984
this.deleteDialogSubscription?.unsubscribe();
10085
this.deleteDialogSubscription = this.deleteDialogService.showSimpleDialog().subscribe(response => {
@@ -112,4 +97,16 @@ export abstract class DatatargetDetailTabsCommon implements DatatargetDetail {
11297
);
11398
});
11499
}
100+
101+
protected abstract getDetailsLink(): string;
102+
103+
protected onDestroy(): void {
104+
this.subscriptions?.forEach(s => s?.unsubscribe());
105+
this.deleteDialogSubscription?.unsubscribe();
106+
}
107+
108+
private getDatatarget = (id: number) =>
109+
this.datatargetService.get(id).subscribe((dataTarget: Datatarget) => {
110+
this.datatarget = dataTarget;
111+
});
115112
}

src/app/applications/datatarget/datatarget-test-connection/datatarget-test-connection.component.html

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,42 +41,44 @@ <h3>{{ "DATATARGET.TEST_CONNECTION.TEST-CONNECTION" | translate }}</h3>
4141
</p>
4242
</div>
4343
</div>
44-
<div class="col-md-6 d-flex align-items-stretch">
44+
<div class="col-md-6 d-flex align-items-stretch min-height-400">
4545
<div class="jumbotron jumbotron--full-width">
4646
<h3>{{ "DATATARGET.TEST_CONNECTION.CHOSEN-DATA-PACKAGE" | translate }}</h3>
4747
<ngx-monaco-editor
4848
[(ngModel)]="payloadData"
4949
[ngModelOptions]="{ standalone: true }"
5050
[options]="editorJsonOutpuOptions"
51-
style="height: 85%"
51+
class="height-85"
5252
>
5353
</ngx-monaco-editor>
5454
</div>
5555
</div>
56-
<div class="col-md-6 d-flex align-items-stretch">
56+
<div class="col-md-6 d-flex align-items-stretch min-height-400">
5757
<div class="jumbotron jumbotron--full-width">
5858
<h3>{{ "DATATARGET.TEST_CONNECTION.SENT-DECODED-REQUEST" | translate }}</h3>
5959
<ngx-monaco-editor
6060
[(ngModel)]="decodedData"
6161
[ngModelOptions]="{ standalone: true }"
6262
[options]="editorJsonOutpuOptions"
63+
class="height-85"
6364
>
6465
</ngx-monaco-editor>
6566
</div>
6667
</div>
67-
<div class="col-md-6 d-flex align-items-stretch">
68+
<div class="col-md-6 d-flex align-items-stretch min-height-400">
6869
<div class="jumbotron jumbotron--full-width">
6970
<h3>{{ "DATATARGET.TEST_CONNECTION.RECEIVED-RESPONSE" | translate }}</h3>
70-
<div *ngIf="loading">
71-
<app-loading-spinner></app-loading-spinner>
72-
</div>
7371
<ngx-monaco-editor
7472
[(ngModel)]="testResponse"
7573
[ngModelOptions]="{ standalone: true }"
7674
[options]="editorJsonOutpuOptions"
75+
class="height-85"
7776
>
7877
</ngx-monaco-editor>
7978
</div>
8079
</div>
80+
<div *ngIf="loading">
81+
<app-loading-spinner></app-loading-spinner>
82+
</div>
8183
</div>
8284
</div>
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
.marginTop5 {
2-
margin-top: 5px !important
1+
.height-85 {
2+
height: 85%;
3+
}
4+
5+
.min-height-400 {
6+
min-height: 400px;
37
}

src/app/applications/datatarget/datatarget-test-connection/datatarget-test-connection.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { MatSelectChange } from "@angular/material/select";
88
import { DatatargetService } from "@applications/datatarget/datatarget.service";
99
import { Datatarget } from "@applications/datatarget/datatarget.model";
1010
import { DataTargetType } from "@shared/enums/datatarget-type";
11-
import { PayloadDecoder } from "@payload-decoder/payload-decoder.model";
11+
import { PayloadDecoderMinimal } from "@payload-decoder/payload-decoder.model";
1212
import { PayloadDecoderService } from "@payload-decoder/payload-decoder.service";
1313
import { PayloadDeviceDatatargetService } from "@payload-decoder/payload-device-datatarget.service";
1414

@@ -28,7 +28,7 @@ export class DatatargetTestConnectionComponent implements OnInit, OnDestroy {
2828
};
2929

3030
public iotDevices: IotDevice[];
31-
public payloadDecoders: PayloadDecoder[];
31+
public payloadDecoders: PayloadDecoderMinimal[];
3232
public payloadData = "";
3333
public testResponse = "";
3434
public decodedData = "";
@@ -120,8 +120,8 @@ export class DatatargetTestConnectionComponent implements OnInit, OnDestroy {
120120
}
121121

122122
private getPayloadDecoders() {
123-
const sub = this.payloadDecoderService.getMultiple(100, 0, "asc", "name").subscribe(({ data }) => {
124-
this.payloadDecoders = data;
123+
const sub = this.payloadDecoderService.getMinimal().subscribe(result => {
124+
this.payloadDecoders = result.data;
125125
});
126126

127127
this.subscriptions.push(sub);
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,54 @@
1+
@import "src/assets/scss/setup/variables";
2+
13
:host {
24
.fa-error {
35
color: red !important;
46
margin-left: 5px;
57
}
68
}
9+
10+
a {
11+
color: $color-link;
12+
border-bottom: 0px transparent !important;
13+
cursor: pointer;
14+
text-decoration: none;
15+
16+
&:hover,
17+
&.link-hover,
18+
&:visited:hover {
19+
color: $color-link-hover;
20+
border-bottom: 0px $color-link-hover-bg !important;
21+
22+
&:disabled,
23+
.disabled {
24+
background-color: transparent !important;
25+
}
26+
}
27+
28+
&:active,
29+
&.link-active {
30+
background-color: inherit;
31+
color: $color-active;
32+
border-bottom: 0px $color-link-active-bg !important;
33+
}
34+
35+
&:focus,
36+
&.link-focus {
37+
color: $color-link-focus;
38+
background-color: transparent;
39+
border-bottom: 0px $color-link-focus-bg !important;
40+
}
41+
42+
&:disabled,
43+
&.disabled {
44+
box-shadow: none !important;
45+
cursor: not-allowed !important;
46+
//color: #000 !important; // FIXME: Hvad skal der der være her?
47+
outline-offset: inherit !important;
48+
49+
&:focus {
50+
outline: none;
51+
background-color: transparent;
52+
}
53+
}
54+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,54 @@
1+
@import "src/assets/scss/setup/variables";
2+
13
:host {
24
.fa-error {
35
color: red !important;
46
margin-left: 5px;
57
}
68
}
9+
10+
a {
11+
color: $color-link;
12+
border-bottom: 0px transparent !important;
13+
cursor: pointer;
14+
text-decoration: none;
15+
16+
&:hover,
17+
&.link-hover,
18+
&:visited:hover {
19+
color: $color-link-hover;
20+
border-bottom: 0px $color-link-hover-bg !important;
21+
22+
&:disabled,
23+
.disabled {
24+
background-color: transparent !important;
25+
}
26+
}
27+
28+
&:active,
29+
&.link-active {
30+
background-color: inherit;
31+
color: $color-active;
32+
border-bottom: 0px $color-link-active-bg !important;
33+
}
34+
35+
&:focus,
36+
&.link-focus {
37+
color: $color-link-focus;
38+
background-color: transparent;
39+
border-bottom: 0px $color-link-focus-bg !important;
40+
}
41+
42+
&:disabled,
43+
&.disabled {
44+
box-shadow: none !important;
45+
cursor: not-allowed !important;
46+
//color: #000 !important; // FIXME: Hvad skal der der være her?
47+
outline-offset: inherit !important;
48+
49+
&:focus {
50+
outline: none;
51+
background-color: transparent;
52+
}
53+
}
54+
}

src/app/payload-decoder/payload-decoder.model.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,13 @@ export interface GetPayloadDecoderParameters {
7171
orderOn: string;
7272
organizationId?: number;
7373
}
74+
75+
export class PayloadDecoderMinimal {
76+
name: string;
77+
id: number;
78+
}
79+
80+
export interface PayloadDecoderMinimalResponse {
81+
data: PayloadDecoderMinimal[];
82+
count: number;
83+
}

src/app/payload-decoder/payload-decoder.service.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ import { Injectable } from "@angular/core";
22
import { RestService } from "../shared/services/rest.service";
33
import { Observable } from "rxjs";
44
import {
5-
PayloadDecoderResponse,
5+
GetPayloadDecoderParameters,
66
PayloadDecoder,
77
PayloadDecoderBodyResponse,
88
PayloadDecoderMappedResponse,
9-
GetPayloadDecoderParameters,
9+
PayloadDecoderMinimalResponse,
10+
PayloadDecoderResponse,
1011
} from "src/app/payload-decoder/payload-decoder.model";
1112
import { SharedVariableService } from "@shared/shared-variable/shared-variable.service";
1213
import { map } from "rxjs/operators";
@@ -101,6 +102,10 @@ export class PayloadDecoderService {
101102
);
102103
}
103104

105+
getMinimal(): Observable<PayloadDecoderMinimalResponse> {
106+
return this.restService.get(this.URL + "/minimal");
107+
}
108+
104109
delete(id: number) {
105110
return this.restService.delete(this.URL, id);
106111
}

0 commit comments

Comments
 (0)