This commit is contained in:
Diamantis Tziotzios 2024-06-12 11:36:25 +03:00
parent f75428595f
commit 947a4cc087
41 changed files with 334 additions and 1917 deletions

View File

@ -1,15 +1,14 @@
import { Injectable } from '@angular/core';
import { UserSettingPersist, UserSettingsInformation, UserSettings as UserSettingsObject } from '@app/core/model/user-settings/user-settings.model';
import { BaseService } from '@common/base/base.service';
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
import { Guid } from '@common/types/guid';
import moment from 'moment';
import { Moment } from 'moment';
import moment, { Moment } from 'moment';
import { Observable, Subject, of as observableOf } from 'rxjs';
import { map, takeUntil } from 'rxjs/operators';
import { AuthService, LoginStatus } from '../auth/auth.service';
import { ConfigurationService } from '../configuration/configuration.service';
import { UserSettingsHttpService } from './user-settings-http.service';
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
export enum UserSettingsType {
Setting = 0,
@ -117,7 +116,7 @@ export class UserSettingsService extends BaseService {
this.persistUserSettings(userSettingsInformation.key, result, userSettingsInformation, false);
this.userSettingUpdated.next(userSettingsInformation.key);
},
error => this.httpErrorHandlingService.handleBackedRequestError(error));
error => this.httpErrorHandlingService.handleBackedRequestError(error));
}
private buildUserSettings<T>(setting: UserSetting<T>, key: string): UserSettings<T> {
@ -264,7 +263,7 @@ export class UserSettingsService extends BaseService {
});
}
},
error => this.httpErrorHandlingService.handleBackedRequestError(error));
error => this.httpErrorHandlingService.handleBackedRequestError(error));
}
private clearSetting(key: string) {
@ -289,24 +288,6 @@ export class UserSettingsService extends BaseService {
return `${this.getUserSettingsVersion()}_${this.getUserId()}_${key}`;
}
// private defaultValue<T>(userSettingsInformation: UserSettingsInformation<T>): UserSettings<T> {
// const defaultSetting: UserSetting<T> = {
// id: null,
// name: null,
// userId: this.getUserId(),
// key: userSettingsInformation.key,
// type: UserSettingsType.Config,
// isDefault: true,
// value: new userSettingsInformation.type()
// };
// const userSettings: UserSettings<T> = {
// defaultSetting: defaultSetting,
// key: userSettingsInformation.key,
// settings: [defaultSetting]
// };
// return userSettings;
// }
private getUserId(): Guid {
return this.authService.userId();
}

View File

@ -226,12 +226,8 @@ export class EnumUtils {
toRecentActivityOrderString(status: RecentActivityOrder): string {
switch (status) {
// case RecentActivityOrder.CREATED: return this.language.instant('TYPES.RECENT-ACTIVITY-ORDER.CREATED');
case RecentActivityOrder.Label: return this.language.instant('TYPES.RECENT-ACTIVITY-ORDER.LABEL');
case RecentActivityOrder.UpdatedAt: return this.language.instant('TYPES.RECENT-ACTIVITY-ORDER.MODIFIED');
// case RecentActivityOrder.FINALIZED: return this.language.instant('TYPES.RECENT-ACTIVITY-ORDER.FINALIZED');
// case RecentActivityOrder.PUBLISHED: return this.language.instant('TYPES.RECENT-ACTIVITY-ORDER.PUBLISHED');
// case RecentActivityOrder.DATASETPUBLISHED: return this.language.instant('TYPES.RECENT-ACTIVITY-ORDER.PUBLISHED');
case RecentActivityOrder.Status: return this.language.instant('TYPES.RECENT-ACTIVITY-ORDER.STATUS');
}
}

View File

@ -1,6 +1,4 @@
.multiple-auto-complete {
// margin-left: inherit;
// margin-right: inherit;
.not-loading {
display: none;
@ -8,10 +6,7 @@
.align-arrow-right {
// position: absolute;
right: 0;
// bottom: 0;
// vertical-align: middle;
cursor: pointer;
align-self: center;
color: rgba(0, 0, 0, 0.54);
@ -25,19 +20,10 @@
}
.chip-text {
// text-overflow: ellipsis;
// white-space: nowrap;
// overflow: hidden;
white-space: normal;
word-break: break-word;
}
// .chip-list {
// max-width: calc(100% - 30px);
// padding-left: 0.8em;
// }
.title-subtitle-fn {
height: auto;
width: calc(100% - 46px);

View File

@ -57,11 +57,6 @@
line-height: 1.2em;
}
// .two-line-mat-option {
// height: 3.5em;
// line-height: 1.2em;
// }
.mat-standard-chip:hover::after {
opacity: 0;
}
@ -70,11 +65,6 @@
opacity: 0;
}
// .mat-form-field-type-single-autocomplete:not(.mat-form-field-disabled) .mat-form-field-flex {
// cursor: pointer;
// }
.option-text-container {
min-width: 0;
}

View File

@ -17,42 +17,6 @@ ngx-guided-tour {
border-radius: 44px; /*custom add*/
}
.tour-orb {
position: fixed;
width: 20px;
height: 20px;
border-radius: 50%;
.tour-orb-ring {
width: 35px;
height: 35px;
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
animation: pulse 2s linear infinite;
&:after {
content: "";
display: inline-block;
height: 100%;
width: 100%;
border-radius: 50%;
}
}
@keyframes pulse {
from {
transform: translate(-50%, -50%) scale(0.45);
opacity: 1;
}
to {
transform: translate(-50%, -50%) scale(1);
opacity: 0;
}
}
}
.tour-step {
position: fixed;
&.page-tour-step {
@ -154,9 +118,6 @@ ngx-guided-tour {
}
.tour-title {
// font-weight: bold !important;
// padding-bottom: 20px;
/*custom add*/
font-weight: lighter !important;
font-size: 16px !important;
@ -166,7 +127,6 @@ ngx-guided-tour {
color: #212121;
line-height: 26px;
white-space: pre-line;
// height: 210px;
}
h3.tour-title {
@ -201,14 +161,11 @@ ngx-guided-tour {
}
button.skip-button.link-button {
// padding-left: 0;
border-left: 0;
/*custom add*/
// padding: 0;
padding-right: 1em;
padding-left: 1em;
// float: right;
min-width: 133px;
height: 40px;
border: 1px solid var(--primary-color);
@ -218,16 +175,10 @@ ngx-guided-tour {
.next-button {
cursor: pointer;
// border-radius: 1px;
// float: right;
border: none;
outline: none;
// padding-left: 10px;
// padding-right: 10px;
/*custom add*/
// float: left;
// padding: 10px 0px;
padding-left: 1em;
padding-right: 1em;
min-width: 101px;

View File

@ -40,7 +40,6 @@ export class DescriptionTemplateEditorSectionFieldSetComponent implements OnInit
private initializer = new Subject<void>();
private scroller = new Subject<string>();
// private $selectedFieldsetId = new Subject<string>();
constructor(
private dragulaService: DragulaService,
private myElement: ElementRef
@ -52,8 +51,6 @@ export class DescriptionTemplateEditorSectionFieldSetComponent implements OnInit
this.dragulaService.createGroup(this.FIELDSETS, {
moves: (el, container, handle) => {
// if(this.viewOnly) return false; //uncomment if want to unable drag n drop in viewonly mode
// if (el.id != (this.dragula_prefix + this.tocentry.id)) return false;
if (handle.className && handle.classList.contains('handle')) return true;
return false;
}

View File

@ -1,16 +1,16 @@
import { CdkStep, StepperSelectionEvent } from '@angular/cdk/stepper';
import { DatePipe } from '@angular/common';
import { Component, OnInit, QueryList, ViewChild } from '@angular/core';
import { FormArray, FormControl, FormGroup, UntypedFormArray, UntypedFormGroup } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
// import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
import { CdkStep, StepperSelectionEvent } from '@angular/cdk/stepper';
import { DatePipe } from '@angular/common';
import { MatStepper } from '@angular/material/stepper';
import { Title } from '@angular/platform-browser';
import { ActivatedRoute, Router } from '@angular/router';
import { DescriptionTemplateStatus } from '@app/core/common/enum/description-template-status';
import { DescriptionTemplateTypeStatus } from '@app/core/common/enum/description-template-type-status';
import { IsActive } from '@app/core/common/enum/is-active.enum';
import { LockTargetType } from '@app/core/common/enum/lock-target-type';
import { AppPermission } from '@app/core/common/enum/permission.enum';
import { UserDescriptionTemplateRole } from '@app/core/common/enum/user-description-template-role';
import { DescriptionTemplate } from '@app/core/model/description-template/description-template';
@ -18,13 +18,19 @@ import { DescriptionTemplatePersist, NewVersionDescriptionTemplatePersist } from
import { LanguageInfo } from '@app/core/model/language-info';
import { User } from '@app/core/model/user/user';
import { AuthService } from '@app/core/services/auth/auth.service';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { LanguageInfoService } from '@app/core/services/culture/language-info-service';
import { DescriptionTemplateTypeService } from '@app/core/services/description-template-type/description-template-type.service';
import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service';
import { LockService } from '@app/core/services/lock/lock.service';
import { LoggingService } from '@app/core/services/logging/logging-service';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
import { UserService } from '@app/core/services/user/user.service';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { FileUtils } from '@app/core/services/utilities/file-utils.service';
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
import { BaseEditor } from '@common/base/base-editor';
import { FormService } from '@common/forms/form-service';
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
@ -38,13 +44,6 @@ import { DescriptionTemplateEditorModel, DescriptionTemplateFieldEditorModel, De
import { DescriptionTemplateEditorResolver } from './description-template-editor.resolver';
import { DescriptionTemplateEditorService } from './description-template-editor.service';
import { NewEntryType, ToCEntry, ToCEntryType } from './table-of-contents/description-template-table-of-contents-entry';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { LockService } from '@app/core/services/lock/lock.service';
import { LockTargetType } from '@app/core/common/enum/lock-target-type';
import { Title } from '@angular/platform-browser';
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
import { DescriptionTemplateTypeStatus } from '@app/core/common/enum/description-template-type-status';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
@Component({
@ -143,7 +142,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
public titleService: Title,
private analyticsService: AnalyticsService
) {
const descriptionLabel:string = route.snapshot.data['entity']?.label;
const descriptionLabel: string = route.snapshot.data['entity']?.label;
if (descriptionLabel) {
titleService.setTitle(descriptionLabel);
} else {
@ -233,14 +232,14 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
} else if (this.isNew || this.isNewVersion || this.isClone) {
route.push('/description-templates/' + id);
this.router.navigate(route, { queryParams: { 'lookup': this.queryParamsService.serializeLookup(this.lookupParams), 'lv': ++this.lv }, replaceUrl: true, relativeTo: this.route });
} else{
} else {
this.refreshData();
}
}
persistEntity(onSuccess?: (response) => void): void {
if (this.isNewVersion == false){
if (this.isNewVersion == false) {
const formData = this.formService.getValue(this.formGroup.value) as DescriptionTemplatePersist;
this.descriptionTemplateService.persist(formData)
@ -248,14 +247,14 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
complete => onSuccess ? onSuccess(complete) : this.onCallbackSuccess(complete),
error => this.onCallbackError(error)
);
} else if (this.isNewVersion== true && this.isNew == false && this.isClone == false) {
const formData = this.formService.getValue(this.formGroup.value) as NewVersionDescriptionTemplatePersist;
} else if (this.isNewVersion == true && this.isNew == false && this.isClone == false) {
const formData = this.formService.getValue(this.formGroup.value) as NewVersionDescriptionTemplatePersist;
this.descriptionTemplateService.newVersion(formData)
.pipe(takeUntil(this._destroyed)).subscribe(
complete => onSuccess ? onSuccess(complete) : this.onCallbackSuccess(complete),
error => this.onCallbackError(error)
);
this.descriptionTemplateService.newVersion(formData)
.pipe(takeUntil(this._destroyed)).subscribe(
complete => onSuccess ? onSuccess(complete) : this.onCallbackSuccess(complete),
error => this.onCallbackError(error)
);
}
}
@ -269,10 +268,10 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
this.persistEntity(onSuccess);
}
saveWithClose(close: boolean){
saveWithClose(close: boolean) {
this.formSubmit((data) => {
this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
if(close){
if (close) {
this.formGroup = null;
this.router.navigate(['/description-templates']);
} else {
@ -325,7 +324,8 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
if (result) {
this.formGroup.get('status').setValue(DescriptionTemplateStatus.Finalized);
this.persistEntity();
}});
}
});
}
//
@ -592,7 +592,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
}
}
return sameLevelFields.at(tceIndex > 0 ? tceIndex-1 : tceIndex+1); //if deleting the first field, find the next one, else find the previous
return sameLevelFields.at(tceIndex > 0 ? tceIndex - 1 : tceIndex + 1); //if deleting the first field, find the next one, else find the previous
}
private populateSections(sections: UntypedFormArray, existingNumbering: string, validationRootPath: string): ToCEntry[] {
@ -803,7 +803,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
field.ordinal = 0;//first filed in the fields list
const fieldSetsArray = parent.form.get('fieldSets') as UntypedFormArray
const fieldForm = field.buildForm({ rootPath:'definition.pages[' + pageIndex + '].' + parentSectionRootPath + 'fieldSets[' + fieldSetsArray.length + '].' + 'fields[' + 0 + '].' });
const fieldForm = field.buildForm({ rootPath: 'definition.pages[' + pageIndex + '].' + parentSectionRootPath + 'fieldSets[' + fieldSetsArray.length + '].' + 'fields[' + 0 + '].' });
//give fieldset id and ordinal
const fieldSet: DescriptionTemplateFieldSetEditorModel = new DescriptionTemplateFieldSetEditorModel(this.editorModel.validationErrorModel);
@ -1016,7 +1016,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
}
cloneFieldSet(fieldset: FormGroup, validationRootPath: string){
cloneFieldSet(fieldset: FormGroup, validationRootPath: string) {
const values = fieldset.getRawValue();
const parentArray = fieldset.parent as FormArray;
@ -1029,14 +1029,14 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
const clonedModel = new DescriptionTemplateFieldSetEditorModel(this.editorModel.validationErrorModel).fromModel(values);
const clonedForm = clonedModel.buildForm({rootPath: validationRootPath + '.fieldSets[' + parentArray.length + ']' + '.fields[' + 0 + '].'});
const clonedForm = clonedModel.buildForm({ rootPath: validationRootPath + '.fieldSets[' + parentArray.length + ']' + '.fields[' + 0 + '].' });
parentArray.push(clonedForm);
//update tocentries and make selected tocentry the cloedn
let entries = this.refreshToCEntries();
const entryfound = this._findTocEntryById(clonedForm.get('id').value, entries);
if(entryfound){
if (entryfound) {
this.selectedTocEntry = entryfound;
}
}
@ -1206,33 +1206,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
//
//
private hasInvalidVisibilityRule(field: UntypedFormGroup): boolean {
// const renderStyle = field.get('viewStyle').get('renderStyle').value;
// if (renderStyle && ![
// DatasetProfileFieldViewStyle.TextArea,
// DatasetProfileFieldViewStyle.RichTextArea,
// DatasetProfileFieldViewStyle.Upload,
// DatasetProfileFieldViewStyle.FreeText,
// DatasetProfileFieldViewStyle.BooleanDecision,
// DatasetProfileFieldViewStyle.RadioBox,
// DatasetProfileFieldViewStyle.CheckBox,
// DatasetProfileFieldViewStyle.DatePicker,
// DatasetProfileFieldViewStyle.ComboBox,
// ].includes(renderStyle)) {
// if (((renderStyle === DatasetProfileFieldViewStyle) && (field.get('data').get('type').value === DatasetProfileComboBoxType.Select))) {
// return false;
// }
// try {
// if (field.get('visible').get('rules').value.length) {
// return true;
// }
// return false;
// } catch {
// return false;
// }
// } else {
return false;
// }
}
private removeFieldSetVisibilityRules(fieldsets: ToCEntry[]) {

View File

@ -414,7 +414,7 @@ export class DescriptionTemplateTableOfContents extends BaseComponent implements
);
this.dragSubscriptions.push(
dragulaService.over(this.DRAG_GROUP).subscribe(( {el, container, source }) => {
dragulaService.over(this.DRAG_GROUP).subscribe(({ el, container, source }) => {
try {
this.overcontainer = container.id;
} catch (error) {
@ -430,394 +430,9 @@ export class DescriptionTemplateTableOfContents extends BaseComponent implements
this.overcontainer = null;
})
);
// if (this.dragulaService.find('TABLEDRAG')) {
// this.dragulaService.destroy('TABLEDRAG');
// }
// const dragula = this.dragulaService.createGroup('TABLEDRAG', {});
// const drake = dragula.drake;
// drake.on('drop', (el, target, source, sibling) => {
// if (this._dragStartedAt) {
// const timeNow = new Date().getTime();
// if (timeNow - this._dragStartedAt > this.VALID_DROP_TIME) {
// // console.log('timenow: ', timeNow);
// // console.log('timestarted', this._dragStartedAt);
// this._dragStartedAt = null;
// } else {
// this.dataNeedsRefresh.emit();// even though the data is not changed the TABLE DRAG may has changed
// return;
// }
// } else {
// this.dataNeedsRefresh.emit();// even though the data is not changed the TABLE DRAG may has changed
// return;
// }
// const elementId = (el.id as string).replace(this.DRAGULA_ITEM_ID_PREFIX, '');
// const targetId = target.id as string;
// const sourceId = source.id as string;
// if (!(elementId && targetId && sourceId)) {
// console.info('Elements do not have an id');
// this.dataNeedsRefresh.emit();
// return;
// }
// const element: ToCEntry = this._findTocEntryById(elementId, this.links);
// const targetContainer: ToCEntry = this._findTocEntryById(targetId, this.links);
// const sourceContainer: ToCEntry = this._findTocEntryById(sourceId, this.links);
// if (!(element && (targetContainer || ((element.type === ToCEntryType.Page) && (targetId === this.ROOT_ID))) && (sourceContainer || ((element.type === ToCEntryType.Page) && (sourceId === this.ROOT_ID))))) {
// // console.info('Could not find elements');
// this.dataNeedsRefresh.emit();
// //TODO: angular update //drake.cancel(true);
// return;
// }
// switch (element.type) {
// case ToCEntryType.FieldSet: {
// if (targetContainer.type != this.tocEntryType.Section) {
// // const message = 'Fieldset can only be child of Subsections';
// const message = this.language.instant('DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.TABLE-OF-CONTENTS.ERROR-MESSAGES.FIELDSET-MUST-HAVE-PARENT-SECTION');
// // console.error(message);
// this.notifyUser(message)
// this.dataNeedsRefresh.emit();
// return;
// }
// //check if target container has no sections
// if ((targetContainer.form.get('sections') as UntypedFormArray).length) {
// // const message = 'Cannot have inputs and sections on the same level';
// const message = this.language.instant('DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.TABLE-OF-CONTENTS.ERROR-MESSAGES.INPUT-SECTION-SAME-LEVEL');
// this.notifyUser(message);
// // console.error(message);
// this.dataNeedsRefresh.emit();
// return;
// }
// const fieldsetForm = element.form;
// const targetFieldsets = targetContainer.form.get('fieldSets') as UntypedFormArray;
// const sourceFieldsets = sourceContainer.form.get('fieldSets') as UntypedFormArray;
// if (!targetFieldsets) {
// console.info('Not target fieldsets container found');
// this.dataNeedsRefresh.emit();
// return;
// }
// let sourceOrdinal = -1;
// let idx = -1;
// sourceFieldsets.controls.forEach((elem, index) => {
// if (elem.get('id').value === elementId) {
// sourceOrdinal = elem.get('ordinal').value;
// idx = index
// }
// });
// if (sourceOrdinal >= 0 && idx >= 0) {
// sourceFieldsets.removeAt(idx);
// sourceFieldsets.controls.forEach(control => {
// const ordinal = control.get('ordinal');
// if ((ordinal.value >= sourceOrdinal) && sourceOrdinal > 0) {
// const updatedOrdinalVal = ordinal.value - 1;
// ordinal.setValue(updatedOrdinalVal);
// }
// });
// sourceFieldsets.controls.sort(this._compareOrdinals);
// }
// let position: number = targetFieldsets.length;
// if (!sibling || !sibling.id) {
// console.info('No sibling Id found');
// } else {
// const siblingId = (sibling.id as string).replace(this.DRAGULA_ITEM_ID_PREFIX, '');
// let siblingIndex = -1;
// targetFieldsets.controls.forEach((e, idx) => {
// if (e.get('id').value === siblingId) {
// siblingIndex = idx;
// position = e.get('ordinal').value;
// }
// });
// if (siblingIndex >= 0) { //sibling found
// targetFieldsets.controls.filter(control => control.get('ordinal').value >= position).forEach(control => {
// const ordinal = control.get('ordinal');
// const updatedOrdinalVal = ordinal.value + 1;
// ordinal.setValue(updatedOrdinalVal);
// })
// }
// }
// fieldsetForm.get('ordinal').setValue(position);
// targetFieldsets.insert(position, fieldsetForm);
// targetFieldsets.controls.sort(this._compareOrdinals);
// this.dataNeedsRefresh.emit({ draggedItemId: elementId });
// break;
// }
// case ToCEntryType.Section: {
// if (targetContainer.type == ToCEntryType.Section) {
// if ((targetContainer.form.get('fieldSets') as UntypedFormArray).length) {
// // const message = 'Cannot have inputs and sections on the same level';
// const message = this.language.instant('DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.TABLE-OF-CONTENTS.ERROR-MESSAGES.INPUT-SECTION-SAME-LEVEL');;
// this.notifyUser(message);
// // console.info(message);
// this.dataNeedsRefresh.emit();
// return;
// }
// const targetSections = targetContainer.form.get('sections') as UntypedFormArray;
// const elementSectionForm = element.form;
// const sourceSections = elementSectionForm.parent as UntypedFormArray;
// if (!(targetSections && sourceSections && elementSectionForm)) {
// console.info('Could not load sections');
// this.dataNeedsRefresh.emit();
// return;
// }
// let idx = -1;
// sourceSections.controls.forEach((section, i) => {
// if (section.get('id').value === elementId) {
// idx = i;
// }
// });
// if (!(idx >= 0)) {
// console.info('Could not find element in Parent container');
// this.dataNeedsRefresh.emit();
// return;
// }
// sourceSections.controls.filter(control => control.get('ordinal').value >= elementSectionForm.get('ordinal').value).forEach(control => {
// const ordinal = control.get('ordinal');
// const updatedOrdinalVal = ordinal.value ? ordinal.value - 1 : 0;
// ordinal.setValue(updatedOrdinalVal);
// });
// sourceSections.removeAt(idx);
// let targetOrdinal = targetSections.length;
// if (sibling && sibling.id) {
// const siblingId = sibling.id.replace(this.DRAGULA_ITEM_ID_PREFIX, '');
// targetSections.controls.forEach((section, i) => {
// if (section.get('id').value === siblingId) {
// targetOrdinal = section.get('ordinal').value;
// }
// })
// targetSections.controls.filter(control => control.get('ordinal').value >= targetOrdinal).forEach(control => {
// const ordinal = control.get('ordinal');
// const updatedOrdinalVal = ordinal.value + 1;
// ordinal.setValue(updatedOrdinalVal);
// });
// } else {
// console.info('no siblings found');
// }
// elementSectionForm.get('ordinal').setValue(targetOrdinal);
// targetSections.insert(targetOrdinal, elementSectionForm);
// } else if (targetContainer.type === ToCEntryType.Page) {
// const rootform = targetContainer.form.root;
// const sectionForm = element.form;
// const parentSections = sectionForm.parent as UntypedFormArray;
// let parentIndex = -1;
// parentSections.controls.forEach((section, i) => {
// if (section.get('id').value === elementId) {
// parentIndex = i
// }
// })
// if (parentIndex < 0) {
// console.info('could not locate section in parents array');
// this.dataNeedsRefresh.emit();
// return;
// }
// //update parent sections ordinal
// parentSections.controls.filter(section => section.get('ordinal').value >= sectionForm.get('ordinal').value).forEach(section => {
// const ordinal = section.get('ordinal');
// const updatedOrdinalVal = ordinal.value ? ordinal.value - 1 : 0;
// ordinal.setValue(updatedOrdinalVal);
// })
// parentSections.removeAt(parentIndex);
// let position = 0;
// if (targetContainer.subEntries) {
// position = targetContainer.subEntries.length;
// }
// //populate sections
// const targetSectionsArray = rootform.get('sections') as UntypedFormArray;
// if (sibling && sibling.id) {
// const siblingId = sibling.id.replace(this.DRAGULA_ITEM_ID_PREFIX, '');
// let indx = -1;
// targetContainer.subEntries.forEach((e, i) => {
// if (e.form.get('id').value === siblingId) {
// indx = i;
// position = e.form.get('ordinal').value;
// }
// });
// if (indx >= 0) {
// // e.form.get('ordinal').setValue(i+1);
// targetContainer.subEntries.filter(e => e.form.get('ordinal').value >= position).forEach(e => {
// const ordinal = e.form.get('ordinal');
// const updatedOrdinalVal = ordinal.value + 1;
// ordinal.setValue(updatedOrdinalVal);
// });
// }
// } else {
// console.info('No sibling found');
// }
// sectionForm.get('ordinal').setValue(position);
// sectionForm.get('page').setValue(targetContainer.id);
// targetSectionsArray.push(sectionForm);
// } else {
// // const message = 'Drag not support to specific container';
// const message = this.language.instant('DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.TABLE-OF-CONTENTS.ERROR-MESSAGES.DRAG-NOT-SUPPORTED');
// this.notifyUser(message);
// // console.info(message);
// this.dataNeedsRefresh.emit();
// return;
// }
// this.dataNeedsRefresh.emit({ draggedItemId: elementId });
// break;
// }
// case ToCEntryType.Page: {
// if (targetId != this.ROOT_ID) {
// // const message = 'A page element can only be at top level';
// const message = this.language.instant('DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.TABLE-OF-CONTENTS.ERROR-MESSAGES.PAGE-ELEMENT-ONLY-TOP-LEVEL');
// this.notifyUser(message);
// // console.info(message);
// this.dataNeedsRefresh.emit();
// return;
// }
// const rootForm = element.form.root;
// if (!rootForm) {
// console.info('Could not find root!')
// this.dataNeedsRefresh.emit();
// return;
// }
// const pages = rootForm.get('pages') as UntypedFormArray;
// const pageForm = element.form;
// let index = -1;
// pages.controls.forEach((page, i) => {
// if (page.get('id').value === elementId) {
// index = i;
// }
// });
// if (index < 0) {
// console.info('Could not locate page on pages');
// this.dataNeedsRefresh.emit();
// return;
// }
// //ordinality
// pages.controls.filter(page => page.get('ordinal').value >= pageForm.get('ordinal').value).forEach(page => {
// const ordinal = page.get('ordinal');
// const ordinalVal = ordinal.value ? ordinal.value - 1 : 0;
// ordinal.setValue(ordinalVal);
// });
// pages.removeAt(index);
// let targetPosition = pages.length;
// if (sibling) {
// const siblingId = sibling.id.replace(this.DRAGULA_ITEM_ID_PREFIX, '');
// pages.controls.forEach((page, i) => {
// if (page.get('id').value === siblingId) {
// targetPosition = page.get('ordinal').value;
// }
// });
// }
// pageForm.get('ordinal').setValue(targetPosition);
// //update ordinality
// pages.controls.filter(page => page.get('ordinal').value >= targetPosition).forEach(page => {
// const ordinal = page.get('ordinal');
// const ordinalVal = ordinal.value + 1;
// ordinal.setValue(ordinalVal);
// });
// pages.insert(targetPosition, pageForm);
// this.dataNeedsRefresh.emit({ draggedItemId: elementId });
// break;
// }
// default:
// console.info('Could not support moving objects for specific type of element');
// this.dataNeedsRefresh.emit();
// return;
// }
// });
// drake.on('drag', (el, source) => {
// this._dragStartedAt = new Date().getTime();
// // console.log('drag fired');
// this.isDragging = true;
// this.draggingItemId = (el.id as string).replace(this.DRAGULA_ITEM_ID_PREFIX, '');
// });
// drake.on('over', (el, container, source) => {
// try {
// this.overcontainer = container.id;
// } catch (error) {
// this.overcontainer = null;
// }
// });
// drake.on('dragend', (el) => {
// this.isDragging = false;
// this.draggingItemId = null;
// this.overcontainer = null;
// });
}
ngOnInit(): void {}
ngOnInit(): void { }
ngAfterViewInit(): void {
@ -872,42 +487,6 @@ export class DescriptionTemplateTableOfContents extends BaseComponent implements
this.dragSubscriptions.forEach(subscription => subscription.unsubscribe())
}
private _scrollIntoDragginItem(id: string) {
// const table = document.getElementById('tocentrytable');
// if(table){
// // const element = document.getElementById('TABLE_ENTRY'+id);
// console.log('Table found!');
// const element = document.getElementById('TABLE_ENTRY' + id);
// const elementFromTable = table.closest('#TABLE_ENTRY'+ id);
// if(elementFromTable){
// console.log('found from table:', elementFromTable);
// }
// if(element){
// console.log('Element found!');
// // element.classList.add('text-danger');
// // console.log(element);
// const tableRect = table.getBoundingClientRect();
// const elementRect = element.getBoundingClientRect();
// console.log('tablerect :',tableRect);
// console.log('elementRect :',elementRect);
// const dY = elementRect.top - tableRect.top;
// console.log('Distance from table is ', dY);
// // table.scroll({top:dY,behavior:'smooth'});
// console.log('found from document ', element);
// // element.scrollIntoView();
// }
// // element.scrollIntoView();
// }
}
private _findTocEntryById(id: string, tocentries: ToCEntry[]): ToCEntry {
if (!tocentries) {
return null;

View File

@ -3,17 +3,22 @@ import { Component, OnInit } from '@angular/core';
import { FormArray, FormGroup, UntypedFormGroup } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';
import { PrefillingSourceService } from '@app/core/services/prefilling-source/prefilling-source.service';
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
import { PrefillingSourceService } from '@app/core/services/prefilling-source/prefilling-source.service';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
// import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
import { DatePipe } from '@angular/common';
import { MatCheckboxChange } from '@angular/material/checkbox';
import { Title } from '@angular/platform-browser';
import { IsActive } from '@app/core/common/enum/is-active.enum';
import { AppPermission } from '@app/core/common/enum/permission.enum';
import { PrefillingSource, PrefillingSourcePersist } from '@app/core/model/prefilling-source/prefilling-source';
import { AuthService } from '@app/core/services/auth/auth.service';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { LockService } from '@app/core/services/lock/lock.service';
import { LoggingService } from '@app/core/services/logging/logging-service';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
import { ResultFieldsMappingConfigurationEditorModel } from '@app/ui/external-fetcher/external-fetcher-source-editor.model';
import { BaseEditor } from '@common/base/base-editor';
import { FormService } from '@common/forms/form-service';
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
@ -22,15 +27,9 @@ import { FilterService } from '@common/modules/text-filter/filter-service';
import { Guid } from '@common/types/guid';
import { TranslateService } from '@ngx-translate/core';
import { map, takeUntil } from 'rxjs/operators';
import { PrefillingSourceDefinitionEditorModel, PrefillingSourceEditorModel } from './prefilling-source-editor.model';
import { PrefillingSourceEditorResolver } from './prefilling-source-editor.resolver';
import { PrefillingSourceEditorService } from './prefilling-source-editor.service';
import { PrefillingSourceDefinitionEditorModel, PrefillingSourceEditorModel } from './prefilling-source-editor.model';
import { ResultFieldsMappingConfigurationEditorModel } from '@app/ui/external-fetcher/external-fetcher-source-editor.model';
import { MatCheckboxChange } from '@angular/material/checkbox';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { LockService } from '@app/core/services/lock/lock.service';
import { Title } from '@angular/platform-browser';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
@Component({
selector: 'app-prefilling-source-editor-component',
@ -80,7 +79,7 @@ export class PrefillingSourceEditorComponent extends BaseEditor<PrefillingSource
private titleService: Title,
private analyticsService: AnalyticsService
) {
const descriptionLabel:string = route.snapshot.data['entity']?.label;
const descriptionLabel: string = route.snapshot.data['entity']?.label;
if (descriptionLabel) {
titleService.setTitle(descriptionLabel);
} else {
@ -190,13 +189,13 @@ export class PrefillingSourceEditorComponent extends BaseEditor<PrefillingSource
this.formService.validateAllFormFields(this.formGroup);
}
getEnabledChanged(event: MatCheckboxChange){
if(event.checked == true){
getEnabledChanged(event: MatCheckboxChange) {
if (event.checked == true) {
const definition = new PrefillingSourceDefinitionEditorModel(this.editorModel.validationErrorModel);
definition.buildGetConfiguration(this.formGroup.get('definition') as UntypedFormGroup, "definition.");
this.submitFields();
}else{
} else {
const definition = this.formGroup.get('definition') as UntypedFormGroup;
if (definition.get('getConfiguration')) definition.removeControl('getConfiguration');
this.submitFields();
@ -294,21 +293,21 @@ export class PrefillingSourceEditorComponent extends BaseEditor<PrefillingSource
}
const fieldsMapping = new ResultFieldsMappingConfigurationEditorModel(this.editorModel.validationErrorModel);
fieldsMapping.code = code;
formArray.push(fieldsMapping.buildForm({rootPath: "definition." + controlName + ".results.fieldsMapping[" + fieldMappingSize + "]."}));
formArray.push(fieldsMapping.buildForm({ rootPath: "definition." + controlName + ".results.fieldsMapping[" + fieldMappingSize + "]." }));
// formArray.at(fieldMappingSize).get('code').patchValue(code);
}
removeFieldMapping(baseFormGroup: any, fieldCode: string){
if(baseFormGroup){
removeFieldMapping(baseFormGroup: any, fieldCode: string) {
if (baseFormGroup) {
const fieldMappingFormArray = (baseFormGroup.get('results').get('fieldsMapping') as FormArray);
for (let j = 0; j < fieldMappingFormArray.length; j++) {
if (fieldCode == fieldMappingFormArray.at(j).get('code').getRawValue()) {
fieldMappingFormArray.removeAt(j);
PrefillingSourceEditorModel.reApplyDefinitionValidators({
formGroup: this.formGroup,
validationErrorModel: this.editorModel.validationErrorModel
}
formGroup: this.formGroup,
validationErrorModel: this.editorModel.validationErrorModel
}
);
}
}

View File

@ -1,21 +1,23 @@
import { DatePipe } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { FormArray, UntypedFormGroup } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { Title } from '@angular/platform-browser';
import { ActivatedRoute, Router } from '@angular/router';
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
// import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
import { DatePipe } from '@angular/common';
import { ExternalFetcherApiHTTPMethodType } from '@app/core/common/enum/external-fetcher-api-http-method-type';
import { ExternalFetcherSourceType } from '@app/core/common/enum/external-fetcher-source-type';
import { IsActive } from '@app/core/common/enum/is-active.enum';
import { AppPermission } from '@app/core/common/enum/permission.enum';
import { ReferenceFieldDataType } from '@app/core/common/enum/reference-field-data-type';
import { ExternalFetcherApiHTTPMethodType } from '@app/core/common/enum/external-fetcher-api-http-method-type';
import { ExternalFetcherSourceType } from '@app/core/common/enum/external-fetcher-source-type';
import { ReferenceType, ReferenceTypePersist } from '@app/core/model/reference-type/reference-type';
import { AuthService } from '@app/core/services/auth/auth.service';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { LockService } from '@app/core/services/lock/lock.service';
import { LoggingService } from '@app/core/services/logging/logging-service';
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
import { BaseEditor } from '@common/base/base-editor';
import { FormService } from '@common/forms/form-service';
@ -25,12 +27,9 @@ import { FilterService } from '@common/modules/text-filter/filter-service';
import { Guid } from '@common/types/guid';
import { TranslateService } from '@ngx-translate/core';
import { map, takeUntil } from 'rxjs/operators';
import { ReferenceTypeEditorModel} from './reference-type-editor.model';
import { ReferenceTypeEditorModel } from './reference-type-editor.model';
import { ReferenceTypeEditorResolver } from './reference-type-editor.resolver';
import { ReferenceTypeEditorService } from './reference-type-editor.service';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { LockService } from '@app/core/services/lock/lock.service';
import { Title } from '@angular/platform-browser';
@Component({
selector: 'app-reference-type-editor-component',
@ -91,7 +90,7 @@ export class ReferenceTypeEditorComponent extends BaseEditor<ReferenceTypeEditor
private referenceTypeEditorService: ReferenceTypeEditorService,
private titleService: Title
) {
const descriptionLabel:string = route.snapshot.data['entity']?.name;
const descriptionLabel: string = route.snapshot.data['entity']?.name;
if (descriptionLabel) {
titleService.setTitle(descriptionLabel);
} else {
@ -227,7 +226,7 @@ export class ReferenceTypeEditorComponent extends BaseEditor<ReferenceTypeEditor
fieldForm.markAsDirty();
const sourceFormArray = (this.formGroup.get('definition').get('sources') as FormArray);
if(sourceFormArray){
if (sourceFormArray) {
for (let i = 0; i < sourceFormArray.length; i++) {
const fieldMappingFormArray = (sourceFormArray.at(i).get('results').get('fieldsMapping') as FormArray);
for (let j = 0; j < fieldMappingFormArray.length; j++) {
@ -334,10 +333,10 @@ export class ReferenceTypeEditorComponent extends BaseEditor<ReferenceTypeEditor
this.sourceKeysMap.set(referenceType.id, sourceKeys);
})
},
error => {
this.router.navigate(['/reference-type']);
this.httpErrorHandlingService.handleBackedRequestError(error);
});
error => {
this.router.navigate(['/reference-type']);
this.httpErrorHandlingService.handleBackedRequestError(error);
});
}
selectedReferenceTypeChanged(id: Guid): void {

View File

@ -1,21 +1,24 @@
import { DatePipe } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { FormArray, UntypedFormGroup } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { Title } from '@angular/platform-browser';
import { ActivatedRoute, Router } from '@angular/router';
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
import { ReferenceService } from '@app/core/services/reference/reference.service';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
// import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
import { DatePipe } from '@angular/common';
import { IsActive } from '@app/core/common/enum/is-active.enum';
import { AppPermission } from '@app/core/common/enum/permission.enum';
import { ReferenceFieldDataType } from '@app/core/common/enum/reference-field-data-type';
import { ReferenceSourceType } from '@app/core/common/enum/reference-source-type';
import { Reference, ReferencePersist } from '@app/core/model/reference/reference';
import { AuthService } from '@app/core/services/auth/auth.service';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { LockService } from '@app/core/services/lock/lock.service';
import { LoggingService } from '@app/core/services/logging/logging-service';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
import { ReferenceService } from '@app/core/services/reference/reference.service';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { FileUtils } from '@app/core/services/utilities/file-utils.service';
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
import { BaseEditor } from '@common/base/base-editor';
@ -29,10 +32,6 @@ import { map, takeUntil } from 'rxjs/operators';
import { ReferenceEditorModel } from './reference-editor.model';
import { ReferenceEditorResolver } from './reference-editor.resolver';
import { ReferenceEditorService } from './reference-editor.service';
import { LockService } from '@app/core/services/lock/lock.service';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { Title } from '@angular/platform-browser';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
@Component({
@ -93,7 +92,7 @@ export class ReferenceEditorComponent extends BaseEditor<ReferenceEditorModel, R
private analyticsService: AnalyticsService
) {
const descriptionLabel:string = route.snapshot.data['entity']?.label;
const descriptionLabel: string = route.snapshot.data['entity']?.label;
if (descriptionLabel) {
titleService.setTitle(descriptionLabel);
} else {

View File

@ -1,34 +1,32 @@
import { HttpErrorResponse } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { UntypedFormGroup } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
// import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
import { AppPermission } from '@app/core/common/enum/permission.enum';
import { TenantConfigurationType } from '@app/core/common/enum/tenant-configuration-type';
import { CultureInfo } from '@app/core/model/culture-info';
import { TenantConfiguration, TenantConfigurationPersist } from '@app/core/model/tenant-configuaration/tenant-configuration';
import { AuthService } from '@app/core/services/auth/auth.service';
import { CultureService } from '@app/core/services/culture/culture-service';
import { DefaultUserLocaleService } from '@app/core/services/default-user-locale/default-user-locale.service';
import { LanguageService } from '@app/core/services/language/language.service';
import { LoggingService } from '@app/core/services/logging/logging-service';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
import { TenantConfigurationService } from '@app/core/services/tenant-configuration/tenant-configuration.service';
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
import { BasePendingChangesComponent } from '@common/base/base-pending-changes.component';
import { FormService } from '@common/forms/form-service';
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
import { HttpError, HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
import { TranslateService } from '@ngx-translate/core';
import moment from 'moment';
import { Observable } from 'rxjs';
import { map, takeUntil } from 'rxjs/operators';
import { TenantConfigurationEditorModel } from './default-user-locale-editor.model';
import { TenantConfiguration, TenantConfigurationPersist } from '@app/core/model/tenant-configuaration/tenant-configuration';
import { TenantConfigurationService } from '@app/core/services/tenant-configuration/tenant-configuration.service';
import { DefaultUserLocaleEditorService } from './default-user-locale-editor.service';
import { DefaultUserLocaleEditorResolver } from './default-user-locale-editor.resolver';
import { BasePendingChangesComponent } from '@common/base/base-pending-changes.component';
import { Observable, of } from 'rxjs';
import { TenantConfigurationType } from '@app/core/common/enum/tenant-configuration-type';
import { HttpErrorResponse } from '@angular/common/http';
import { ResponseErrorCode } from '@app/core/common/enum/respone-error-code';
import { LoggingService } from '@app/core/services/logging/logging-service';
import { CultureInfo } from '@app/core/model/culture-info';
import moment from 'moment';
import { CultureService } from '@app/core/services/culture/culture-service';
import { LanguageService } from '@app/core/services/language/language.service';
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
import { DefaultUserLocaleService } from '@app/core/services/default-user-locale/default-user-locale.service';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
import { DefaultUserLocaleEditorService } from './default-user-locale-editor.service';
@Component({
@ -225,7 +223,7 @@ export class DefaultUserLocaleEditorComponent extends BasePendingChangesComponen
if (culture == null
|| culture.displayName == null
|| culture.nativeName == null)
|| culture.nativeName == null)
return undefined;
return culture.displayName + '-' + culture.nativeName;

View File

@ -1,6 +1,5 @@
import { Component } from '@angular/core';
// import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
import { BaseComponent } from '@common/base/base.component';

View File

@ -1,18 +1,20 @@
import { DatePipe } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { UntypedFormGroup } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';
import { TenantService } from '@app/core/services/tenant/tenant.service';
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
// import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
import { DatePipe } from '@angular/common';
import { IsActive } from '@app/core/common/enum/is-active.enum';
import { AppPermission } from '@app/core/common/enum/permission.enum';
import { Tenant, TenantPersist } from '@app/core/model/tenant/tenant';
import { AuthService } from '@app/core/services/auth/auth.service';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { LockService } from '@app/core/services/lock/lock.service';
import { LoggingService } from '@app/core/services/logging/logging-service';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
import { TenantService } from '@app/core/services/tenant/tenant.service';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { FileUtils } from '@app/core/services/utilities/file-utils.service';
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
import { BaseEditor } from '@common/base/base-editor';
@ -23,12 +25,9 @@ import { FilterService } from '@common/modules/text-filter/filter-service';
import { Guid } from '@common/types/guid';
import { TranslateService } from '@ngx-translate/core';
import { map, takeUntil } from 'rxjs/operators';
import { TenantEditorModel } from './tenant-editor.model';
import { TenantEditorResolver } from './tenant-editor.resolver';
import { TenantEditorService } from './tenant-editor.service';
import { TenantEditorModel } from './tenant-editor.model';
import { LockService } from '@app/core/services/lock/lock.service';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
@Component({

View File

@ -159,11 +159,6 @@ export class AnnotationDialogComponent extends BaseComponent {
this.threads.add(element.threadId);
});
console.log(this.parentAnnotationsPerThread);
// console.log(this.comments);
// console.log(this.threads);
// console.log(this.parentAnnotationsPerThread);
// console.log(this.annotationsPerThread);
// this.annotationsChanged.emit(this.threads);
},
error => this.onCallbackError(error),
);

View File

@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { DescriptionStatus } from '@app/core/common/enum/description-status';
import { AppPermission } from '@app/core/common/enum/permission.enum';
import { DescriptionTemplate, DescriptionTemplateBaseFieldData, DescriptionTemplateDefaultValue, DescriptionTemplateDefinition, DescriptionTemplateExternalDatasetData, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateReferenceTypeData, DescriptionTemplateRule, DescriptionTemplateSection, DescriptionTemplateSelectData, DescriptionTemplateSelectOption, DescriptionTemplateUploadData, DescriptionTemplateUploadOption } from '@app/core/model/description-template/description-template';
import { DescriptionTemplate } from '@app/core/model/description-template/description-template';
import { Description, DescriptionExternalIdentifier, DescriptionField, DescriptionPropertyDefinition, DescriptionPropertyDefinitionFieldSet, DescriptionPropertyDefinitionFieldSetItem, DescriptionReference, DescriptionReferenceData, DescriptionTag } from '@app/core/model/description/description';
import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
import { Dmp, DmpDescriptionTemplate } from '@app/core/model/dmp/dmp';
@ -131,10 +131,7 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
(prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.label)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.ordinal)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.hasTemplates)].join('.'),
// (prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.id)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.descriptionTemplateGroupId)].join('.'),
// (prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.label)].join('.'),
// (prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.minMultiplicity)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.maxMultiplicity)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.prefillingSources), nameof<PrefillingSource>(x => x.id)].join('.'),
@ -169,19 +166,19 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
return this.descriptionService.getSingle(Guid.parse(id), fields).pipe(tap(d => this.breadcrumbService.addIdResolvedValue(d.id.toString(), d.label)));
} else if (dmpId != null && dmpSectionId != null && copyDmpId == null) {
return this.dmpService.getSingle(Guid.parse(dmpId), DescriptionEditorResolver.dmpLookupFields())
.pipe(tap(x => {
this.breadcrumbService.addIdResolvedValue(`${x.id}/${dmpSectionId}`, this.language.instant("DESCRIPTION-EDITOR.TITLE-NEW"));
.pipe(tap(x => {
this.breadcrumbService.addIdResolvedValue(`${x.id}/${dmpSectionId}`, this.language.instant("DESCRIPTION-EDITOR.TITLE-NEW"));
}), takeUntil(this._destroyed), map(dmp => {
}), takeUntil(this._destroyed), map(dmp => {
const description: Description = {};
description.dmp = dmp;
description.dmpDescriptionTemplate = {
sectionId: Guid.parse(dmpSectionId)
}
return description;
}));
} else if (copyDmpId != null && id != null && dmpSectionId != null) {
const description: Description = {};
description.dmp = dmp;
description.dmpDescriptionTemplate = {
sectionId: Guid.parse(dmpSectionId)
}
return description;
}));
} else if (copyDmpId != null && id != null && dmpSectionId != null) {
return this.dmpService.getSingle(Guid.parse(copyDmpId), DescriptionEditorResolver.dmpLookupFields()).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed), concatMap(dmp => {
return this.descriptionService.getSingle(Guid.parse(id), DescriptionEditorResolver.cloneLookupFields()).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed), map(description => {
@ -197,9 +194,5 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
}));
}));
}
//TODO: check this
// else if (cloneid != null) {
// return this.descriptionService.clone(Guid.parse(cloneid), fields).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed));
// }
}
}

View File

@ -1,13 +1,10 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
// import { DescriptionWizardComponent } from './description-wizard/description-wizard.component';
import { AppPermission } from '@app/core/common/enum/permission.enum';
import { PendingChangesGuard } from '@common/forms/pending-form-changes/pending-form-changes-guard.service';
// import { DescriptionOverviewComponent } from './overview/description-overview.component';
import { AuthGuard } from '@app/core/auth-guard.service';
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
import { PendingChangesGuard } from '@common/forms/pending-form-changes/pending-form-changes-guard.service';
import { DescriptionEditorComponent } from './description-editor.component';
import { DescriptionEditorResolver } from './description-editor.resolver';
import { AuthGuard } from '@app/core/auth-guard.service';
const routes: Routes = [
{
@ -22,11 +19,7 @@ const routes: Routes = [
breadcrumbs: true,
getFromTitleService: true,
usePrefix: false
//title: 'DESCRIPTION-EDITOR.TITLE-EDIT-DESCRIPTION'
// ,
// authContext: {
// permissions: [AppPermission.EditDescription]
// }
}
},
{
@ -43,10 +36,6 @@ const routes: Routes = [
hideNavigationItem: true
}),
title: 'DESCRIPTION-EDITOR.TITLE-EDIT-DESCRIPTION',
// ,
// authContext: {
// permissions: [AppPermission.EditDescription]
// }
}
},
{
@ -62,10 +51,6 @@ const routes: Routes = [
title: 'DESCRIPTION-EDITOR.TITLE-NEW',
getFromTitleService: true,
usePrefix: false
// ,
// authContext: {
// permissions: [AppPermission.EditDescription]
// }
}
},
{
@ -81,66 +66,8 @@ const routes: Routes = [
title: 'DESCRIPTION-EDITOR.TITLE-NEW',
getFromTitleService: true,
usePrefix: false
// ,
// authContext: {
// permissions: [AppPermission.EditDescription]
// }
}
},
// {
// path: 'edit/:id/finalize',
// component: DescriptionWizardComponent,
// canActivate: [AuthGuard],
// data: {
// breadcrumb: true,
// public: false,
// title: 'GENERAL.TITLES.DATASET-EDIT',
// finalize: true
// },
// canDeactivate:[CanDeactivateGuard]
// },
// {
// path: 'publicEdit/:publicId',
// component: DescriptionWizardComponent,
// //canActivate: [AuthGuard],
// data: {
// public: true,
// title: 'GENERAL.TITLES.DATASET-PUBLIC-EDIT'
// },
// canDeactivate:[CanDeactivateGuard]
// },
// {
// path: 'new',
// component: DescriptionWizardComponent,
// canActivate: [AuthGuard],
// data: {
// breadcrumb: true,
// title: 'GENERAL.TITLES.DATASET-NEW'
// },
// canDeactivate:[CanDeactivateGuard]
// },
// {
// path: 'copy/:id',
// component: DescriptionWizardComponent,
// canActivate: [AuthGuard],
// data: {
// breadcrumb: true,
// title: 'GENERAL.TITLES.DATASET-COPY'
// },
// canDeactivate:[CanDeactivateGuard]
// },
// {
// path: 'profileupdate/:updateId',
// component: DescriptionWizardComponent,
// canActivate: [AuthGuard],
// data: {
// breadcrumb: true,
// title: 'GENERAL.TITLES.DATASET-UPDATE'
// },
// canDeactivate:[CanDeactivateGuard]
// },
];
@NgModule({

View File

@ -35,18 +35,10 @@ export class DescriptionFormFieldSetComponent extends BaseComponent {
return this.fieldSet.hasMultiplicity && this.fieldSet.multiplicity != null;
}
isVisibleByVisibilityService: boolean = true;
@Input() visibilityRulesService: VisibilityRulesService;
@Input() path: String;
@Input() datasetProfileId: String;
// @Input() form: UntypedFormGroup;
@Input() isChild: Boolean = false;
@Input() showDelete: Boolean = false;
@Input() tocentry: ToCEntry;

View File

@ -190,11 +190,6 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
) {
setTimeout(() => this.refreshCallback(true));
}
// if (this.refreshCallback != null &&
// (this.criteria.like == null || this.criteria.like.length === 0 || this.criteria.like.length > 2)
// ) {
// this.refreshCallback();
// }
}
filterTags(value: string): Observable<ExternalSourceItemModel[]> {
@ -225,12 +220,6 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
const fields: Array<string> = new Array<string>();
fields.push('asc');
// if (this.isPublic) {
// const dmpDataTableRequest: DataTableRequest<ExploreDmpCriteriaModel> = new DataTableRequest(0, null, { fields: fields });
// dmpDataTableRequest.criteria = new ExploreDmpCriteriaModel();
// dmpDataTableRequest.criteria.like = value;
// return this.dmpService.getPublicPaged(dmpDataTableRequest, "autocomplete");
// } else {
const dmpDataTableRequest: DataTableRequest<DmpCriteria> = new DataTableRequest(0, null, { fields: fields });
dmpDataTableRequest.criteria = new DmpCriteria();
dmpDataTableRequest.criteria.like = value;

View File

@ -12,6 +12,7 @@ import { AppPermission } from '@app/core/common/enum/permission.enum';
import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
import { DescriptionTemplate } from '@app/core/model/description-template/description-template';
import { Description } from '@app/core/model/description/description';
import { DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
import { Dmp, DmpDescriptionTemplate, DmpUser } from '@app/core/model/dmp/dmp';
import { DmpReference } from '@app/core/model/dmp/dmp-reference';
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
@ -20,36 +21,29 @@ import { DescriptionLookup } from '@app/core/query/description.lookup';
import { DmpLookup } from '@app/core/query/dmp.lookup';
import { AuthService } from '@app/core/services/auth/auth.service';
import { DescriptionService } from '@app/core/services/description/description.service';
import { DmpService } from '@app/core/services/dmp/dmp.service';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { GuidedTour, Orientation } from '@app/library/guided-tour/guided-tour.constants';
import { GuidedTourService } from '@app/library/guided-tour/guided-tour.service';
import { StartNewDmpDialogComponent } from '@app/ui/dmp/new/start-new-dmp-dialogue/start-new-dmp-dialog.component';
// import { IBreadCrumbComponent } from '@app/ui/misc/breadcrumb/definition/IBreadCrumbComponent';
// import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
import { BaseComponent } from '@common/base/base.component';
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
import { SortDirection } from '@common/modules/hybrid-listing/hybrid-listing.component';
import { Guid } from '@common/types/guid';
import { TranslateService } from '@ngx-translate/core';
import { debounceTime, takeUntil } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof';
import { StartNewDescriptionDialogComponent } from '../start-new-description-dialog/start-new-description-dialog.component';
import { DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
import { SortDirection } from '@common/modules/hybrid-listing/hybrid-listing.component';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
@Component({
selector: 'app-description-listing-component',
templateUrl: 'description-listing.component.html',
styleUrls: ['./description-listing.component.scss']
})
export class DescriptionListingComponent extends BaseComponent implements OnInit {//IBreadCrumbComponent
export class DescriptionListingComponent extends BaseComponent implements OnInit {
@ViewChild(MatPaginator, { static: true }) _paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
// @ViewChild(DescriptionCriteriaComponent, { static: true }) criteria: DescriptionCriteriaComponent;
// breadCrumbs: Observable<BreadcrumbItem[]>;
titlePrefix: String;
dmpId: string;
@ -202,12 +196,12 @@ export class DescriptionListingComponent extends BaseComponent implements OnInit
this.refresh(this.lookup);
}
orderByChanged(){
if (this.formGroup.get('order').value == RecentActivityOrder.Status){
orderByChanged() {
if (this.formGroup.get('order').value == RecentActivityOrder.Status) {
this.lookup.order = { items: [this.sortingDirectionPrefix + nameof<Dmp>(x => x.status)] };
} else if(this.formGroup.get('order').value == RecentActivityOrder.Label){
} else if (this.formGroup.get('order').value == RecentActivityOrder.Label) {
this.lookup.order = { items: [this.sortingDirectionPrefix + nameof<Dmp>(x => x.label)] };
}else{
} else {
this.lookup.order = { items: [this.sortingDirectionPrefix + nameof<Dmp>(x => x.updatedAt)] };
}
this.refresh(this.lookup);
@ -256,96 +250,35 @@ export class DescriptionListingComponent extends BaseComponent implements OnInit
[nameof<Description>(x => x.dmpDescriptionTemplate), nameof<DmpDescriptionTemplate>(x => x.sectionId)].join('.'),
]
};
if(this.isPublic){
if (this.isPublic) {
this.descriptionService.publicQuery(lookup).pipe(takeUntil(this._destroyed))
.subscribe(result => {
if (!result) { return []; }
this.totalCount = result.count;
if (lookup?.page?.offset === 0) this.listingItems = [];
this.listingItems.push(...result.items);
this.hasListingItems = true;
},
(error) => this.httpErrorHandlingService.handleBackedRequestError(error));
}else{
.subscribe(result => {
if (!result) { return []; }
this.totalCount = result.count;
if (lookup?.page?.offset === 0) this.listingItems = [];
this.listingItems.push(...result.items);
this.hasListingItems = true;
},
(error) => this.httpErrorHandlingService.handleBackedRequestError(error));
} else {
this.descriptionService.query(lookup).pipe(takeUntil(this._destroyed))
.subscribe(result => {
if (!result) { return []; }
this.totalCount = result.count;
if (lookup?.page?.offset === 0) this.listingItems = [];
result.items.forEach(description => {
if (description.status != DescriptionStatus.Canceled) this.listingItems.push(description);
})
this.hasListingItems = true;
},
(error) => this.httpErrorHandlingService.handleBackedRequestError(error));
.subscribe(result => {
if (!result) { return []; }
this.totalCount = result.count;
if (lookup?.page?.offset === 0) this.listingItems = [];
result.items.forEach(description => {
if (description.status != DescriptionStatus.Canceled) this.listingItems.push(description);
})
this.hasListingItems = true;
},
(error) => this.httpErrorHandlingService.handleBackedRequestError(error));
}
}
openFiltersDialog(): void {
//TODO: Add filters dialog
// const dialogRef = this.dialog.open(DescriptionCriteriaDialogComponent, {
// width: '456px',
// height: '100%',
// id: 'filters',
// restoreFocus: false,
// data: {
// isPublic: this.isPublic,
// status: this.status,
// criteria: this.criteria,
// formGroup: this.criteriaFormGroup,
// // criteria: this.grantId ? this.criteria : this.getDefaultCriteria(),
// updateDataFn: this.updateDataFn.bind(this)
// },
// position: { right: '0px;' },
// panelClass: 'dialog-side-panel'
// });
// dialogRef.afterClosed().subscribe(result => {
// });
}
// updateDataFn(criteria: DescriptionCriteriaComponent): void {
// this.criteriaFormGroup = criteria.formGroup;
// this.toDescriptionCriteria(criteria);
// this.refresh();
// }
// toDescriptionCriteria(criteria: DescriptionCriteriaComponent) {
// let formGroup = criteria.formGroup;
// this.criteria = {
// like: formGroup.get("like").value,
// status: formGroup.get("status").value,
// allVersions: formGroup.get("allVersions").value,
// role: formGroup.get("role").value
// }
// if (formGroup.get("tags") && formGroup.get("tags").value) {
// this.criteria.tags = formGroup.get("tags").value.map(x => (<ExternalTagEditorModel>x));
// }
// if (formGroup.get("collaborators") && formGroup.get("collaborators").value) {
// this.criteria.collaborators = formGroup.get("collaborators").value.map(x => x.id);
// }
// if (formGroup.get("dmpIds") && formGroup.get("dmpIds").value) {
// this.criteria.dmpIds = formGroup.get("dmpIds").value.map(x => x.id);
// }
// if (formGroup.get("groupIds") && formGroup.get("groupIds").value) {
// this.criteria.groupIds = formGroup.get("groupIds").value.map(x => x.groupId);
// }
// if (formGroup.get("grants") && formGroup.get("grants").value) {
// this.criteria.grants = formGroup.get("grants").value.map(x => x.id);
// }
// if (formGroup.get("organisations") && formGroup.get("organisations").value) {
// this.criteria.organisations = formGroup.get("organisations").value.map(x => x.id);
// }
// if (formGroup.get("descriptionTemplates") && formGroup.get("descriptionTemplates").value) {
// this.criteria.descriptionTemplates = formGroup.get("descriptionTemplates").value.map(x => x.id)
// }
// if (formGroup.get("grantStatus") && formGroup.get("grantStatus").value) {
// this.criteria.grantStatus = formGroup.get("grantStatus").value;
// }
// this.criteria.isPublic = this.isPublic;
// }
hasScrollbar(): boolean {
return document.getElementById("main-page").scrollHeight > document.documentElement.clientHeight
@ -360,16 +293,16 @@ export class DescriptionListingComponent extends BaseComponent implements OnInit
public setDashboardTourDmpText(): void {
this.dmpText = this.language.instant('DMP-LISTING.TEXT-INFO') + '\n\n' +
this.language.instant('DMP-LISTING.TEXT-INFO-QUESTION') + ' ' +
this.language.instant('DMP-LISTING.LINK-ZENODO') + ' ' +
this.language.instant('DMP-LISTING.GET-IDEA');
this.language.instant('DMP-LISTING.TEXT-INFO-QUESTION') + ' ' +
this.language.instant('DMP-LISTING.LINK-ZENODO') + ' ' +
this.language.instant('DMP-LISTING.GET-IDEA');
this.dashboardTour.steps[0].title = this.dmpText;
}
public setDashboardTourDescriptionText(): void {
this.descriptionText = this.language.instant('DESCRIPTION-LISTING.TEXT-INFO') + '\n\n' +
this.language.instant('DESCRIPTION-LISTING.TEXT-INFO-QUESTION') + ' ' +
this.language.instant('DESCRIPTION-LISTING.GET-IDEA');
this.language.instant('DESCRIPTION-LISTING.TEXT-INFO-QUESTION') + ' ' +
this.language.instant('DESCRIPTION-LISTING.GET-IDEA');
this.dashboardTour.steps[1].title = this.descriptionText;
}

View File

@ -1,6 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { BaseComponent } from '@common/base/base.component';
import { Location } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { UntypedFormBuilder, Validators } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Params, Router } from '@angular/router';
@ -18,6 +17,7 @@ import { Dmp, DmpDescriptionTemplate, DmpUser, DmpUserRemovePersist } from '@app
import { DmpReference } from '@app/core/model/dmp/dmp-reference';
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
import { Reference } from '@app/core/model/reference/reference';
import { User } from '@app/core/model/user/user';
import { AuthService } from '@app/core/services/auth/auth.service';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { DescriptionService } from '@app/core/services/description/description.service';
@ -28,22 +28,21 @@ import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
import { ReferenceService } from '@app/core/services/reference/reference.service';
import { UserService } from '@app/core/services/user/user.service';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { FileUtils } from '@app/core/services/utilities/file-utils.service';
import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component';
import { DescriptionValidationOutput } from '@app/ui/dmp/dmp-finalize-dialog/dmp-finalize-dialog.component';
import { DmpInvitationDialogComponent } from '@app/ui/dmp/invitation/dialog/dmp-invitation-dialog.component';
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
import { BaseComponent } from '@common/base/base.component';
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
import { Guid } from '@common/types/guid';
import { TranslateService } from '@ngx-translate/core';
import { map, takeUntil } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof';
import { DescriptionCopyDialogComponent } from '../description-copy-dialog/description-copy-dialog.component';
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
import { Observable, of } from 'rxjs';
import { UserService } from '@app/core/services/user/user.service';
import { User } from '@app/core/model/user/user';
@Component({
@ -59,7 +58,6 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
isFinalized = false;
isPublicView = true;
hasPublishButton: boolean = true;
// breadCrumbs: Observable<BreadcrumbItem[]> = observableOf();
expand = false;
isLocked: Boolean;
descriptionStatusEnum = DescriptionStatus;
@ -189,14 +187,14 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
}
});
if (this.isAuthenticated()) {
this.userService.getSingle(this.authentication.userId(), [
nameof<User>(x => x.id),
nameof<User>(x => x.name)])
.pipe(map(u => u.name)).subscribe(name => this.userName = name);
} else {
this.userName = '';
}
if (this.isAuthenticated()) {
this.userService.getSingle(this.authentication.userId(), [
nameof<User>(x => x.id),
nameof<User>(x => x.name)])
.pipe(map(u => u.name)).subscribe(name => this.userName = name);
} else {
this.userName = '';
}
}
get unauthorizedTootipText(): string {
@ -216,10 +214,10 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
});
}
},
error => {
this.router.navigate(['/descriptions']);
this.httpErrorHandlingService.handleBackedRequestError(error);
});
error => {
this.router.navigate(['/descriptions']);
this.httpErrorHandlingService.handleBackedRequestError(error);
});
}
onFetchingDeletedCallbackError(redirectRoot: string) {
@ -417,39 +415,39 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
finalize(description: Description) {
this.descriptionService.validate([description.id]).pipe(takeUntil(this._destroyed))
.subscribe(result => {
if (result[0].result == DescriptionValidationOutput.Invalid) {
this.router.navigate(['descriptions/edit/' + description.id + '/finalize']);
} else {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
restoreFocus: false,
data: {
message: this.language.instant('DESCRIPTION-OVERVIEW.FINALIZE-DIALOG.TITLE'),
confirmButton: this.language.instant('DESCRIPTION-OVERVIEW.FINALIZE-DIALOG.CONFIRM'),
cancelButton: this.language.instant('DESCRIPTION-OVERVIEW.FINALIZE-DIALOG.NEGATIVE'),
isDeleteConfirmation: false
}
});
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
if (result) {
const descriptionStatusPersist: DescriptionStatusPersist = {
id: description.id,
status: DescriptionStatus.Finalized,
hash: description.hash
};
this.descriptionService.persistStatus(descriptionStatusPersist).pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.reloadPage();
this.onUpdateCallbackSuccess()
}, (error: any) => {
this.onUpdateCallbackError(error)
});
}
},
.subscribe(result => {
if (result[0].result == DescriptionValidationOutput.Invalid) {
this.router.navigate(['descriptions/edit/' + description.id + '/finalize']);
} else {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
restoreFocus: false,
data: {
message: this.language.instant('DESCRIPTION-OVERVIEW.FINALIZE-DIALOG.TITLE'),
confirmButton: this.language.instant('DESCRIPTION-OVERVIEW.FINALIZE-DIALOG.CONFIRM'),
cancelButton: this.language.instant('DESCRIPTION-OVERVIEW.FINALIZE-DIALOG.NEGATIVE'),
isDeleteConfirmation: false
}
});
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
if (result) {
const descriptionStatusPersist: DescriptionStatusPersist = {
id: description.id,
status: DescriptionStatus.Finalized,
hash: description.hash
};
this.descriptionService.persistStatus(descriptionStatusPersist).pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.reloadPage();
this.onUpdateCallbackSuccess()
}, (error: any) => {
this.onUpdateCallbackError(error)
});
}
},
error => this.httpErrorHandlingService.handleBackedRequestError(error));
}
},
error => this.httpErrorHandlingService.handleBackedRequestError(error));
}
},
error => this.httpErrorHandlingService.handleBackedRequestError(error));
}
hasReversableStatus(description: Description): boolean {

View File

@ -317,11 +317,6 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
formSubmit(): void {
this.formService.removeAllBackEndErrors(this.formGroup);
// this.formService.touchAllFormFields(this.formGroup);
// if (this.formGroup.get('label').valid && this.formGroup.get('blueprint').valid && this.formGroup.get('status').valid
// && this.formGroup.get('descriptionTemplates').valid) {
// this.persistEntity();
// }
this.persistEntity();
}

View File

@ -53,9 +53,6 @@ export class DmpEditorResolver extends BaseEditorResolver {
[nameof<Dmp>(x => x.properties), nameof<DmpProperties>(x => x.contacts), nameof<DmpContact>(x => x.email)].join('.'),
// [nameof<Dmp>(x => x.entityDois), nameof<EntityDoi>(x => x.id)].join('.'),
// [nameof<Dmp>(x => x.entityDois), nameof<EntityDoi>(x => x.repositoryId)].join('.'),
// [nameof<Dmp>(x => x.entityDois), nameof<EntityDoi>(x => x.doi)].join('.'),
[nameof<Dmp>(x => x.descriptions), nameof<Description>(x => x.id)].join('.'),
[nameof<Dmp>(x => x.descriptions), nameof<Description>(x => x.label)].join('.'),
[nameof<Dmp>(x => x.descriptions), nameof<Description>(x => x.status)].join('.'),
@ -88,11 +85,6 @@ export class DmpEditorResolver extends BaseEditorResolver {
[nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.isActive)].join('.'),
// nameof<Dmp>(x => x.id),
// nameof<Dmp>(x => x.label),
// nameof<Dmp>(x => x.status),
// nameof<Dmp>(x => x.description),
// nameof<Dmp>(x => x.status),
...DmpEditorResolver.blueprintLookupFields(nameof<Dmp>(x => x.blueprint)),
]

View File

@ -1,33 +0,0 @@
<div class="main-info" [formGroup]="formGroup">
<div class="col-12 intro">
<p>{{'DMP-EDITOR.DATASET-INFO.SECOND-INTRO' | translate}}</p>
</div>
<div class="col-12 card">
<div class="row">
<div class="col-12">
<div class="heading">4.1 {{'DMP-EDITOR.STEPPER.DESCRIPTION-INFO' | translate}}*</div>
<div class="hint">
<div class="pb-1">{{'DMP-EDITOR.DATASET-INFO.HINT' | translate}}</div>
<div><span class="material-icons-outlined align-bottom">info</span> {{'DMP-EDITOR.MAIN-INFO.TYPING' | translate}}</div>
</div>
<div class="profile-form">
<mat-form-field>
<mat-label>{{'DMP-EDITOR.FIELDS.SELECT-TEMPLATE' | translate}}</mat-label>
<app-multiple-auto-complete placeholder="{{'DMP-EDITOR.FIELDS.SELECT-TEMPLATE' | translate}}" required='true' [formControl]="formGroup.get('profiles')" [configuration]="profilesAutoCompleteConfiguration" (optionRemoved)="onRemoveTemplate($event)" (optionActionClicked)="onPreviewTemplate($event)" (optionSelected)="onOptionSelected()">
</app-multiple-auto-complete>
<mat-error *ngIf="formGroup.get('profiles').hasError('backendError')">
{{formGroup.get('profiles').getError('backendError').message}}</mat-error>
<mat-error *ngIf="formGroup.get('profiles').hasError('required')">
{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
<button matSuffix class="input-btn" [disabled]="formGroup.get('profiles').disabled" (click)="allAvailableProfiles($event)">
<mat-icon class="icon-btn">view_list</mat-icon>
</button>
</mat-form-field>
</div>
<div class="col pl-0 pt-2 pb-3 d-flex">
<span class="not-found">{{'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.SECOND-STEP.FIELDS.HELP' | translate}}</span>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,84 +0,0 @@
.main-info {
// position: relative;
// left: 362px;
// width: calc(100% - 366px);
.intro {
text-align: left;
font-weight: 400;
letter-spacing: 0px;
color: #212121;
opacity: 1;
margin: 3rem 0rem 3rem 0rem;
}
.heading {
text-align: left;
font-weight: 700;
font-size: 18px;
letter-spacing: 0px;
color: #212121;
opacity: 0.81;
margin-top: 1.625rem;
margin-bottom: 0.625rem;
}
.hint {
text-align: left;
font-weight: 400;
font-size: 16px;
letter-spacing: 0px;
color: #212121;
opacity: 0.81;
margin-bottom: 2.125rem;
}
.title-form,
.description-form {
text-align: left;
font-weight: 400;
font-size: 16px;
letter-spacing: 0.15px;
color: #7d7d7d;
opacity: 1;
margin-bottom: 1rem;
}
// textarea::placeholder {
// font-style: oblique;
// }
.input-btn {
border: none;
color: #aaaaaa;
background-color: #ffffff00;
cursor: pointer;
}
.input-btn :hover {
color: var(--primary-color-3) !important;
}
.not-found {
font-size: 0.875rem;
font-weight: 400;
padding: 0rem 0.5rem 0rem 0rem;
}
}
::ng-deep .profile-form .mat-form-field-appearance-outline .mat-form-field-outline {
background: #fafafa !important;
}
::ng-deep .profile-form .mat-form-field-appearance-outline .mat-form-field-infix {
font-size: 1rem;
padding: 0.6em 0 1em 0 !important;
}
::ng-deep .profile-form .mat-form-field-wrapper {
padding-bottom: 0rem;
}
:host ::ng-deep .multiple-auto-complete .align-arrow-right {
bottom: 1rem !important;
}

View File

@ -1,258 +0,0 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { UntypedFormGroup } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';
import { DmpBlueprintDefinition } from '@app/core/model/dmp-blueprint/dmp-blueprint';
import { RequestItem } from '@app/core/query/request-item';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { DmpBlueprintService } from '@app/core/services/dmp/dmp-blueprint.service';
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
import { BaseComponent } from '@common/base/base.component';
import { TranslateService } from '@ngx-translate/core';
import { Observable } from 'rxjs';
import { map, takeUntil } from 'rxjs/operators';
import { AvailableProfilesComponent } from '../available-profiles/available-profiles.component';
import { DmpService } from '@app/core/services/dmp/dmp.service';
@Component({
selector: 'dataset-info',
templateUrl: './dataset-info.component.html',
styleUrls: ['./dataset-info.component.scss']
})
export class DatasetInfoComponent extends BaseComponent implements OnInit {
@Input() formGroup: UntypedFormGroup = null;
// @Input() datasetFormGroup: FormGroup = null;
@Input() isUserOwner: boolean;
@Input() dmp: DmpEditorModel;
@Input() hasDmpId: boolean;
@Input() isPublic: boolean;
@Input() isFinalized: boolean;
@Input() isNewVersion: boolean;
@Input() isClone: boolean;
@Output() onFormChanged: EventEmitter<any> = new EventEmitter();
availableProfiles: DatasetProfileModel[] = [];
selectedDmpBlueprintDefinition: DmpBlueprintDefinition;
profilesAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
datasetProfileDefinitionModel: DatasetDescriptionFormEditorModel;
datasetProfileDefinitionFormGroup: UntypedFormGroup;
constructor(
private language: TranslateService,
private configurationService: ConfigurationService,
private externalSourcesService: ExternalSourcesService,
private datasetWizardService: DatasetWizardService,
private dialog: MatDialog,
private _service: DmpService,
private dmpBlueprintService: DmpBlueprintService,
private router: Router,
private route: ActivatedRoute,
private uiNotificationService: UiNotificationService
) {
super();
}
ngOnInit() {
try {
const profiles = this.formGroup.get('profiles').value as { id: string, label: string }[];
profiles.sort((a, b) => a.label.localeCompare(b.label));
} catch {
console.info('Could not sort profiles');
}
this.profilesAutoCompleteConfiguration = {
filterFn: this.filterProfiles.bind(this),
initialItems: (excludedItems: any[]) => this.filterProfiles('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
displayFn: (item) => item['label'],
titleFn: (item) => item['label'],
subtitleFn: (item) => item['description'],
popupItemActionIcon: 'visibility'
};
if (this.formGroup.get('definition')) { this.selectedDmpBlueprintDefinition = this.formGroup.get('definition').value; }
this.registerFormEventsForDmpBlueprint();
if (this.hasDmpId) {
this.loadDatasetProfiles();
this.profilesAutoCompleteConfiguration = {
filterFn: this.filterProfiles.bind(this),
initialItems: (excludedItems: any[]) => this.filterProfiles('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
displayFn: (item) => item['label'],
titleFn: (item) => item['label'],
subtitleFn: (item) => item['description'],
popupItemActionIcon: 'visibility'
};
}
}
// Researchers
filterProfiles(value: string): Observable<DatasetProfileModel[]> {
const request = new DataTableRequest<DatasetProfileCriteria>(null, null, { fields: ['+label'] });
const criteria = new DatasetProfileCriteria();
criteria.like = value;
request.criteria = criteria;
return this._service.searchDmpBlueprints(request);
}
registerFormEventsForDmpBlueprint(definitionProperties?: DmpBlueprintDefinition): void {
this.formGroup.get('profile').valueChanges
.pipe(
takeUntil(this._destroyed))
.subscribe(Option => {
if (Option instanceof Object) {
this.selectedDmpBlueprintDefinition = null;
this.dmpBlueprintService.getSingle(Option.id)
.pipe(takeUntil(this._destroyed))
.subscribe(result => {
this.selectedDmpBlueprintDefinition = result.definition;
});
} else {
this.selectedDmpBlueprintDefinition = null;
}
this.selectedDmpBlueprintDefinition = definitionProperties;
})
}
loadDatasetProfiles() {
const datasetProfileRequestItem: RequestItem<DatasetProfileCriteria> = new RequestItem();
datasetProfileRequestItem.criteria = new DatasetProfileCriteria();
this.formGroup.get('id').value ? datasetProfileRequestItem.criteria.id = this.formGroup.get('id').value : datasetProfileRequestItem.criteria.id = this.formGroup.get('datasets')['controls'][0].get('dmp').value.id;
if (datasetProfileRequestItem.criteria.id) {
this.datasetWizardService.getAvailableProfiles(datasetProfileRequestItem)
.pipe(takeUntil(this._destroyed))
.subscribe(items => {
this.availableProfiles = items;
});
}
}
allAvailableProfiles(event: MouseEvent) {
event.stopPropagation();
const dialogRef = this.dialog.open(AvailableProfilesComponent, {
data: {
profiles: this.formGroup.get('profiles')
}
});
return false;
}
// dmpValueChanged(dmp: DmpListingModel) {
// if (dmp) {
// this.formGroup.get('profile').enable();
// this.loadDatasetProfiles();
// }
// else {
// this.availableProfiles = [];
// this.formGroup.get('profile').reset();
// this.formGroup.get('profile').disable();
// this.formGroup.removeControl('datasetProfileDefinition');
// }
// }
// registerFormListeners() {
// this.formGroup.get('datasets')['controls'][0].get('dmp').valueChanges
// .pipe(takeUntil(this._destroyed))
// .subscribe(x => {
// this.dmpValueChanged(x);
// });
// this.formGroup.get('profile').valueChanges
// .pipe(takeUntil(this._destroyed))
// .subscribe(x => {
// //this.datasetProfileValueChanged(x);
// });
// }
// datasetProfileValueChanged(profiledId: string) {
// if (profiledId && profiledId.length > 0) {
// this.formGroup.removeControl('datasetProfileDefinition');
// this.getDefinition();
// }
// }
// getDefinition() {
// this.datasetWizardService.getDefinition(this.formGroup.get('profile').value)
// .pipe(takeUntil(this._destroyed))
// .subscribe(item => {
// this.formGroup.get('datasets')['controls'][0].datasetProfileDefinition = new DatasetDescriptionFormEditorModel().fromModel(item);
// this.datasetProfileDefinitionModel = this.formGroup.get('datasets')['controls'][0].datasetProfileDefinition;
// this.formGroup.addControl('datasetProfileDefinition', this.datasetProfileDefinitionModel.buildForm());
// });
// }
onRemoveTemplate(event) {
let found = false;
const profiles = this.formGroup.get('profiles').value;
this.formGroup.get('datasets')['controls'].forEach(element => {
if (element.get('profile').value.id === event.id) {
found = true;
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-REMOVE-TEMPLATE'), SnackBarNotificationLevel.Success);
}
});
if (found) {
this.formGroup.get('profiles').setValue(profiles);
this.profilesAutoCompleteConfiguration = {
filterFn: this.filterProfiles.bind(this),
initialItems: (excludedItems: any[]) => this.filterProfiles('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
displayFn: (item) => item['label'],
titleFn: (item) => item['label'],
subtitleFn: (item) => item['description'],
popupItemActionIcon: 'visibility'
};
}
}
onPreviewTemplate(event) {
const dialogRef = this.dialog.open(DatasetPreviewDialogComponent, {
width: '590px',
minHeight: '200px',
restoreFocus: false,
data: {
template: event
},
panelClass: 'custom-modalbox'
});
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
if (result) {
let profiles = this.formGroup.get('profiles').value;
profiles.push(event);
this.formGroup.get('profiles').setValue(profiles);
this.profilesAutoCompleteConfiguration = {
filterFn: this.filterProfiles.bind(this),
initialItems: (excludedItems: any[]) => this.filterProfiles('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
displayFn: (item) => item['label'],
titleFn: (item) => item['label'],
subtitleFn: (item) => item['description'],
popupItemActionIcon: 'visibility'
};
}
});
}
onOptionSelected() {
try {
const profiles = this.formGroup.get('profiles').value as { id: string, label: string }[];
const profileCounts: Map<String, number> = new Map<String, number>();
profiles.forEach((value) => profileCounts.set(value.id, (profileCounts.get(value.id) !== undefined ? profileCounts.get(value.id) : 0) + 1));
const duplicateProfiles = profiles.filter((value) => {
let isOk = profileCounts.get(value.id) > 1;
if (isOk) {
profileCounts.set(value.id, 0);
}
return isOk;
});
duplicateProfiles.forEach((value) => profiles.splice(profiles.lastIndexOf(value), 1));
profiles.sort((a, b) => a.label.localeCompare(b.label));
} catch {
console.info('Could not sort Dataset Templates')
}
}
}

View File

@ -6,43 +6,41 @@ import { MatDialog } from '@angular/material/dialog';
import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { ActivatedRoute, Router } from '@angular/router';
import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
import { AuthService } from '@app/core/services/auth/auth.service';
import { DmpService } from '@app/core/services/dmp/dmp.service';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { GuidedTour, Orientation } from '@app/library/guided-tour/guided-tour.constants';
import { GuidedTourService } from '@app/library/guided-tour/guided-tour.service';
// import { IBreadCrumbComponent } from '@app/ui/misc/breadcrumb/definition/IBreadCrumbComponent';
// import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
import { DescriptionStatus } from '@app/core/common/enum/description-status';
import { DmpStatus } from '@app/core/common/enum/dmp-status';
import { DmpVersionStatus } from '@app/core/common/enum/dmp-version-status';
import { IsActive } from '@app/core/common/enum/is-active.enum';
import { AppPermission } from '@app/core/common/enum/permission.enum';
import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
import { DescriptionTemplate } from '@app/core/model/description-template/description-template';
import { Description } from '@app/core/model/description/description';
import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
import { Dmp, DmpDescriptionTemplate, DmpUser } from '@app/core/model/dmp/dmp';
import { DmpReference } from '@app/core/model/dmp/dmp-reference';
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
import { Reference } from '@app/core/model/reference/reference';
import { DmpLookup } from '@app/core/query/dmp.lookup';
import { AuthService } from '@app/core/services/auth/auth.service';
import { DmpService } from '@app/core/services/dmp/dmp.service';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { GuidedTour, Orientation } from '@app/library/guided-tour/guided-tour.constants';
import { GuidedTourService } from '@app/library/guided-tour/guided-tour.service';
import { BaseComponent } from '@common/base/base.component';
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
import { SortDirection } from '@common/modules/hybrid-listing/hybrid-listing.component';
import { Guid } from '@common/types/guid';
import { TranslateService } from '@ngx-translate/core';
import { NgDialogAnimationService } from "ng-dialog-animation";
import { debounceTime, takeUntil } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof';
import { DmpVersionStatus } from '@app/core/common/enum/dmp-version-status';
import { DmpReference } from '@app/core/model/dmp/dmp-reference';
import { Reference } from '@app/core/model/reference/reference';
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
import { AppPermission } from '@app/core/common/enum/permission.enum';
import { DmpStatus } from '@app/core/common/enum/dmp-status';
import { DescriptionStatus } from '@app/core/common/enum/description-status';
import { SortDirection } from '@common/modules/hybrid-listing/hybrid-listing.component';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
import { DescriptionTemplate } from '@app/core/model/description-template/description-template';
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
@Component({
selector: 'app-dmp-listing-component',
templateUrl: 'dmp-listing.component.html',
styleUrls: ['./dmp-listing.component.scss'],
})
export class DmpListingComponent extends BaseComponent implements OnInit { //IBreadCrumbComponent
export class DmpListingComponent extends BaseComponent implements OnInit {
@ViewChild(MatPaginator, { static: true }) _paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
@ -174,8 +172,8 @@ export class DmpListingComponent extends BaseComponent implements OnInit { //IBr
this.language.instant('DMP-LISTING.GET-IDEA');
this.dashboardTour.steps[1].title = this.language.instant('DESCRIPTION-LISTING.TEXT-INFO') + '\n\n' +
this.language.instant('DESCRIPTION-LISTING.TEXT-INFO-QUESTION') + ' ' +
this.language.instant('DESCRIPTION-LISTING.GET-IDEA');
this.language.instant('DESCRIPTION-LISTING.TEXT-INFO-QUESTION') + ' ' +
this.language.instant('DESCRIPTION-LISTING.GET-IDEA');
this.guidedTourService.startTour(this.dashboardTour);
});
@ -186,12 +184,12 @@ export class DmpListingComponent extends BaseComponent implements OnInit { //IBr
this.refresh(this.lookup);
}
orderByChanged(){
if (this.formGroup.get('order').value == RecentActivityOrder.Status){
orderByChanged() {
if (this.formGroup.get('order').value == RecentActivityOrder.Status) {
this.lookup.order = { items: [this.sortingDirectionPrefix + nameof<Dmp>(x => x.status)] };
} else if(this.formGroup.get('order').value == RecentActivityOrder.Label){
} else if (this.formGroup.get('order').value == RecentActivityOrder.Label) {
this.lookup.order = { items: [this.sortingDirectionPrefix + nameof<Dmp>(x => x.label)] };
}else{
} else {
this.lookup.order = { items: [this.sortingDirectionPrefix + nameof<Dmp>(x => x.updatedAt)] };
}
this.refresh(this.lookup);
@ -234,10 +232,6 @@ export class DmpListingComponent extends BaseComponent implements OnInit { //IBr
[nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.hasTemplates)].join('.'),
[nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.descriptionTemplateGroupId)].join('.'),
// [nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.label)].join('.'),
// [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.id)].join('.'),
// [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.label)].join('.'),
// [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.accessType)].join('.'),
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.id)].join('.'),
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.user.id)].join('.'),
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.role)].join('.'),
@ -254,42 +248,40 @@ export class DmpListingComponent extends BaseComponent implements OnInit { //IBr
[nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.descriptionTemplateGroupId)].join('.'),
[nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.isActive)].join('.'),
// [nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.reference)].join('.'),
]
};
if(this.isPublic){
if (this.isPublic) {
this.dmpService.publicQuery(lookup).pipe(takeUntil(this._destroyed))
.subscribe(result => {
if (!result) { return []; }
this.totalCount = result.count;
if (lookup?.page?.offset === 0) this.listingItems = [];
this.listingItems.push(...result.items);
this.hasListingItems = true;
},
error => this.httpErrorHandlingService.handleBackedRequestError(error));
.subscribe(result => {
if (!result) { return []; }
this.totalCount = result.count;
if (lookup?.page?.offset === 0) this.listingItems = [];
this.listingItems.push(...result.items);
this.hasListingItems = true;
},
error => this.httpErrorHandlingService.handleBackedRequestError(error));
}else{
} else {
this.dmpService.query(lookup).pipe(takeUntil(this._destroyed))
.subscribe(result => {
if (!result) { return []; }
this.totalCount = result.count;
if (lookup?.page?.offset === 0) this.listingItems = [];
result.items.forEach(x=> {
if (x.descriptions) {
if (x.status == DmpStatus.Finalized) {
x.descriptions = x.descriptions.filter(x => x.isActive === IsActive.Active && x.status === DescriptionStatus.Finalized);
} else {
x.descriptions = x.descriptions.filter(x => x.isActive === IsActive.Active && x.status !== DescriptionStatus.Canceled);
.subscribe(result => {
if (!result) { return []; }
this.totalCount = result.count;
if (lookup?.page?.offset === 0) this.listingItems = [];
result.items.forEach(x => {
if (x.descriptions) {
if (x.status == DmpStatus.Finalized) {
x.descriptions = x.descriptions.filter(x => x.isActive === IsActive.Active && x.status === DescriptionStatus.Finalized);
} else {
x.descriptions = x.descriptions.filter(x => x.isActive === IsActive.Active && x.status !== DescriptionStatus.Canceled);
}
}
}
x.dmpUsers = x.dmpUsers.filter(x=> x.isActive === IsActive.Active);
this.listingItems.push(x);
})
// this.listingItems.push(...result.items);
this.hasListingItems = true;
},
error => this.httpErrorHandlingService.handleBackedRequestError(error));
x.dmpUsers = x.dmpUsers.filter(x => x.isActive === IsActive.Active);
this.listingItems.push(x);
})
this.hasListingItems = true;
},
error => this.httpErrorHandlingService.handleBackedRequestError(error));
}
}
@ -303,92 +295,12 @@ export class DmpListingComponent extends BaseComponent implements OnInit { //IBr
openShareDialog(rowId: any, rowName: any) {
//TODO: add this
// const dialogRef = this.dialog.open(DmpInvitationDialogComponent, {
// autoFocus: false,
// data: {
// dmpId: rowId,
// dmpName: rowName
// }
// });
}
openFiltersDialog(): void {
//TODO: Add filters dialog
// const dialogRef = this.dialog.open(DmpCriteriaDialogComponent, {
// width: '456px',
// height: '100%',
// id: 'filters',
// restoreFocus: false,
// data: {
// showGrant: this.showGrant,
// isPublic: this.isPublic,
// criteria: this.criteria,
// formGroup: this.criteriaFormGroup,
// // criteria: this.grantId ? this.criteria : this.getDefaultCriteria(),
// updateDataFn: this.updateDataFn.bind(this)
// },
// position: { right: '0px;' },
// panelClass: 'dialog-side-panel',
// // may remove NgDialogAnimationService package
// // animation: {
// // to: "left",
// // incomingOptions: {
// // keyframeAnimationOptions: { duration: 300, easing: "ease-in-out" }
// // }
// // }
// });
// dialogRef.afterClosed().subscribe(result => {
// });
}
// updateDataFn(criteria: DmpCriteriaComponent): void {
// this.criteriaFormGroup = criteria.formGroup;
// this.toDmpCriteria(criteria);
// this.refresh();
// }
// toDmpCriteria(criteria: DmpCriteriaComponent): void {
// let formGroup = criteria.formGroup;
// this.criteria = {
// like: formGroup.get('like').value,
// grants: formGroup.get('grants').value,
// role: formGroup.get('role').value
// }
// this.criteria.status = formGroup.get('status').value;
// this.setPublicCriteria(formGroup);
// if (formGroup.get('datasetTemplates').value)
// this.criteria.datasetTemplates = formGroup.get('datasetTemplates').value.map(x => x.id);
// if (formGroup.get('collaborators').value)
// this.criteria.collaborators = formGroup.get('collaborators').value.map(x => x.id);
// if (formGroup.get('organisations').value)
// this.criteria.organisations = formGroup.get('organisations').value.map(x => x.id);
// if (this.itemId) {
// this.criteria.groupIds = [this.itemId];
// this.criteria.allVersions = true;
// }
// this.criteria.grantStatus = formGroup.get('grantStatus').value;
// }
// setPublicCriteria(formGroup?: UntypedFormGroup): void {
// if (!isNullOrUndefined(formGroup)) {
// if (formGroup.get('status').value == 2) {
// this.criteria.status = 1;
// this.criteria.isPublic = true;
// } else {
// this.criteria.isPublic = false;
// }
// }
// this.criteria.onlyPublic = this.isPublic;
// if (this.isPublic) {
// this.criteria.isPublic = true;
// }
// // } else {
// // this.criteria.isPublic = false;
// // }
// }
hasScrollbar(): boolean {
return document.getElementById("main-page").scrollHeight > document.documentElement.clientHeight
}
@ -403,8 +315,8 @@ export class DmpListingComponent extends BaseComponent implements OnInit { //IBr
public setDashboardTourDatasetText(): void {
const datasetText = this.language.instant('DESCRIPTION-LISTING.TEXT-INFO') + '\n\n' +
this.language.instant('DESCRIPTION-LISTING.TEXT-INFO-QUESTION') + ' ' +
this.language.instant('DESCRIPTION-LISTING.GET-IDEA');
this.language.instant('DESCRIPTION-LISTING.TEXT-INFO-QUESTION') + ' ' +
this.language.instant('DESCRIPTION-LISTING.GET-IDEA');
this.dashboardTour.steps[1].title = datasetText;
}

View File

@ -1,18 +1,10 @@
import { Location } from '@angular/common';
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { DmpStatus } from '@app/core/common/enum/dmp-status';
import { AuthService } from '@app/core/services/auth/auth.service';
import { DmpService } from '@app/core/services/dmp/dmp.service';
import {
SnackBarNotificationLevel,
UiNotificationService
} from '@app/core/services/notification/ui-notification-service';
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
// import {BreadcrumbItem} from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
import { Location } from '@angular/common';
import { DescriptionStatus } from '@app/core/common/enum/description-status';
import { DmpAccessType } from '@app/core/common/enum/dmp-access-type';
import { DmpStatus } from '@app/core/common/enum/dmp-status';
import { DmpUserRole } from '@app/core/common/enum/dmp-user-role';
import { DmpVersionStatus } from '@app/core/common/enum/dmp-version-status';
import { FileTransformerEntityType } from '@app/core/common/enum/file-transformer-entity-type';
@ -27,18 +19,29 @@ import { DmpReference } from '@app/core/model/dmp/dmp-reference';
import { EntityDoi } from '@app/core/model/entity-doi/entity-doi';
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
import { Reference } from '@app/core/model/reference/reference';
import { User } from '@app/core/model/user/user';
import { AuthService } from '@app/core/services/auth/auth.service';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { DepositService } from '@app/core/services/deposit/deposit.service';
import { DmpBlueprintService } from '@app/core/services/dmp/dmp-blueprint.service';
import { DmpService } from '@app/core/services/dmp/dmp.service';
import { FileTransformerService } from '@app/core/services/file-transformer/file-transformer.service';
import { LockService } from '@app/core/services/lock/lock.service';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
import {
SnackBarNotificationLevel,
UiNotificationService
} from '@app/core/services/notification/ui-notification-service';
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
import { ReferenceService } from '@app/core/services/reference/reference.service';
import { UserService } from '@app/core/services/user/user.service';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { FileUtils } from '@app/core/services/utilities/file-utils.service';
import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component';
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
import { BaseComponent } from '@common/base/base.component';
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
import { Guid } from '@common/types/guid';
import { TranslateService } from '@ngx-translate/core';
import { map, takeUntil } from 'rxjs/operators';
@ -49,11 +52,6 @@ import { DmpEditorResolver } from '../dmp-editor-blueprint/dmp-editor.resolver';
import { DmpFinalizeDialogComponent, DmpFinalizeDialogOutput } from '../dmp-finalize-dialog/dmp-finalize-dialog.component';
import { DmpInvitationDialogComponent } from '../invitation/dialog/dmp-invitation-dialog.component';
import { NewVersionDmpDialogComponent } from '../new-version-dialog/dmp-new-version-dialog.component';
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
import { User } from '@app/core/model/user/user';
import { UserService } from '@app/core/services/user/user.service';
import { Observable, of } from 'rxjs';
@Component({
selector: 'app-dmp-overview',
@ -70,8 +68,6 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
isFinalized = false;
isPublicView = true;
hasPublishButton: boolean = true;
// breadCrumbs: Observable<BreadcrumbItem[]> = observableOf();
// isUserOwner: boolean;
isLocked: Boolean;
textMessage: any;
selectedModel: EntityDoi;
@ -212,8 +208,8 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
error => this.depositRepos = []);
this.userService.getSingle(this.authentication.userId(), [
nameof<User>(x => x.id),
nameof<User>(x => x.name)])
nameof<User>(x => x.id),
nameof<User>(x => x.name)])
.pipe(map(u => u.name)).subscribe(name => this.userName = name);
} else {
this.userName = '';
@ -324,90 +320,6 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
});
}
// private checkForGrant(blueprint: DmpBlueprintDefinition) {
// let hasGrant = false;
// blueprint.sections.forEach(section => section.fields.forEach(
// field => {
// if (field.category as unknown === DmpBlueprintFieldCategory.System && field.systemFieldType === DmpBlueprintSystemFieldType.GRANT) {
// hasGrant = true;
// }
// }
// ));
// if (!hasGrant) {
// this.formGroup.removeControl('grant');
// }
// }
// private checkForFunder(blueprint: DmpBlueprintDefinition) {
// let hasFunder = false;
// blueprint.sections.forEach(section => section.fields.forEach(
// field => {
// if (field.category as unknown === DmpBlueprintFieldCategory.System && field.systemFieldType === DmpBlueprintSystemFieldType.FUNDER) {
// hasFunder = true;
// }
// }
// ));
// if (!hasFunder) {
// this.formGroup.removeControl('funder');
// }
// }
// private checkForProject(blueprint: DmpBlueprintDefinition) {
// let hasProject = false;
// blueprint.sections.forEach(section => section.fields.forEach(
// field => {
// if (field.category as unknown === DmpBlueprintFieldCategory.System && field.systemFieldType === DmpBlueprintSystemFieldType.PROJECT) {
// hasProject = true;
// }
// }
// ));
// if (!hasProject) {
// this.formGroup.removeControl('project');
// }
// }
// openCloneDialog(isNewVersion: boolean) {
// const dialogRef = this.dialog.open(CloneDialogComponent, {
// maxWidth: '900px',
// maxHeight: '80vh',
// data: {
// formGroup: this.formGroup,
// descriptions: this.dmp.descriptions,
// isNewVersion: isNewVersion,
// confirmButton: this.language.instant('DMP-EDITOR.CLONE-DIALOG.SAVE'),
// cancelButton: this.language.instant('DMP-EDITOR.CLONE-DIALOG.CANCEL'),
// }
// });
// dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
// if (result) {
// if (!isNewVersion) {
// this.dmpService.clone(this.formGroup.getRawValue(), this.dmp.id)
// .pipe(takeUntil(this._destroyed))
// .subscribe(
// complete => this.onCallbackSuccess(complete),
// error => this.onCallbackError(error)
// );
// } else if (isNewVersion) {
// this.dmpService.newVersion(this.formGroup.getRawValue(), this.dmp.id)
// .pipe(takeUntil(this._destroyed))
// .subscribe(
// complete => this.onCallbackSuccess(complete),
// error => this.onCallbackError(error)
// );
// }
// }
// });
// }
// onCallbackSuccess(dmpId: String): void {
// this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
// this.router.navigate(['/plans/edit/', dmpId]);
// }
// onCallbackError(error: any) {
// this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Error);
// }
deleteClicked() {
let dialogRef: any;
if (this.dmp.descriptions && this.dmp.descriptions.length > 0) {
@ -520,38 +432,6 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
}
// private checkIfAnyProfileIsUsedLessThanMin(dmp: Dmp): Observable<boolean> {
// const blueprintId = dmp.profile.id;
// return this.dmpBlueprintService.getSingle(Guid.parse(blueprintId))
// .pipe(map(result => {
// return result.definition.sections.some(section => {
// if (!section.hasTemplates)
// return false;
// return section.descriptionTemplates.some(template => {
// if (!(template.minMultiplicity > 0))
// return false;
// let count = 0;
// dmp.descriptions.filter(description => description.dmpSectionIndex === (section.ordinal - 1)).forEach(description => {
// if (Guid.parse(description.profile.id) === template.descriptionTemplateId) {
// count++;
// }
// })
// if (count < template.minMultiplicity) {
// this.dialog.open(PopupNotificationDialogComponent, {
// data: {
// title: this.language.instant('DMP-OVERVIEW.MIN-DESCRIPTIONS-DIALOG.TITLE', { 'minMultiplicity': template.minMultiplicity }),
// message: this.language.instant('DMP-OVERVIEW.MIN-DESCRIPTIONS-DIALOG.MESSAGE',)
// }, maxWidth: '30em'
// });
// return true;
// }
// else
// return false;
// })
// })
// }), takeUntil(this._destroyed));
// }
public isAuthenticated(): boolean {
return this.authentication.currentAccountIsAuthenticated();
}
@ -630,16 +510,6 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
});
}
// updateUsers() {
// return this.dmpService.updateUsers(this.dmp.id, this.dmp.users).pipe(takeUntil(this._destroyed))
// .subscribe(
// complete => {
// this.onUpdateCallbackSuccess();
// },
// error => this.onUpdateCallbackError(error)
// );
// }
removeUserFromDmp(dmpUser: DmpUser) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
data: {
@ -714,10 +584,10 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
});
}
},
error => {
this.router.navigate(['/plans']);
this.httpErrorHandlingService.handleBackedRequestError(error);
});
error => {
this.router.navigate(['/plans']);
this.httpErrorHandlingService.handleBackedRequestError(error);
});
}
private lookupFields(): string[] {

View File

@ -229,21 +229,6 @@ export class NavbarComponent extends BaseComponent implements OnInit {
}
};
// getTitle() {
// var titlee = this.location.prepareExternalUrl(this.location.path());
// if (titlee.charAt(0) === '#') {
// titlee = titlee.slice(2);
// }
// titlee = titlee.split('/').pop();
// for (var item = 0; item < this.listTitles.length; item++) {
// if (this.listTitles[item].path === titlee) {
// return this.listTitles[item].title;
// }
// }
// return 'Dashboard';
// }
public getCurrentLanguage(): any {
const lang = this.languages.find(lang => lang.value === this.languageService.getCurrentLanguage());
return lang;

View File

@ -113,13 +113,6 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit, On
} else {
this.referenceToUse = referenceToUse;
}
// if (this.referenceToUseInitialized && (!referenceToUse.map(x => x.reference).every(x => this.referenceToUse.map(y => y.reference).includes(x)) ||
// !this.referenceToUse.map(x => x.reference).every(x => referenceToUse.map(y => y.reference).includes(x)))) {
// this.form.setValue(null, {onlySelf: true, emitEvent: false});
// }
// this.referenceToUse = referenceToUse;
// this.referenceToUseInitialized = true;
if (this.multiple) {
this.multipleAutoCompleteSearchConfiguration = this.referenceService.getMultipleAutoCompleteSearchConfiguration(this.referenceType.id, this.referenceToUse);

View File

@ -1,9 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { Component, OnInit } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { BaseComponent } from '@common/base/base.component';
import { takeUntil } from 'rxjs/operators';
@Component({
selector: 'app-splash',
@ -23,22 +22,8 @@ export class SplashComponent extends BaseComponent implements OnInit {
}
ngOnInit() {
// this.httpClient.get(this.configurationService.splashPath, {responseType: "text"})
// .pipe(takeUntil(this._destroyed)).subscribe(response => {
// const blob = new Blob([response], { type: 'text/html' });
// this.readBlob(blob);
// });
// this.splashHTML = this.sanitizer.bypassSecurityTrustHtml(`${this.configurationService.app}/${this.configurationService.splashPath}`);
}
// readBlob(blob: Blob) {
// const fr = new FileReader();
// fr.onload = ev => {
// this.splashHTML = this.sanitizer.bypassSecurityTrustHtml(fr.result as string);
// //this.parse();
// };
// fr.readAsText(blob);
// }
}
resizeFrame() {
const frame: HTMLIFrameElement = (document.getElementById('splash') as HTMLIFrameElement);
@ -46,7 +31,6 @@ export class SplashComponent extends BaseComponent implements OnInit {
}
getSplashUrl() {
// return this.sanitizer.bypassSecurityTrustHtml(this.configurationService.splashPath);
}
}

View File

@ -9,7 +9,7 @@ import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
import { SupportiveMaterialService } from '@app/core/services/supportive-material/supportive-material.service';
import { BaseComponent } from '@common/base/base.component';
import { LangChangeEvent, TranslateService } from '@ngx-translate/core';
import { interval, Subject } from 'rxjs';
import { Subject, interval } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
@Component({
@ -60,16 +60,7 @@ export class UserGuideContentComponent extends BaseComponent implements OnInit {
this.readBlob(blob);
} else {
this.guideHTMLUrl = this.sanitizer.bypassSecurityTrustResourceUrl((window.URL ? URL : webkitURL).createObjectURL(blob));
//GK: In case the app is in localhost (dev/debug build) apply the following transformation
// in order to show the user guide's images
// if (this.guideHTMLUrl && this.configurationService.app.includes('localhost')) {
// interval(1000).pipe(takeUntil(this._transformed)).subscribe(() => this.transform());
// }
}
// this.guideHTML = this.sanitizer.sanitize(SecurityContext.HTML, blob);
// this.sanitizedGuideUrl = this.sanitizer.sanitize(SecurityContext.URL, this.guideHTMLUrl);
// console.log(this.guideHTMLUrl);
});
}
@ -161,18 +152,6 @@ export class UserGuideContentComponent extends BaseComponent implements OnInit {
onIFrameLoad(iframe: HTMLIFrameElement) {
try {
// const contentDocument = iframe.contentDocument;
// const URI = contentDocument.URL;
// const refs = contentDocument.getElementsByTagName('a');
// const navLinks:HTMLAnchorElement[] = [];//only navigation links
// for(let i =0; i<refs.length;i++){
// const ref = refs[i];
// if(ref.classList.contains('nav-link')){
// navLinks.push(ref);
// }
// }
// navLinks.forEach(a=>a.href = URI+a.hash);
const images = iframe.contentWindow.document.getElementsByTagName('img');
for (let i = 0; i < images.length; i++) {
@ -181,11 +160,6 @@ export class UserGuideContentComponent extends BaseComponent implements OnInit {
tempDiv.innerHTML = currentImage.outerHTML.trim();
currentImage.src = (tempDiv.firstChild as HTMLImageElement).src;
}
// const elem = tempDiv.firstChild as HTMLImageElement;
// console.log('eleme', elem);
// firstimage.src = elem.src;
} catch {
console.warn('Could not find contentDocument');
}

View File

@ -4,27 +4,26 @@ import { Component, OnInit } from '@angular/core';
import { UntypedFormGroup } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, ParamMap, Router } from '@angular/router';
import { LockTargetType } from '@app/core/common/enum/lock-target-type';
import { ResponseErrorCode } from '@app/core/common/enum/respone-error-code';
import { AuthService } from '@app/core/services/auth/auth.service';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { LockService } from '@app/core/services/lock/lock.service';
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component';
import { BaseEntity } from '@common/base/base-entity.model';
import { BasePendingChangesComponent } from '@common/base/base-pending-changes.component';
import { FormService } from '@common/forms/form-service';
import { HttpError, HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
import { FilterService } from '@common/modules/text-filter/filter-service';
import { TranslateService } from '@ngx-translate/core';
import { interval, Observable } from 'rxjs';
import { isNullOrUndefined } from '@swimlane/ngx-datatable';
import { Observable, interval } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof';
import { Guid } from '../types/guid';
import { BaseEditorModel } from './base-form-editor-model';
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
import { LockService } from '@app/core/services/lock/lock.service';
import { LockPersist } from '@app/core/model/lock/lock.model';
import { LockTargetType } from '@app/core/common/enum/lock-target-type';
import { isNullOrUndefined } from '@swimlane/ngx-datatable';
import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component';
import { AuthService } from '@app/core/services/auth/auth.service';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { ResponseErrorCode } from '@app/core/common/enum/respone-error-code';
@Component({
selector: 'app-base-editor-component',
@ -73,13 +72,13 @@ export abstract class BaseEditor<EditorModelType extends BaseEditorModel, Entity
public ngOnInit(): void {
const entity = this.route.snapshot.data['entity'] as EntityType;
if(entity) {
if (entity) {
this.isNew = false;
this.prepareForm(entity);
if (this.formGroup && this.editorModel.belongsToCurrentTenant == false) {
this.formGroup.disable();
}
}else{
this.formGroup.disable();
}
} else {
this.prepareForm(null);
}
@ -132,7 +131,7 @@ export abstract class BaseEditor<EditorModelType extends BaseEditorModel, Entity
if (error.statusCode === 400) {
this.editorModel.validationErrorModel.fromJSONObject(errorResponse.error);
if(errorResponse.error.code === ResponseErrorCode.DmpDescriptionTemplateCanNotRemove){
if (errorResponse.error.code === ResponseErrorCode.DmpDescriptionTemplateCanNotRemove) {
this.refreshOnNavigateToData(null);
}
@ -145,20 +144,7 @@ export abstract class BaseEditor<EditorModelType extends BaseEditorModel, Entity
this.formService.validateAllFormFields(this.formGroup);
}
// private refreshOnNavigateToData(id?: Guid): void {
// if (this.isNew) {
// this.formGroup.markAsPristine();
// this.router.navigate([this.formUtilsService.getFormRoute(this.editorModel.type) + '/' + (id ? id : this.editorModel.id)]);
// } else { this.internalRefreshData(); }
// }
internalRefreshData(): void {
// setTimeout(() => {
// this.formGroup = null;
// this.editorModel = null;
// });
this.refreshData();
}
@ -221,6 +207,6 @@ export abstract class BaseEditor<EditorModelType extends BaseEditorModel, Entity
ngOnDestroy(): void {
super.ngOnDestroy();
if(this.isLockedByUser) this.unlockTarget(this.editorModel.id);
if (this.isLockedByUser) this.unlockTarget(this.editorModel.id);
}
}

View File

@ -80,14 +80,5 @@ export class FormValidationErrorsDialogComponent {
} else if (formControl.nativeElement.localName === 'app-multiple-auto-complete') {
return (Array.from(formControl.nativeElement.firstChild.firstChild.firstChild.children).filter((x: any) => x.localName === 'input')[0] as any).getAttribute('placeholder');
}
// Needs to have <mat-label> in <mat-form-field> in html in order to fill results
// let result = '';
// try {
// result = (Array.from(formControl.nativeElement.parentElement.children).filter((x: any) => Array.from(x.classList).includes('mat-form-field-label-wrapper'))[0] as any).innerText;
// result = result.replace(' *', '');
// } catch (error) { }
// return result;
}
}

View File

@ -5,7 +5,6 @@ import { JsonInterceptor } from './interceptors/json.interceptor';
import { LocaleInterceptor } from './interceptors/locale.interceptor';
import { ProgressIndicationInterceptor } from './interceptors/progress-indication.interceptor';
import { RequestTimingInterceptor } from './interceptors/request-timing.interceptor';
import { ResponsePayloadInterceptor } from './interceptors/response-payload.interceptor';
import { UnauthorizedResponseInterceptor } from './interceptors/unauthorized-response.interceptor';
import { StatusCodeInterceptor } from './interceptors/status-code.interceptor';
import { TenantHeaderInterceptor } from './interceptors/tenant-header.interceptor';
@ -51,11 +50,6 @@ import { TenantHeaderInterceptor } from './interceptors/tenant-header.intercepto
useClass: ProgressIndicationInterceptor,
multi: true,
},
{
provide: HTTP_INTERCEPTORS,
useClass: ResponsePayloadInterceptor,
multi: true,
},
{
provide: HTTP_INTERCEPTORS,
useClass: StatusCodeInterceptor,

View File

@ -1,43 +0,0 @@
import { HttpHandler, HttpHeaderResponse, HttpProgressEvent, HttpRequest, HttpResponse, HttpSentEvent, HttpUserEvent } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { MatSnackBar } from '@angular/material/snack-bar';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { BaseInterceptor } from './base.interceptor';
import { InterceptorType } from './interceptor-type';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
@Injectable()
export class ResponsePayloadInterceptor extends BaseInterceptor {
constructor(
private snackBar: MatSnackBar,
configurationService: ConfigurationService
) { super(configurationService); }
get type(): InterceptorType { return InterceptorType.ResponsePayload; }
interceptRequest(req: HttpRequest<any>, next: HttpHandler): Observable<HttpSentEvent | HttpHeaderResponse | HttpProgressEvent | HttpResponse<any> | HttpUserEvent<any>> {
return next.handle(req).pipe(
map(response => {
// if (!(response instanceof HttpResponse) || (response instanceof Blob)) { return response; }
// if (response.status == 200) {
// if (response.body.statusCode === ApiMessageCode.SUCCESS_MESSAGE) {
// //throw new Error('Request failed');
// // this.snackBar.openFromComponent(SnackBarNotificationComponent, {
// // data: { message: response['message'], language: null },
// // duration: 3000,
// // });
// return response.body.payload;
// } else if (response.body.statusCode === ApiMessageCode.NO_MESSAGE) {
// return response.body.payload;
// } else {
// return response.body.payload;
// }
// }
return response;
}));
}
}

View File

@ -111,24 +111,7 @@ export class UserSettingsPickerComponent extends BaseComponent implements OnInit
}
renameCurrentUserSetting(): void {
// this.dialog.open<FilterNameDialogComponent, FilterNameDialogComponentParams, FilterNameDialogComponentReturn>(
// FilterNameDialogComponent,
// {
// maxWidth: '600px',
// maxHeight: '400px',
// restoreFocus: false,
// data: { name: this.currentUserSetting.name},
// disableClose: false
// }
// ).afterClosed()
// .pipe(
// filter(x => !!x),
// takeUntil(this._destroyed)
// )
// .subscribe(newName => {
// this.currentUserSetting.name = newName;
// this.persistLookupChangesManually(this.currentUserSetting, true);
// })
}
settingDeleted(value: Guid = this.currentUserSetting.id) {
@ -149,21 +132,10 @@ export class UserSettingsPickerComponent extends BaseComponent implements OnInit
}
});
}
/* this.userSettingsService.remove(this.currentUserSetting.id, this.key); */
}
saveFilter() {
// const saveDialogRef = this.dialog.open(FilterNameDialogComponent, {
// maxWidth: '600px',
// maxHeight: '400px',
// restoreFocus: false,
// data: { name: this.currentUserSetting ? this.currentUserSetting.name : '' },
// disableClose: false
// });
// saveDialogRef.afterClosed().subscribe(result => {
// if (result) { this.createNewFilter(result); }
// });
//TODO: implement
}

View File

@ -1,12 +1,12 @@
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { UserSetting, UserSettingsService } from '@app/core/services/user-settings/user-settings.service';
import { BaseComponent } from '@common/base/base.component';
import { Lookup } from '@common/model/lookup';
import { takeUntil, filter } from 'rxjs/operators';
import { TranslateService } from '@ngx-translate/core';
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
import { TranslateService } from '@ngx-translate/core';
import { isNullOrUndefined } from '@swimlane/ngx-datatable';
import { UserSetting, UserSettingsService } from '@app/core/services/user-settings/user-settings.service';
import { takeUntil } from 'rxjs/operators';
@Component({
selector: 'app-user-settings-selector',
@ -87,7 +87,6 @@ export class UserSettingsSelectorComponent extends BaseComponent implements OnIn
if (setting === null) { return; }
//Persist the active user setting
//this.onSettingSelected.emit(setting.value);
this.userSettingsService.set(setting, true, this.key);
}
@ -109,21 +108,10 @@ export class UserSettingsSelectorComponent extends BaseComponent implements OnIn
}
});
}
/* this.userSettingsService.remove(this.currentUserSetting.id, this.key); */
}
saveFilter() {
// const saveDialogRef = this.dialog.open(FilterNameDialogComponent, {
// maxWidth: '600px',
// maxHeight: '400px',
// restoreFocus: false,
// data: { name: this.currentUserSetting ? this.currentUserSetting.name : '' },
// disableClose: false
// });
// saveDialogRef.afterClosed().subscribe(result => {
// if (result) { this.createNewFilter(result); }
// });
//TODO: implement
}
updateFilter() {

View File

@ -1,23 +1,22 @@
import { HttpErrorResponse } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, ParamMap, Router } from '@angular/router';
import { IsActive } from '@app/core/common/enum/is-active.enum';
import { AuthService } from '@app/core/services/auth/auth.service';
import { LoggingService } from '@app/core/services/logging/logging-service';
import { UiNotificationService } from '@app/core/services/notification/ui-notification-service';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { BaseComponent } from '@common/base/base.component';
import { FormService } from '@common/forms/form-service';
import { LoggingService } from '@app/core/services/logging/logging-service';
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
import { HttpError, HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
import { Guid } from '@common/types/guid';
import { TranslateService } from '@ngx-translate/core';
import { IsActive } from '@app/core/common/enum/is-active.enum';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { map, takeUntil } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof';
import { AuthService } from '@app/core/services/auth/auth.service';
import { InAppNotificationService } from '@notification-service/services/http/inapp-notification.service';
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
import { NotificationInAppTracking } from '@notification-service/core/enum/notification-inapp-tracking.enum';
import { InAppNotification } from '@notification-service/core/model/inapp-notification.model';
import { InAppNotificationService } from '@notification-service/services/http/inapp-notification.service';
import { map, takeUntil } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof';
@Component({
selector: 'app-inapp-notification-editor',
@ -72,7 +71,7 @@ export class InAppNotificationEditorComponent extends BaseComponent implements O
this.isDeleted = this.inappNotification.isActive === IsActive.Inactive;
this.isRead = this.inappNotification.trackingState === NotificationInAppTracking.Delivered;
if(!this.isDeleted && !this.isRead) this.markAsRead()
if (!this.isDeleted && !this.isRead) this.markAsRead()
},
error => this.httpErrorHandlingService.handleBackedRequestError(error)
);
@ -89,7 +88,6 @@ export class InAppNotificationEditorComponent extends BaseComponent implements O
complete => this.onCallbackSuccess(),
error => this.httpErrorHandlingService.handleBackedRequestError(error)
);
// this.clearErrorModel();
}
public delete() {

View File

@ -2,8 +2,6 @@ import { DragDropModule } from '@angular/cdk/drag-drop';
import { NgModule } from '@angular/core';
import { CommonFormsModule } from '@common/forms/common-forms.module';
import { CommonUiModule } from '@common/ui/common-ui.module';
import { CoreNotificationServiceModule } from '@notification-service/services/core-service.module';
// import { TotpModule } from '@idp-service/ui/totp/totp.module';
import { UserProfileNotifierListEditorComponent } from '@notification-service/ui/user-profile/notifier-list/user-profile-notifier-list-editor.component';
@NgModule({

View File

@ -149,21 +149,6 @@ $mat-dark-theme: mat.m2-define-dark-theme((color: (primary: $mat-dark-theme-prim
filter: alpha(opacity=20);
}
// Custom Theme
// @import "./assets/scss/blue-theme.scss";
// Define a theme.
// $primary: mat-palette($app-blue-theme-primary-palette);
// $accent: mat-palette($mat-pink, A200, A100, A400);
// $theme: mat-light-theme($primary, $accent);
// Include all theme styles for the components.
// @include angular-material-theme($theme);
// @include covalent-theme($theme);
.cc-btn {
background-color: var(--primary-color-3) !important;
}
@ -186,7 +171,6 @@ $mat-dark-theme: mat.m2-define-dark-theme((color: (primary: $mat-dark-theme-prim
.lightblue-btn {
background-color: var(--primary-color) !important;
color: white !important;
// background-color: rgba(0, 112, 192, 1) !important;
}
.listing-item {
@ -211,7 +195,6 @@ $mat-dark-theme: mat.m2-define-dark-theme((color: (primary: $mat-dark-theme-prim
padding: 0.1em 1em;
border-radius: 10em;
background-color: #0d7489;
// background-color: rgba(0, 112, 192, 1);
color: #fff;
text-transform: uppercase;
font-weight: 500;
@ -227,8 +210,6 @@ $mat-dark-theme: mat.m2-define-dark-theme((color: (primary: $mat-dark-theme-prim
border-radius: 10em;
background-color: rgb(236, 241, 249);
color: var(--primary-color);
// color: rgba(0, 112, 192, 1);
// color: rgb(68, 114, 196);
text-transform: uppercase;
font-weight: 500;
max-width: 160px;
@ -274,21 +255,6 @@ $mat-dark-theme: mat.m2-define-dark-theme((color: (primary: $mat-dark-theme-prim
margin-bottom: 0px;
}
// .draft-bookmark {
// color: #e7e6e6;
// display: inline;
// position: absolute;
// padding-top: 3px;
// }
// .finalized-bookmark {
// color: #08bd63;
// // color: #92d050;
// display: inline;
// position: absolute;
// padding-top: 3px;
// }
h4 span {
color: #089dbb;
font-weight: 600;
@ -387,43 +353,6 @@ $mat-dark-theme: mat.m2-define-dark-theme((color: (primary: $mat-dark-theme-prim
margin-top: 8px;
}
//.angular-editor-textarea {
// min-height: 150px !important;
//}
//
//.editor-wrapper {
// border: 1px solid transparent !important;
// border-radius: 5px;
//}
//
//.angular-editor-toolbar {
// margin-left: 1px;
// margin-right: 1px;
//}
//
//.angular-editor-textarea, .angular-editor-toolbar {
// border: none !important;
//}
//
//.angular-editor {
// border: 1px solid #ddd !important;
// border-radius: 5px;
// background-color: #fff;
//}
//
//.editor-wrapper:hover, .angular-editor:hover {
// border: 1px solid #000 !important;
//}
//
//.editor-wrapper:focus-within, .angular-editor:focus-within {
// border: 1px solid #034459 !important;
//}
//
//.required.editor-wrapper, .required .editor .angular-editor {
// border: 1px solid #f44336 !important;
//}
// end of CSS for <angular-editor> (@kolkov/angular-editor)
/* Transition Group */
.list-move {
transition: transform 1s;