Commit c3a494bc authored by Thodoris Nestoridis's avatar Thodoris Nestoridis

ui search bars

parent b5a70ddf
...@@ -11,15 +11,15 @@ ...@@ -11,15 +11,15 @@
<div class="first"> <div class="first">
<div *ngIf="currentboilerplate.id" class="edit-form"> <div *ngIf="currentboilerplate.id" class="edit-form">
<form> <form>
<div class="form-group" style="width: 63%;"> <div class="form-group" style="display:flex; flex-direction: row; align-items: center">
<label for="title">Boilerplate title</label> <label for="title" style="margin-right: 50px;">Boilerplate title</label>
<input <input
name="title"
id="title"
type="text" type="text"
class="form-control" class="form-control"
id="title"
[(ngModel)]="currentboilerplate.title" [(ngModel)]="currentboilerplate.title"
name="title" style="width: 63%;"/>
/>
</div> </div>
<div style="display: flex; flex-grow: grow; margin-top: 50px;"> <div style="display: flex; flex-grow: grow; margin-top: 50px;">
<form class="form-group form-inline "> <form class="form-group form-inline ">
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
<!-- Dictionary --> <!-- Dictionary -->
<div class="second"> <div class="second">
<div class="search-hero"> <div class="search-hero">
<input class="form-control" type="text" name="search" [(ngModel)]="searchText" autocomplete="off" placeholder="&#61442; Start searching for a hero by id or name or country"> <input class="form-control" type="text" name="search" [(ngModel)]="searchText" autocomplete="off" placeholder="Start searching for a System, Function, etc.">
</div> </div>
<mat-tab-group mat-align-tabs="center"> <mat-tab-group mat-align-tabs="center">
<div *ngFor="let section of systems| filter:searchText"> <div *ngFor="let section of systems| filter:searchText">
...@@ -168,5 +168,8 @@ ...@@ -168,5 +168,8 @@
</mat-tab> </mat-tab>
</div> </div>
</mat-tab-group> </mat-tab-group>
<div *ngIf="!checklen(systems)">
<mat-spinner style="margin: auto;"></mat-spinner>
</div>
</div> </div>
\ No newline at end of file
...@@ -5,23 +5,14 @@ ...@@ -5,23 +5,14 @@
</ol> </ol>
</nav> </nav>
<div class="list row"> <div class="list row">
<div class="col-md-8"> <div class="col-md-14">
<div class="input-group mb-3"> <div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<input <input
type="text" type="text"
class="form-control" class="form-control"
placeholder="Search by title" placeholder="Search"
[(ngModel)]="title" (keyup)="applyFilter($event)"
(keyup.enter)="SearchTitle()" #input/>
/>
<div class="input-group-append">
<button
class="btn btn-primary"
type="button"
(click)="SearchTitle()"
>Search
</button>
</div>
</div> </div>
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end"> <div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<ul fxLayout fxLayoutGap="15px" class="navigation-items"> <ul fxLayout fxLayoutGap="15px" class="navigation-items">
...@@ -43,8 +34,7 @@ ...@@ -43,8 +34,7 @@
</div> </div>
</div> </div>
<div>
<table mat-table [dataSource]="newdataSource" class="mat-elevation-z8"> <table mat-table [dataSource]="newdataSource" class="mat-elevation-z8">
<!-- Position Column --> <!-- Position Column -->
<ng-container matColumnDef="id"> <ng-container matColumnDef="id">
...@@ -84,3 +74,4 @@ ...@@ -84,3 +74,4 @@
<tr mat-header-row *matHeaderRowDef="newdisplayedColumns"></tr> <tr mat-header-row *matHeaderRowDef="newdisplayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: newdisplayedColumns;"></tr> <tr mat-row *matRowDef="let row; columns: newdisplayedColumns;"></tr>
</table> </table>
</div>
import { Component, OnInit } from '@angular/core'; import { Component, OnInit, AfterViewInit, ViewChild } from '@angular/core';
import { Boilerplate } from 'src/app/models/boilerplate.model'; import { Boilerplate } from 'src/app/models/boilerplate.model';
import { BoilerplateData } from 'src/app/models/boilerplate.model'; import { BoilerplateData } from 'src/app/models/boilerplate.model';
import { InferenceResults } from 'src/app/models/boilerplate.model'; import { InferenceResults } from 'src/app/models/boilerplate.model';
import { BoilerplateService } from 'src/app/services/boilerplate.service'; import { BoilerplateService } from 'src/app/services/boilerplate.service';
import { PrefixService } from 'src/app/services/prefix.service'; import { PrefixService } from 'src/app/services/prefix.service';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import {MatTableDataSource} from '@angular/material/table';
...@@ -14,6 +15,7 @@ import { ActivatedRoute, Router } from '@angular/router'; ...@@ -14,6 +15,7 @@ import { ActivatedRoute, Router } from '@angular/router';
styleUrls: ['./boilerplate-list.component.scss'] styleUrls: ['./boilerplate-list.component.scss']
}) })
export class BoilerplateListComponent implements OnInit { export class BoilerplateListComponent implements OnInit {
boilerplates?: Boilerplate[]; boilerplates?: Boilerplate[];
...@@ -29,7 +31,8 @@ export class BoilerplateListComponent implements OnInit { ...@@ -29,7 +31,8 @@ export class BoilerplateListComponent implements OnInit {
displayedColumns: string[] = ['id', 'title', 'has_prefix', 'has_main', 'has_suffix', 'action']; displayedColumns: string[] = ['id', 'title', 'has_prefix', 'has_main', 'has_suffix', 'action'];
newdisplayedColumns: string[] = ['id','title_data' ,'prefix_data', 'main_data', 'suffix_data', 'action']; newdisplayedColumns: string[] = ['id','title_data' ,'prefix_data', 'main_data', 'suffix_data', 'action'];
dataSource :Boilerplate[] = [{}]; dataSource :Boilerplate[] = [{}];
newdataSource:BoilerplateData[] = [{}]; thenewdataSource:BoilerplateData[] = [{}];
newdataSource = new MatTableDataSource(this.thenewdataSource);
infer:InferenceResults[] = [{}]; infer:InferenceResults[] = [{}];
dataofboilerplates: any [] = []; dataofboilerplates: any [] = [];
...@@ -65,7 +68,8 @@ export class BoilerplateListComponent implements OnInit { ...@@ -65,7 +68,8 @@ export class BoilerplateListComponent implements OnInit {
.subscribe( .subscribe(
data => { data => {
this.boilerplatesdata =data; this.boilerplatesdata =data;
this.newdataSource = data; this.thenewdataSource = data;
this.newdataSource = new MatTableDataSource(this.thenewdataSource);
console.log(data) console.log(data)
}, },
error => { error => {
...@@ -136,4 +140,9 @@ export class BoilerplateListComponent implements OnInit { ...@@ -136,4 +140,9 @@ export class BoilerplateListComponent implements OnInit {
}); });
} }
applyFilter(event: Event) {
const filterValue = (event.target as HTMLInputElement).value;
this.newdataSource.filter = filterValue.trim().toLowerCase();
}
} }
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
class="form-control" class="form-control"
placeholder="Search" placeholder="Search"
[(ngModel)]="title" [(ngModel)]="title"
name="search"
autocomplete="off"
/> />
<!-- (keyup.enter)="SearchTitle()"--> <!-- (keyup.enter)="SearchTitle()"-->
<!-- (click)="SearchTitle()" --> <!-- (click)="SearchTitle()" -->
...@@ -32,7 +34,7 @@ ...@@ -32,7 +34,7 @@
</div> </div>
</div> </div>
<div *ngFor="let gb of grouboilerplates"> <div *ngFor="let gb of grouboilerplates| filter:title">
<mat-card class="example-card"> <mat-card class="example-card">
<a routerLink="/groupboilerplates/{{gb.id}}/boilerplates"> <a routerLink="/groupboilerplates/{{gb.id}}/boilerplates">
<mat-card-header> <mat-card-header>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment