Skip to content

Commit

Permalink
Merge pull request #1621 from UUDigitalHumanitieslab/bugfix/nn-reset
Browse files Browse the repository at this point in the history
use params.get instead of lodash get
  • Loading branch information
JeltevanBoheemen authored Jul 5, 2024
2 parents 6093a65 + 20d25dc commit e83ce0b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions frontend/src/app/param/param-directive.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Directive, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { ActivatedRoute, ParamMap, Params, Router } from '@angular/router';
import { Subscription } from 'rxjs';
import * as _ from 'lodash';

Expand Down Expand Up @@ -57,5 +57,5 @@ export abstract class ParamDirective implements OnDestroy, OnInit {

abstract teardown();

abstract setStateFromParams(params: Params);
abstract setStateFromParams(params: ParamMap);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { ActivatedRoute, ParamMap, Router } from '@angular/router';
import * as _ from 'lodash';
import { ParamDirective } from '../../param/param-directive';
import { Normalizer, ChartType, ChartParameters } from '../../models';
Expand Down Expand Up @@ -85,7 +85,7 @@ export class BarchartOptionsComponent

teardown() {}

setStateFromParams(params: Params) {
setStateFromParams(params: ParamMap) {
if (params.has('normalize')) {
this.currentNormalizer = params.get('normalize') as Normalizer;
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { ActivatedRoute, ParamMap, Router } from '@angular/router';

import { ParamDirective } from '../../../param/param-directive';
import { ParamService } from '../../../services';
Expand Down Expand Up @@ -44,7 +44,7 @@ export class TermComparisonEditorComponent

teardown() {}

setStateFromParams(params: Params) {
setStateFromParams(params: ParamMap) {
if (params.has('compareTerm')) {
this.queries = params.getAll('compareTerm');
this.queriesChanged.emit(this.queries);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, EventEmitter, HostBinding, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { ActivatedRoute, ParamMap, Params, Router } from '@angular/router';
import { BehaviorSubject } from 'rxjs';
import * as _ from 'lodash';
import { showLoading } from '../../utils/utils';
Expand All @@ -26,7 +26,7 @@ export class RelatedWordsComponent extends ParamDirective implements OnChanges {

isLoading$ = new BehaviorSubject<boolean>(false);

neighbours = 5;
neighbours: number = 5;

timeIntervals: string[] = [];
totalData: WordSimilarity[]; // similarities of overall nearest neighbours per time period
Expand Down Expand Up @@ -60,8 +60,8 @@ export class RelatedWordsComponent extends ParamDirective implements OnChanges {

teardown() {}

setStateFromParams(params: Params) {
this.neighbours = _.get(params, 'neighbours', 5);
setStateFromParams(params: ParamMap) {
this.neighbours = Number(params.get('neighbours'));
}

getData(): void {
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/app/word-models/word-models.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, ElementRef, HostListener, ViewChild } from '@angular/core';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { ActivatedRoute, ParamMap, Router } from '@angular/router';
import * as _ from 'lodash';

import { Corpus, QueryFeedback, User, WordInModelResult } from '../models';
Expand Down Expand Up @@ -83,7 +83,7 @@ export class WordModelsComponent extends ParamDirective {

teardown() {}

setStateFromParams(params: Params) {
setStateFromParams(params: ParamMap) {
const queryFromParams = params.get('query');
if (queryFromParams !== this.activeQuery) {
this.queryText = queryFromParams;
Expand All @@ -99,7 +99,7 @@ export class WordModelsComponent extends ParamDirective {
this.queryFeedback = { status: 'success' };
}
if (params.has('show')) {
this.currentTab = params.get('show');
this.currentTab = params.get('show') as 'relatedwords' | 'wordsimilarity';
} else {
this.currentTab = 'relatedwords';
}
Expand Down

0 comments on commit e83ce0b

Please sign in to comment.