Browse Source

UI: Minor improvements

pull/6641/head
Igor Kulikov 4 years ago
parent
commit
8382850d1a
  1. 6
      ui-ngx/src/app/modules/home/components/vc/auto-commit-settings.component.html
  2. 4
      ui-ngx/src/app/modules/home/components/vc/auto-commit-settings.component.ts
  3. 3
      ui-ngx/src/app/modules/home/components/vc/complex-version-create.component.html
  4. 4
      ui-ngx/src/app/modules/home/components/vc/complex-version-create.component.ts
  5. 6
      ui-ngx/src/app/modules/home/components/vc/entity-types-version-create.component.html
  6. 4
      ui-ngx/src/app/modules/home/components/vc/entity-types-version-create.component.ts
  7. 6
      ui-ngx/src/app/modules/home/components/vc/entity-types-version-load.component.html
  8. 6
      ui-ngx/src/app/modules/home/components/vc/entity-types-version-load.component.ts
  9. 6
      ui-ngx/src/app/modules/home/components/vc/entity-version-create.component.html
  10. 2
      ui-ngx/src/app/modules/home/components/vc/entity-version-create.component.ts
  11. 6
      ui-ngx/src/app/modules/home/components/vc/entity-version-restore.component.html
  12. 4
      ui-ngx/src/app/modules/home/components/vc/entity-version-restore.component.ts
  13. 12
      ui-ngx/src/app/shared/components/popover.component.ts
  14. 8
      ui-ngx/src/app/shared/components/popover.service.ts
  15. 17
      ui-ngx/src/app/shared/models/vc.models.ts
  16. 4
      ui-ngx/src/assets/locale/locale.constant-en_US.json

6
ui-ngx/src/app/modules/home/components/vc/auto-commit-settings.component.html

@ -75,12 +75,12 @@
</div> </div>
</div> </div>
<div fxFlex fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="16px" formGroupName="config"> <div fxFlex fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="16px" formGroupName="config">
<mat-checkbox formControlName="saveRelations">
{{ 'version-control.export-relations' | translate }}
</mat-checkbox>
<mat-checkbox formControlName="saveAttributes"> <mat-checkbox formControlName="saveAttributes">
{{ 'version-control.export-attributes' | translate }} {{ 'version-control.export-attributes' | translate }}
</mat-checkbox> </mat-checkbox>
<mat-checkbox formControlName="saveRelations">
{{ 'version-control.export-relations' | translate }}
</mat-checkbox>
</div> </div>
</div> </div>
</div> </div>

4
ui-ngx/src/app/modules/home/components/vc/auto-commit-settings.component.ts

@ -97,8 +97,8 @@ export class AutoCommitSettingsComponent extends PageComponent implements OnInit
const entityTypesArray = this.autoCommitSettingsForm.get('entityTypes') as FormArray; const entityTypesArray = this.autoCommitSettingsForm.get('entityTypes') as FormArray;
const config: AutoVersionCreateConfig = { const config: AutoVersionCreateConfig = {
branch: null, branch: null,
saveRelations: false, saveAttributes: true,
saveAttributes: false saveRelations: false
}; };
const allowed = this.allowedEntityTypes(); const allowed = this.allowedEntityTypes();
let entityType: EntityType = null; let entityType: EntityType = null;

3
ui-ngx/src/app/modules/home/components/vc/complex-version-create.component.html

@ -39,13 +39,14 @@
{{ 'version-control.version-name-required' | translate }} {{ 'version-control.version-name-required' | translate }}
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex class="mat-block"> <mat-form-field fxFlex class="mat-block" style="margin-bottom: 16px;">
<mat-label translate>version-control.default-sync-strategy</mat-label> <mat-label translate>version-control.default-sync-strategy</mat-label>
<mat-select required formControlName="syncStrategy"> <mat-select required formControlName="syncStrategy">
<mat-option *ngFor="let strategy of syncStrategies" [value]="strategy"> <mat-option *ngFor="let strategy of syncStrategies" [value]="strategy">
{{syncStrategyTranslations.get(strategy) | translate}} {{syncStrategyTranslations.get(strategy) | translate}}
</mat-option> </mat-option>
</mat-select> </mat-select>
<mat-hint [innerHTML]="(syncStrategyHints.get(createVersionFormGroup.get('syncStrategy').value) | translate) | safe:'html'"></mat-hint>
</mat-form-field> </mat-form-field>
<tb-entity-types-version-create <tb-entity-types-version-create
formControlName="entityTypes"> formControlName="entityTypes">

4
ui-ngx/src/app/modules/home/components/vc/complex-version-create.component.ts

@ -20,7 +20,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { import {
ComplexVersionCreateRequest, ComplexVersionCreateRequest,
createDefaultEntityTypesVersionCreate, createDefaultEntityTypesVersionCreate,
SyncStrategy, syncStrategyTranslationMap, SyncStrategy, syncStrategyHintMap, syncStrategyTranslationMap,
VersionCreateRequestType, VersionCreateRequestType,
VersionCreationResult VersionCreationResult
} from '@shared/models/vc.models'; } from '@shared/models/vc.models';
@ -51,6 +51,8 @@ export class ComplexVersionCreateComponent extends PageComponent implements OnIn
syncStrategyTranslations = syncStrategyTranslationMap; syncStrategyTranslations = syncStrategyTranslationMap;
syncStrategyHints = syncStrategyHintMap;
resultMessage: string; resultMessage: string;
versionCreateResult: VersionCreationResult = null; versionCreateResult: VersionCreationResult = null;

6
ui-ngx/src/app/modules/home/components/vc/entity-types-version-create.component.html

@ -65,12 +65,12 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<div fxFlex fxLayout="column" fxLayoutGap="8px"> <div fxFlex fxLayout="column" fxLayoutGap="8px">
<mat-checkbox formControlName="saveRelations">
{{ 'version-control.export-relations' | translate }}
</mat-checkbox>
<mat-checkbox formControlName="saveAttributes"> <mat-checkbox formControlName="saveAttributes">
{{ 'version-control.export-attributes' | translate }} {{ 'version-control.export-attributes' | translate }}
</mat-checkbox> </mat-checkbox>
<mat-checkbox formControlName="saveRelations">
{{ 'version-control.export-relations' | translate }}
</mat-checkbox>
</div> </div>
</div> </div>
</div> </div>

4
ui-ngx/src/app/modules/home/components/vc/entity-types-version-create.component.ts

@ -183,8 +183,8 @@ export class EntityTypesVersionCreateComponent extends PageComponent implements
const entityTypesArray = this.entityTypesVersionCreateFormGroup.get('entityTypes') as FormArray; const entityTypesArray = this.entityTypesVersionCreateFormGroup.get('entityTypes') as FormArray;
const config: EntityTypeVersionCreateConfig = { const config: EntityTypeVersionCreateConfig = {
syncStrategy: null, syncStrategy: null,
saveRelations: false, saveAttributes: true,
saveAttributes: false, saveRelations: true,
allEntities: true, allEntities: true,
entityIds: [] entityIds: []
}; };

6
ui-ngx/src/app/modules/home/components/vc/entity-types-version-load.component.html

@ -64,12 +64,12 @@
</mat-checkbox> </mat-checkbox>
</div> </div>
<div fxFlex fxLayout="column" fxLayoutGap="8px"> <div fxFlex fxLayout="column" fxLayoutGap="8px">
<mat-checkbox formControlName="loadRelations">
{{ 'version-control.load-relations' | translate }}
</mat-checkbox>
<mat-checkbox formControlName="loadAttributes"> <mat-checkbox formControlName="loadAttributes">
{{ 'version-control.load-attributes' | translate }} {{ 'version-control.load-attributes' | translate }}
</mat-checkbox> </mat-checkbox>
<mat-checkbox formControlName="loadRelations">
{{ 'version-control.load-relations' | translate }}
</mat-checkbox>
</div> </div>
</div> </div>
</div> </div>

6
ui-ngx/src/app/modules/home/components/vc/entity-types-version-load.component.ts

@ -164,10 +164,10 @@ export class EntityTypesVersionLoadComponent extends PageComponent implements On
public addEntityType() { public addEntityType() {
const entityTypesArray = this.entityTypesVersionLoadFormGroup.get('entityTypes') as FormArray; const entityTypesArray = this.entityTypesVersionLoadFormGroup.get('entityTypes') as FormArray;
const config: EntityTypeVersionLoadConfig = { const config: EntityTypeVersionLoadConfig = {
loadRelations: false, loadAttributes: true,
loadAttributes: false, loadRelations: true,
removeOtherEntities: false, removeOtherEntities: false,
findExistingEntityByName: false findExistingEntityByName: true
}; };
const allowed = this.allowedEntityTypes(); const allowed = this.allowedEntityTypes();
let entityType: EntityType = null; let entityType: EntityType = null;

6
ui-ngx/src/app/modules/home/components/vc/entity-version-create.component.html

@ -38,12 +38,12 @@
{{ 'version-control.version-name-required' | translate }} {{ 'version-control.version-name-required' | translate }}
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
<mat-checkbox formControlName="saveRelations" style="margin-bottom: 16px;">
{{ 'version-control.export-relations' | translate }}
</mat-checkbox>
<mat-checkbox formControlName="saveAttributes" style="margin-bottom: 16px;"> <mat-checkbox formControlName="saveAttributes" style="margin-bottom: 16px;">
{{ 'version-control.export-attributes' | translate }} {{ 'version-control.export-attributes' | translate }}
</mat-checkbox> </mat-checkbox>
<mat-checkbox formControlName="saveRelations" style="margin-bottom: 16px;">
{{ 'version-control.export-relations' | translate }}
</mat-checkbox>
</div> </div>
</fieldset> </fieldset>
</form> </form>

2
ui-ngx/src/app/modules/home/components/vc/entity-version-create.component.ts

@ -67,7 +67,7 @@ export class EntityVersionCreateComponent extends PageComponent implements OnIni
versionName: [this.translate.instant('version-control.default-create-entity-version-name', versionName: [this.translate.instant('version-control.default-create-entity-version-name',
{entityName: this.entityName}), [Validators.required]], {entityName: this.entityName}), [Validators.required]],
saveRelations: [false, []], saveRelations: [false, []],
saveAttributes: [false, []] saveAttributes: [true, []]
}); });
} }

6
ui-ngx/src/app/modules/home/components/vc/entity-version-restore.component.html

@ -27,12 +27,12 @@
<form *ngIf="entityDataInfo" [formGroup]="restoreFormGroup" style="padding-top: 16px;"> <form *ngIf="entityDataInfo" [formGroup]="restoreFormGroup" style="padding-top: 16px;">
<fieldset [disabled]="isLoading$ | async"> <fieldset [disabled]="isLoading$ | async">
<div fxFlex fxLayout="column"> <div fxFlex fxLayout="column">
<mat-checkbox *ngIf="entityDataInfo.hasRelations" formControlName="loadRelations" style="margin-bottom: 16px;">
{{ 'version-control.load-relations' | translate }}
</mat-checkbox>
<mat-checkbox *ngIf="entityDataInfo.hasAttributes" formControlName="loadAttributes" style="margin-bottom: 16px;"> <mat-checkbox *ngIf="entityDataInfo.hasAttributes" formControlName="loadAttributes" style="margin-bottom: 16px;">
{{ 'version-control.load-attributes' | translate }} {{ 'version-control.load-attributes' | translate }}
</mat-checkbox> </mat-checkbox>
<mat-checkbox *ngIf="entityDataInfo.hasRelations" formControlName="loadRelations" style="margin-bottom: 16px;">
{{ 'version-control.load-relations' | translate }}
</mat-checkbox>
</div> </div>
</fieldset> </fieldset>
</form> </form>

4
ui-ngx/src/app/modules/home/components/vc/entity-version-restore.component.ts

@ -70,8 +70,8 @@ export class EntityVersionRestoreComponent extends PageComponent implements OnIn
ngOnInit(): void { ngOnInit(): void {
this.restoreFormGroup = this.fb.group({ this.restoreFormGroup = this.fb.group({
loadRelations: [true, []], loadAttributes: [true, []],
loadAttributes: [true, []] loadRelations: [true, []]
}); });
this.entitiesVersionControlService.getEntityDataInfo(this.externalEntityId, this.versionId).subscribe((data) => { this.entitiesVersionControlService.getEntityDataInfo(this.externalEntityId, this.versionId).subscribe((data) => {
this.entityDataInfo = data; this.entityDataInfo = data;

12
ui-ngx/src/app/shared/components/popover.component.ts

@ -55,7 +55,7 @@ import {
POSITION_MAP, POSITION_MAP,
PropertyMapping PropertyMapping
} from '@shared/components/popover.models'; } from '@shared/components/popover.models';
import { distinctUntilChanged, takeUntil } from 'rxjs/operators'; import { distinctUntilChanged, take, takeUntil } from 'rxjs/operators';
import { isNotEmptyStr, onParentScrollOrWindowResize } from '@core/utils'; import { isNotEmptyStr, onParentScrollOrWindowResize } from '@core/utils';
export type TbPopoverTrigger = 'click' | 'focus' | 'hover' | null; export type TbPopoverTrigger = 'click' | 'focus' | 'hover' | null;
@ -372,7 +372,7 @@ export class TbPopoverComponent implements OnDestroy, OnInit {
} }
get tbVisible(): boolean { get tbVisible(): boolean {
return this.visible; return this.visible && this.tbAnimationState === 'active';
} }
visible = false; visible = false;
@ -514,10 +514,12 @@ export class TbPopoverComponent implements OnDestroy, OnInit {
const el = this.origin.elementRef.nativeElement; const el = this.origin.elementRef.nativeElement;
this.intersectionObserver.unobserve(el); this.intersectionObserver.unobserve(el);
} }
this.tbAnimationState = 'void';
this.tbVisible = false;
this.tbVisibleChange.next(false);
this.cdr.detectChanges(); this.cdr.detectChanges();
this.tbAnimationDone.pipe(take(1)).subscribe(() => {
this.tbVisible = false;
this.cdr.detectChanges();
});
} }
updateByDirective(): void { updateByDirective(): void {

8
ui-ngx/src/app/shared/components/popover.service.ts

@ -80,9 +80,7 @@ export class TbPopoverService {
component.tbShowCloseButton = showCloseButton; component.tbShowCloseButton = showCloseButton;
component.tbVisibleChange.subscribe((visible: boolean) => { component.tbVisibleChange.subscribe((visible: boolean) => {
if (!visible) { if (!visible) {
component.tbAnimationDone.subscribe(() => { componentRef.destroy();
componentRef.destroy();
});
} }
}); });
component.tbDestroy.subscribe(() => { component.tbDestroy.subscribe(() => {
@ -132,9 +130,7 @@ export class TbPopoverService {
component.tbVisibleChange.subscribe((visible: boolean) => { component.tbVisibleChange.subscribe((visible: boolean) => {
if (!visible) { if (!visible) {
visibleFn(false); visibleFn(false);
component.tbAnimationDone.subscribe(() => { componentRef.destroy();
componentRef.destroy();
});
} }
}); });
component.tbDestroy.subscribe(() => { component.tbDestroy.subscribe(() => {

17
ui-ngx/src/app/shared/models/vc.models.ts

@ -64,6 +64,13 @@ export const syncStrategyTranslationMap = new Map<SyncStrategy, string>(
] ]
); );
export const syncStrategyHintMap = new Map<SyncStrategy, string>(
[
[SyncStrategy.MERGE, 'version-control.sync-strategy-merge-hint'],
[SyncStrategy.OVERWRITE, 'version-control.sync-strategy-overwrite-hint']
]
);
export interface EntityTypeVersionCreateConfig extends VersionCreateConfig { export interface EntityTypeVersionCreateConfig extends VersionCreateConfig {
syncStrategy: SyncStrategy; syncStrategy: SyncStrategy;
entityIds: string[]; entityIds: string[];
@ -81,8 +88,8 @@ export function createDefaultEntityTypesVersionCreate(): {[entityType: string]:
for (const entityType of exportableEntityTypes) { for (const entityType of exportableEntityTypes) {
res[entityType] = { res[entityType] = {
syncStrategy: null, syncStrategy: null,
saveRelations: false, saveAttributes: true,
saveAttributes: false, saveRelations: true,
allEntities: true, allEntities: true,
entityIds: [] entityIds: []
}; };
@ -126,10 +133,10 @@ export function createDefaultEntityTypesVersionLoad(): {[entityType: string]: En
const res: {[entityType: string]: EntityTypeVersionLoadConfig} = {}; const res: {[entityType: string]: EntityTypeVersionLoadConfig} = {};
for (const entityType of exportableEntityTypes) { for (const entityType of exportableEntityTypes) {
res[entityType] = { res[entityType] = {
loadRelations: false, loadAttributes: true,
loadAttributes: false, loadRelations: true,
removeOtherEntities: false, removeOtherEntities: false,
findExistingEntityByName: false findExistingEntityByName: true
}; };
} }
return res; return res;

4
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -3168,7 +3168,9 @@
"deleted": "{{deleted}} deleted", "deleted": "{{deleted}} deleted",
"remove-other-entities-confirm-text": "Be careful! This will permanently <b>delete</b> <b>all</b> current entities<br/>not present in the version you want to restore.<br/><br/>Please type <b>remove other entities</b> to confirm.", "remove-other-entities-confirm-text": "Be careful! This will permanently <b>delete</b> <b>all</b> current entities<br/>not present in the version you want to restore.<br/><br/>Please type <b>remove other entities</b> to confirm.",
"auto-commit-to-branch": "auto-commit to <b>{{ branch }}</b> branch", "auto-commit-to-branch": "auto-commit to <b>{{ branch }}</b> branch",
"default-create-entity-version-name": "{{entityName}} update" "default-create-entity-version-name": "{{entityName}} update",
"sync-strategy-merge-hint": "Sync strategy <b>merge</b> hint",
"sync-strategy-overwrite-hint": "Sync strategy <b>overwrite</b> hint"
}, },
"widget": { "widget": {
"widget-library": "Widgets Library", "widget-library": "Widgets Library",

Loading…
Cancel
Save