@hmcts/ccd-case-ui-toolkit 7.3.83 → 7.3.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -11,7 +11,7 @@ import { NG_VALUE_ACCESSOR, NG_VALIDATORS, FormArray, FormGroup, FormControl, Va
|
|
|
11
11
|
import { BehaviorSubject, throwError, Subject, EMPTY, concat, defer, timer, Observable, skip, of, forkJoin, fromEvent, Subscription, combineLatest } from 'rxjs';
|
|
12
12
|
import { distinctUntilChanged, catchError, map, switchMap, repeat, retry, publish, refCount, debounceTime, delay, finalize, timeout, mergeMap, retryWhen, tap, delayWhen, publishReplay, take, first, takeUntil, filter } from 'rxjs/operators';
|
|
13
13
|
import * as i1$2 from '@angular/common/http';
|
|
14
|
-
import { HttpErrorResponse, HttpHeaders, HttpParams } from '@angular/common/http';
|
|
14
|
+
import { HttpErrorResponse, HttpHeaders, HttpParams, HttpStatusCode } from '@angular/common/http';
|
|
15
15
|
import { Type, Exclude, Expose, plainToClassFromExist, plainToClass } from 'class-transformer';
|
|
16
16
|
import moment from 'moment';
|
|
17
17
|
import { __decorate, __metadata } from 'tslib';
|
|
@@ -14653,8 +14653,8 @@ class CaseFileViewFieldComponent {
|
|
|
14653
14653
|
this.caseFileViewService.updateDocumentCategory(cid, this.caseVersion, data.document.attribute_path, data.newCategory)
|
|
14654
14654
|
.pipe(finalize(() => {
|
|
14655
14655
|
this.loadingService.unregister(loadingToken);
|
|
14656
|
-
}), catchError(() => {
|
|
14657
|
-
this.errorMessages = [
|
|
14656
|
+
}), catchError((err) => {
|
|
14657
|
+
this.errorMessages = [this.moveDocumentError(err)];
|
|
14658
14658
|
return of(null);
|
|
14659
14659
|
}))
|
|
14660
14660
|
.subscribe(res => {
|
|
@@ -14678,6 +14678,31 @@ class CaseFileViewFieldComponent {
|
|
|
14678
14678
|
isIcpEnabled() {
|
|
14679
14679
|
return this.icpEnabled && ((this.icp_jurisdictions?.length < 1) || this.icp_jurisdictions.includes(this.caseNotifier?.cachedCaseView?.case_type?.jurisdiction.id));
|
|
14680
14680
|
}
|
|
14681
|
+
moveDocumentError(err) {
|
|
14682
|
+
const defaultMsg = 'We couldn\'t move the document. Please try again.';
|
|
14683
|
+
if (!(err instanceof HttpErrorResponse)) {
|
|
14684
|
+
return defaultMsg;
|
|
14685
|
+
}
|
|
14686
|
+
switch (err.status) {
|
|
14687
|
+
case HttpStatusCode.BadRequest:
|
|
14688
|
+
// e.g. malformed PUT, invalid attribute_path, invalid target category
|
|
14689
|
+
return 'The request was invalid. Check the document path and destination folder.';
|
|
14690
|
+
case HttpStatusCode.Conflict:
|
|
14691
|
+
// optimistic concurrency / stale case version
|
|
14692
|
+
return 'This case changed since you opened it. Refresh and try again.';
|
|
14693
|
+
case HttpStatusCode.NotFound:
|
|
14694
|
+
return 'The document or destination folder could not be found.';
|
|
14695
|
+
case HttpStatusCode.Forbidden:
|
|
14696
|
+
case HttpStatusCode.Unauthorized:
|
|
14697
|
+
return 'You do not have permission to move this document to the selected folder.';
|
|
14698
|
+
case HttpStatusCode.ServiceUnavailable:
|
|
14699
|
+
case HttpStatusCode.GatewayTimeout:
|
|
14700
|
+
return 'The service is temporarily unavailable. Please try again in a moment.';
|
|
14701
|
+
default:
|
|
14702
|
+
// Any other status (including 500)
|
|
14703
|
+
return defaultMsg;
|
|
14704
|
+
}
|
|
14705
|
+
}
|
|
14681
14706
|
static ɵfac = function CaseFileViewFieldComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CaseFileViewFieldComponent)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(CaseFileViewService), i0.ɵɵdirectiveInject(DocumentManagementService), i0.ɵɵdirectiveInject(LoadingService), i0.ɵɵdirectiveInject(SessionStorageService), i0.ɵɵdirectiveInject(WindowService), i0.ɵɵdirectiveInject(CaseNotifier), i0.ɵɵdirectiveInject(AbstractAppConfig)); };
|
|
14682
14707
|
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseFileViewFieldComponent, selectors: [["ccd-case-file-view-field"]], standalone: false, decls: 3, vars: 3, consts: [[4, "ngIf"], ["class", "govuk-grid-column-two-thirds", 4, "ngIf"], ["id", "case-file-view-field-errors", "data-module", "govuk-error-summary", 1, "govuk-error-summary", "govuk-!-margin-bottom-4"], ["role", "alert"], [1, "govuk-error-summary__title"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], [4, "ngFor", "ngForOf"], ["type", "button", 1, "govuk-js-link"], [1, "govuk-grid-column-two-thirds"], [1, "govuk-heading-xl"], [1, "govuk-body"], [1, "govuk-heading-l"], ["id", "case-file-view", 1, "govuk-form-group"], [1, "document-tree-container"], [1, "document-tree-container__tree", 3, "clickedDocument", "moveDocument", "categoriesAndDocuments", "allowMoving"], [1, "slider"], [1, "media-viewer-container"], [3, "url", "downloadFileName", "showToolbar", "contentType", "enableAnnotations", "enableRedactions", "height", "caseId", "multimediaPlayerEnabled", "enableICP"]], template: function CaseFileViewFieldComponent_Template(rf, ctx) { if (rf & 1) {
|
|
14683
14708
|
i0.ɵɵtemplate(0, CaseFileViewFieldComponent_ng_container_0_Template, 8, 1, "ng-container", 0)(1, CaseFileViewFieldComponent_div_1_Template, 5, 0, "div", 1)(2, CaseFileViewFieldComponent_div_2_Template, 9, 3, "div", 0);
|
|
@@ -14693,7 +14718,7 @@ class CaseFileViewFieldComponent {
|
|
|
14693
14718
|
type: Component,
|
|
14694
14719
|
args: [{ selector: 'ccd-case-file-view-field', standalone: false, template: "<ng-container *ngIf=\"errorMessages?.length\">\n <div\n id=\"case-file-view-field-errors\"\n class=\"govuk-error-summary govuk-!-margin-bottom-4\"\n data-module=\"govuk-error-summary\"\n >\n <div role=\"alert\">\n <h2 class=\"govuk-error-summary__title\">There is a problem</h2>\n <div class=\"govuk-error-summary__body\">\n <ul class=\"govuk-list govuk-error-summary__list\">\n <li *ngFor=\"let errorMessage of errorMessages\">\n <button type=\"button\" class=\"govuk-js-link\">{{ errorMessage }}</button>\n </li>\n </ul>\n </div>\n </div>\n </div>\n</ng-container>\n\n<div\n *ngIf=\"getCategoriesAndDocumentsError\"\n class=\"govuk-grid-column-two-thirds\"\n>\n <h1 class=\"govuk-heading-xl\">Sorry, there is a problem with the service</h1>\n <p class=\"govuk-body\">Try again later.</p>\n</div>\n<div *ngIf=\"!getCategoriesAndDocumentsError\">\n <h2 class=\"govuk-heading-l\">Case file</h2>\n <div class=\"govuk-form-group\" id=\"case-file-view\">\n <!-- Document tree -->\n <div class=\"document-tree-container\">\n <ccd-case-file-view-folder \n class=\"document-tree-container__tree\"\n [categoriesAndDocuments]=\"categoriesAndDocuments$\"\n (clickedDocument)=\"setMediaViewerFile($event); resetErrorMessages()\" \n (moveDocument)=\"moveDocument($event)\"\n [allowMoving]=\"allowMoving\">\n </ccd-case-file-view-folder>\n </div>\n <!-- Slider -->\n <div class=\"slider\"></div>\n <!-- Media viewer -->\n <div class=\"media-viewer-container\">\n <ng-container *ngIf=\"currentDocument\">\n <mv-media-viewer\n [url]=\"currentDocument.document_binary_url\"\n [downloadFileName]=\"currentDocument.document_filename\"\n [showToolbar]=\"true\"\n [contentType]=\"currentDocument.content_type\"\n [enableAnnotations]=\"true\"\n [enableRedactions]=\"true\"\n [height]=\"'94.5vh'\"\n [caseId]=\"caseId\"\n [multimediaPlayerEnabled]=\"true\"\n [enableICP]=\"isIcpEnabled()\"\n >\n </mv-media-viewer>\n </ng-container>\n </div>\n </div>\n</div>\n", styles: ["#case-file-view{display:flex;border:2px solid #C9C9C9;height:100vh;position:relative}#case-file-view .document-tree-container{background-color:#faf8f8;width:30%;min-height:400px;min-width:10%}#case-file-view .slider{width:.2%;background-color:#6b6b6b}#case-file-view .slider:hover,#case-file-view .slider:focus{cursor:col-resize}#case-file-view .media-viewer-container{background-color:#dee0e2;flex:1 1 0;overflow:hidden}\n"] }]
|
|
14695
14720
|
}], () => [{ type: i0.ElementRef }, { type: i1$1.ActivatedRoute }, { type: CaseFileViewService }, { type: DocumentManagementService }, { type: LoadingService }, { type: SessionStorageService }, { type: WindowService }, { type: CaseNotifier }, { type: AbstractAppConfig }], null); })();
|
|
14696
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseFileViewFieldComponent, { className: "CaseFileViewFieldComponent", filePath: "lib/shared/components/palette/case-file-view/case-file-view-field.component.ts", lineNumber:
|
|
14721
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseFileViewFieldComponent, { className: "CaseFileViewFieldComponent", filePath: "lib/shared/components/palette/case-file-view/case-file-view-field.component.ts", lineNumber: 20 }); })();
|
|
14697
14722
|
|
|
14698
14723
|
const PVP_FLAG_CODE = 'PF0021';
|
|
14699
14724
|
const PVP_DISPLAY_TEXT = 'POTENTIALLY VIOLENT PERSON';
|