frontend code clean up

This commit is contained in:
amentis 2024-07-11 12:57:25 +03:00
parent c2343defab
commit 5e551cd4ef
16 changed files with 7 additions and 38 deletions

View File

@ -26,13 +26,11 @@ export class FileTransformerHttpService extends BaseService {
} }
exportPlan(planId: Guid, repositoryId: string, format: string): Observable<any> { exportPlan(planId: Guid, repositoryId: string, format: string): Observable<any> {
//TODO: implement
const url = `${this.apiBase}/export-plan`; const url = `${this.apiBase}/export-plan`;
return this.http.post<any>(url, {id: planId, repositoryId: repositoryId, format: format}, {responseType: 'blob', observe: 'response'}).pipe(catchError((error: any) => throwError(error))); return this.http.post<any>(url, {id: planId, repositoryId: repositoryId, format: format}, {responseType: 'blob', observe: 'response'}).pipe(catchError((error: any) => throwError(error)));
} }
exportDescription(id: Guid, repositoryId: string, format: string): Observable<any> { exportDescription(id: Guid, repositoryId: string, format: string): Observable<any> {
//TODO: implement
const url = `${this.apiBase}/export-description`; const url = `${this.apiBase}/export-description`;
return this.http.post<any>(url, {id: id, repositoryId: repositoryId, format: format}, {responseType: 'blob', observe: 'response'}).pipe(catchError((error: any) => throwError(error))); return this.http.post<any>(url, {id: id, repositoryId: repositoryId, format: format}, {responseType: 'blob', observe: 'response'}).pipe(catchError((error: any) => throwError(error)));
} }

View File

@ -138,8 +138,7 @@ export class DescriptionTemplateEditorSectionFieldSetComponent implements OnInit
this._selectedFieldSetId = this.tocentry.id; this._selectedFieldSetId = this.tocentry.id;
this.scroller.next(this.tocentry.id); this.scroller.next(this.tocentry.id);
} else {//scroll on top } else {
// this._scrollOnTop();
this.scroller.next(null); this.scroller.next(null);
} }
} }

View File

@ -33,7 +33,6 @@ export class LanguageListingComponent extends BaseListingComponent<Language, Lan
userSettingsKey = { key: 'LanguageListingUserSettings' }; userSettingsKey = { key: 'LanguageListingUserSettings' };
propertiesAvailableForOrder: ColumnDefinition[]; propertiesAvailableForOrder: ColumnDefinition[];
// @ViewChild('LanguageStatus', { static: true }) LanguageStatus?: TemplateRef<any>;
@ViewChild('actions', { static: true }) actions?: TemplateRef<any>; @ViewChild('actions', { static: true }) actions?: TemplateRef<any>;
@ViewChild(HybridListingComponent, { static: true }) hybridListingComponent: HybridListingComponent; @ViewChild(HybridListingComponent, { static: true }) hybridListingComponent: HybridListingComponent;

View File

@ -33,7 +33,6 @@ export class PrefillingSourceListingComponent extends BaseListingComponent<Prefi
userSettingsKey = { key: 'PrefillingSourceListingUserSettings' }; userSettingsKey = { key: 'PrefillingSourceListingUserSettings' };
propertiesAvailableForOrder: ColumnDefinition[]; propertiesAvailableForOrder: ColumnDefinition[];
// @ViewChild('PrefillingSourceStatus', { static: true }) PrefillingSourceStatus?: TemplateRef<any>;
@ViewChild('actions', { static: true }) actions?: TemplateRef<any>; @ViewChild('actions', { static: true }) actions?: TemplateRef<any>;
@ViewChild(HybridListingComponent, { static: true }) hybridListingComponent: HybridListingComponent; @ViewChild(HybridListingComponent, { static: true }) hybridListingComponent: HybridListingComponent;

View File

@ -32,9 +32,7 @@ export class ReferenceTypeListingComponent extends BaseListingComponent<Referenc
publish = false; publish = false;
userSettingsKey = { key: 'ReferenceTypeListingUserSettings' }; userSettingsKey = { key: 'ReferenceTypeListingUserSettings' };
propertiesAvailableForOrder: ColumnDefinition[]; propertiesAvailableForOrder: ColumnDefinition[];
//ReferenceTypeStatuses = ReferenceTypeStatus;
//@ViewChild('ReferenceTypeStatus', { static: true }) ReferenceTypeStatus?: TemplateRef<any>;
@ViewChild('actions', { static: true }) actions?: TemplateRef<any>; @ViewChild('actions', { static: true }) actions?: TemplateRef<any>;
@ViewChild(HybridListingComponent, { static: true }) hybridListingComponent: HybridListingComponent; @ViewChild(HybridListingComponent, { static: true }) hybridListingComponent: HybridListingComponent;

View File

@ -33,7 +33,6 @@ export class TenantListingComponent extends BaseListingComponent<Tenant, TenantL
userSettingsKey = { key: 'TenantListingUserSettings' }; userSettingsKey = { key: 'TenantListingUserSettings' };
propertiesAvailableForOrder: ColumnDefinition[]; propertiesAvailableForOrder: ColumnDefinition[];
// @ViewChild('TenantStatus', { static: true }) TenantStatus?: TemplateRef<any>;
@ViewChild('actions', { static: true }) actions?: TemplateRef<any>; @ViewChild('actions', { static: true }) actions?: TemplateRef<any>;
@ViewChild(HybridListingComponent, { static: true }) hybridListingComponent: HybridListingComponent; @ViewChild(HybridListingComponent, { static: true }) hybridListingComponent: HybridListingComponent;

View File

@ -113,7 +113,6 @@ export class AnnotationDialogComponent extends BaseComponent {
} }
replyThread(threadId: Guid) { replyThread(threadId: Guid) {
// if (!this.threadReplyTexts[threadId.toString()] || this.threadReplyTexts[threadId.toString()].length === 0) { return; }
this.formService.removeAllBackEndErrors(this.threadReplyTextsFG[threadId.toString()]); this.formService.removeAllBackEndErrors(this.threadReplyTextsFG[threadId.toString()]);
this.formService.touchAllFormFields(this.threadReplyTextsFG[threadId.toString()]); this.formService.touchAllFormFields(this.threadReplyTextsFG[threadId.toString()]);
if (!this.isFormValid(this.threadReplyTextsFG[threadId.toString()])) { if (!this.isFormValid(this.threadReplyTextsFG[threadId.toString()])) {
@ -178,7 +177,6 @@ export class AnnotationDialogComponent extends BaseComponent {
this.resetFormGroup(); this.resetFormGroup();
this.comments = data.items.sort((a1, a2) => new Date(a2.timeStamp).getTime() - new Date(a1.timeStamp).getTime()); this.comments = data.items.sort((a1, a2) => new Date(a2.timeStamp).getTime() - new Date(a1.timeStamp).getTime());
this.comments.forEach(element => { this.comments.forEach(element => {
// this.threadReplyTextsFG.addControl(element.id.toString(), new FormControl(null));
this.threadReplyTextsFG[element.threadId.toString()] = this.formBuilder.group({ replyText: new FormControl(null, [Validators.required]) }); this.threadReplyTextsFG[element.threadId.toString()] = this.formBuilder.group({ replyText: new FormControl(null, [Validators.required]) });
this.annotationsPerThread[element.threadId.toString()] = data.items.filter(x => x.threadId === element.threadId && x.id !== element.id).sort((a1, a2) => new Date(a1.timeStamp).getTime() - new Date(a2.timeStamp).getTime()); this.annotationsPerThread[element.threadId.toString()] = data.items.filter(x => x.threadId === element.threadId && x.id !== element.id).sort((a1, a2) => new Date(a1.timeStamp).getTime() - new Date(a2.timeStamp).getTime());
this.parentAnnotationsPerThread[element.threadId.toString()] = data.items.filter(x => x.threadId === element.threadId && x.id === element.id)[0]; this.parentAnnotationsPerThread[element.threadId.toString()] = data.items.filter(x => x.threadId === element.threadId && x.id === element.id)[0];
@ -257,11 +255,6 @@ export class AnnotationDialogComponent extends BaseComponent {
this.dialogRef.close(this.changesMade); this.dialogRef.close(this.changesMade);
} }
startWizard() { // not used
this.router.navigate([this.routerUtils.generateUrl('/plans/new')]);
this.close();
}
showReplies(threadId: string): void { showReplies(threadId: string): void {
this.showRepliesPerThread[threadId] = true; this.showRepliesPerThread[threadId] = true;
} }

View File

@ -5,7 +5,6 @@ import { MergeEmailConfirmation } from './merge-email-confirmation/merge-email-c
import { UnlinkEmailConfirmation } from './unlink-email-confirmation/unlink-email-confirmation.component'; import { UnlinkEmailConfirmation } from './unlink-email-confirmation/unlink-email-confirmation.component';
import { AuthGuard } from '@app/core/auth-guard.service'; import { AuthGuard } from '@app/core/auth-guard.service';
import { UserInviteConfirmation } from './user-invite-confirmation/user-invite-confirmation.component'; import { UserInviteConfirmation } from './user-invite-confirmation/user-invite-confirmation.component';
// import { PostLoginComponent } from './post-login/post-login.component';
const routes: Routes = [ const routes: Routes = [
{ path: '', component: LoginComponent }, { path: '', component: LoginComponent },
@ -14,10 +13,6 @@ const routes: Routes = [
component: MergeEmailConfirmation, component: MergeEmailConfirmation,
canActivate: [AuthGuard] canActivate: [AuthGuard]
}, },
// {
// path: 'post',
// component: PostLoginComponent
// },
{ path: 'unlink/confirmation/:token', component: UnlinkEmailConfirmation }, { path: 'unlink/confirmation/:token', component: UnlinkEmailConfirmation },
{ path: 'invitation/confirmation/:token', component: UserInviteConfirmation }, { path: 'invitation/confirmation/:token', component: UserInviteConfirmation },

View File

@ -16,7 +16,6 @@ export class LogoutComponent implements OnInit {
this.authService.clear(); this.authService.clear();
this.keycloak.logout(location.origin).then(() => { this.keycloak.logout(location.origin).then(() => {
localStorage.clear(); localStorage.clear();
// this.router.navigate(['./'], { replaceUrl: true });
}); });
} }
} }

View File

@ -31,7 +31,7 @@ export class DescriptionCopyDialogComponent {
sections: PlanBlueprintDefinitionSection[] = []; sections: PlanBlueprintDefinitionSection[] = [];
descriptionDescriptionTemplateLabel: String; descriptionDescriptionTemplateLabel: String;
planAutoCompleteConfiguration: SingleAutoCompleteConfiguration = { //TODO: add filter to only get plans that have connection with the same Description Template group. planAutoCompleteConfiguration: SingleAutoCompleteConfiguration = {
initialItems: (data?: any) => this.planService.query(this.buildPlanLookup(null,null,null, this.planDescriptionTemplateLookup)).pipe(map(x => x.items)), initialItems: (data?: any) => this.planService.query(this.buildPlanLookup(null,null,null, this.planDescriptionTemplateLookup)).pipe(map(x => x.items)),
filterFn: (searchQuery: string, data?: any) => this.planService.query(this.buildPlanLookup(searchQuery, null, null, this.planDescriptionTemplateLookup)).pipe(map(x => x.items)), filterFn: (searchQuery: string, data?: any) => this.planService.query(this.buildPlanLookup(searchQuery, null, null, this.planDescriptionTemplateLookup)).pipe(map(x => x.items)),
getSelectedItem: (selectedItem: any) => this.planService.query(this.buildPlanLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])), getSelectedItem: (selectedItem: any) => this.planService.query(this.buildPlanLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])),

View File

@ -501,7 +501,6 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
const errors: string[] = []; const errors: string[] = [];
Object.keys(formControl.errors).forEach(key => { Object.keys(formControl.errors).forEach(key => {
if (key === 'required') { if (key === 'required') {
// errors.push(this.language.instant(name + ": " + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.REQUIRED')));
if (name == 'label') errors.push(this.language.instant(this.language.instant('DESCRIPTION-EDITOR.BASE-INFO.FIELDS.TITLE') + ": " + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.REQUIRED'))); if (name == 'label') errors.push(this.language.instant(this.language.instant('DESCRIPTION-EDITOR.BASE-INFO.FIELDS.TITLE') + ": " + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.REQUIRED')));
else if (name == 'descriptionTemplateId') errors.push(this.language.instant(this.language.instant('DESCRIPTION-EDITOR.BASE-INFO.FIELDS.DESCRIPTION-TEMPLATE') + ": " + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.REQUIRED'))); else if (name == 'descriptionTemplateId') errors.push(this.language.instant(this.language.instant('DESCRIPTION-EDITOR.BASE-INFO.FIELDS.DESCRIPTION-TEMPLATE') + ": " + this.language.instant('GENERAL.FORM-VALIDATION-DISPLAY-DIALOG.REQUIRED')));
} }
@ -539,7 +538,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
// //
isDirty() { isDirty() {
return this.formGroup.dirty; //TODO: check if needed //&& this.hasChanges; // do we need this.formGroup.dirty return this.formGroup.dirty;
} }
isPristine() { isPristine() {
@ -697,7 +696,6 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
if (section.sections) { if (section.sections) {
const subNestedSectionIds: string[] = section.sections.flatMap((subsection: DescriptionTemplateSection) => this.getNestedSectionIdsByField(subsection, fieldSetId)) const subNestedSectionIds: string[] = section.sections.flatMap((subsection: DescriptionTemplateSection) => this.getNestedSectionIdsByField(subsection, fieldSetId))
if (subNestedSectionIds.length > 0) return [section.id, ...subNestedSectionIds]; if (subNestedSectionIds.length > 0) return [section.id, ...subNestedSectionIds];
// return [section.id, ...section.sections.flatMap((subsection: DescriptionTemplateSection) => this.getNestedSectionIdsByField(subsection, fieldSetId))];
} }
else if (section.fieldSets.find(fieldSet => fieldSet.id == fieldSetId)) return [section.id]; else if (section.fieldSets.find(fieldSet => fieldSet.id == fieldSetId)) return [section.id];

View File

@ -241,7 +241,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
let messages: string[] = []; let messages: string[] = [];
if (this.filesToUpload.length == 0) { if (this.filesToUpload.length == 0) {
messages.push(this.language.instant('DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.NO-FILES-SELECTED')); // fix messages.push(this.language.instant('DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.NO-FILES-SELECTED'));
return; return;
} else { } else {
let fileToUpload = this.filesToUpload[0]; let fileToUpload = this.filesToUpload[0];
@ -253,9 +253,9 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
this.upload(); this.upload();
} else { } else {
this.filesToUpload = null; this.filesToUpload = null;
messages.push(this.language.instant('DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.LARGE-FILE-OR-UNACCEPTED-TYPE')); // fix messages.push(this.language.instant('DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.LARGE-FILE-OR-UNACCEPTED-TYPE'));
messages.push(this.language.instant('DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-UPLOAD-MAX-FILE-SIZE', { 'maxfilesize': data.maxFileSizeInMB })); // fix FIELD-UPLOAD-MAX-FILE-SIZE messages.push(this.language.instant('DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-UPLOAD-MAX-FILE-SIZE', { 'maxfilesize': data.maxFileSizeInMB }));
messages.push(this.language.instant('DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.ACCEPTED-FILE-TRANSFOMER') + data.types.map(type => type.value).join(", ")); // fix messages.push(this.language.instant('DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.ACCEPTED-FILE-TRANSFOMER') + data.types.map(type => type.value).join(", "));
} }
if (messages && messages.length > 0) { if (messages && messages.length > 0) {

View File

@ -27,10 +27,6 @@ export class DescriptionFormSectionComponent extends BaseComponent implements On
@Input() path: string; @Input() path: string;
@Input() descriptionId: Guid; @Input() descriptionId: Guid;
@Input() planUsers: PlanUser[] = []; @Input() planUsers: PlanUser[] = [];
// @Input() descriptionTemplateId: String;
// @Input() form: UntypedFormGroup;
@Input() tocentry: ToCEntry; @Input() tocentry: ToCEntry;
@Input() pathName: string; @Input() pathName: string;
@Input() linkToScroll: LinkToScroll; @Input() linkToScroll: LinkToScroll;

View File

@ -7,7 +7,6 @@ const routes: Routes = [
{ {
path: '', path: '',
component: DescriptionListingComponent, component: DescriptionListingComponent,
// canActivate: [AuthGuard],
data: { data: {
breadcrumb: true breadcrumb: true
}, },

View File

@ -134,8 +134,6 @@ export class DescriptionListingItemComponent extends BaseComponent implements On
openShareDialog() { openShareDialog() {
// TODO: This is a shared component. Put it in a seperate module. // TODO: This is a shared component. Put it in a seperate module.
const dialogRef = this.dialog.open(PlanInvitationDialogComponent, { const dialogRef = this.dialog.open(PlanInvitationDialogComponent, {
// height: '250px',
// width: '700px',
autoFocus: false, autoFocus: false,
restoreFocus: false, restoreFocus: false,
data: { data: {

View File

@ -6,7 +6,6 @@ const routes: Routes = [
{ {
path: '', path: '',
component: PlanListingComponent, component: PlanListingComponent,
// canActivate: [AuthGuard],
data: { data: {
breadcrumb: true breadcrumb: true
}, },