From 0be0df601567b7e72e24f05427f5661aca6e2a1e Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Fri, 27 May 2022 19:34:55 +0300 Subject: [PATCH] UI: Implemented entity version diff component. --- .../http/entities-version-control.service.ts | 10 +- .../vc/entity-version-diff.component.html | 50 +++- .../vc/entity-version-diff.component.scss | 46 ++- .../vc/entity-version-diff.component.ts | 283 ++++++++++++++++-- .../vc/entity-versions-table.component.ts | 10 +- ui-ngx/src/app/shared/models/vc.models.ts | 41 +++ .../assets/locale/locale.constant-en_US.json | 6 +- 7 files changed, 407 insertions(+), 39 deletions(-) diff --git a/ui-ngx/src/app/core/http/entities-version-control.service.ts b/ui-ngx/src/app/core/http/entities-version-control.service.ts index 86674f0569..7578696774 100644 --- a/ui-ngx/src/app/core/http/entities-version-control.service.ts +++ b/ui-ngx/src/app/core/http/entities-version-control.service.ts @@ -19,7 +19,7 @@ import { HttpClient } from '@angular/common/http'; import { defaultHttpOptionsFromConfig, RequestConfig } from '@core/http/http-utils'; import { combineLatest, Observable, of } from 'rxjs'; import { - BranchInfo, + BranchInfo, EntityDataDiff, EntityVersion, VersionCreateRequest, VersionCreationResult, @@ -105,4 +105,12 @@ export class EntitiesVersionControlService { public loadEntitiesVersion(request: VersionLoadRequest, config?: RequestConfig): Observable> { return this.http.post>('/api/entities/vc/entity', request, defaultHttpOptionsFromConfig(config)); } + + public compareEntityDataToVersion(branch: string, + entityId: EntityId, + versionId: string, + config?: RequestConfig): Observable { + return this.http.get(`/api/entities/vc/diff/${branch}/${entityId.entityType}/${entityId.id}?versionId=${versionId}`, + defaultHttpOptionsFromConfig(config)); + } } diff --git a/ui-ngx/src/app/modules/home/components/vc/entity-version-diff.component.html b/ui-ngx/src/app/modules/home/components/vc/entity-version-diff.component.html index f080fcaf99..22bebd716f 100644 --- a/ui-ngx/src/app/modules/home/components/vc/entity-version-diff.component.html +++ b/ui-ngx/src/app/modules/home/components/vc/entity-version-diff.component.html @@ -15,16 +15,52 @@ limitations under the License. --> -
- +
+

{{ 'version-control.diff-entity-with-version' | translate: {versionName} }}

+ + + + {{ 'version-control.differences' | translate : {count: diffCount} }} + + +
- - -
-
+
+
{{ 'version-control.current' | translate }}
+
+
{{ versionIdContent() }}
+
+ +
+