Skip to content

Commit c05e3a6

Browse files
routing and code reusability changes
1 parent 126e006 commit c05e3a6

8 files changed

+69
-180
lines changed

frontend/orca_data_converter/src/app/app-routing.module.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import { NgModule } from '@angular/core';
22
import { RouterModule, Routes } from '@angular/router';
3-
import { Dashboard1Component } from './views/dashboard1/dashboard1.component';
3+
import { DashboardComponent } from './views/dashboard/dashboard.component';
4+
import { GaussianDashboardComponent } from './views/gaussianDashboard/gaussianDashboard.component';
45

56
const routes: Routes = [
6-
{ path: 'home1', component: Dashboard1Component }
7+
{ path: 'orca', component: DashboardComponent },
8+
{ path: 'gaussian', component: GaussianDashboardComponent },
9+
{ path: '', redirectTo: 'orca', pathMatch: 'full' }
710
];
811

912
@NgModule({
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
1-
<div class="filter-wrapper row" *ngIf="dashboard == '/' ">
2-
<div class="col-md-3 offset-md-3">
3-
<app-dashboard appendTo="body" [options]="options" (onPanelHide)="onPanelHide($event)"></app-dashboard>
4-
</div>
5-
</div>
61
<router-outlet></router-outlet>

frontend/orca_data_converter/src/app/app.component.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
import { Component, OnInit } from '@angular/core';
22
import {HttpClient} from '@angular/common/http';
33
import {firstValueFrom} from 'rxjs';
4+
import { Router } from '@angular/router';
45

56
@Component({
67
selector: 'app-root',
78
templateUrl: './app.component.html',
89
styleUrls: ['./app.component.css']
910
})
1011
export class AppComponent implements OnInit {
11-
dashboard:any;
12+
dashboard:string;
1213

1314

14-
constructor(private http: HttpClient) {
15-
this.dashboard = window.location.pathname
15+
constructor(private http: HttpClient, private router: Router) {
16+
this.dashboard = this.router.url;
1617
}
1718

1819
async ngOnInit(): Promise<void> {

frontend/orca_data_converter/src/app/views/dashboard/dashboard.component.html

-83
This file was deleted.

frontend/orca_data_converter/src/app/views/dashboard/dashboard.component.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ interface BrandsGroup {
1818

1919
@Component({
2020
selector: 'app-dashboard',
21-
templateUrl: './dashboard.component.html',
22-
styleUrls: ['./dashboardView.component.css']
21+
templateUrl: '../dashboardView/dashboardView.component.html',
22+
styleUrls: ['../dashboardView/dashboardView.component.css']
2323
})
2424

2525
export class DashboardComponent implements OnInit{
2626

27+
fileType = 'ORCA';
28+
fileExtension = '.txt';
2729
brandGroups: BrandsGroup[] = [];
2830
selectedBrands: Brand[] = [];
2931
public fileName: string;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<div id="whole">
2+
<h2>Convert {{ fileType }} files to Word documents</h2>
3+
<h3>Upload your {{ fileType }} data file</h3>
4+
<div class="background-image"></div>
5+
<div>
6+
<input type="file" (change)="onFileSelected($event)" [accept]="fileExtension">
7+
<button class="Submit" (click)="onUpload()">Submit</button>
8+
</div>
9+
<div>
10+
<h3>Enter the terms you wish to search for (txt only):</h3>
11+
<div class="keyterms-search">
12+
<form action="localhost:4200/" method="POST">
13+
<input type="text" placeholder="E.g., CARTESIAN COORDINATES" id="keyTerms-toSearch" />
14+
</form>
15+
</div>
16+
</div>
17+
<div>
18+
<h3>Enter how you want the lines specified:</h3>
19+
<div class="linesSpecified_search">
20+
<form action="localhost:4200/" method="POST">
21+
<input type="text" placeholder="E.g., WHOLE, FIRST X, LAST X" id="linesSpecified-toSearch" />
22+
</form>
23+
</div>
24+
</div>
25+
<div>
26+
<h3>Number of sections?</h3>
27+
<div class="sections_search">
28+
<form action="localhost:4200/" method="POST">
29+
<input type="text" placeholder="Input as number..." id="sections-toSearch" />
30+
</form>
31+
</div>
32+
</div>
33+
<div>
34+
<h3>Use total lines?</h3>
35+
<div class="useTotalLines_search">
36+
<form action="localhost:4200/" method="POST">
37+
<input type="text" placeholder="TRUE/FALSE" id="useTotalLines-toSearch" />
38+
</form>
39+
</div>
40+
</div>
41+
<div>
42+
<h3>Total number of lines for output doc?</h3>
43+
<div class="totalLines_search">
44+
<form action="localhost:4200/" method="POST">
45+
<input type="text" placeholder="Input as number..." id="totalLines-toSearch" />
46+
</form>
47+
</div>
48+
</div>
49+
<div>
50+
<button id="downloadButton" value="Download" type="button" (click)="runBackend()">Convert</button>
51+
</div>
52+
</div>

frontend/orca_data_converter/src/app/views/gaussianDashboard/gaussianDashboard.component.html

-83
This file was deleted.

frontend/orca_data_converter/src/app/views/gaussianDashboard/gaussianDashboard.component.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ interface BrandsGroup {
1818

1919
@Component({
2020
selector: 'app-gaussianDashboard',
21-
templateUrl: './gaussianDashboard.component.html',
22-
styleUrls: ['./dashboardView.component.css']
21+
templateUrl: '../dashboardView/dashboardView.component.html',
22+
styleUrls: ['../dashboardView/dashboardView.component.css']
2323
})
2424

2525
export class GaussianDashboardComponent implements OnInit{
2626

27+
fileType = 'Gaussian';
28+
fileExtension = '.log';
2729
brandGroups: BrandsGroup[] = [];
2830
selectedBrands: Brand[] = [];
2931
public fileName: string;

0 commit comments

Comments
 (0)