Skip to content
Snippets Groups Projects
Commit 20bd5df5 authored by Charlotte Hausman's avatar Charlotte Hausman
Browse files

clean up UI for 2.7 release

parent 3a8875d0
No related branches found
No related tags found
1 merge request!1126clean up UI for 2.7 release
Pipeline #7244 passed
Showing
with 2 additions and 610 deletions
......@@ -19,7 +19,7 @@
import {BrowserModule, Title} from "@angular/platform-browser";
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
import {ReactiveFormsModule} from "@angular/forms";
import {APP_INITIALIZER, NgModule} from "@angular/core";
import {NgModule} from "@angular/core";
import {HttpClientModule} from "@angular/common/http";
import {AppComponent} from "./app.component";
......@@ -33,11 +33,6 @@ import {AppRoutingModule} from "./app-routing.module";
import {SplashComponent} from "./splash/splash.component";
import {SharedModule} from "./shared/shared.module";
import {AlertComponent} from "./shared/alert/alert.component";
import {TestDataService} from "./shared/test-data.service";
export function initializeApp(testDataService: TestDataService) {
return (): Promise<any> => { return testDataService.Init(); }
}
@NgModule({
declarations: [AppComponent, HeaderComponent, FooterComponent, SplashComponent, AlertComponent],
......@@ -52,7 +47,7 @@ export function initializeApp(testDataService: TestDataService) {
SharedModule,
],
providers: [WebAnalyticsService, {provide: APP_INITIALIZER, useFactory: initializeApp, deps: [TestDataService], multi: true}, Title],
providers: [WebAnalyticsService, Title],
bootstrap: [AppComponent],
})
export class AppModule {}
/*
* Copyright (C) 2021 Associated Universities, Inc. Washington DC, USA.
*
* This file is part of NRAO Workspaces.
*
* Workspaces is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Workspaces is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Workspaces. If not, see <https://www.gnu.org/licenses/>.
*/
import {TestBed} from '@angular/core/testing';
import {TestDataService} from './test-data.service';
describe('TestDataService', () => {
let service: TestDataService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(TestDataService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
/*
* Copyright (C) 2021 Associated Universities, Inc. Washington DC, USA.
*
* This file is part of NRAO Workspaces.
*
* Workspaces is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Workspaces is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Workspaces. If not, see <https://www.gnu.org/licenses/>.
*/
import {Injectable} from '@angular/core';
import {Job} from '../workspaces/model/job';
import {User} from '../workspaces/model/user';
import {StorageService} from "./storage/storage.service";
@Injectable({
providedIn: 'root'
})
export class TestDataService {
constructor(private storage: StorageService) {
}
Init(): Promise<any> {
return new Promise<void>((resolve) => {
const users: Array<User> = [
{name: 'Drew Medlin', email: 'dmedlin@nrao.edu', role: 'admin', id: 1},
{name: 'Rachel Roberts', email: 'rroberts@nrao.edu', role: 'DA', id: 2},
{name: 'Shelly Scientist', email: 'sscientist', role: 'AoD', id: 3},
{name: 'Edward Starr', email: 'estarr@nrao.edu', role: 'DA', id: 4}
];
this.storage.saveLocal("users", JSON.stringify(users));
const jobs: Array<Job> = [
{
requestId: 1,
currentVersion: 2,
state: "Created",
sdmId: "13B-014.sb12345.eb98765",
obsDate: "2016-08-23",
bands: ["C", "D", "B"],
arrayConfiguration: "A",
srdp: false,
},
{
requestId: 2,
currentVersion: 2,
state: "Complete",
sdmId: "14A-000.sb12345.eb98765",
obsDate: "2016-11-01",
bands: ["C"],
arrayConfiguration: "A",
srdp: false,
},
{
requestId: 3,
currentVersion: 1,
state: "Submitted",
sdmId: "13B-014.sb12345.eb98765",
obsDate: "2016-08-23",
bands: ["C", "D", "B"],
arrayConfiguration: "A",
srdp: false,
},
{
requestId: 4,
currentVersion: 3,
state: "Cancelled",
sdmId: "20A-465.sb34343.eb98765.23984239",
obsDate: "2016-08-23",
bands: ["C", "D", "B"],
arrayConfiguration: "A",
srdp: true,
},
{
requestId: 5,
currentVersion: 1,
state: "Failed",
sdmId: "19B-324.sb38254745.eb38257021.59004",
obsDate: "2020-06-19",
bands: ["D"],
arrayConfiguration: "D",
srdp: true,
},
];
this.storage.saveLocal("jobs", JSON.stringify(jobs));
resolve();
});
}
}
<div class="row my-3 mx-2 no-gutters align-items-center">
<div class="col-auto page-form">
<div class="form-row p-2 pb-0 align-items-center">
<div class="col-auto pl-3"><b>Capability</b>:</div>
<div class="btn-group col" ngbDropdown>
<ul ngbDropdownMenu>
<li ngbDropdownItem>
<button type="button" class="dropdown-item" id="null" (click)="getActiveRequests('null'); setCapability('null')">Null</button>
</li>
<li ngbDropdownItem>
<button type="button" class="dropdown-item" id="test_download" (click)="getActiveRequests('test_download'); setCapability('test_download')">
Download
</button>
</li>
<li ngbDropdownItem>
<button type="button" class="dropdown-item" id="std_calibration" (click)="getActiveRequests('std_calibration'); setCapability('std_calibration')">
Standard Calibration
</button>
</li>
</ul>
</div>
</div>
</div>
</div>
<div *ngIf="activeCapabilityRequests && activeCapabilityRequests.length > 0">
<h3>{{ getCapability() }}</h3>
<ul *ngFor="let request of activeCapabilityRequests">
<li>{{request | json}}</li>
</ul>
</div>
/*
* Copyright (C) 2021 Associated Universities, Inc. Washington DC, USA.
*
* This file is part of NRAO Workspaces.
*
* Workspaces is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Workspaces is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Workspaces. If not, see <https://www.gnu.org/licenses/>.
*/
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AnalystToolsComponent } from './analyst-tools.component';
describe('AnalystToolsComponent', () => {
let component: AnalystToolsComponent;
let fixture: ComponentFixture<AnalystToolsComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AnalystToolsComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(AnalystToolsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
/*
* Copyright (C) 2021 Associated Universities, Inc. Washington DC, USA.
*
* This file is part of NRAO Workspaces.
*
* Workspaces is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Workspaces is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Workspaces. If not, see <https://www.gnu.org/licenses/>.
*/
import { Component, OnInit } from '@angular/core';
import { CapabilityRequest } from '../../model/capability-request';
import { CapabilityRequestService } from '../../services/capability-request.service';
@Component({
selector: 'app-analyst-tools',
templateUrl: './analyst-tools.component.html',
styleUrls: ['./analyst-tools.component.scss'],
})
export class AnalystToolsComponent implements OnInit {
// tslint:disable-next-line:variable-name
public capability_name = '';
public activeCapabilityRequests: Array<CapabilityRequest>;
constructor(private capabilityRequestService: CapabilityRequestService) {}
ngOnInit(): void {
}
setCapability(name: string) {
this.capability_name = name;
}
getCapability() {
return this.capability_name;
}
getActiveRequests(capabilityName: string) {
const activeCapabilityRequestsObserver = {
next: (request) => {
this.activeCapabilityRequests = request.active_requests;
},
error: (error) => console.error("Error when retrieving list of active capability requests:" + error),
};
this.capabilityRequestService.getActiveCapabilityRequests(capabilityName).subscribe(activeCapabilityRequestsObserver);
}
}
<div class="container-fluid">
<div class="row border-bottom py-2" *ngIf="job">
<div class="col-1">
{{ job.requestId }}
</div>
<div class="col-1">
{{ job.currentVersion }}
</div>
<div class="col-1">
{{ job.state }}
</div>
<div class="col text-sm-left">
{{job.sdmId}}
</div>
<div class="col-1">
{{job.bands}}
</div>
<div class="col-2">
{{job.obsDate}}
</div>
<div class="col-1">
{{job.arrayConfiguration}}
</div>
<div class="col-1">
{{ job.srdp }}
</div>
</div>
</div>
/*
* Copyright (C) 2021 Associated Universities, Inc. Washington DC, USA.
*
* This file is part of NRAO Workspaces.
*
* Workspaces is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Workspaces is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Workspaces. If not, see <https://www.gnu.org/licenses/>.
*/
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { JobItemComponent } from './job-item.component';
describe('JobItemComponent', () => {
let component: JobItemComponent;
let fixture: ComponentFixture<JobItemComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ JobItemComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(JobItemComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
/*
* Copyright (C) 2021 Associated Universities, Inc. Washington DC, USA.
*
* This file is part of NRAO Workspaces.
*
* Workspaces is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Workspaces is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Workspaces. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, Input, OnInit} from '@angular/core';
import {Job} from "../../../model/job";
@Component({
selector: 'app-job-item',
templateUrl: './job-item.component.html',
styleUrls: ['./job-item.component.scss']
})
export class JobItemComponent implements OnInit {
private _job: Job | undefined;
@Input() set job(job: Job | undefined) {
if (job) {
this._job = job;
}
}
get job(): Job | undefined {
return this._job;
}
constructor() { }
ngOnInit(): void {
}
}
<div class="container-fluid">
<div class="row bg-light py-2 border-bottom font-weight-bold">
<div class="col-1">
Request ID
</div>
<div class="col-1">
Current Version
</div>
<div class="col-2">
State
</div>
<div class="col">
SDM ID
</div>
<div class="col-1">
Bands
</div>
<div class="col-2">
Observation Date
</div>
<div class="col-1">
Config
</div>
<div class="col-1">
SRDP?
</div>
</div>
</div>
<app-job-item *ngFor="let job of jobs" [job]="job">
</app-job-item>
/*
* Copyright (C) 2021 Associated Universities, Inc. Washington DC, USA.
*
* This file is part of NRAO Workspaces.
*
* Workspaces is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Workspaces is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Workspaces. If not, see <https://www.gnu.org/licenses/>.
*/
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { JobsListComponent } from './jobs-list.component';
describe('JobsListComponent', () => {
let component: JobsListComponent;
let fixture: ComponentFixture<JobsListComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ JobsListComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(JobsListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
/*
* Copyright (C) 2021 Associated Universities, Inc. Washington DC, USA.
*
* This file is part of NRAO Workspaces.
*
* Workspaces is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Workspaces is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Workspaces. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, OnDestroy, OnInit} from '@angular/core';
import {JobService} from "../../services/job.service";
import {Subject} from "rxjs";
import {Job} from "../../model/job";
import {takeUntil} from "rxjs/operators";
@Component({
selector: 'app-jobs-list',
templateUrl: './jobs-list.component.html',
styleUrls: ['./jobs-list.component.scss']
})
export class JobsListComponent implements OnInit, OnDestroy {
private ngUnsubscribe = new Subject();
public jobs: Array<Job> = [];
constructor(private jobService: JobService) {
}
ngOnInit(): void {
this.jobService.jobs$.pipe(takeUntil(this.ngUnsubscribe)).subscribe((jobs: Array<Job>) => {
this.jobs = jobs;
});
}
ngOnDestroy() {
this.ngUnsubscribe.next();
this.ngUnsubscribe.complete();
}
}
<p>global-settings works!</p>
/*
* Copyright (C) 2021 Associated Universities, Inc. Washington DC, USA.
*
* This file is part of NRAO Workspaces.
*
* Workspaces is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Workspaces is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Workspaces. If not, see <https://www.gnu.org/licenses/>.
*/
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { GlobalSettingsComponent } from './global-settings.component';
describe('GlobalSettingsComponent', () => {
let component: GlobalSettingsComponent;
let fixture: ComponentFixture<GlobalSettingsComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ GlobalSettingsComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(GlobalSettingsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
/*
* Copyright (C) 2021 Associated Universities, Inc. Washington DC, USA.
*
* This file is part of NRAO Workspaces.
*
* Workspaces is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Workspaces is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Workspaces. If not, see <https://www.gnu.org/licenses/>.
*/
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-global-settings',
templateUrl: './global-settings.component.html',
styleUrls: ['./global-settings.component.scss']
})
export class GlobalSettingsComponent implements OnInit {
public globalSettingsList: Array<any> = []
public calibrationSettingsList: Array<any> = []
constructor() { }
ngOnInit(): void {
this.globalSettingsList = [
{
"allow_job_deletion": false,
"allow_product_deletion": false,
},
{},
{},
{},
]
this.calibrationSettingsList = [
{
"something": "foo",
"sth_else": 2.2,
"whom": "meem",
"things": []
}
]
}
}
<!--<router-outlet>-->
<!--</router-outlet>-->
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment