tenant configuration changes
This commit is contained in:
parent
480814ae30
commit
61ccefa9f7
|
@ -6,6 +6,7 @@ import java.util.List;
|
|||
|
||||
public class DepositTenantConfigurationEntity {
|
||||
private List<DepositSourceEntity> sources;
|
||||
private boolean disableSystemSources;
|
||||
|
||||
public List<DepositSourceEntity> getSources() {
|
||||
return sources;
|
||||
|
@ -14,4 +15,12 @@ public class DepositTenantConfigurationEntity {
|
|||
public void setSources(List<DepositSourceEntity> sources) {
|
||||
this.sources = sources;
|
||||
}
|
||||
|
||||
public boolean getDisableSystemSources() {
|
||||
return disableSystemSources;
|
||||
}
|
||||
|
||||
public void setDisableSystemSources(boolean disableSystemSources) {
|
||||
this.disableSystemSources = disableSystemSources;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.util.List;
|
|||
public class FileTransformerTenantConfigurationEntity {
|
||||
|
||||
private List<FileTransformerSourceEntity> sources;
|
||||
private boolean disableSystemSources;
|
||||
|
||||
public List<FileTransformerSourceEntity> getSources() {
|
||||
return sources;
|
||||
|
@ -15,4 +16,12 @@ public class FileTransformerTenantConfigurationEntity {
|
|||
public void setSources(List<FileTransformerSourceEntity> sources) {
|
||||
this.sources = sources;
|
||||
}
|
||||
|
||||
public boolean getDisableSystemSources() {
|
||||
return disableSystemSources;
|
||||
}
|
||||
|
||||
public void setDisableSystemSources(boolean disableSystemSources) {
|
||||
this.disableSystemSources = disableSystemSources;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ public class DepositTenantConfigurationBuilder extends BaseBuilder<DepositTenant
|
|||
for (DepositTenantConfigurationEntity d : data) {
|
||||
DepositTenantConfiguration m = new DepositTenantConfiguration();
|
||||
if (!sourcesFields.isEmpty() && d.getSources() != null){
|
||||
if (fields.hasField(this.asIndexer(DepositTenantConfiguration._disableSystemSources))) m.setDisableSystemSources(d.getDisableSystemSources());
|
||||
m.setSources(this.builderFactory.builder(DepositSourceBuilder.class).encrypted(true).authorize(this.authorize).build(sourcesFields, d.getSources()));
|
||||
}
|
||||
models.add(m);
|
||||
|
|
|
@ -51,6 +51,7 @@ public class FileTransformerTenantConfigurationBuilder extends BaseBuilder<FileT
|
|||
for (FileTransformerTenantConfigurationEntity d : data) {
|
||||
FileTransformerTenantConfiguration m = new FileTransformerTenantConfiguration();
|
||||
if (!sourcesFields.isEmpty() && d.getSources() != null){
|
||||
if (fields.hasField(this.asIndexer(FileTransformerTenantConfiguration._disableSystemSources))) m.setDisableSystemSources(d.getDisableSystemSources());
|
||||
m.setSources(this.builderFactory.builder(FileTransformerSourceBuilder.class).encrypted(true).authorize(this.authorize).build(sourcesFields, d.getSources()));
|
||||
}
|
||||
models.add(m);
|
||||
|
|
|
@ -20,6 +20,8 @@ import java.util.List;
|
|||
public class DepositTenantConfigurationPersist {
|
||||
private List<DepositSourcePersist> sources;
|
||||
public static final String _sources = "sources";
|
||||
private Boolean disableSystemSources;
|
||||
public static final String _disableSystemSources = "disableSystemSources";
|
||||
|
||||
public List<DepositSourcePersist> getSources() {
|
||||
return sources;
|
||||
|
@ -29,6 +31,14 @@ public class DepositTenantConfigurationPersist {
|
|||
this.sources = sources;
|
||||
}
|
||||
|
||||
public Boolean getDisableSystemSources() {
|
||||
return disableSystemSources;
|
||||
}
|
||||
|
||||
public void setDisableSystemSources(Boolean disableSystemSources) {
|
||||
this.disableSystemSources = disableSystemSources;
|
||||
}
|
||||
|
||||
@Component(DepositTenantConfigurationPersist.DepositTenantConfigurationPersistValidator.ValidatorName)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public static class DepositTenantConfigurationPersistValidator extends BaseValidator<DepositTenantConfigurationPersist> {
|
||||
|
@ -54,6 +64,9 @@ public class DepositTenantConfigurationPersist {
|
|||
@Override
|
||||
protected List<Specification> specifications(DepositTenantConfigurationPersist item) {
|
||||
return Arrays.asList(
|
||||
this.spec()
|
||||
.must(() -> !this.isNull(item.getDisableSystemSources()))
|
||||
.failOn(DepositTenantConfigurationPersist._disableSystemSources).failWith(messageSource.getMessage("Validation_Required", new Object[]{DepositTenantConfigurationPersist._disableSystemSources}, LocaleContextHolder.getLocale())),
|
||||
this.spec()
|
||||
.must(() -> !this.isListNullOrEmpty(item.getSources()))
|
||||
.failOn(DepositTenantConfigurationPersist._sources).failWith(messageSource.getMessage("Validation_Required", new Object[]{DepositTenantConfigurationPersist._sources}, LocaleContextHolder.getLocale())),
|
||||
|
|
|
@ -19,6 +19,8 @@ public class FileTransformerTenantConfigurationPersist {
|
|||
|
||||
private List<FileTransformerSourcePersist> sources;
|
||||
public static final String _sources = "sources";
|
||||
private Boolean disableSystemSources;
|
||||
public static final String _disableSystemSources = "disableSystemSources";
|
||||
|
||||
public List<FileTransformerSourcePersist> getSources() {
|
||||
return sources;
|
||||
|
@ -28,6 +30,14 @@ public class FileTransformerTenantConfigurationPersist {
|
|||
this.sources = sources;
|
||||
}
|
||||
|
||||
public Boolean getDisableSystemSources() {
|
||||
return disableSystemSources;
|
||||
}
|
||||
|
||||
public void setDisableSystemSources(Boolean disableSystemSources) {
|
||||
this.disableSystemSources = disableSystemSources;
|
||||
}
|
||||
|
||||
@Component(FileTransformerTenantConfigurationPersist.FileTransformerTenantConfigurationPersistValidator.ValidatorName)
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public static class FileTransformerTenantConfigurationPersistValidator extends BaseValidator<FileTransformerTenantConfigurationPersist> {
|
||||
|
@ -53,6 +63,9 @@ public class FileTransformerTenantConfigurationPersist {
|
|||
@Override
|
||||
protected List<Specification> specifications(FileTransformerTenantConfigurationPersist item) {
|
||||
return Arrays.asList(
|
||||
this.spec()
|
||||
.must(() -> !this.isNull(item.getDisableSystemSources()))
|
||||
.failOn(FileTransformerTenantConfigurationPersist._disableSystemSources).failWith(messageSource.getMessage("Validation_Required", new Object[]{FileTransformerTenantConfigurationPersist._disableSystemSources}, LocaleContextHolder.getLocale())),
|
||||
this.spec()
|
||||
.must(() -> !this.isListNullOrEmpty(item.getSources()))
|
||||
.failOn(FileTransformerTenantConfigurationPersist._sources).failWith(messageSource.getMessage("Validation_Required", new Object[]{FileTransformerTenantConfigurationPersist._sources}, LocaleContextHolder.getLocale())),
|
||||
|
|
|
@ -8,6 +8,8 @@ import java.util.List;
|
|||
public class DepositTenantConfiguration {
|
||||
private List<DepositSource> sources;
|
||||
public static final String _sources = "sources";
|
||||
private Boolean disableSystemSources;
|
||||
public static final String _disableSystemSources = "disableSystemSources";
|
||||
|
||||
public List<DepositSource> getSources() {
|
||||
return sources;
|
||||
|
@ -16,4 +18,12 @@ public class DepositTenantConfiguration {
|
|||
public void setSources(List<DepositSource> sources) {
|
||||
this.sources = sources;
|
||||
}
|
||||
|
||||
public Boolean getDisableSystemSources() {
|
||||
return disableSystemSources;
|
||||
}
|
||||
|
||||
public void setDisableSystemSources(Boolean disableSystemSources) {
|
||||
this.disableSystemSources = disableSystemSources;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@ public class FileTransformerTenantConfiguration {
|
|||
|
||||
private List<FileTransformerSource> sources;
|
||||
public static final String _sources = "sources";
|
||||
private Boolean disableSystemSources;
|
||||
public static final String _disableSystemSources = "disableSystemSources";
|
||||
|
||||
public List<FileTransformerSource> getSources() {
|
||||
return sources;
|
||||
|
@ -17,4 +19,12 @@ public class FileTransformerTenantConfiguration {
|
|||
public void setSources(List<FileTransformerSource> sources) {
|
||||
this.sources = sources;
|
||||
}
|
||||
|
||||
public Boolean getDisableSystemSources() {
|
||||
return disableSystemSources;
|
||||
}
|
||||
|
||||
public void setDisableSystemSources(Boolean disableSystemSources) {
|
||||
this.disableSystemSources = disableSystemSources;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ public class TenantConfigurationServiceImpl implements TenantConfigurationServic
|
|||
|
||||
TenantConfigurationQuery tenantConfigurationQuery = this.queryFactory.query(TenantConfigurationQuery.class).excludedIds(data.getId()).isActive(IsActive.Active).types(data.getType());
|
||||
if (data.getTenantId() == null) tenantConfigurationQuery.tenantIsSet(false);
|
||||
else tenantConfigurationQuery.tenantIsSet(false).tenantIds(data.getTenantId());
|
||||
else tenantConfigurationQuery.tenantIsSet(true).tenantIds(data.getTenantId());
|
||||
if (tenantConfigurationQuery.count() > 0)throw new MyValidationException(this.errors.getMultipleTenantConfigurationTypeNotAllowed().getCode(), this.errors.getMultipleTenantConfigurationTypeNotAllowed().getMessage());
|
||||
|
||||
switch (data.getType()){
|
||||
|
@ -156,6 +156,7 @@ public class TenantConfigurationServiceImpl implements TenantConfigurationServic
|
|||
private @NotNull DepositTenantConfigurationEntity buildDepositTenantConfigurationEntity(DepositTenantConfigurationPersist persist) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException {
|
||||
DepositTenantConfigurationEntity data = new DepositTenantConfigurationEntity();
|
||||
if (persist == null || this.conventionService.isListNullOrEmpty(persist.getSources())) return data;
|
||||
data.setDisableSystemSources(persist.getDisableSystemSources());
|
||||
data.setSources(new ArrayList<>());
|
||||
for (DepositSourcePersist depositSourcePersist : persist.getSources()) {
|
||||
data.getSources().add(this.buildDepositSourceEntity(depositSourcePersist));
|
||||
|
@ -179,6 +180,7 @@ public class TenantConfigurationServiceImpl implements TenantConfigurationServic
|
|||
private @NotNull FileTransformerTenantConfigurationEntity buildFileTransformerTenantConfigurationEntity(FileTransformerTenantConfigurationPersist persist) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException {
|
||||
FileTransformerTenantConfigurationEntity data = new FileTransformerTenantConfigurationEntity();
|
||||
if (persist == null || this.conventionService.isListNullOrEmpty(persist.getSources())) return data;
|
||||
data.setDisableSystemSources(persist.getDisableSystemSources());
|
||||
data.setSources(new ArrayList<>());
|
||||
for (FileTransformerSourcePersist depositSourcePersist : persist.getSources()) {
|
||||
data.getSources().add(this.buildFileTransformerSourceEntity(depositSourcePersist));
|
||||
|
|
|
@ -120,7 +120,7 @@ public class TenantConfigurationController {
|
|||
|
||||
TenantConfigurationQuery query = this.queryFactory.query(TenantConfigurationQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).isActive(IsActive.Active).types(TenantConfigurationType.of(type));
|
||||
if (this.tenantScope.isDefaultTenant()) query.tenantIsSet(false);
|
||||
else query.tenantIsSet(false).tenantIds(this.tenantScope.getTenant());
|
||||
else query.tenantIsSet(true).tenantIds(this.tenantScope.getTenant());
|
||||
|
||||
TenantConfiguration model = this.builderFactory.builder(TenantConfigurationBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||
|
||||
|
|
|
@ -28,12 +28,13 @@
|
|||
"cookieconsent": "^3.1.1",
|
||||
"dragula": "^3.7.3",
|
||||
"file-saver": "^2.0.5",
|
||||
"moment": "^2.30.1",
|
||||
"keycloak-angular": "^15.2.1",
|
||||
"keycloak-js": "^24.0.2",
|
||||
"moment": "^2.30.1",
|
||||
"moment-timezone": "^0.5.45",
|
||||
"ng-dialog-animation": "^9.0.4",
|
||||
"ng2-dragula": "^5.0.1",
|
||||
"ngx-colors": "^3.5.3",
|
||||
"ngx-cookie-service": "^17.1.0",
|
||||
"ngx-cookieconsent": "^6.0.0",
|
||||
"ngx-dropzone": "^3.0.0",
|
||||
|
|
|
@ -26,10 +26,12 @@ export interface DefaultUserLocaleTenantConfiguration{
|
|||
}
|
||||
|
||||
export interface DepositTenantConfiguration{
|
||||
disableSystemSources: boolean;
|
||||
sources: DepositSource[];
|
||||
}
|
||||
|
||||
export interface FileTransformerTenantConfiguration{
|
||||
disableSystemSources: boolean;
|
||||
sources: FileTransformerSource[];
|
||||
}
|
||||
|
||||
|
@ -80,10 +82,12 @@ export interface DefaultUserLocaleTenantConfigurationPersist{
|
|||
}
|
||||
|
||||
export interface DepositTenantConfigurationPersist{
|
||||
disableSystemSources: boolean;
|
||||
sources: DepositSourcePersist[];
|
||||
}
|
||||
|
||||
export interface FileTransformerTenantConfigurationPersist{
|
||||
disableSystemSources: boolean;
|
||||
sources: FileTransformerSourcePersist[];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,31 +1,62 @@
|
|||
<div *ngIf="formGroup" class="container-fluid css-colors">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<mat-form-field class="w-100">
|
||||
<div class="row">
|
||||
|
||||
<mat-form-field class="col-6">
|
||||
<mat-label>{{'TENANT-CONFIGURATION-EDITOR.FIELDS.PRIMARY-COLOR' | translate}}</mat-label>
|
||||
<input matInput type="text" name="primaryColor" [formControl]="formGroup.get('cssColors')?.get('primaryColor')" required>
|
||||
<input matInput [formControl]="formGroup.get('cssColors')?.get('primaryColorInput')" required />
|
||||
<ngx-colors
|
||||
class="suffix"
|
||||
matSuffix
|
||||
ngx-colors-trigger
|
||||
[formControl]="formGroup.get('cssColors')?.get('primaryColor')"
|
||||
></ngx-colors>
|
||||
<mat-error *ngIf="formGroup.get('cssColors')?.get('primaryColor')?.hasError('backendError')">{{formGroup.get('cssColors')?.get('primaryColor')?.getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('cssColors')?.get('primaryColor')?.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('cssColors')?.get('primaryColor')?.hasError('invalidColor')">{{'GENERAL.VALIDATION.INVALID-COLOR' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="w-100">
|
||||
<mat-form-field class="col-6">
|
||||
<mat-label>{{'TENANT-CONFIGURATION-EDITOR.FIELDS.PRIMARY-COLOR-2' | translate}}</mat-label>
|
||||
<input matInput type="text" name="primaryColor2" [formControl]="formGroup.get('cssColors')?.get('primaryColor2')" required>
|
||||
<input matInput [formControl]="formGroup.get('cssColors')?.get('primaryColor2Input')" required />
|
||||
<ngx-colors
|
||||
class="suffix"
|
||||
matSuffix
|
||||
ngx-colors-trigger
|
||||
[formControl]="formGroup.get('cssColors')?.get('primaryColor2')"
|
||||
></ngx-colors>
|
||||
<mat-error *ngIf="formGroup.get('cssColors')?.get('primaryColor2')?.hasError('backendError')">{{formGroup.get('cssColors')?.get('primaryColor2')?.getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('cssColors')?.get('primaryColor2')?.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('cssColors')?.get('primaryColor2')?.hasError('invalidColor')">{{'GENERAL.VALIDATION.INVALID-COLOR' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="w-100">
|
||||
<mat-form-field class="col-6">
|
||||
<mat-label>{{'TENANT-CONFIGURATION-EDITOR.FIELDS.PRIMARY-COLOR-3' | translate}}</mat-label>
|
||||
<input matInput type="text" name="primaryColor3" [formControl]="formGroup.get('cssColors')?.get('primaryColor3')" required>
|
||||
<input matInput [formControl]="formGroup.get('cssColors')?.get('primaryColor3Input')" required />
|
||||
<ngx-colors
|
||||
class="suffix"
|
||||
matSuffix
|
||||
ngx-colors-trigger
|
||||
[formControl]="formGroup.get('cssColors')?.get('primaryColor3')"
|
||||
></ngx-colors>
|
||||
<mat-error *ngIf="formGroup.get('cssColors')?.get('primaryColor3')?.hasError('backendError')">{{formGroup.get('cssColors')?.get('primaryColor3')?.getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('cssColors')?.get('primaryColor3')?.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('cssColors')?.get('primaryColor3')?.hasError('invalidColor')">{{'GENERAL.VALIDATION.INVALID-COLOR' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="w-100">
|
||||
<mat-form-field class="col-6">
|
||||
<mat-label>{{'TENANT-CONFIGURATION-EDITOR.FIELDS.SECONDARY-COLOR' | translate}}</mat-label>
|
||||
<input matInput type="text" name="secondaryColor" [formControl]="formGroup.get('cssColors')?.get('secondaryColor')" required>
|
||||
<input matInput [formControl]="formGroup.get('cssColors')?.get('secondaryColorInput')" required />
|
||||
<ngx-colors
|
||||
class="suffix"
|
||||
matSuffix
|
||||
ngx-colors-trigger
|
||||
[formControl]="formGroup.get('cssColors')?.get('secondaryColor')"
|
||||
></ngx-colors>
|
||||
<mat-error *ngIf="formGroup.get('cssColors')?.get('secondaryColor')?.hasError('backendError')">{{formGroup.get('cssColors')?.get('secondaryColor')?.getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('cssColors')?.get('secondaryColor')?.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('cssColors')?.get('secondaryColor')?.hasError('invalidColor')">{{'GENERAL.VALIDATION.INVALID-COLOR' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="row actions-row">
|
||||
<div class="col"></div>
|
||||
|
|
|
@ -78,6 +78,50 @@ export class CssColorsEditorComponent extends BasePendingChangesComponent implem
|
|||
this.formGroup.disable();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private bindColorInputs() {
|
||||
this.formGroup.get('cssColors')?.get('primaryColorInput').valueChanges.subscribe((color) => {
|
||||
this.formGroup.get('cssColors')?.get('primaryColor').setValue(color, {
|
||||
emitEvent: false,
|
||||
});
|
||||
});
|
||||
this.formGroup.get('cssColors')?.get('primaryColor').valueChanges.subscribe((color) =>
|
||||
this.formGroup.get('cssColors')?.get('primaryColorInput').setValue(color, {
|
||||
emitEvent: false,
|
||||
})
|
||||
);
|
||||
this.formGroup.get('cssColors')?.get('primaryColor2Input').valueChanges.subscribe((color) => {
|
||||
this.formGroup.get('cssColors')?.get('primaryColor2').setValue(color, {
|
||||
emitEvent: false,
|
||||
});
|
||||
});
|
||||
this.formGroup.get('cssColors')?.get('primaryColor2').valueChanges.subscribe((color) =>
|
||||
this.formGroup.get('cssColors')?.get('primaryColor2Input').setValue(color, {
|
||||
emitEvent: false,
|
||||
})
|
||||
);
|
||||
this.formGroup.get('cssColors')?.get('primaryColor3Input').valueChanges.subscribe((color) => {
|
||||
this.formGroup.get('cssColors')?.get('primaryColor3').setValue(color, {
|
||||
emitEvent: false,
|
||||
});
|
||||
});
|
||||
this.formGroup.get('cssColors')?.get('primaryColor3').valueChanges.subscribe((color) =>
|
||||
this.formGroup.get('cssColors')?.get('primaryColor3Input').setValue(color, {
|
||||
emitEvent: false,
|
||||
})
|
||||
);
|
||||
this.formGroup.get('cssColors')?.get('secondaryColorInput').valueChanges.subscribe((color) => {
|
||||
this.formGroup.get('cssColors')?.get('secondaryColor').setValue(color, {
|
||||
emitEvent: false,
|
||||
});
|
||||
});
|
||||
this.formGroup.get('cssColors')?.get('secondaryColor').valueChanges.subscribe((color) =>
|
||||
this.formGroup.get('cssColors')?.get('secondaryColorInput').setValue(color, {
|
||||
emitEvent: false,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
getItem(successFunction: (item: TenantConfiguration) => void) {
|
||||
|
@ -119,8 +163,9 @@ export class CssColorsEditorComponent extends BasePendingChangesComponent implem
|
|||
prepareForm(data: TenantConfiguration) {
|
||||
try {
|
||||
this.editorModel = data ? new TenantConfigurationEditorModel().fromModel(data) : new TenantConfigurationEditorModel();
|
||||
|
||||
this.buildForm();
|
||||
this.bindColorInputs();
|
||||
|
||||
} catch (error) {
|
||||
this.logger.error('Could not parse TenantConfiguration item: ' + data + error);
|
||||
this.uiNotificationService.snackBarNotification(this.language.instant('COMMONS.ERRORS.DEFAULT'), SnackBarNotificationLevel.Error);
|
||||
|
@ -172,7 +217,7 @@ export class CssColorsEditorComponent extends BasePendingChangesComponent implem
|
|||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
maxWidth: '300px',
|
||||
data: {
|
||||
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.RESET-TO-DEFAULT'),
|
||||
message: this.language.instant('TENANT-CONFIGURATION-EDITOR.RESET-TO-DEFAULT-DIALOG.RESET-TO-DEFAULT'),
|
||||
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'),
|
||||
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL')
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import { BaseEditorModel } from "@common/base/base-form-editor-model";
|
|||
import { BackendErrorValidator } from "@common/forms/validation/custom-validator";
|
||||
import { ValidationErrorModel } from "@common/forms/validation/error-model/validation-error-model";
|
||||
import { Validation, ValidationContext } from "@common/forms/validation/validation-context";
|
||||
import { validColorValidator } from "ngx-colors";
|
||||
|
||||
export class TenantConfigurationEditorModel extends BaseEditorModel implements TenantConfigurationPersist {
|
||||
type: TenantConfigurationType;
|
||||
|
@ -91,7 +92,12 @@ export class CssColorsTenantConfigurationEditorModel implements CssColorsTenantC
|
|||
primaryColor2: [{ value: this.primaryColor2, disabled: disabled }, context.getValidation('primaryColor2').validators],
|
||||
primaryColor3: [{ value: this.primaryColor3, disabled: disabled }, context.getValidation('primaryColor3').validators],
|
||||
secondaryColor: [{ value: this.secondaryColor, disabled: disabled }, context.getValidation('secondaryColor').validators],
|
||||
});
|
||||
primaryColorInput: [{ value: this.primaryColor, disabled: disabled}, context.getValidation('primaryColorInput').validators ],
|
||||
primaryColor2Input: [{ value: this.primaryColor2, disabled: disabled}, context.getValidation('primaryColor2Input').validators ],
|
||||
primaryColor3Input: [{ value: this.primaryColor3, disabled: disabled}, context.getValidation('primaryColor3Input').validators ],
|
||||
secondaryColorInput: [{ value: this.secondaryColor, disabled: disabled}, context.getValidation('secondaryColorInput').validators ],
|
||||
},
|
||||
{ updateOn: "change" });
|
||||
|
||||
return form;
|
||||
}
|
||||
|
@ -105,10 +111,14 @@ export class CssColorsTenantConfigurationEditorModel implements CssColorsTenantC
|
|||
|
||||
const baseContext: ValidationContext = new ValidationContext();
|
||||
const baseValidationArray: Validation[] = new Array<Validation>();
|
||||
baseValidationArray.push({ key: 'primaryColor', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}primaryColor`)] });
|
||||
baseValidationArray.push({ key: 'primaryColor2', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}primaryColor2`)] });
|
||||
baseValidationArray.push({ key: 'primaryColor3', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}primaryColor3`)] });
|
||||
baseValidationArray.push({ key: 'secondaryColor', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}secondaryColor`)] });
|
||||
baseValidationArray.push({ key: 'primaryColor', validators: [validColorValidator(), Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}primaryColor`)] });
|
||||
baseValidationArray.push({ key: 'primaryColor2', validators: [validColorValidator(), Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}primaryColor2`)] });
|
||||
baseValidationArray.push({ key: 'primaryColor3', validators: [validColorValidator(), Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}primaryColor3`)] });
|
||||
baseValidationArray.push({ key: 'secondaryColor', validators: [validColorValidator(), Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}secondaryColor`)] });
|
||||
baseValidationArray.push({ key: 'primaryColorInput', validators: [validColorValidator()] });
|
||||
baseValidationArray.push({ key: 'primaryColor2Input', validators: [validColorValidator()] });
|
||||
baseValidationArray.push({ key: 'primaryColor3Input', validators: [validColorValidator()] });
|
||||
baseValidationArray.push({ key: 'secondaryColorInput', validators: [validColorValidator()] });
|
||||
|
||||
baseContext.validation = baseValidationArray;
|
||||
return baseContext;
|
||||
|
|
|
@ -185,7 +185,7 @@ export class DefaultUserLocaleEditorComponent extends BasePendingChangesComponen
|
|||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
maxWidth: '300px',
|
||||
data: {
|
||||
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.RESET-TO-DEFAULT'),
|
||||
message: this.language.instant('TENANT-CONFIGURATION-EDITOR.RESET-TO-DEFAULT-DIALOG.RESET-TO-DEFAULT'),
|
||||
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'),
|
||||
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL')
|
||||
}
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
<div *ngIf="formGroup" class="container-fluid deposit">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h3>
|
||||
{{label}}
|
||||
<div class="row">{{label}}</div>
|
||||
<div class="row">
|
||||
<mat-checkbox [formControl]="formGroup.get('depositPlugins').get('disableSystemSources')">
|
||||
{{'TENANT-CONFIGURATION-EDITOR.FIELDS.DISABLE-SYSTEM-SOURCES' | translate}}
|
||||
<mat-error *ngIf=" formGroup.get('depositPlugins')?.get('disableSystemSources')?.hasError('backendError')">{{ formGroup?.get('depositPlugins')?.get('disableSystemSources')?.getError('backendError')?.message}}</mat-error>
|
||||
<mat-error *ngIf=" formGroup.get('depositPlugins')?.get('disableSystemSources')?.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-checkbox>
|
||||
</div>
|
||||
<button mat-button class="action-btn" type="button" (click)="addSource()" [disabled]="formGroup.disabled">{{'TENANT-CONFIGURATION-EDITOR.ACTIONS.ADD-SOURCE' | translate}}</button>
|
||||
</h3>
|
||||
|
||||
<div *ngFor="let source of formGroup.get('depositPlugins').get('sources').controls; let sourceIndex=index;" class="row mb-3">
|
||||
<div class="col-12">
|
||||
<div class="row mb-3 d-flex align-items-center">
|
||||
|
|
|
@ -172,7 +172,7 @@ export class DepositEditorComponent extends BasePendingChangesComponent implemen
|
|||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
maxWidth: '300px',
|
||||
data: {
|
||||
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.RESET-TO-DEFAULT'),
|
||||
message: this.language.instant('TENANT-CONFIGURATION-EDITOR.RESET-TO-DEFAULT-DIALOG.RESET-TO-DEFAULT'),
|
||||
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'),
|
||||
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL')
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ export class TenantConfigurationEditorModel extends BaseEditorModel implements T
|
|||
}
|
||||
|
||||
export class DepositTenantConfigurationEditorModel implements DepositTenantConfigurationPersist {
|
||||
disableSystemSources: boolean = false;
|
||||
sources: DepositSourceEditorModel[] = [];
|
||||
|
||||
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
|
||||
|
@ -76,6 +77,7 @@ export class DepositTenantConfigurationEditorModel implements DepositTenantConfi
|
|||
|
||||
public fromModel(item: DepositTenantConfiguration): DepositTenantConfigurationEditorModel {
|
||||
if (item) {
|
||||
this.disableSystemSources = item.disableSystemSources;
|
||||
if (item.sources) { item.sources.map(x => this.sources.push(new DepositSourceEditorModel(this.validationErrorModel).fromModel(x))); }
|
||||
}
|
||||
return this;
|
||||
|
@ -95,6 +97,7 @@ export class DepositTenantConfigurationEditorModel implements DepositTenantConfi
|
|||
}
|
||||
|
||||
const form: UntypedFormGroup = this.formBuilder.group({
|
||||
disableSystemSources: [{ value: this.disableSystemSources, disabled: disabled }, context.getValidation('disableSystemSources').validators],
|
||||
sources: this.formBuilder.array(
|
||||
(this.sources ?? []).map(
|
||||
(item, index) => item.buildForm({
|
||||
|
@ -116,6 +119,7 @@ export class DepositTenantConfigurationEditorModel implements DepositTenantConfi
|
|||
|
||||
const baseContext: ValidationContext = new ValidationContext();
|
||||
const baseValidationArray: Validation[] = new Array<Validation>();
|
||||
baseValidationArray.push({ key: 'disableSystemSources', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}disableSystemSources`)] });
|
||||
baseValidationArray.push({ key: 'sources', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}sources`)] });
|
||||
baseContext.validation = baseValidationArray;
|
||||
return baseContext;
|
||||
|
|
|
@ -29,6 +29,7 @@ export class DepositEditorResolver extends BaseEditorResolver {
|
|||
[nameof<TenantConfiguration>(x => x.depositPlugins), nameof<DepositTenantConfiguration>(x => x.sources), nameof<DepositSource>(x => x.url)].join('.'),
|
||||
[nameof<TenantConfiguration>(x => x.depositPlugins), nameof<DepositTenantConfiguration>(x => x.sources), nameof<DepositSource>(x => x.pdfTransformerId)].join('.'),
|
||||
[nameof<TenantConfiguration>(x => x.depositPlugins), nameof<DepositTenantConfiguration>(x => x.sources), nameof<DepositSource>(x => x.rdaTransformerId)].join('.'),
|
||||
[nameof<TenantConfiguration>(x => x.depositPlugins), nameof<DepositTenantConfiguration>(x => x.disableSystemSources)].join('.'),
|
||||
|
||||
|
||||
nameof<TenantConfiguration>(x => x.createdAt),
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
<div *ngIf="formGroup" class="container-fluid file-transformer">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h3>
|
||||
{{label}}
|
||||
<button mat-button class="action-btn" type="button" (click)="addSource()" [disabled]="formGroup.disabled">{{'TENANT-CONFIGURATION-EDITOR.ACTIONS.ADD-SOURCE' | translate}}</button>
|
||||
</h3>
|
||||
<div class="row">{{label}}</div>
|
||||
<div class="row">
|
||||
<mat-checkbox [formControl]="formGroup.get('fileTransformerPlugins').get('disableSystemSources')">
|
||||
{{'TENANT-CONFIGURATION-EDITOR.FIELDS.DISABLE-SYSTEM-SOURCES' | translate}}
|
||||
<mat-error *ngIf=" formGroup.get('fileTransformerPlugins')?.get('disableSystemSources')?.hasError('backendError')">{{ formGroup?.get('fileTransformerPlugins')?.get('disableSystemSources')?.getError('backendError')?.message}}</mat-error>
|
||||
<mat-error *ngIf=" formGroup.get('fileTransformerPlugins')?.get('disableSystemSources')?.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-checkbox>
|
||||
</div>
|
||||
<button mat-button class="action-btn row" type="button" (click)="addSource()" [disabled]="formGroup.disabled">{{'TENANT-CONFIGURATION-EDITOR.ACTIONS.ADD-SOURCE' | translate}}</button>
|
||||
<div *ngFor="let source of formGroup.get('fileTransformerPlugins').get('sources').controls; let sourceIndex=index;" class="row mb-3">
|
||||
<div class="col-12">
|
||||
<div class="row mb-3 d-flex align-items-center">
|
||||
|
|
|
@ -172,7 +172,7 @@ export class FileTransformerEditorComponent extends BasePendingChangesComponent
|
|||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
maxWidth: '300px',
|
||||
data: {
|
||||
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.RESET-TO-DEFAULT'),
|
||||
message: this.language.instant('TENANT-CONFIGURATION-EDITOR.RESET-TO-DEFAULT-DIALOG.RESET-TO-DEFAULT'),
|
||||
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'),
|
||||
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL')
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ export class TenantConfigurationEditorModel extends BaseEditorModel implements T
|
|||
}
|
||||
|
||||
export class FileTransformerTenantConfigurationEditorModel implements FileTransformerTenantConfigurationPersist {
|
||||
disableSystemSources: boolean = false;
|
||||
sources: FileTransformerSourceEditorModel[] = [];
|
||||
|
||||
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
|
||||
|
@ -76,6 +77,7 @@ export class FileTransformerTenantConfigurationEditorModel implements FileTransf
|
|||
|
||||
public fromModel(item: FileTransformerTenantConfiguration): FileTransformerTenantConfigurationEditorModel {
|
||||
if (item) {
|
||||
this.disableSystemSources = item.disableSystemSources;
|
||||
if (item.sources) { item.sources.map(x => this.sources.push(new FileTransformerSourceEditorModel(this.validationErrorModel).fromModel(x))); }
|
||||
}
|
||||
return this;
|
||||
|
@ -95,6 +97,7 @@ export class FileTransformerTenantConfigurationEditorModel implements FileTransf
|
|||
}
|
||||
|
||||
const form: UntypedFormGroup = this.formBuilder.group({
|
||||
disableSystemSources: [{ value: this.disableSystemSources, disabled: disabled }, context.getValidation('disableSystemSources').validators],
|
||||
sources: this.formBuilder.array(
|
||||
(this.sources ?? []).map(
|
||||
(item, index) => item.buildForm({
|
||||
|
@ -116,6 +119,7 @@ export class FileTransformerTenantConfigurationEditorModel implements FileTransf
|
|||
|
||||
const baseContext: ValidationContext = new ValidationContext();
|
||||
const baseValidationArray: Validation[] = new Array<Validation>();
|
||||
baseValidationArray.push({ key: 'disableSystemSources', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}disableSystemSources`)] });
|
||||
baseValidationArray.push({ key: 'sources', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}sources`)] });
|
||||
baseContext.validation = baseValidationArray;
|
||||
return baseContext;
|
||||
|
|
|
@ -27,6 +27,7 @@ export class FileTransformerEditorResolver extends BaseEditorResolver {
|
|||
[nameof<TenantConfiguration>(x => x.fileTransformerPlugins), nameof<FileTransformerTenantConfiguration>(x => x.sources), nameof<FileTransformerSource>(x => x.transformerId)].join('.'),
|
||||
[nameof<TenantConfiguration>(x => x.fileTransformerPlugins), nameof<FileTransformerTenantConfiguration>(x => x.sources), nameof<FileTransformerSource>(x => x.scope)].join('.'),
|
||||
[nameof<TenantConfiguration>(x => x.fileTransformerPlugins), nameof<FileTransformerTenantConfiguration>(x => x.sources), nameof<FileTransformerSource>(x => x.url)].join('.'),
|
||||
[nameof<TenantConfiguration>(x => x.fileTransformerPlugins), nameof<FileTransformerTenantConfiguration>(x => x.disableSystemSources)].join('.'),
|
||||
|
||||
|
||||
nameof<TenantConfiguration>(x => x.createdAt),
|
||||
|
|
|
@ -182,7 +182,7 @@ export class LogoEditorComponent extends BasePendingChangesComponent implements
|
|||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
maxWidth: '300px',
|
||||
data: {
|
||||
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.RESET-TO-DEFAULT'),
|
||||
message: this.language.instant('TENANT-CONFIGURATION-EDITOR.RESET-TO-DEFAULT-DIALOG.RESET-TO-DEFAULT'),
|
||||
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'),
|
||||
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL')
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import { FormattingModule } from '@app/core/formatting.module';
|
|||
import { DepositEditorComponent } from './editor/deposit/deposit-editor.component';
|
||||
import { FileTransformerEditorComponent } from './editor/file-transformer/file-transformer-editor.component';
|
||||
import { LogoEditorComponent } from './editor/logo/logo-editor.component';
|
||||
import { NgxColorsModule } from 'ngx-colors';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -33,7 +34,8 @@ import { LogoEditorComponent } from './editor/logo/logo-editor.component';
|
|||
TextFilterModule,
|
||||
UserSettingsModule,
|
||||
CommonFormattingModule,
|
||||
RichTextEditorModule
|
||||
RichTextEditorModule,
|
||||
NgxColorsModule
|
||||
],
|
||||
declarations: [
|
||||
TenantConfigurationEditorComponent,
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
"GENERAL": {
|
||||
"VALIDATION": {
|
||||
"REQUIRED": "Required",
|
||||
"INVALID-COLOR": "Invalid color",
|
||||
"URL": {
|
||||
"LABEL": "URL",
|
||||
"MESSAGE": "Please provide a valid URL"
|
||||
|
@ -186,6 +187,7 @@
|
|||
"PREFILLING-SOURCES": "Prefilling Sources",
|
||||
"NEW-PREFILLING-SOURCE": "New",
|
||||
"EDIT-PREFILLING-SOURCE": "Edit",
|
||||
"TENANT-CONFIGURATION": "Tenant Configuration",
|
||||
"ENTITY-LOCKS": "Entity Locks"
|
||||
},
|
||||
"COOKIE": {
|
||||
|
@ -250,6 +252,7 @@
|
|||
"NOTIFICATION-TEMPLATES": "Notification Templates",
|
||||
"NOTIFICATIONS": "Notifications",
|
||||
"PREFILLING-SOURCES": "Prefilling Sources",
|
||||
"TENANT-CONFIGURATION": "Tenant Configuration",
|
||||
"ENTITY-LOCKS": "Entity Locks"
|
||||
},
|
||||
"DESCRIPTION-TEMPLATE-PREVIEW": {
|
||||
|
@ -296,6 +299,60 @@
|
|||
"MESSAGE": "Are you sure you want to perform this action?"
|
||||
}
|
||||
},
|
||||
"TENANT-CONFIGURATION-EDITOR": {
|
||||
"TITLE": "Tenant Configuration",
|
||||
"DEFAULT-USER-LOCALE":{
|
||||
"TITLE": "Default User Locale",
|
||||
"HINT": "Default locale assigned to new users"
|
||||
},
|
||||
"CSS-COLORS":{
|
||||
"TITLE": "App Colors",
|
||||
"HINT": "App color theme"
|
||||
},
|
||||
"LOGO":{
|
||||
"TITLE": "Extra Logo",
|
||||
"HINT": "Add extra logo"
|
||||
},
|
||||
"DEPOSIT-PLUGINS":{
|
||||
"TITLE": "Deposit Plugins",
|
||||
"HINT": "Change deposit plugins"
|
||||
},
|
||||
"FILE-TRANSFORMER-PLUGINS":{
|
||||
"TITLE": "File Transformer Plugins",
|
||||
"HINT": "Change file transformer plugins"
|
||||
},
|
||||
"FIELDS": {
|
||||
"TIMEZONE": "Timezone",
|
||||
"CULTURE": "Culture",
|
||||
"LANGUAGE": "Language",
|
||||
"PRIMARY-COLOR": "Primary Color",
|
||||
"PRIMARY-COLOR-2": "Primary Color 2",
|
||||
"PRIMARY-COLOR-3": "Primary Color 2",
|
||||
"SECONDARY-COLOR": "Secondary Color",
|
||||
"DISABLE-SYSTEM-SOURCES": "Disable System Sources",
|
||||
"DEPOSIT-PLUGINS": "Plugin",
|
||||
"FILE-TRANSFORMER-PLUGINS": "Plugin",
|
||||
"REPOSITORY-ID": "Repository Id",
|
||||
"TRANSFORMER-ID": "Transformer Id",
|
||||
"URL": "Url",
|
||||
"ISSUER-URL": "Issuer Url",
|
||||
"CLIENT-ID": "Client Id",
|
||||
"CLIENT-SECRET": "Client Secret",
|
||||
"SCOPE": "Scope",
|
||||
"PDF-TRANSFORMER-ID": "Pdf Transformer Id",
|
||||
"RDA-TRANSFORMER-ID": "Rda Transformer Id"
|
||||
},
|
||||
"RESET-TO-DEFAULT-DIALOG":{
|
||||
"RESET-TO-DEFAULT": "Reset To Default"
|
||||
},
|
||||
"ACTIONS": {
|
||||
"SAVE": "Save",
|
||||
"UPLOAD": "Upload",
|
||||
"DOWNLOAD": "Download",
|
||||
"ADD-SOURCE": "Add Source",
|
||||
"RESET-TO-DEFAULT": "Reset To Default"
|
||||
}
|
||||
},
|
||||
"DESCRIPTION-TEMPLATE-EDITOR": {
|
||||
"TITLE": {
|
||||
"NEW": "New API Client",
|
||||
|
|
Loading…
Reference in New Issue