Skip to content

Commit 6c31093

Browse files
committed
[NAE-1758] Task on single task view is not rendering
- added check for null value
1 parent cd24876 commit 6c31093

File tree

5 files changed

+19
-13
lines changed

5 files changed

+19
-13
lines changed

projects/netgrif-components-core/src/lib/data-fields/enumeration-field/enumeration-autocomplete-select-field/abstract-enumeration-autocomplete-select-field.component.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Component, Input, OnDestroy, OnInit, ViewChild} from '@angular/core';
2-
import {FormControl, NgModel} from '@angular/forms';
2+
import { AbstractControl, FormControl, NgModel, ValidationErrors } from '@angular/forms';
33
import {Observable, of} from 'rxjs';
44
import {map, startWith} from 'rxjs/operators';
55
import {EnumerationField, EnumerationFieldValidation, EnumerationFieldValue} from '../models/enumeration-field';
@@ -21,12 +21,14 @@ export abstract class AbstractEnumerationAutocompleteSelectFieldComponent implem
2121
public tmpValue: string;
2222

2323
filteredOptions: Observable<Array<EnumerationFieldValue>>;
24+
filteredOptionsArray: Array<EnumerationFieldValue>;
2425

2526
constructor(protected _translate: TranslateService) {
2627
}
2728

2829
ngOnInit() {
2930
this.tmpValue = this.formControlRef.value ?? '';
31+
this.formControlRef.addValidators(this.checkFilteredOptions);
3032
this.filteredOptions = this.formControlRef.valueChanges.pipe(
3133
startWith(''),
3234
map(value => this._filter(value))
@@ -121,4 +123,12 @@ export abstract class AbstractEnumerationAutocompleteSelectFieldComponent implem
121123
return this._translate.instant('dataField.validations.enumeration');
122124
}
123125
}
126+
127+
private checkFilteredOptions(control: AbstractControl): ValidationErrors | null {
128+
if (!!this.filteredOptionsArray && this.filteredOptionsArray.length === 0) {
129+
return {wrongValue: true};
130+
}
131+
return null;
132+
}
133+
124134
}

projects/netgrif-components/src/lib/panel/panel.component.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<mat-expansion-panel [@.disabled]="expansionDisabled" hideToggle (afterExpand)="emitExpand()"
22
(afterCollapse)="emitCollapse()" #matExpansionPanel class="panel-margin"
3-
[ngClass]="{'margin-top':first, 'margin-bottom':last}" [disabled]='preventCollapse'>
4-
<mat-expansion-panel-header *ngIf="showPanelHeader()"
5-
(click)="expandPanel()" class="panel-color header-padding header-min-height"
3+
[ngClass]="{'margin-top':first, 'margin-bottom':last}">
4+
<mat-expansion-panel-header (click)="expandPanel()" class="panel-color header-padding header-min-height"
65
[ngStyle]="{'background': caseColor, 'color': getCaseFontColor()}">
76
<mat-panel-description *ngTemplateOutlet="panelHeader">
87
</mat-panel-description>

projects/netgrif-components/src/lib/panel/task-panel-single/single-task.component.html

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<span class='font-size-20'>{{ 'tasks.view.noTasksSatisfyingThisFilter' | translate }}</span>
88
</div>
99

10-
<div class='full-width full-heigh task-tab-background' fxFlex='100'>
10+
<div class='full-width full-height task-tab-background' fxFlex='100'>
1111
<div *ngTemplateOutlet='pageHeader ?? defaultPageHeader'></div>
1212
<nc-task-panel
1313
[textEllipsis]='textEllipsis'
@@ -16,10 +16,8 @@
1616
[responsiveBody]='responsiveBody'
1717
(taskEvent)='emitTaskEvent($event)'
1818
(panelRefOutput)='setPanelRef($event)'
19-
[preventCollapse]='preventCollapse'
20-
[hidePanelHeader]='hidePanelHeader'
21-
[actionButtonTemplates]='actionButtonTemplates'
22-
[actionRowJustifyContent]='actionRowJustifyContent'
19+
[first]='true'
20+
[last]='true'
2321
class='panel-expanded-spacing'>
2422
</nc-task-panel>
2523

@@ -36,7 +34,7 @@
3634
</ng-template>
3735

3836
<ng-template #defaultPageFooter>
39-
<mat-card class='bootom-card footer'>
37+
<mat-card class='bottom-card footer'>
4038
<span class="bottom-card-title footer-font"><strong>{{footerText ?? 'tasks.footer.defaultText' | translate}}</strong></span>
4139
</mat-card>
4240
</ng-template>

projects/netgrif-components/src/lib/panel/task-panel-single/single-task.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
}
88

99
.full-height {
10-
height: 100%;
10+
height: 100vh;
1111
}
1212

1313
.task-panel-scroll-container {

projects/netgrif-components/src/lib/panel/task-panel/task-panel.component.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<nc-app-panel [panelContent]="taskPanelContent" [panelHeader]="taskPanelHeader"
2-
(stopLoading)="stopLoading()" (getExpansionPanelRef)="setPanelRef($event)" [first]="first" [last]="last"
3-
[preventCollapse]='preventCollapse' [hidePanelHeader]='hidePanelHeader'>
2+
(stopLoading)="stopLoading()" (getExpansionPanelRef)="setPanelRef($event)" [first]="first" [last]="last">
43
<ng-template #taskPanelHeader>
54
<div fxLayoutAlign="start center" fxLayout="row" fxFlex="95" (click)="preventSelectionClick($event)">
65
<div *ngFor="let field of featuredFieldsValues; let i = index" fxFlex

0 commit comments

Comments
 (0)