ng lint fixes

This commit is contained in:
Nile Walker 2021-02-15 14:26:23 -05:00
parent f6f8e463ea
commit 3c57e6092a
16 changed files with 183 additions and 170 deletions

View File

@ -8,7 +8,7 @@ import { SettingsComponent } from './settings/settings.component';
import { MultipleLabelsComponent } from './multiple-labels/multiple-labels.component';
import { DepositsComponent } from './deposits/deposits.component';
import { GraphsComponent } from './graphs/graphs.component';
import { ImportedFilesComponent } from './imported-files/imported-files.component'
import { ImportedFilesComponent } from './imported-files/imported-files.component';
import { SidebarComponent } from './sidebar/sidebar.component';
export const routes: Routes = [

View File

@ -48,12 +48,12 @@ import { ChartsModule } from 'ng2-charts';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatNativeDateModule, DateAdapter } from '@angular/material/core';
import {MatPaginatorModule} from '@angular/material/paginator';
import { CustomDateAdapter } from './custom-date-adapter';
import { MatTableModule } from '@angular/material/table';
import {MatGridListModule} from '@angular/material/grid-list';
import {MatDividerModule} from '@angular/material/divider';
import { SidebarComponent } from './sidebar/sidebar.component';
import {MatListModule} from '@angular/material/list';
import { CustomDatePipe } from './custom-date-adapter';
@ -79,6 +79,7 @@ export function getBaseHref(platformLocation: PlatformLocation): string {
CircleQRcodeDoubleComponent,
CircleQRcodeSingleComponent,
CountComponent,
CustomDatePipe,
FooterComponent,
LabelLayoutComponent,
LoadingComponent,
@ -132,7 +133,6 @@ export function getBaseHref(platformLocation: PlatformLocation): string {
CacheService,
SettingsService,
MatDatepickerModule,
{provide: DateAdapter, useClass: CustomDateAdapter },
{provide: 'APP_ENVIRONMENT', useClass: ThisEnvironment},
{provide: APP_BASE_HREF, useFactory: getBaseHref, deps: [PlatformLocation]},
{provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: {appearance: 'outline'}},

View File

@ -1,8 +1,20 @@
import { NativeDateAdapter } from '@angular/material/core';
import {Injectable} from '@angular/core';
// @Pipe({ name: 'date' })
/** Adapts the native JS Date for use with cdk-based components that work with dates. */
import { Pipe, PipeTransform } from '@angular/core';
import { DatePipe } from '@angular/common';
@Pipe({ name: 'dated' })
export class CustomDatePipe implements PipeTransform {
// adding a default value in case you don't want to pass the format then 'yyyy-MM-dd' will be used
transform(date: Date | string, day: number, format: string = 'yyyy-MM-dd'): string {
date = new Date(date); // if orginal type was a string
date.setDate(date.getDate() - day);
return new DatePipe('en-US').transform(date, format);
}
}
@Injectable()
export class CustomDateAdapter extends NativeDateAdapter {

View File

@ -22,8 +22,8 @@
<ng-container matColumnDef="position">
<th mat-header-cell *matHeaderCellDef> Date Added <br>
<input matInput
[(ngModel)]="date_temp"
[value] = "date_temp"
[(ngModel)]="dateTemp"
[value] = "dateTemp"
[matDatepicker]="picker"
(keyup.enter)="addDeposit()">
<mat-datepicker #picker></mat-datepicker>

View File

@ -1,61 +1,62 @@
import { Component, OnInit } from '@angular/core';
import { GraphService } from '../services/graph.service'
import { PageEvent } from '@angular/material/paginator'
import { GraphService } from '../services/graph.service';
import { PageEvent } from '@angular/material/paginator';
import { ApiService } from '../services/api.service';
import { InventoryDeposit } from "../models/deposit.interface";
import { SearchForm } from '../models/search_form'
import { InventoryDeposit } from '../models/deposit.interface';
import { SearchForm } from '../models/search_form';
@Component({
selector: 'app-deposits',
templateUrl: './deposits.component.html',
styleUrls: ['./deposits.component.css']
})
export class DepositsComponent implements OnInit {
depositList: InventoryDeposit[] = [];
newDeposit: InventoryDeposit = {
amount: 0,
date_added: "",
notes: ''
};
date_temp = new Date(Date.now());
notify_data : Array<Array<number>>[] = [];
constructor(
private depositService: ApiService,
private graphService: GraphService) {
}
depositList: InventoryDeposit[] = [];
newDeposit: InventoryDeposit = {
amount: 0,
date_added: '',
notes: ''
};
dateTemp = new Date(Date.now());
form: SearchForm = {
start_date: "10/05/2020",
end_date: new Date().toLocaleDateString(),
student_id: "",
location: "",
compute_id: "",
include_tests: false
startDate: '10/05/2020',
endDate: new Date().toLocaleDateString(),
studentId: '',
location: '',
computeId: '',
includeTests: false
};
remainingLabels: number;
topBarData: Array<number> = [0, 0, 0, 0, 0, 0, 0, 0];
currentPage = 0;
pageSize = 10;
pageSizeOptions: number[] = [10, 20, 50, 100];
displayedColumns: string[] = ['position', 'name', 'weight'];
addDeposit(): void {
this.newDeposit.date_added = this.date_temp.toLocaleDateString();
this.newDeposit.date_added = this.dateTemp.toLocaleDateString();
this.depositService.addDeposit(this.newDeposit).subscribe();
this.loadPage(0);
}
current_page: number = 0;
pageSize: number = 10;
pageSizeOptions: number[] = [10,20,50,100];
displayedColumns: string[] = ['position', 'name', 'weight'];
changePage(event: PageEvent) {
this.current_page = event.pageIndex;
this.depositService.getDeposits(this.current_page).subscribe(searchResult => this.depositList = searchResult);
this.currentPage = event.pageIndex;
this.depositService.getDeposits(this.currentPage).subscribe(searchResult => this.depositList = searchResult);
}
loadPage(event: number) {
this.current_page = event;
this.depositService.getDeposits(this.current_page).subscribe(searchResult => this.depositList = searchResult);
this.currentPage = event;
this.depositService.getDeposits(this.currentPage).subscribe(searchResult => this.depositList = searchResult);
this.graphService.getTopBarData(this.form).subscribe(tempData => {
this.topBarData = tempData;
});
@ -63,21 +64,21 @@ export class DepositsComponent implements OnInit {
next(){
if (this.depositList.length > 0){
this.current_page += 1;
this.loadPage(this.current_page);
this.currentPage += 1;
this.loadPage(this.currentPage);
}
}
prev(){
if (this.current_page > 0){
this.current_page -= 1;
this.loadPage(this.current_page);
if (this.currentPage > 0){
this.currentPage -= 1;
this.loadPage(this.currentPage);
}
}
ngOnInit(): void {
this.loadPage(0);
this.loadPage(0);
}
}

View File

@ -1,39 +1,39 @@
<div class="full-height flex-container bg-primary">
<div class="flex-grid">
<mat-card class="col">
<h5 class="card-title text-uppercase text-muted">Total Samples within<br> {{form.start_date | date}}
<h5 class="card-title text-uppercase text-muted">Total Samples within<br> {{form.startDate | date}}
-
{{form.end_date | date}}</h5>
{{form.endDate | date}}</h5>
<span class="h2 font-weight-bold">{{topBarData[0]}}</span>
</mat-card>
<mat-card class="col">
<h5 class="card-title text-uppercase text-muted mb-0">Total Samples within <br> {{start_date_1 | date}}
<h5 class="card-title text-uppercase text-muted mb-0">Total Samples within <br> {{startDate1 | date}}
-
{{end_date_1 | date}}</h5>
{{endDate1 | date}}</h5>
<span class="h2 font-weight-bold ">{{topBarData[1]}}</span>
</mat-card>
<mat-card class="col">
<h5 class="card-title text-uppercase text-muted ">Total Samples within <br> {{start_date_2 |
<h5 class="card-title text-uppercase text-muted ">Total Samples within <br> {{startDate2 |
date}}
-
{{end_date_2 | date}}</h5>
{{endDate2 | date}}</h5>
<span class="h2 font-weight-bold ">{{topBarData[2]}}</span>
</mat-card>
<mat-card class="col">
<h5 class="card-title text-uppercase text-muted ">Email Notifications within <br>
{{form.start_date |
date}} - {{form.end_date | date}}</h5>
{{form.startDate |
date}} - {{form.endDate | date}}</h5>
<span class="h2 font-weight-bold "><span style="color:green">{{topBarData[3]}}</span>/<span
style="color:red">{{topBarData[4]}}</span></span>
</mat-card>
<mat-card class="col">
<h5 class="card-title text-uppercase text-muted ">Text Notifications within <br>
{{form.start_date |
date}} - {{form.end_date | date}}</h5>
{{form.startDate |
date}} - {{form.endDate | date}}</h5>
<span class="h2 font-weight-bold"><span style="color:green">{{topBarData[5]}}</span>/<span
style="color:red">{{topBarData[6]}}</span></span>
</mat-card>
@ -44,7 +44,7 @@
<div class="col">
<h1>Search</h1>
<br>
<mat-checkbox [(ngModel)]="form.include_tests">Include Test Labels</mat-checkbox>
<mat-checkbox [(ngModel)]="form.includeTests">Include Test Labels</mat-checkbox>
</div>
<div class="col">
@ -60,8 +60,8 @@
<div class="col">
<mat-form-field>
<mat-date-range-input [rangePicker]="picker">
<input matStartDate [(ngModel)]="start_date">
<input matEndDate [(ngModel)]="end_date">
<input matStartDate [(ngModel)]="startDate">
<input matEndDate [(ngModel)]="endDate">
</mat-date-range-input>
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-date-range-picker #picker></mat-date-range-picker>
@ -77,14 +77,14 @@
<div class="col">
<mat-form-field>
<mat-label>Student ID(s)</mat-label>
<textarea matInput [(ngModel)]="form.student_id" placeholder="Ex. 00224483"></textarea>
<textarea matInput [(ngModel)]="form.studentId" placeholder="Ex. 00224483"></textarea>
</mat-form-field>
</div>
<div class="col">
<mat-form-field>
<mat-label>Compute ID(s)</mat-label>
<textarea matInput [(ngModel)]="form.compute_id" placeholder="Ex. ECC8Z"></textarea>
<textarea matInput [(ngModel)]="form.computeId" placeholder="Ex. ECC8Z"></textarea>
</mat-form-field>
</div>
</div>
@ -105,7 +105,7 @@
<mat-card class="col">
<mat-card-header>
<h1>Average Count By Weekday For {{form.start_date | date}} - {{form.end_date | date}}</h1>
<h1>Average Count By Weekday For {{form.startDate | date}} - {{form.endDate | date}}</h1>
</mat-card-header>
<div style="display: block">
@ -117,7 +117,7 @@
<mat-card class="col">
<mat-card-header>
<h1>Average Count By Hour For {{form.start_date | date}} - {{form.end_date | date}}</h1>
<h1>Average Count By Hour For {{form.startDate | date}} - {{form.endDate | date}}</h1>
</mat-card-header>
<div style="display: block">
@ -164,7 +164,7 @@
<th mat-header-cell *matHeaderCellDef> IDs </th>
<td mat-cell *matCellDef="let sample; ">
Compute ID: {{sample.compute_id}}<br>Student ID: {{sample.student_id}}
Compute ID: {{sample.computeId}}<br>Student ID: {{sample.studentId}}
</td>
</ng-container>
<ng-container matColumnDef="text">

View File

@ -2,11 +2,11 @@ import { Component, OnInit } from '@angular/core';
import { ChartOptions, ChartType, ChartDataSets } from 'chart.js';
import { Label } from 'ng2-charts';
import { GraphService } from '../services/graph.service'
import { Sample } from '../models/sample.interface'
import { SearchForm } from '../models/search_form'
import { GraphService } from '../services/graph.service';
import { Sample } from '../models/sample.interface';
import { SearchForm } from '../models/search_form';
import {PageEvent} from '@angular/material/paginator'
import {PageEvent} from '@angular/material/paginator';
import * as pluginDataLabels from 'chartjs-plugin-datalabels';
@ -21,10 +21,10 @@ export class GraphsComponent implements OnInit {
constructor(private graphService: GraphService) { }
topBarData: Array<number> = [0, 0, 0, 0, 0, 0, 0, 0];
ChartName: String = "Location Activity";
ChartName = 'Location Activity';
dailyChartLabels: Label[] = [];
weekdayChartLabels: Label[] = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
hourlyChartLabels: Label[] = ["1 AM", "2 AM", "3 AM", "4 AM", "5 AM", "6 AM", "7 AM", "8 AM", "9 AM", "10 AM", "11 AM", "12 AM", "1 PM", "2 PM", "3 PM", "4 PM", "5 PM", "6 PM", "7 PM", "8 PM", "9 PM", "10 PM", "11 PM", "12 PM"];
weekdayChartLabels: Label[] = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
hourlyChartLabels: Label[] = ['1 AM', '2 AM', '3 AM', '4 AM', '5 AM', '6 AM', '7 AM', '8 AM', '9 AM', '10 AM', '11 AM', '12 AM', '1 PM', '2 PM', '3 PM', '4 PM', '5 PM', '6 PM', '7 PM', '8 PM', '9 PM', '10 PM', '11 PM', '12 PM'];
dailyChartsData: ChartDataSets[] = [];
hourlyChartsData: ChartDataSets[] = [];
weekdayChartsData: ChartDataSets[] = [];
@ -61,7 +61,7 @@ export class GraphsComponent implements OnInit {
align: 'end',
formatter: (value: any, ctx: any) => {
let datasets = ctx.chart.data.datasets;
const datasets = ctx.chart.data.datasets;
if (datasets.indexOf(ctx.dataset) === datasets.length - 1) {
let sum = 0;
datasets.map((dataset: any) => {
@ -82,84 +82,84 @@ export class GraphsComponent implements OnInit {
}
}
};
tempData: JSON = <JSON>{};
tempData: JSON = {} as JSON;
searchResult: Sample[] = [];
displayedColumns: string[] = ['position', 'name', 'weight', 'text', 'email'];
start_date: Date = new Date();
end_date: Date = new Date();
startDate: Date = new Date();
endDate: Date = new Date();
start_date_1: string = "";
end_date_1: string = "";
start_date_2: string = "";
end_date_2: string = "";
startDate1 = '';
endDate1 = '';
startDate2 = '';
endDate2 = '';
currentPage = 0;
pageSize = 10;
pageSizeOptions: number[] = [10, 20, 50, 100];
current_page: number = 0;
pageSize: number = 10;
pageSizeOptions: number[] = [10,20,50,100];
updatePage(event: PageEvent) {
this.current_page = event.pageIndex;
this.graphService.getRawSearchData(this.form, this.current_page).subscribe(searchResult => this.searchResult = searchResult);
}
form: SearchForm = {
start_date: "",
end_date: "",
student_id: "",
location: "",
compute_id: "",
include_tests: false
startDate: '',
endDate: '',
studentId: '',
location: '',
computeId: '',
includeTests: false
};
updatePage(event: PageEvent) {
this.currentPage = event.pageIndex;
this.graphService.getRawSearchData(this.form, this.currentPage).subscribe(searchResult => this.searchResult = searchResult);
}
searchToday(): void {
this.start_date = new Date();
this.end_date = new Date();
this.startDate = new Date();
this.endDate = new Date();
this.updateGraphData();
}
searchAll(): void {
this.start_date = new Date(2020,9,5);
this.end_date = new Date();
this.startDate = new Date(2020, 9, 5);
this.endDate = new Date();
this.updateGraphData();
}
updateGraphData(): void {
if (this.form.location.trim().split(" ").length == 1) {
this.ChartName = "Total Samples per Station @ Location " + this.form.location;
if (this.form.location.trim().split(' ').length === 1) {
this.ChartName = 'Total Samples per Station @ Location ' + this.form.location;
} else {
this.ChartName = "Total Samples per Location";
this.ChartName = 'Total Samples per Location';
}
if (this.form.location.trim() == "") {
this.ChartName = "Total Samples per Location";
if (this.form.location.trim() === '') {
this.ChartName = 'Total Samples per Location';
}
this.form.start_date = this.start_date.toLocaleDateString();
this.form.end_date = this.end_date.toLocaleDateString();
this.form.startDate = this.startDate.toLocaleDateString();
this.form.endDate = this.endDate.toLocaleDateString();
var date = new Date();
var date_2 = new Date();
const date = new Date();
const date2 = new Date();
date.setDate(this.start_date.getDate() - 7);
this.start_date_1 = date.toLocaleDateString();
date.setDate(this.startDate.getDate() - 7);
this.startDate1 = date.toLocaleDateString();
date_2.setDate(this.end_date.getDate() - 7);
this.end_date_1 = date_2.toLocaleDateString();
date2.setDate(this.endDate.getDate() - 7);
this.endDate1 = date2.toLocaleDateString();
date.setDate(date.getDate() - 7);
this.start_date_2 = date.toLocaleDateString();
this.startDate2 = date.toLocaleDateString();
date_2.setDate(date_2.getDate() - 7);
this.end_date_2 = date_2.toLocaleDateString();
date2.setDate(date2.getDate() - 7);
this.endDate2 = date2.toLocaleDateString();
var temp = new Date(this.start_date.getTime());
const temp = new Date(this.startDate.getTime());
this.dailyChartLabels = [];
while (true) {
this.dailyChartLabels.push(temp.toLocaleDateString());
if (temp.toLocaleDateString() == this.end_date.toLocaleDateString()) {
if (temp.toLocaleDateString() === this.endDate.toLocaleDateString()) {
break;
} else {
temp.setDate(temp.getDate() + 1);
@ -169,24 +169,24 @@ export class GraphsComponent implements OnInit {
this.graphService.getDayData(this.form).subscribe(tempData => {
this.tempData = tempData;
this.dailyChartsData = [];
Object.entries(this.tempData).forEach(([loc_or_stat_name, totals]) => {
this.dailyChartsData.push({ data: totals, label: loc_or_stat_name, stack: 'a' })
Object.entries(this.tempData).forEach(([LOC_OR_STAT_NAME, totals]) => {
this.dailyChartsData.push({ data: totals, label: LOC_OR_STAT_NAME, stack: 'a' });
});
});
this.graphService.getWeekdayData(this.form).subscribe(tempData => {
this.tempData = tempData;
this.weekdayChartsData = [];
Object.entries(this.tempData).forEach(([loc_or_stat_name, totals]) => {
this.weekdayChartsData.push({ data: totals, label: loc_or_stat_name, stack: 'a' })
Object.entries(this.tempData).forEach(([LOC_OR_STAT_NAME, totals]) => {
this.weekdayChartsData.push({ data: totals, label: LOC_OR_STAT_NAME, stack: 'a' });
});
});
this.graphService.getHourData(this.form).subscribe(tempData => {
this.tempData = tempData;
this.hourlyChartsData = [];
Object.entries(this.tempData).forEach(([loc_or_stat_name, totals]) => {
this.hourlyChartsData.push({ data: totals, label: loc_or_stat_name, stack: 'c' })
Object.entries(this.tempData).forEach(([LOC_OR_STAT_NAME, totals]) => {
this.hourlyChartsData.push({ data: totals, label: LOC_OR_STAT_NAME, stack: 'c' });
});
});
@ -197,10 +197,10 @@ export class GraphsComponent implements OnInit {
}
ngOnInit(): void {
var end_date = new Date();
var start_date = new Date();
this.form.start_date = start_date.toLocaleDateString();
this.form.end_date = end_date.toLocaleDateString();
const endDate = new Date();
const startDate = new Date();
this.form.startDate = startDate.toLocaleDateString();
this.form.endDate = endDate.toLocaleDateString();
this.updateGraphData();
}
@ -214,7 +214,7 @@ export class GraphsComponent implements OnInit {
const label = chart.data.labels[clickedElementIndex];
// get value by index
const value = chart.data.datasets[0].data[clickedElementIndex];
console.log(clickedElementIndex, label, value)
console.log(clickedElementIndex, label, value);
// this.updateGraphData();
}
}

View File

@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { ApiService } from '../services/api.service';
import { PageEvent } from '@angular/material/paginator'
import { PageEvent } from '@angular/material/paginator';
import { IvyFile } from '../models/ivyfile.interface';
@Component({
@ -10,32 +10,32 @@ import { IvyFile } from '../models/ivyfile.interface';
styleUrls: ['./imported-files.component.css']
})
export class ImportedFilesComponent implements OnInit {
fileDataList: any[][] = [];
constructor(private fileService: ApiService) { }
fileDataList: any[][] = [];
displayedColumns: string[] = ['position', 'name', 'weight', 'text', 'email'];
currentPage = 0;
pageSize = 10;
ngOnInit(): void {
this.fileService.getFilesInfo(0).subscribe(fileList => this.fileDataList = fileList);
}
displayedColumns: string[] = ['position', 'name', 'weight', 'text', 'email'];
current_page: number = 0;
pageSize: number = 10;
updatePage() {
this.fileService.getFilesInfo(this.current_page).subscribe(fileList => this.fileDataList = fileList);
this.fileService.getFilesInfo(this.currentPage).subscribe(fileList => this.fileDataList = fileList);
}
next() {
if (this.fileDataList.length > 0) {
this.current_page += 1;
this.currentPage += 1;
this.updatePage();
}
}
prev() {
if (this.current_page > 0) {
this.current_page -= 1;
if (this.currentPage > 0) {
this.currentPage -= 1;
this.updatePage();
}
}

View File

@ -2,4 +2,4 @@ export interface InventoryDeposit {
amount: number;
notes: string;
date_added: string;
}
}

View File

@ -2,4 +2,4 @@ export interface IvyFile {
sample_count: number;
file_name: string;
date_added: Date;
}
}

View File

@ -8,4 +8,4 @@ export interface Sample {
computing_id?: string;
phone?: string;
email?: string;
}
}

View File

@ -1,8 +1,8 @@
export interface SearchForm{
start_date: string;
end_date: string;
student_id : string;
location : string;
compute_id : string;
include_tests : boolean;
}
startDate: string;
endDate: string;
studentId: string;
location: string;
computeId: string;
includeTests: boolean;
}

View File

@ -39,8 +39,8 @@ export class ApiService {
}
/** */
getDeposits(page: Number): Observable<InventoryDeposit[]> {
let param = new HttpParams().set("page", String(page));
getDeposits(page: number): Observable<InventoryDeposit[]> {
const param = new HttpParams().set('page', String(page));
const url = this.apiRoot + this.endpoints.deposit;
return this.httpClient
@ -60,11 +60,11 @@ export class ApiService {
/** */
getFilesInfo(page: Number): Observable<Array<Array<any>>> {
let params = new HttpParams().set("page", String(page));
getFilesInfo(page: number): Observable<Array<Array<any>>> {
const params = new HttpParams().set('page', String(page));
const url = this.apiRoot + this.endpoints.ivy_file;
return this.httpClient
.get<Array<Array<any>>>(url, { params: params })
.get<Array<Array<any>>>(url, { params })
.pipe(timeout(1000), catchError(err => this._handleError(err)))
.pipe(catchError(err => this._handleError(err)));
}

View File

@ -16,17 +16,17 @@ import { SearchForm } from '../models/search_form';
export class GraphService {
apiRoot: string;
constructor(@Inject('APP_ENVIRONMENT') private environment: AppEnvironment,
@Inject(APP_BASE_HREF) public baseHref: string,
private httpClient: HttpClient,
@Inject(APP_BASE_HREF) public baseHref: string,
private httpClient: HttpClient,
) {
this.apiRoot = environment.api;
}
getRawSearchData(form: SearchForm, page: Number): Observable<Sample[]> {
var params = this.createParams(form);
params = params.set("page", String(page));
getRawSearchData(form: SearchForm, page: number): Observable<Sample[]> {
let params = this.createParams(form);
params = params.set('page', String(page));
return this.httpClient
.get<Sample[]>(this.apiRoot + `/dashboard/search`, { params: params })
.get<Sample[]>(this.apiRoot + `/dashboard/search`, { params })
.pipe(timeout(1000), catchError(err => this._handleError(err)))
.pipe(catchError(err => this._handleError(err)));
}
@ -42,14 +42,14 @@ export class GraphService {
getDayData(form: SearchForm): Observable<JSON> {
return this.httpClient
.get<JSON>(this.apiRoot + "/dashboard/day", { params: this.createParams(form) })
.get<JSON>(this.apiRoot + '/dashboard/day', { params: this.createParams(form) })
.pipe(timeout(1000), catchError(err => this._handleError(err)))
.pipe(catchError(err => this._handleError(err)));
}
getWeekdayData(form: SearchForm): Observable<JSON> {
return this.httpClient
.get<JSON>(this.apiRoot + "/dashboard/weekday", { params: this.createParams(form) })
.get<JSON>(this.apiRoot + '/dashboard/weekday', { params: this.createParams(form) })
.pipe(timeout(1000), catchError(err => this._handleError(err)))
.pipe(catchError(err => this._handleError(err)));
@ -57,19 +57,19 @@ export class GraphService {
getHourData(form: SearchForm): Observable<JSON> {
return this.httpClient
.get<JSON>(this.apiRoot + "/dashboard/hour", { params: this.createParams(form) })
.get<JSON>(this.apiRoot + '/dashboard/hour', { params: this.createParams(form) })
.pipe(timeout(1000), catchError(err => this._handleError(err)))
.pipe(catchError(err => this._handleError(err)));
}
createParams(form: SearchForm): HttpParams {
let params = new HttpParams()
.set("start_date", form.start_date)
.set("end_date", form.end_date)
.set("student_id", form.student_id)
.set("compute_id", form.compute_id)
.set("location", form.location)
.set("include_tests", String(form.include_tests))
const params = new HttpParams()
.set('start_date', form.startDate)
.set('end_date', form.endDate)
.set('student_id', form.studentId)
.set('compute_id', form.computeId)
.set('location', form.location)
.set('include_tests', String(form.includeTests));
return params;
}

View File

@ -1,5 +1,5 @@
import {Injectable} from '@angular/core';
//https://github.com/visjs/vis-network/issues/67
// https://github.com/visjs/vis-network/issues/67
import * as createClone from 'rfdc';
import {BehaviorSubject} from 'rxjs';
import serializeJs from 'serialize-javascript';

View File

@ -21,7 +21,7 @@
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
"strictInjectionParameters": true,
}
}