Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
refactor: clean up jsDocs and delete deprecated methods (DEV-741) (#722)
* refactor(message): use correct version

* refactor(form): resetForm is no longer needed as we have a cancel button

* refactor(message): use correct version

* refactor(search): filterbyproject is deprecated, use limitToProject instead

* refactor(results): delete deprecated outputs

* refactor(jsDocs): delete @ignore; it was a doc setup for the ui-lib
  • Loading branch information
kilchenmann committed May 4, 2022
1 parent 0c2a43d commit 8457119
Show file tree
Hide file tree
Showing 19 changed files with 27 additions and 175 deletions.
28 changes: 2 additions & 26 deletions src/app/main/action/message/message.component.ts
Expand Up @@ -5,8 +5,7 @@ import { ApiResponseError } from '@dasch-swiss/dsp-js';
import { StatusMsg } from 'src/assets/http/statusMsg';

/**
* @ignore
* Data type for messages
* data type for messages
*/
export class AppMessageData {
status: number;
Expand All @@ -19,9 +18,6 @@ export class AppMessageData {
url?: string;
}

/**
* @deprecated Will be replaced by notification service with material snackbar
*/
@Component({
selector: 'app-message',
templateUrl: './message.component.html',
Expand Down Expand Up @@ -50,20 +46,6 @@ export class MessageComponent implements OnInit {
*/
@Input() size: 'short' | 'medium' | 'long' = 'long';

/**
* @deprecated
* @param short Show short message only
* A small message box to notify the user an event has occured.
*/
@Input() short = (this.size === 'short');

/**
* @deprecated
* @param medium Show medium message
* A message box without footnote or links.
*/
@Input() medium = (this.size === 'medium');

/**
* @param duration How long should the message be displayed
*/
Expand All @@ -79,7 +61,7 @@ export class MessageComponent implements OnInit {
disable = false;

/**
* @ignore
* default link list, which will be used in message content to give a user some possibilities
* what he can do in the case of an error
*
Expand Down Expand Up @@ -113,12 +95,6 @@ export class MessageComponent implements OnInit {
) { }

ngOnInit() {
// temporary solution as long we have to support the deprecated inputs "short" and "medium"
if (this.short || this.medium) {
this.size = (this.short ? 'short' : 'medium');
}


if (this.apiError) {
this.message.status = this.apiError.status;
}
Expand Down
2 changes: 0 additions & 2 deletions src/app/main/action/sort-button/sort-button.component.ts
Expand Up @@ -68,8 +68,6 @@ export class SortButtonComponent implements OnInit {
}

/**
* @ignore
*
* @param key a string to sort by
*/
sortBy(key: string) {
Expand Down
Expand Up @@ -133,8 +133,6 @@ export class StringLiteralInputComponent implements OnInit, OnChanges {
}

/**
* @ignore
*
* emit data to parent on any change on the input field
*/
onValueChanged() {
Expand All @@ -157,10 +155,8 @@ export class StringLiteralInputComponent implements OnInit, OnChanges {
}

/**
* @ignore
*
* Set the language after selecting;
* This updates the array of StringLiterals: adds item with the selected language if it doesn't exist
* set the language after selecting;
* this updates the array of StringLiterals: adds item with the selected language if it doesn't exist
*/
setLanguage(lang: string) {

Expand All @@ -176,9 +172,7 @@ export class StringLiteralInputComponent implements OnInit, OnChanges {
}

/**
* @ignore
*
* Switch focus to input field after selecting a language
* switch focus to input field after selecting a language
*/
switchFocus() {
// close the menu
Expand All @@ -193,9 +187,7 @@ export class StringLiteralInputComponent implements OnInit, OnChanges {
}

/**
* @ignore
*
* Switch focus to input field after closing the menu by clicking anywhere outside of it
* switch focus to input field after closing the menu by clicking anywhere outside of it
*/
menuClosed() {
if (!this.disabled) {
Expand All @@ -205,9 +197,7 @@ export class StringLiteralInputComponent implements OnInit, OnChanges {
}

/**
* @ignore
*
* Set the value in the input field
* set the value in the input field
*/
updateFormField(value: string) {
if (!value) {
Expand All @@ -220,9 +210,7 @@ export class StringLiteralInputComponent implements OnInit, OnChanges {
}

/**
* @ignore
*
* Update the array of StringLiterals depending on value / empty value add or remove item from array.
* update the array of StringLiterals depending on value / empty value add or remove item from array.
*/
updateStringLiterals(lang: string, value?: string) {
const index = this.value.findIndex(i => i.language === lang);
Expand All @@ -249,9 +237,7 @@ export class StringLiteralInputComponent implements OnInit, OnChanges {
}

/**
* @ignore
*
* In case of strange array of StringLiterals, this method will reset to a API-conform array. This means an array without empty values.
* in case of strange array of StringLiterals, this method will reset to a API-conform array. This means an array without empty values.
*/
resetValues() {
const length: number = this.value.length;
Expand All @@ -277,9 +263,7 @@ export class StringLiteralInputComponent implements OnInit, OnChanges {
}

/**
* @ignore
*
* Get the value from array of StringLiterals for the selected language
* get the value from array of StringLiterals for the selected language
*/
getValueFromStringLiteral(lang: string): string {
// get index for this language
Expand Down
3 changes: 0 additions & 3 deletions src/app/main/directive/admin-image/admin-image.config.ts
@@ -1,7 +1,4 @@
/* eslint-disable max-len */
/**
* @ignore
*/
export class AdminImageConfig {

/**
Expand Down
11 changes: 2 additions & 9 deletions src/app/main/directive/admin-image/admin-image.directive.ts
Expand Up @@ -27,27 +27,20 @@ export class AdminImageDirective implements OnChanges {


/**
* @ignore
* image source
*/
source: string;


/**
* @ignore
* in case of an error
*/
onError: string = AdminImageConfig.defaultNotFound;


/**
* @ignore
*/
constructor(private _renderer: Renderer2,
private _ele: ElementRef
) { }

/**
* @ignore
*/
ngOnChanges() {

this.source = this.image;
Expand Down
10 changes: 0 additions & 10 deletions src/app/main/directive/existing-name/existing-name.directive.ts
Expand Up @@ -7,18 +7,11 @@ import { Validators, AbstractControl, ValidatorFn } from '@angular/forms';
})
export class ExistingNameDirective implements Validators, OnChanges {

/**
* @ignore
*/
@Input() existingName: string;

/**
* @ignore
*/
private _valFn = Validators.nullValidator;

/**
* @ignore
* @param changes
*/
ngOnChanges(changes: SimpleChanges): void {
Expand All @@ -33,7 +26,6 @@ export class ExistingNameDirective implements Validators, OnChanges {
}

/**
* @ignore
* @param control
*/
validate(control: AbstractControl): { [key: string]: any } {
Expand Down Expand Up @@ -91,8 +83,6 @@ export function existingNamesValidator(valArrayRegexp: [RegExp]): ValidatorFn {
}

/**
* @ignore
*
* @param {RegExp} pattern
* @param {string} regType
* @returns ValidatorFn
Expand Down
1 change: 0 additions & 1 deletion src/app/main/header/header.component.spec.ts
Expand Up @@ -38,7 +38,6 @@ class TestHostHeaderComponent {
})
class TestSearchPanelComponent {
@Input() projectfilter?: boolean = false;
@Input() filterbyproject?: string;
@Input() limitToProject?: string;
@Input() advanced?: boolean = false;
@Input() expert?: boolean = false;
Expand Down
17 changes: 0 additions & 17 deletions src/app/project/project-form/project-form.component.ts
Expand Up @@ -528,21 +528,4 @@ export class ProjectFormComponent implements OnInit {
);
}

/**
* @deprecated Maybe we can reactivate later.
*
* Reset the form
*/
resetForm(ev: Event, project?: ReadProject) {
ev.preventDefault();

project = (project ? project : new ReadProject());
this.description = project.description;

this.buildForm(project);

// --> TODO fix "set value" for keywords field
// this.form.controls['keywords'].setValue(this.keywords);
}

}
@@ -1 +1 @@
<app-message [message]="message" [medium]="true"></app-message>
<app-message [message]="message" [size]="'medium'"></app-message>
Expand Up @@ -5,7 +5,7 @@
<div *ngIf="!loading">

<!-- message after updating: success message or error message if something went wrong -->
<app-message *ngIf="showResponse" [message]="showResponse" [short]="true"
<app-message *ngIf="showResponse" [message]="showResponse" [size]="'short'"
(click)="closeMessage(showResponse.status)">
</app-message>

Expand Down
2 changes: 1 addition & 1 deletion src/app/user/user-form/user-form.component.html
Expand Up @@ -3,7 +3,7 @@
<app-progress-indicator *ngIf="loading"></app-progress-indicator>

<!-- success message after updating -->
<app-message *ngIf="success" [message]="successMessage" [short]="true"></app-message>
<app-message *ngIf="success" [message]="successMessage" [size]="'short'"></app-message>

<!-- content -->
<form *ngIf="!loading" [formGroup]="form" class="form-content user-data" (ngSubmit)="submitData()">
Expand Down
11 changes: 0 additions & 11 deletions src/app/user/user-form/user-form.component.ts
Expand Up @@ -457,15 +457,4 @@ export class UserFormComponent implements OnInit, OnChanges {
}
}

/**
* reset the form
*/
resetForm(ev: Event, user?: ReadUser) {
ev.preventDefault();

user = user ? user : new ReadUser();

this.buildForm(user);
}

}
Expand Up @@ -57,8 +57,8 @@ class TestProgressIndicatorComponent {
*/
@Component({
template: `
<app-list-view #listViewFulltext [search]="fulltext" (resourceSelected)="openResource($event)"></app-list-view>
<app-list-view #listViewGravsearch [search]="gravsearch" (resourceSelected)="openResource($event)"></app-list-view>`
<app-list-view #listViewFulltext [search]="fulltext" (selectedResources)="openResource($event)"></app-list-view>
<app-list-view #listViewGravsearch [search]="gravsearch" (selectedResources)="openResource($event)"></app-list-view>`
})
class TestParentComponent implements OnInit {

Expand Down
24 changes: 0 additions & 24 deletions src/app/workspace/results/list-view/list-view.component.ts
Expand Up @@ -76,30 +76,6 @@ export class ListViewComponent implements OnChanges {
*/
@Output() selectedResources: EventEmitter<FilteredResources> = new EventEmitter<FilteredResources>();

/**
* @deprecated Use selectedResources instead
*
* Click on checkbox will emit the resource info
*
* @param {EventEmitter<FilteredResources>} resourcesSelected
*/
@Output() multipleResourcesSelected?: EventEmitter<FilteredResources> = new EventEmitter<FilteredResources>();

/**
* @deprecated Use selectedResources instead
*
* Click on an item will emit the resource iri
*
* @param {EventEmitter<string>} singleResourceSelected
*/
@Output() singleResourceSelected?: EventEmitter<string> = new EventEmitter<string>();

/**
* @deprecated Use selectedResources instead.
* Click on an item will emit the resource iri
*/
@Output() resourceSelected: EventEmitter<string> = new EventEmitter<string>();

resources: ReadResourceSequence;

selectedResourceIdx: number[] = [];
Expand Down
Expand Up @@ -87,8 +87,7 @@ export class AdvancedSearchComponent implements OnInit, OnDestroy, AfterViewChec
}

/**
* @ignore
* Gets all available ontologies for the search form.
* gets all available ontologies for the search form.
* @returns void
*/
initializeOntologies(): void {
Expand Down Expand Up @@ -167,8 +166,7 @@ export class AdvancedSearchComponent implements OnInit, OnDestroy, AfterViewChec
}

/**
* @ignore
* Validates form and returns its status (boolean).
* validates form and returns its status (boolean).
*/
private _validateForm(): boolean {

Expand Down
Expand Up @@ -126,26 +126,23 @@ export class ResourceAndPropertySelectionComponent implements OnInit, OnChanges
}

/**
* @ignore
* Add a property to the search form.
* add a property to the search form.
* @returns void
*/
addProperty(): void {
this.activeProperties.push(true);
}

/**
* @ignore
* Remove the last property from the search form.
* remove the last property from the search form.
* @returns void
*/
removeProperty(): void {
this.activeProperties.splice(-1, 1);
}

/**
* @ignore
* Resets the form (selected resource class and specified properties) preserving the active ontology.
* resets the form (selected resource class and specified properties) preserving the active ontology.
*/
resetForm() {
if (this.activeOntology !== undefined) {
Expand Down

0 comments on commit 8457119

Please sign in to comment.