Skip to content

Commit

Permalink
Updated the SearchBar component to support span searches and added an…
Browse files Browse the repository at this point in the history
… example span search to the config file.
  • Loading branch information
alancleary committed Feb 12, 2019
1 parent 1946d80 commit 1477d0b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions client/src/app/components/shared/search-bar.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Angular
import { Component } from "@angular/core";
import { Router } from "@angular/router";

// App
import { AppConfig } from "../../app.config";

Expand All @@ -15,11 +14,11 @@ import { AppConfig } from "../../app.config";
form button { margin-right: 0; }
`],
template: `
<form (ngSubmit)="submit()" #geneSearchForm="ngForm">
<form (ngSubmit)="submit()" #searchForm="ngForm">
<div class="input-group">
<input type="text" class="form-control" id="gene-search"
[(ngModel)]="model.gene" name="gene"
#geneSearch="ngModel"
<input type="text" class="form-control" id="query-search"
[(ngModel)]="model.query" name="query"
#search="ngModel"
placeholder="{{placeholder}}" >
<span class="input-group-btn">
<select class="select form-control" [(ngModel)]="model.source" name="source">
Expand All @@ -36,13 +35,14 @@ import { AppConfig } from "../../app.config";
export class SearchBarComponent {

servers: any[] = AppConfig.SERVERS;
model: any = {source: this.servers[0], gene: ""};
model: any = {source: this.servers[0], query: ""};
placeholder: string = AppConfig.MISCELLANEOUS.searchPlaceholder;

constructor(private router: Router) { }

submit(): void {
const url = "/search/" + this.model.source.id + "/" + this.model.gene;
const query = this.model.query.replace(":", "/");
const url = "/search/" + this.model.source.id + "/" + query;
this.router.navigateByUrl(url);
}
}
2 changes: 1 addition & 1 deletion client/src/config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
]
},
"miscellaneous": {
"searchPlaceholder": "e.g. phavu.Phvul.002G100400",
"searchPlaceholder": "e.g. phavu.Phvul.002G100400 or phavu.Chr02:13142457-13496658",
"communicationChannel": "GCV"
},
"tours": [
Expand Down

0 comments on commit 1477d0b

Please sign in to comment.