frontend code clean up

This commit is contained in:
amentis 2024-07-11 14:51:33 +03:00
parent d7277e990c
commit 81092adc13
13 changed files with 1 additions and 50 deletions

View File

@ -350,10 +350,7 @@ export class AuthService extends BaseService {
onAuthenticateError(errorResponse: HttpErrorResponse) { onAuthenticateError(errorResponse: HttpErrorResponse) {
this.zone.run(() => { this.zone.run(() => {
// const error: HttpError =
// this.httpErrorHandlingService.getError(errorResponse);
this.uiNotificationService.snackBarNotification( this.uiNotificationService.snackBarNotification(
// error.getMessagesString(),
errorResponse.message, errorResponse.message,
SnackBarNotificationLevel.Warning SnackBarNotificationLevel.Warning
); );

View File

@ -11,8 +11,6 @@ export class QueryParamsService {
serializeLookup(lookup: Lookup): string { serializeLookup(lookup: Lookup): string {
return JSON.stringify(lookup, (key: string, value: any) => { return JSON.stringify(lookup, (key: string, value: any) => {
switch (key) { switch (key) {
// case nameof<Lookup>(x => x.page):
// case nameof<Lookup>(x => x.order):
case nameof<Lookup>(x => x.metadata): case nameof<Lookup>(x => x.metadata):
case nameof<Lookup>(x => x.project): case nameof<Lookup>(x => x.project):
return undefined; return undefined;
@ -24,8 +22,6 @@ export class QueryParamsService {
deSerializeLookup(serializedLookup: string): any { deSerializeLookup(serializedLookup: string): any {
const json = JSON.parse(serializedLookup); const json = JSON.parse(serializedLookup);
// delete json[nameof<Lookup>(x => x.page)];
// delete json[nameof<Lookup>(x => x.order)];
delete json[nameof<Lookup>(x => x.metadata)]; delete json[nameof<Lookup>(x => x.metadata)];
delete json[nameof<Lookup>(x => x.project)]; delete json[nameof<Lookup>(x => x.project)];
return json; return json;

View File

@ -67,8 +67,6 @@ export class MultipleAutoCompleteComponent extends _CustomComponentMixinBase imp
valueOnBlur = new BehaviorSubject<any>(null); valueOnBlur = new BehaviorSubject<any>(null);
onSelectAutoCompleteValue = new BehaviorSubject<any>(null); onSelectAutoCompleteValue = new BehaviorSubject<any>(null);
// valueAssignSubscription: Subscription;
queryValue: string = ""; queryValue: string = "";
focused = false; focused = false;
@ -406,16 +404,9 @@ export class MultipleAutoCompleteComponent extends _CustomComponentMixinBase imp
//Chip Functions //Chip Functions
_addItem(event: MatChipInputEvent): void { _addItem(event: MatChipInputEvent): void {
const input = event.input; const input = event.input;
const value = event.value;
// Add our fruit
// if ((value || '').trim()) {
// this.selectedItems.push(value.trim());
// }
// Reset the input value
if (input) { if (input) {
this.inputValue = ''; this.inputValue = '';
} }
//this.inputFormControl.setValue(null);
} }
public reset(): void { public reset(): void {
this._inputSubject.unsubscribe(); this._inputSubject.unsubscribe();

View File

@ -337,8 +337,6 @@ export class GuidedTourComponent implements AfterViewInit, OnDestroy {
public get overlayTop(): number { public get overlayTop(): number {
if (this.selectedElementRect) { if (this.selectedElementRect) {
// return this.selectedElementRect.top - this.getHighlightPadding();
/*custom add*/ /*custom add*/
let customTopOffset = 0; let customTopOffset = 0;
if (this.currentTourStep.customTopOffset) { if (this.currentTourStep.customTopOffset) {

View File

@ -12,10 +12,6 @@ import { Subscription } from "rxjs";
placeholder="{{(placeholder? (placeholder | translate) : '') + (required ? ' *': '')}}" placeholder="{{(placeholder? (placeholder | translate) : '') + (required ? ' *': '')}}"
(paste)="pasteWithoutFormatting($event)"></angular-editor> (paste)="pasteWithoutFormatting($event)"></angular-editor>
<mat-icon *ngIf="form.value && editable" (click)="parentFormGroup.get(controlName).patchValue('')" class="clear">close</mat-icon> <mat-icon *ngIf="form.value && editable" (click)="parentFormGroup.get(controlName).patchValue('')" class="clear">close</mat-icon>
<!-- <mat-form-field class="full-width editor">
<mat-label>{{(placeholder? (placeholder | translate) : '')}}</mat-label>
<textarea matInput [formControl]="form" rows="5"></textarea>
</mat-form-field> -->
</div> </div>
`, `,
styleUrls: ['./rich-text-editor.component.scss'], styleUrls: ['./rich-text-editor.component.scss'],
@ -68,10 +64,8 @@ export class RichTextEditorComponent implements OnInit, OnChanges, OnDestroy {
[ [
'fontSize', 'fontSize',
'backgroundColor', 'backgroundColor',
// 'customClasses',
'insertImage', 'insertImage',
'insertVideo', 'insertVideo',
// 'removeFormat',
'toggleEditorMode' 'toggleEditorMode'
], ],
[ [

View File

@ -212,10 +212,6 @@ export class DescriptionTemplateEditorFieldComponent extends BaseComponent imple
} }
this.clearVisibilityRulesValue(); this.clearVisibilityRulesValue();
// setTimeout(() => { //TODO
// this.showPreview = true;
// });
} }

View File

@ -382,8 +382,6 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
if (event.selectedIndex === (this.steps.length - 1)) {//preview selected if (event.selectedIndex === (this.steps.length - 1)) {//preview selected
this.generatePreviewForm(); this.generatePreviewForm();
} else {
// this.formGroup = null;
} }
this.formGroup.markAsUntouched(); this.formGroup.markAsUntouched();

View File

@ -7,7 +7,6 @@ export interface ToCEntry {
subEntriesType: ToCEntryType; subEntriesType: ToCEntryType;
subEntries: ToCEntry[]; subEntries: ToCEntry[];
type: ToCEntryType; type: ToCEntryType;
// form: AbstractControl;
numbering: string; numbering: string;
ordinal: number; ordinal: number;
hidden?: boolean; hidden?: boolean;

View File

@ -222,7 +222,6 @@ export class TableOfContentsComponent extends BaseComponent implements OnInit, O
}); });
} }
return { return {
// form: form,
id: item.id, id: item.id,
label: item.title, label: item.title,
numbering: '', numbering: '',
@ -239,7 +238,6 @@ export class TableOfContentsComponent extends BaseComponent implements OnInit, O
if (!item) return null; if (!item) return null;
return { return {
// form: form,
id: item.id, id: item.id,
label: item.title, label: item.title,
numbering: 's', numbering: 's',

View File

@ -85,11 +85,9 @@ export class DescriptionListingItemComponent extends BaseComponent implements On
} else if (this.description.status === DescriptionStatus.Draft) { } else if (this.description.status === DescriptionStatus.Draft) {
this.isDraft = true; this.isDraft = true;
this.isDeleted = false; this.isDeleted = false;
this.setIsUserOwner();
} else { } else {
this.isDraft = false; this.isDraft = false;
this.isDeleted = false; this.isDeleted = false;
this.setIsUserOwner();
} }
this.canDelete = (this.authService.hasPermission(AppPermission.DeleteDescription) || this.canDelete = (this.authService.hasPermission(AppPermission.DeleteDescription) ||
@ -106,14 +104,6 @@ export class DescriptionListingItemComponent extends BaseComponent implements On
return this.tenants?.find(t => t?.id == id)?.name; return this.tenants?.find(t => t?.id == id)?.name;
} }
setIsUserOwner() {
if (this.description) {
const principalId: string = this.authService.userId()?.toString();
//TODO: add user to description objects
//if (principalId) this.isUserOwner = !!this.description.users.find(x => (x.role === Role.Owner) && (principalId === x.id));
}
}
isUserPlanRelated() { isUserPlanRelated() {
const principalId: Guid = this.authService.userId(); const principalId: Guid = this.authService.userId();
return this.description.plan.planUsers?.some(x => (x.user.id === principalId)); return this.description.plan.planUsers?.some(x => (x.user.id === principalId));

View File

@ -273,10 +273,6 @@ export class PlanListingComponent extends BaseListingComponent<BasePlan, PlanLoo
this.filterChanged(this.lookup, true); this.filterChanged(this.lookup, true);
} }
openShareDialog(rowId: any, rowName: any) {
//TODO: add this
}
openFiltersDialog(): void { openFiltersDialog(): void {
let dialogRef = this.dialog.open(PlanFilterDialogComponent, { let dialogRef = this.dialog.open(PlanFilterDialogComponent, {
width: '456px', width: '456px',

View File

@ -441,8 +441,6 @@ export class PlanOverviewComponent extends BaseComponent implements OnInit {
openShareDialog(rowId: any, rowName: any) { openShareDialog(rowId: any, rowName: any) {
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

@ -780,7 +780,7 @@ export class PlanEditorComponent extends BaseEditor<PlanEditorModel, Plan> imple
// //
// //
public isDirty(): boolean { public isDirty(): boolean {
return this.formGroup && this.formGroup.dirty; //&& this.hasChanges; return this.formGroup && this.formGroup.dirty;
} }
getLanguageInfos(): LanguageInfo[] { getLanguageInfos(): LanguageInfo[] {