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> {
//TODO: implement
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)));
}
exportDescription(id: Guid, repositoryId: string, format: string): Observable<any> {
//TODO: implement
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)));
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -113,7 +113,6 @@ export class AnnotationDialogComponent extends BaseComponent {
}
replyThread(threadId: Guid) {
// if (!this.threadReplyTexts[threadId.toString()] || this.threadReplyTexts[threadId.toString()].length === 0) { return; }
this.formService.removeAllBackEndErrors(this.threadReplyTextsFG[threadId.toString()]);
this.formService.touchAllFormFields(this.threadReplyTextsFG[threadId.toString()]);
if (!this.isFormValid(this.threadReplyTextsFG[threadId.toString()])) {
@ -178,7 +177,6 @@ export class AnnotationDialogComponent extends BaseComponent {
this.resetFormGroup();
this.comments = data.items.sort((a1, a2) => new Date(a2.timeStamp).getTime() - new Date(a1.timeStamp).getTime());
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.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];
@ -257,11 +255,6 @@ export class AnnotationDialogComponent extends BaseComponent {
this.dialogRef.close(this.changesMade);
}
startWizard() { // not used
this.router.navigate([this.routerUtils.generateUrl('/plans/new')]);
this.close();
}
showReplies(threadId: string): void {
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 { AuthGuard } from '@app/core/auth-guard.service';
import { UserInviteConfirmation } from './user-invite-confirmation/user-invite-confirmation.component';
// import { PostLoginComponent } from './post-login/post-login.component';
const routes: Routes = [
{ path: '', component: LoginComponent },
@ -14,10 +13,6 @@ const routes: Routes = [
component: MergeEmailConfirmation,
canActivate: [AuthGuard]
},
// {
// path: 'post',
// component: PostLoginComponent
// },
{ path: 'unlink/confirmation/:token', component: UnlinkEmailConfirmation },
{ path: 'invitation/confirmation/:token', component: UserInviteConfirmation },

View File

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

View File

@ -31,7 +31,7 @@ export class DescriptionCopyDialogComponent {
sections: PlanBlueprintDefinitionSection[] = [];
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)),
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])),

View File

@ -501,7 +501,6 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
const errors: string[] = [];
Object.keys(formControl.errors).forEach(key => {
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')));
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() {
return this.formGroup.dirty; //TODO: check if needed //&& this.hasChanges; // do we need this.formGroup.dirty
return this.formGroup.dirty;
}
isPristine() {
@ -697,7 +696,6 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
if (section.sections) {
const subNestedSectionIds: string[] = section.sections.flatMap((subsection: DescriptionTemplateSection) => this.getNestedSectionIdsByField(subsection, fieldSetId))
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];

View File

@ -241,7 +241,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
let messages: string[] = [];
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;
} else {
let fileToUpload = this.filesToUpload[0];
@ -253,9 +253,9 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
this.upload();
} else {
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.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.ACCEPTED-FILE-TRANSFOMER') + data.types.map(type => type.value).join(", ")); // 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 }));
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) {

View File

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

View File

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

View File

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

View File

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