Auto-commit disable form and buttons if Read-only flag is checked in Repository settings
This commit is contained in:
parent
505404903a
commit
dc1a786d7e
@ -29,7 +29,7 @@
|
|||||||
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>
|
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>
|
||||||
<mat-card-content style="padding-top: 16px;">
|
<mat-card-content style="padding-top: 16px;">
|
||||||
<form [formGroup]="autoCommitSettingsForm" #formDirective="ngForm" (ngSubmit)="save()">
|
<form [formGroup]="autoCommitSettingsForm" #formDirective="ngForm" (ngSubmit)="save()">
|
||||||
<fieldset class="fields-group" [disabled]="isLoading$ | async">
|
<fieldset class="fields-group" [disabled]="(isLoading$ | async) || (isReadOnly | async)">
|
||||||
<legend class="group-title" translate>admin.auto-commit-entities</legend>
|
<legend class="group-title" translate>admin.auto-commit-entities</legend>
|
||||||
<div fxLayout="column">
|
<div fxLayout="column">
|
||||||
<div *ngFor="let entityTypeFormGroup of entityTypesFormGroupArray(); trackBy: trackByEntityType;
|
<div *ngFor="let entityTypeFormGroup of entityTypesFormGroupArray(); trackBy: trackByEntityType;
|
||||||
@ -111,13 +111,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
<div class="tb-hint" *ngIf="isReadOnly | async" translate>version-control.auto-commit-settings-read-only-hint</div>
|
||||||
<div fxLayout="row" fxLayoutAlign="end center" fxLayout.xs="column" fxLayoutAlign.xs="end" fxLayoutGap="16px">
|
<div fxLayout="row" fxLayoutAlign="end center" fxLayout.xs="column" fxLayoutAlign.xs="end" fxLayoutGap="16px">
|
||||||
<button mat-raised-button color="warn" type="button" [fxShow]="settings !== null"
|
<button mat-raised-button color="warn" type="button" [fxShow]="settings !== null"
|
||||||
[disabled]="(isLoading$ | async)" (click)="delete(formDirective)">
|
[disabled]="(isLoading$ | async) || (isReadOnly | async)" (click)="delete(formDirective)">
|
||||||
{{'action.delete' | translate}}
|
{{'action.delete' | translate}}
|
||||||
</button>
|
</button>
|
||||||
<span fxFlex></span>
|
<span fxFlex></span>
|
||||||
<button mat-raised-button color="primary" [disabled]="(isLoading$ | async) || autoCommitSettingsForm.invalid || !autoCommitSettingsForm.dirty"
|
<button mat-raised-button color="primary" [disabled]="(isLoading$ | async) || (isReadOnly | async) || autoCommitSettingsForm.invalid || !autoCommitSettingsForm.dirty"
|
||||||
type="submit">{{'action.save' | translate}}
|
type="submit">{{'action.save' | translate}}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -23,8 +23,8 @@ import { AdminService } from '@core/http/admin.service';
|
|||||||
import { AutoCommitSettings, AutoVersionCreateConfig } from '@shared/models/settings.models';
|
import { AutoCommitSettings, AutoVersionCreateConfig } from '@shared/models/settings.models';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { DialogService } from '@core/services/dialog.service';
|
import { DialogService } from '@core/services/dialog.service';
|
||||||
import { catchError, mergeMap } from 'rxjs/operators';
|
import { catchError, map, mergeMap } from 'rxjs/operators';
|
||||||
import { of } from 'rxjs';
|
import { Observable, of } from 'rxjs';
|
||||||
import { EntityTypeVersionCreateConfig, exportableEntityTypes } from '@shared/models/vc.models';
|
import { EntityTypeVersionCreateConfig, exportableEntityTypes } from '@shared/models/vc.models';
|
||||||
import { EntityType, entityTypeTranslations } from '@shared/models/entity-type.models';
|
import { EntityType, entityTypeTranslations } from '@shared/models/entity-type.models';
|
||||||
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
||||||
@ -41,6 +41,8 @@ export class AutoCommitSettingsComponent extends PageComponent implements OnInit
|
|||||||
|
|
||||||
entityTypes = EntityType;
|
entityTypes = EntityType;
|
||||||
|
|
||||||
|
isReadOnly: Observable<boolean>;
|
||||||
|
|
||||||
constructor(protected store: Store<AppState>,
|
constructor(protected store: Store<AppState>,
|
||||||
private adminService: AdminService,
|
private adminService: AdminService,
|
||||||
private dialogService: DialogService,
|
private dialogService: DialogService,
|
||||||
@ -71,6 +73,7 @@ export class AutoCommitSettingsComponent extends PageComponent implements OnInit
|
|||||||
this.autoCommitSettingsForm.setControl('entityTypes',
|
this.autoCommitSettingsForm.setControl('entityTypes',
|
||||||
this.prepareEntityTypesFormArray(settings), {emitEvent: false});
|
this.prepareEntityTypesFormArray(settings), {emitEvent: false});
|
||||||
});
|
});
|
||||||
|
this.isReadOnly = this.adminService.getRepositorySettingsInfo().pipe(map(settings => settings.readOnly));
|
||||||
}
|
}
|
||||||
|
|
||||||
entityTypesFormGroupArray(): FormGroup[] {
|
entityTypesFormGroupArray(): FormGroup[] {
|
||||||
|
|||||||
@ -3488,7 +3488,8 @@
|
|||||||
"sync-strategy-overwrite-hint": "Creates or updates selected entities in the repository. All other repository entities are <b>deleted</b>.",
|
"sync-strategy-overwrite-hint": "Creates or updates selected entities in the repository. All other repository entities are <b>deleted</b>.",
|
||||||
"device-credentials-conflict": "Failed to load the device with external id <b>{{entityId}}</b><br/>due to the same credentials are already present in the database for another device.<br/>Please consider disabling the <b>load credentials</b> setting in the restore form.",
|
"device-credentials-conflict": "Failed to load the device with external id <b>{{entityId}}</b><br/>due to the same credentials are already present in the database for another device.<br/>Please consider disabling the <b>load credentials</b> setting in the restore form.",
|
||||||
"missing-referenced-entity": "Failed to load the <b>{{sourceEntityTypeName}}</b> with external id <b>{{sourceEntityId}}</b><br/>because it references missing <b>{{targetEntityTypeName}}</b> with id <b>{{targetEntityId}}</b>.",
|
"missing-referenced-entity": "Failed to load the <b>{{sourceEntityTypeName}}</b> with external id <b>{{sourceEntityId}}</b><br/>because it references missing <b>{{targetEntityTypeName}}</b> with id <b>{{targetEntityId}}</b>.",
|
||||||
"runtime-failed": "<b>Failed:</b> {{message}}"
|
"runtime-failed": "<b>Failed:</b> {{message}}",
|
||||||
|
"auto-commit-settings-read-only-hint": "Auto-commit feature doesn't work with enabled read-only option in Repository settings."
|
||||||
},
|
},
|
||||||
"widget": {
|
"widget": {
|
||||||
"widget-library": "Widgets Library",
|
"widget-library": "Widgets Library",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user