Skip to content

Commit 2a5bb17

Browse files
Fix attachment issues(specially in '23) and hence the Pipeline (#202)
1 parent dbcaee9 commit 2a5bb17

File tree

8 files changed

+351
-73
lines changed

8 files changed

+351
-73
lines changed

src/app/_components/_templates/case-view/case-view.component.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export class CaseViewComponent implements OnInit {
3838

3939
caseSummaryPConn$: any;
4040
currentCaseID: string = '';
41+
bHasNewAttachments: boolean = false;
4142

4243
constructor(private cdRef: ChangeDetectorRef, private angularPConnect: AngularPConnectService, private utils: Utils) {}
4344

@@ -100,6 +101,17 @@ export class CaseViewComponent implements OnInit {
100101

101102
updateHeaderAndSummary() {
102103
this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps());
104+
let hasNewAttachments = this.pConn$.getDataObject().caseInfo?.hasNewAttachments;
105+
106+
if(hasNewAttachments !== this.bHasNewAttachments){
107+
this.bHasNewAttachments = hasNewAttachments;
108+
if(this.bHasNewAttachments){
109+
this.PCore$.getPubSubUtils().publish(
110+
this.PCore$.getEvents().getCaseEvent().CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW,
111+
true
112+
);
113+
}
114+
}
103115

104116
let kids = this.pConn$.getChildren();
105117
for (let kid of kids) {

src/app/_components/_widgets/file-utility/file-utility.component.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,23 @@ export class FileUtilityComponent implements OnInit {
9393
this.updateSelf();
9494

9595
this.createModalButtons();
96+
97+
this.PCore$.getPubSubUtils().subscribe(
98+
this.PCore$.getEvents().getCaseEvent().CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW,
99+
this.updateSelf.bind(this),
100+
"caseAttachmentsUpdateFromCaseview"
101+
);
96102
}
97103

98104
ngOnDestroy(): void {
99105
if (this.angularPConnectData.unsubscribeFn) {
100106
this.angularPConnectData.unsubscribeFn();
101107
}
108+
109+
this.PCore$.getPubSubUtils().unsubscribe(
110+
this.PCore$.getEvents().getCaseEvent().CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW,
111+
"caseAttachmentsUpdateFromCaseview"
112+
);
102113
}
103114

104115
// Callback passed when subscribing to store change
Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,64 @@
11
<div class="psdk-label-infix-readonly">
22
<span class="psdk-label-wrapper-readonly">
3-
<label class="psdk-label-readonly">{{ label$ }}</label>
3+
<label
4+
[ngClass]="{
5+
'psdk-label-readonly': true,
6+
'label-required': bRequired$ === true
7+
}"
8+
[htmlFor]="att_valueRef"
9+
>{{ label$ }}</label
10+
>
411
</span>
5-
<div class="psdk-modal-file-selector" *ngIf="bShowSelector$">
6-
<mat-spinner *ngIf="bLoading$" class="progress-spinner" diameter="40"></mat-spinner>
7-
<input hidden type="file" #uploader id="upload-input" (change)="uploadMyFiles($event)" />
12+
<div
13+
[ngClass]="{
14+
'psdk-modal-file-selector': status !== 'error',
15+
'psdk-modal-file-selector-error': status === 'error'
16+
}"
17+
id="attachment-container"
18+
*ngIf="bShowSelector$"
19+
>
20+
<mat-spinner
21+
*ngIf="bLoading$"
22+
class="progress-spinner"
23+
diameter="40"
24+
></mat-spinner>
25+
<input
26+
hidden
27+
type="file"
28+
[required]="bRequired$"
29+
#uploader
30+
[id]="att_valueRef"
31+
(change)="uploadMyFiles($event)"
32+
/>
833

9-
<button mat-stroked-button color="primary" [disabled]="bDisabled$" (click)="uploader.click()">Upload file</button>
34+
<button
35+
mat-stroked-button
36+
color="primary"
37+
[disabled]="bDisabled$"
38+
(click)="uploader.click()"
39+
>
40+
Upload file
41+
</button>
42+
<span *ngIf="validatemessage" class="file-error">{{
43+
validatemessage
44+
}}</span>
1045
</div>
1146

12-
<div class="psdk-attachment-list" *ngIf="arFileList$ != null && arFileList$.length > 0">
47+
<div
48+
class="psdk-attachment-list"
49+
*ngIf="arFileList$ != null && arFileList$.length > 0"
50+
>
1351
<app-material-summary-list
1452
*ngIf="bShowJustDelete$; else showfull"
1553
[arItems$]="arFileList$"
1654
[menuIconOverride$]="'trash'"
1755
[menuIconOverrideAction$]="removeFileFromList$"
1856
></app-material-summary-list>
1957
<ng-template #showfull>
20-
<app-material-summary-list [arItems$]="arFileList$" [menuIconOverrideAction$]="removeFileFromList$"></app-material-summary-list>
58+
<app-material-summary-list
59+
[arItems$]="arFileList$"
60+
[menuIconOverrideAction$]="removeFileFromList$"
61+
></app-material-summary-list>
2162
</ng-template>
2263
</div>
2364
</div>

src/app/_components/attachment/attachment.component.scss

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../../_shared/styles.scss';
1+
@import "../../_shared/styles.scss";
22

33
.progress-spinner {
44
text-align: center;
@@ -14,13 +14,33 @@
1414
position: relative;
1515
}
1616

17+
.label-required::after {
18+
display: inline;
19+
content: " *";
20+
vertical-align: top;
21+
color: $app-neutral-dark-color;
22+
}
23+
24+
.file-error {
25+
color: $app-error-light-color;
26+
}
27+
28+
.psdk-modal-file-selector-error {
29+
border: 1px dashed $app-error-light-color;
30+
width: 100%;
31+
padding: 0.3rem;
32+
text-align: center;
33+
position: relative;
34+
}
35+
1736
.psdk-full-width {
1837
width: 100%;
1938
}
2039

2140
.psdk-label-readonly {
2241
opacity: 54%;
23-
font-size: 0.7rem;
42+
font-size: 0.8rem;
43+
font-weight: 400;
2444
}
2545

2646
.psdk-data-readonly {

0 commit comments

Comments
 (0)