Run `prettier` on //scouting
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: Idbb6011040f44d2b6c4158bf4c84a37818f258a5
diff --git a/scouting/scouting_test.protractor.on-prepare.js b/scouting/scouting_test.protractor.on-prepare.js
index 7919fe7..a1f7267 100644
--- a/scouting/scouting_test.protractor.on-prepare.js
+++ b/scouting/scouting_test.protractor.on-prepare.js
@@ -8,15 +8,15 @@
const protractorUtils = require('@bazel/protractor/protractor-utils');
const protractor = require('protractor');
-module.exports = function(config) {
+module.exports = function (config) {
// In this example, `@bazel/protractor/protractor-utils` is used to run
// the server. protractorUtils.runServer() runs the server on a randomly
// selected port (given a port flag to pass to the server as an argument).
// The port used is returned in serverSpec and the protractor serverUrl
// is the configured.
return protractorUtils
- .runServer(config.workspace, config.server, '--port', [])
- .then(serverSpec => {
- protractor.browser.baseUrl = `http://localhost:${serverSpec.port}`;
- });
+ .runServer(config.workspace, config.server, '--port', [])
+ .then((serverSpec) => {
+ protractor.browser.baseUrl = `http://localhost:${serverSpec.port}`;
+ });
};
diff --git a/scouting/scouting_test.ts b/scouting/scouting_test.ts
index 9a7ecc6..98e1d00 100644
--- a/scouting/scouting_test.ts
+++ b/scouting/scouting_test.ts
@@ -7,7 +7,7 @@
async function loadPage() {
await disableAlerts();
await browser.navigate().refresh();
- expect((await browser.getTitle())).toEqual('FRC971 Scouting Application');
+ expect(await browser.getTitle()).toEqual('FRC971 Scouting Application');
await disableAlerts();
}
@@ -15,9 +15,10 @@
// Protractor since they're not angular elements. We achieve this by checking
// an invisible checkbox that's off-screen.
async function disableAlerts() {
- await browser.executeAsyncScript(function(callback) {
- let block_alerts =
- document.getElementById('block_alerts') as HTMLInputElement;
+ await browser.executeAsyncScript(function (callback) {
+ let block_alerts = document.getElementById(
+ 'block_alerts'
+ ) as HTMLInputElement;
block_alerts.checked = true;
callback();
});
@@ -49,11 +50,16 @@
// Asserts that the n'th instance of a field on the "Submit and Review"
// screen has a specific value.
async function expectNthReviewFieldToBe(
- fieldName: string, n: number, expectedValue: string) {
- expect(await element.all(by.cssContainingText('li', `${fieldName}:`))
- .get(n)
- .getText())
- .toEqual(`${fieldName}: ${expectedValue}`);
+ fieldName: string,
+ n: number,
+ expectedValue: string
+) {
+ expect(
+ await element
+ .all(by.cssContainingText('li', `${fieldName}:`))
+ .get(n)
+ .getText()
+ ).toEqual(`${fieldName}: ${expectedValue}`);
}
// Sets a text field to the specified value.
@@ -62,7 +68,11 @@
// overwrite the text that is there. If we didn't hit CTRL-A to select all
// the text, we'd be appending to whatever is there already.
return element(by.id(id)).sendKeys(
- protractor.Key.CONTROL, 'a', protractor.Key.NULL, value);
+ protractor.Key.CONTROL,
+ 'a',
+ protractor.Key.NULL,
+ value
+ );
}
// Moves the nth slider left or right. A positive "adjustBy" value moves the
@@ -72,7 +82,7 @@
async function adjustNthSliderBy(n: number, adjustBy: number) {
const slider = element.all(by.css('input[type=range]')).get(n);
const key =
- adjustBy > 0 ? protractor.Key.ARROW_RIGHT : protractor.Key.ARROW_LEFT;
+ adjustBy > 0 ? protractor.Key.ARROW_RIGHT : protractor.Key.ARROW_LEFT;
for (let i = 0; i < Math.abs(adjustBy); i++) {
await slider.sendKeys(key);
}
@@ -85,22 +95,26 @@
describe('The scouting web page', () => {
beforeAll(async () => {
await browser.get(browser.baseUrl);
- expect((await browser.getTitle())).toEqual('FRC971 Scouting Application');
+ expect(await browser.getTitle()).toEqual('FRC971 Scouting Application');
await disableAlerts();
// Import the match list before running any tests. Ideally this should be
// run in beforeEach(), but it's not worth doing that at this time. Our
// tests are basic enough not to require this.
- await element(by.cssContainingText('.nav-link', 'Import Match List'))
- .click();
+ await element(
+ by.cssContainingText('.nav-link', 'Import Match List')
+ ).click();
expect(await getHeadingText()).toEqual('Import Match List');
await setTextboxByIdTo('year', '2016');
await setTextboxByIdTo('event_code', 'nytr');
await element(by.buttonText('Import')).click();
- await browser.wait(EC.textToBePresentInElement(
+ await browser.wait(
+ EC.textToBePresentInElement(
element(by.css('.progress_message')),
- 'Successfully imported match list.'));
+ 'Successfully imported match list.'
+ )
+ );
});
it('should: show matches in chronological order.', async () => {
@@ -133,8 +147,9 @@
// Attempt to submit and validate the error.
await element(by.buttonText('Submit')).click();
- expect(await getErrorMessage())
- .toContain('Failed to find team 971 in match 3 in the schedule.');
+ expect(await getErrorMessage()).toContain(
+ 'Failed to find team 971 in match 3 in the schedule.'
+ );
});
// Make sure that each page on the Entry tab has both "Next" and "Back"
@@ -164,8 +179,9 @@
// Go backwards through the screens.
for (let i = 0; i < expectedOrder.length; i++) {
- expect(await getHeadingText())
- .toEqual(expectedOrder[expectedOrder.length - i - 1]);
+ expect(await getHeadingText()).toEqual(
+ expectedOrder[expectedOrder.length - i - 1]
+ );
if (i != expectedOrder.length - 1) {
await element(by.buttonText('Back')).click();
}
@@ -234,7 +250,8 @@
await element(by.buttonText('Submit')).click();
await browser.wait(
- EC.textToBePresentInElement(element(by.css('.header')), 'Success'));
+ EC.textToBePresentInElement(element(by.css('.header')), 'Success')
+ );
// TODO(phil): Make sure the data made its way to the database correctly.
});
@@ -251,18 +268,18 @@
// We expect 2 fully loaded images.
browser
- .executeAsyncScript(function(callback) {
- let images = document.getElementsByTagName('img');
- let numLoaded = 0;
- for (let i = 0; i < images.length; i += 1) {
- if (images[i].naturalWidth > 0) {
- numLoaded += 1;
- }
+ .executeAsyncScript(function (callback) {
+ let images = document.getElementsByTagName('img');
+ let numLoaded = 0;
+ for (let i = 0; i < images.length; i += 1) {
+ if (images[i].naturalWidth > 0) {
+ numLoaded += 1;
}
- callback(numLoaded);
- })
- .then(function(numLoaded) {
- expect(numLoaded).toBe(2);
- });
+ }
+ callback(numLoaded);
+ })
+ .then(function (numLoaded) {
+ expect(numLoaded).toBe(2);
+ });
});
});
diff --git a/scouting/www/app.ng.html b/scouting/www/app.ng.html
index ac9ef03..ab1e433 100644
--- a/scouting/www/app.ng.html
+++ b/scouting/www/app.ng.html
@@ -1,26 +1,66 @@
<!-- Hidden element for protractor to disable alerts. -->
<form class="visually-hidden">
- <input type="checkbox" name="block_alerts" value="1" id="block_alerts" #block_alerts>
+ <input
+ type="checkbox"
+ name="block_alerts"
+ value="1"
+ id="block_alerts"
+ #block_alerts
+ />
</form>
<ul class="nav nav-tabs">
<li class="nav-item">
- <a class="nav-link" [class.active]="tabIs('MatchList')" (click)="switchTabToGuarded('MatchList')">Match List</a>
+ <a
+ class="nav-link"
+ [class.active]="tabIs('MatchList')"
+ (click)="switchTabToGuarded('MatchList')"
+ >
+ Match List
+ </a>
</li>
<li class="nav-item">
- <a class="nav-link" [class.active]="tabIs('Entry')" (click)="switchTabToGuarded('Entry')">Data Entry</a>
+ <a
+ class="nav-link"
+ [class.active]="tabIs('Entry')"
+ (click)="switchTabToGuarded('Entry')"
+ >
+ Data Entry
+ </a>
</li>
<li class="nav-item">
- <a class="nav-link" [class.active]="tabIs('Notes')" (click)="switchTabToGuarded('Notes')">Notes</a>
+ <a
+ class="nav-link"
+ [class.active]="tabIs('Notes')"
+ (click)="switchTabToGuarded('Notes')"
+ >
+ Notes
+ </a>
</li>
<li class="nav-item">
- <a class="nav-link" [class.active]="tabIs('ImportMatchList')" (click)="switchTabToGuarded('ImportMatchList')">Import Match List</a>
+ <a
+ class="nav-link"
+ [class.active]="tabIs('ImportMatchList')"
+ (click)="switchTabToGuarded('ImportMatchList')"
+ >
+ Import Match List
+ </a>
</li>
</ul>
<ng-container [ngSwitch]="tab">
- <app-match-list (selectedTeamEvent)="selectTeamInMatch($event)" *ngSwitchCase="'MatchList'"></app-match-list>
- <app-entry (switchTabsEvent)="switchTabTo($event)" [teamNumber]="selectedTeamInMatch.teamNumber" [matchNumber]="selectedTeamInMatch.matchNumber" *ngSwitchCase="'Entry'"></app-entry>
+ <app-match-list
+ (selectedTeamEvent)="selectTeamInMatch($event)"
+ *ngSwitchCase="'MatchList'"
+ ></app-match-list>
+ <app-entry
+ (switchTabsEvent)="switchTabTo($event)"
+ [teamNumber]="selectedTeamInMatch.teamNumber"
+ [matchNumber]="selectedTeamInMatch.matchNumber"
+ *ngSwitchCase="'Entry'"
+ ></app-entry>
<frc971-notes *ngSwitchCase="'Notes'"></frc971-notes>
- <app-import-match-list *ngSwitchCase="'ImportMatchList'"></app-import-match-list>
+ <app-import-match-list
+ *ngSwitchCase="'ImportMatchList'"
+ ></app-import-match-list>
</ng-container>
diff --git a/scouting/www/app.ts b/scouting/www/app.ts
index c82fbb3..02af125 100644
--- a/scouting/www/app.ts
+++ b/scouting/www/app.ts
@@ -1,20 +1,23 @@
import {Component, ElementRef, ViewChild} from '@angular/core';
-type Tab = 'MatchList'|'Notes'|'Entry'|'ImportMatchList';
+type Tab = 'MatchList' | 'Notes' | 'Entry' | 'ImportMatchList';
type TeamInMatch = {
- teamNumber: number,
- matchNumber: number,
- compLevel: string
+ teamNumber: number;
+ matchNumber: number;
+ compLevel: string;
};
@Component({
selector: 'my-app',
templateUrl: './app.ng.html',
- styleUrls: ['./common.css']
+ styleUrls: ['./common.css'],
})
export class App {
- selectedTeamInMatch:
- TeamInMatch = {teamNumber: 1, matchNumber: 1, compLevel: 'qm'};
+ selectedTeamInMatch: TeamInMatch = {
+ teamNumber: 1,
+ matchNumber: 1,
+ compLevel: 'qm',
+ };
tab: Tab = 'MatchList';
@ViewChild('block_alerts') block_alerts: ElementRef;
diff --git a/scouting/www/app_module.ts b/scouting/www/app_module.ts
index e8518d1..9c762f6 100644
--- a/scouting/www/app_module.ts
+++ b/scouting/www/app_module.ts
@@ -21,5 +21,4 @@
exports: [App],
bootstrap: [App],
})
-export class AppModule {
-}
+export class AppModule {}
diff --git a/scouting/www/common.css b/scouting/www/common.css
index 43f117e..700df9e 100644
--- a/scouting/www/common.css
+++ b/scouting/www/common.css
@@ -3,7 +3,8 @@
.error_message {
color: red;
}
-.error_message:empty, .progress_message:empty {
+.error_message:empty,
+.progress_message:empty {
/* TODO(phil): Figure out a way to make these take up no horizontal space.
* I.e. It would be nice to keep the error message and the progress message
* aligned when they are non-empty. */
diff --git a/scouting/www/counter_button/counter_button.component.css b/scouting/www/counter_button/counter_button.component.css
index 39faea8..35c1929 100644
--- a/scouting/www/counter_button/counter_button.component.css
+++ b/scouting/www/counter_button/counter_button.component.css
@@ -6,6 +6,5 @@
}
* {
- padding: 10px;
+ padding: 10px;
}
-
diff --git a/scouting/www/counter_button/counter_button.module.ts b/scouting/www/counter_button/counter_button.module.ts
index 25bafcb..719ce7c 100644
--- a/scouting/www/counter_button/counter_button.module.ts
+++ b/scouting/www/counter_button/counter_button.module.ts
@@ -6,5 +6,4 @@
declarations: [CounterButton],
exports: [CounterButton],
})
-export class CounterButtonModule {
-}
+export class CounterButtonModule {}
diff --git a/scouting/www/entry/entry.component.css b/scouting/www/entry/entry.component.css
index e6f81b3..24e4127 100644
--- a/scouting/www/entry/entry.component.css
+++ b/scouting/www/entry/entry.component.css
@@ -1,5 +1,5 @@
* {
- padding: 10px;
+ padding: 10px;
}
.buttons {
diff --git a/scouting/www/entry/entry.component.ts b/scouting/www/entry/entry.component.ts
index 33c856f..c90e3d0 100644
--- a/scouting/www/entry/entry.component.ts
+++ b/scouting/www/entry/entry.component.ts
@@ -1,17 +1,34 @@
-import {Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core';
+import {
+ Component,
+ ElementRef,
+ EventEmitter,
+ Input,
+ OnInit,
+ Output,
+ ViewChild,
+} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {Builder, ByteBuffer} from 'flatbuffers';
import {ErrorResponse} from 'org_frc971/scouting/webserver/requests/messages/error_response_generated';
-import {ClimbLevel, SubmitDataScouting} from 'org_frc971/scouting/webserver/requests/messages/submit_data_scouting_generated';
+import {
+ ClimbLevel,
+ SubmitDataScouting,
+} from 'org_frc971/scouting/webserver/requests/messages/submit_data_scouting_generated';
import {SubmitDataScoutingResponse} from 'org_frc971/scouting/webserver/requests/messages/submit_data_scouting_response_generated';
-type Section = 'Team Selection'|'Auto'|'TeleOp'|'Climb'|'Other'|
- 'Review and Submit'|'Success';
+type Section =
+ | 'Team Selection'
+ | 'Auto'
+ | 'TeleOp'
+ | 'Climb'
+ | 'Other'
+ | 'Review and Submit'
+ | 'Success';
@Component({
selector: 'app-entry',
templateUrl: './entry.ng.html',
- styleUrls: ['../common.css', './entry.component.css']
+ styleUrls: ['../common.css', './entry.component.css'],
})
export class EntryComponent {
// Re-export the type here so that we can use it in the `[value]` attribute
@@ -59,7 +76,6 @@
} else if (this.section === 'Other') {
this.section = 'Review and Submit';
} else if (this.section === 'Review and Submit') {
-
this.submitDataScouting();
return;
} else if (this.section === 'Success') {
@@ -108,7 +124,10 @@
SubmitDataScouting.addUpperGoalTele(builder, this.teleUpperShotsMade);
SubmitDataScouting.addLowerGoalTele(builder, this.teleLowerShotsMade);
SubmitDataScouting.addDefenseRating(builder, this.defensePlayedScore);
- SubmitDataScouting.addDefenseReceivedRating(builder, this.defensePlayedOnScore);
+ SubmitDataScouting.addDefenseReceivedRating(
+ builder,
+ this.defensePlayedOnScore
+ );
SubmitDataScouting.addAutoBall1(builder, this.ball1);
SubmitDataScouting.addAutoBall2(builder, this.ball2);
SubmitDataScouting.addAutoBall3(builder, this.ball3);
@@ -120,8 +139,10 @@
builder.finish(SubmitDataScouting.endSubmitDataScouting(builder));
const buffer = builder.asUint8Array();
- const res = await fetch(
- '/requests/submit/data_scouting', {method: 'POST', body: buffer});
+ const res = await fetch('/requests/submit/data_scouting', {
+ method: 'POST',
+ body: buffer,
+ });
if (res.ok) {
// We successfully submitted the data. Report success.
@@ -132,8 +153,7 @@
const parsedResponse = ErrorResponse.getRootAsErrorResponse(fbBuffer);
const errorMessage = parsedResponse.errorMessage();
- this.errorMessage =
- `Received ${res.status} ${res.statusText}: "${errorMessage}"`;
+ this.errorMessage = `Received ${res.status} ${res.statusText}: "${errorMessage}"`;
}
}
}
diff --git a/scouting/www/entry/entry.module.ts b/scouting/www/entry/entry.module.ts
index 45a8a62..38e272e 100644
--- a/scouting/www/entry/entry.module.ts
+++ b/scouting/www/entry/entry.module.ts
@@ -19,5 +19,4 @@
exports: [EntryComponent],
imports: [CommonModule, FormsModule, CounterButtonModule],
})
-export class EntryModule {
-}
+export class EntryModule {}
diff --git a/scouting/www/entry/entry.ng.html b/scouting/www/entry/entry.ng.html
index 2b4f60d..0e76268 100644
--- a/scouting/www/entry/entry.ng.html
+++ b/scouting/www/entry/entry.ng.html
@@ -1,210 +1,398 @@
<div class="header" #header>
- <h2>{{section}}</h2>
+ <h2>{{section}}</h2>
</div>
<ng-container [ngSwitch]="section">
- <div *ngSwitchCase="'Team Selection'" id="team_selection" class="container-fluid">
- <div class="row">
- <label for="match_number">Match Number</label>
- <input [(ngModel)]="matchNumber" type="number" id="match_number" min="1" max="999">
- </div>
- <div class="row">
- <label for="team_number">Team Number</label>
- <input [(ngModel)]="teamNumber" type="number" id="team_number" min="1" max="9999">
- </div>
- <div class="buttons">
- <!-- hack to right align the next button -->
- <div></div>
- <button class="btn btn-primary" (click)="nextSection()">Next</button>
- </div>
+ <div
+ *ngSwitchCase="'Team Selection'"
+ id="team_selection"
+ class="container-fluid"
+ >
+ <div class="row">
+ <label for="match_number">Match Number</label>
+ <input
+ [(ngModel)]="matchNumber"
+ type="number"
+ id="match_number"
+ min="1"
+ max="999"
+ />
+ </div>
+ <div class="row">
+ <label for="team_number">Team Number</label>
+ <input
+ [(ngModel)]="teamNumber"
+ type="number"
+ id="team_number"
+ min="1"
+ max="9999"
+ />
+ </div>
+ <div class="buttons">
+ <!-- hack to right align the next button -->
+ <div></div>
+ <button class="btn btn-primary" (click)="nextSection()">Next</button>
+ </div>
+ </div>
+
+ <div *ngSwitchCase="'Auto'" id="auto" class="container-fluid">
+ <div class="row">
+ <img src="/pictures/field/quadrants.jpeg" alt="Quadrants Image" />
+ <form>
+ <input
+ type="radio"
+ [(ngModel)]="quadrant"
+ name="quadrant"
+ id="quadrant1"
+ [value]="1"
+ />
+ <label for="quadrant1">Quadrant 1</label>
+ <input
+ type="radio"
+ [(ngModel)]="quadrant"
+ name="quadrant"
+ id="quadrant2"
+ [value]="2"
+ />
+ <label for="quadrant2">Quadrant 2</label>
+ <br />
+ <input
+ type="radio"
+ [(ngModel)]="quadrant"
+ name="quadrant"
+ id="quadrant3"
+ [value]="3"
+ />
+ <label for="quadrant3">Quadrant 3</label>
+ <input
+ type="radio"
+ [(ngModel)]="quadrant"
+ name="quadrant"
+ id="quadrant4"
+ [value]="4"
+ />
+ <label for="quadrant4">Quadrant 4</label>
+ </form>
+ </div>
+ <div class="row">
+ <img src="/pictures/field/balls.jpeg" alt="Image" />
+ <form>
+ <!--Choice for each ball location-->
+ <input
+ [(ngModel)]="ball1"
+ type="checkbox"
+ name="1ball"
+ value="1"
+ id="ball-1"
+ />
+ <label for="ball-1">Ball 1</label>
+ <input
+ [(ngModel)]="ball2"
+ type="checkbox"
+ name="2ball"
+ value="2"
+ id="ball-2"
+ />
+ <label for="ball-2">Ball 2</label>
+ <br />
+ <input
+ [(ngModel)]="ball3"
+ type="checkbox"
+ name="3ball"
+ value="3"
+ id="ball-3"
+ />
+ <label for="ball-3">Ball 3</label>
+ <input
+ [(ngModel)]="ball4"
+ type="checkbox"
+ name="4ball"
+ value="4"
+ id="ball-4"
+ />
+ <label for="ball-4">Ball 4</label>
+ <br />
+ <input
+ [(ngModel)]="ball5"
+ type="checkbox"
+ name="5ball"
+ value="5"
+ id="ball-5"
+ />
+ <label for="ball-5">Ball 5</label>
+ </form>
+ </div>
+ <div class="row justify-content-center">
+ <frc971-counter-button class="col-4" [(value)]="autoUpperShotsMade">
+ Upper
+ </frc971-counter-button>
+ <frc971-counter-button class="col-4" [(value)]="autoLowerShotsMade">
+ Lower
+ </frc971-counter-button>
+ <frc971-counter-button class="col-4" [(value)]="autoShotsMissed">
+ Missed
+ </frc971-counter-button>
+ </div>
+ <div class="buttons">
+ <button class="btn btn-primary" (click)="prevSection()">Back</button>
+ <button class="btn btn-primary" (click)="nextSection()">Next</button>
+ </div>
+ </div>
+
+ <div *ngSwitchCase="'TeleOp'" id="teleop" class="container-fluid">
+ <div class="row justify-content-center">
+ <frc971-counter-button class="col-4" [(value)]="teleUpperShotsMade">
+ Upper
+ </frc971-counter-button>
+ <frc971-counter-button class="col-4" [(value)]="teleLowerShotsMade">
+ Lower
+ </frc971-counter-button>
+ <frc971-counter-button class="col-4" [(value)]="teleShotsMissed">
+ Missed
+ </frc971-counter-button>
+ </div>
+ <div class="buttons">
+ <button class="btn btn-primary" (click)="prevSection()">Back</button>
+ <button class="btn btn-primary" (click)="nextSection()">Next</button>
+ </div>
+ </div>
+
+ <div *ngSwitchCase="'Climb'" id="climb" class="container-fluid">
+ <form>
+ <input
+ [(ngModel)]="level"
+ type="radio"
+ name="level"
+ id="no_attempt"
+ [value]="ClimbLevel.NoAttempt"
+ />
+ <label for="no_attempt">No climbing attempt</label>
+ <br />
+ <input
+ [(ngModel)]="level"
+ type="radio"
+ name="level"
+ id="low"
+ [value]="ClimbLevel.Low"
+ />
+ <label for="low">Low</label>
+ <br />
+ <input
+ [(ngModel)]="level"
+ type="radio"
+ name="level"
+ id="medium"
+ [value]="ClimbLevel.Medium"
+ />
+ <label for="medium">Medium</label>
+ <br />
+ <input
+ [(ngModel)]="level"
+ type="radio"
+ name="level"
+ id="high"
+ [value]="ClimbLevel.High"
+ />
+ <label for="high">High</label>
+ <br />
+ <input
+ [(ngModel)]="level"
+ type="radio"
+ name="level"
+ id="transversal"
+ [value]="ClimbLevel.Transversal"
+ />
+ <label for="transversal">Transversal</label>
+ <br />
+ <input
+ [(ngModel)]="level"
+ type="radio"
+ name="level"
+ id="failed"
+ [value]="ClimbLevel.Failed"
+ />
+ <label for="failed">Failed</label>
+ <br />
+ <input
+ [(ngModel)]="level"
+ type="radio"
+ name="level"
+ id="failed_with_plenty_of_time"
+ [value]="ClimbLevel.FailedWithPlentyOfTime"
+ />
+ <label for="failed_with_plenty_of_time">
+ Failed (attempted with more than 10 seconds left)
+ </label>
+ <br />
+ </form>
+ <div class="row">
+ <h4>Comments</h4>
+ <textarea [(ngModel)]="comment" id="comment"></textarea>
+ </div>
+ <div class="buttons">
+ <button class="btn btn-primary" (click)="prevSection()">Back</button>
+ <button class="btn btn-primary" (click)="nextSection()">Next</button>
+ </div>
+ </div>
+
+ <div *ngSwitchCase="'Other'" id="defense" class="container-fluid">
+ <h4 class="text-center">
+ How much did other robots play defense against this robot?
+ </h4>
+ 0 - No defense played against this robot
+ <br />
+ 1 - Minimal defense
+ <br />
+ 2 - Some defense
+ <br />
+ 3 - About half the match was played against defense
+ <br />
+ 4 - Good amount of defense
+ <br />
+ 5 - Constant defense
+ <div class="row" style="min-height: 50px">
+ <div class="col-10">
+ <input
+ type="range"
+ min="0"
+ max="5"
+ [(ngModel)]="defensePlayedOnScore"
+ />
+ </div>
+ <div class="col">
+ <h6>{{defensePlayedOnScore}}</h6>
+ </div>
</div>
- <div *ngSwitchCase="'Auto'" id="auto" class="container-fluid">
- <div class="row">
- <img src="/pictures/field/quadrants.jpeg" alt="Quadrants Image">
- <form>
- <input type="radio" [(ngModel)]="quadrant" name="quadrant" id="quadrant1" [value]="1">
- <label for="quadrant1">Quadrant 1</label>
- <input type="radio" [(ngModel)]="quadrant" name="quadrant" id="quadrant2" [value]="2">
- <label for="quadrant2">Quadrant 2</label><br>
- <input type="radio" [(ngModel)]="quadrant" name="quadrant" id="quadrant3" [value]="3">
- <label for="quadrant3">Quadrant 3</label>
- <input type="radio" [(ngModel)]="quadrant" name="quadrant" id="quadrant4" [value]="4">
- <label for="quadrant4">Quadrant 4</label>
- </form>
- </div>
- <div class="row">
- <img src="/pictures/field/balls.jpeg" alt="Image">
- <form>
- <!--Choice for each ball location-->
- <input [(ngModel)]=ball1 type="checkbox" name="1ball" value="1" id="ball-1"><label for="ball-1">Ball 1</label>
- <input [(ngModel)]=ball2 type="checkbox" name="2ball" value="2" id="ball-2"><label for="ball-2">Ball 2</label><br>
- <input [(ngModel)]=ball3 type="checkbox" name="3ball" value="3" id="ball-3"><label for="ball-3">Ball 3</label>
- <input [(ngModel)]=ball4 type="checkbox" name="4ball" value="4" id="ball-4"><label for="ball-4">Ball 4</label><br>
- <input [(ngModel)]=ball5 type="checkbox" name="5ball" value="5" id="ball-5"><label for="ball-5">Ball 5</label>
- </form>
- </div>
- <div class="row justify-content-center">
- <frc971-counter-button class="col-4" [(value)]="autoUpperShotsMade">Upper</frc971-counter-button>
- <frc971-counter-button class="col-4" [(value)]="autoLowerShotsMade">Lower</frc971-counter-button>
- <frc971-counter-button class="col-4" [(value)]="autoShotsMissed">Missed</frc971-counter-button>
- </div>
- <div class="buttons">
- <button class="btn btn-primary" (click)="prevSection()">Back</button>
- <button class="btn btn-primary" (click)="nextSection()">Next</button>
- </div>
+ <h4 class="text-center">
+ How much did this robot play defense against other robots?
+ </h4>
+ 0 - This robot did not play defense
+ <br />
+ 1 - Minimal defense
+ <br />
+ 2 - Some defense
+ <br />
+ 3 - Defense was played for about half the match
+ <br />
+ 4 - Good amount of defense
+ <br />
+ 5 - Constant defense
+ <div class="row">
+ <div class="col-10">
+ <input type="range" min="0" max="5" [(ngModel)]="defensePlayedScore" />
+ </div>
+ <div class="col">
+ <h6>{{defensePlayedScore}}</h6>
+ </div>
</div>
- <div *ngSwitchCase="'TeleOp'" id="teleop" class="container-fluid">
- <div class="row justify-content-center">
- <frc971-counter-button class="col-4" [(value)]="teleUpperShotsMade">Upper</frc971-counter-button>
- <frc971-counter-button class="col-4" [(value)]="teleLowerShotsMade">Lower</frc971-counter-button>
- <frc971-counter-button class="col-4" [(value)]="teleShotsMissed">Missed</frc971-counter-button>
- </div>
- <div class="buttons">
- <button class="btn btn-primary" (click)="prevSection()">Back</button>
- <button class="btn btn-primary" (click)="nextSection()">Next</button>
- </div>
+ <div class="row">
+ <form>
+ <input
+ type="checkbox"
+ [(ngModel)]="noShow"
+ name="no_show"
+ id="no_show"
+ />
+ <label for="no_show">No show</label>
+ <br />
+ <input
+ type="checkbox"
+ [(ngModel)]="neverMoved"
+ name="never_moved"
+ id="never_moved"
+ />
+ <label for="never_moved">Never moved</label>
+ <br />
+ <input
+ type="checkbox"
+ [(ngModel)]="batteryDied"
+ name="battery_died"
+ id="battery_died"
+ />
+ <label for="battery_died">Battery died</label>
+ <br />
+ <input
+ type="checkbox"
+ [(ngModel)]="mechanicallyBroke"
+ name="mechanically_broke"
+ id="mechanically_broke"
+ />
+ <label for="mechanically_broke">Broke (mechanically)</label>
+ <br />
+ <input
+ type="checkbox"
+ [(ngModel)]="lostComs"
+ name="lost_coms"
+ id="lost_coms"
+ />
+ <label for="lost_coms">Lost coms</label>
+ </form>
</div>
- <div *ngSwitchCase="'Climb'" id="climb" class="container-fluid">
- <form>
- <input [(ngModel)]="level" type="radio" name="level" id="no_attempt" [value]="ClimbLevel.NoAttempt">
- <label for="no_attempt">No climbing attempt</label><br>
- <input [(ngModel)]="level" type="radio" name="level" id="low" [value]="ClimbLevel.Low">
- <label for="low">Low</label><br>
- <input [(ngModel)]="level" type="radio" name="level" id="medium" [value]="ClimbLevel.Medium">
- <label for="medium">Medium</label><br>
- <input [(ngModel)]="level" type="radio" name="level" id="high" [value]="ClimbLevel.High">
- <label for="high">High</label><br>
- <input [(ngModel)]="level" type="radio" name="level" id="transversal" [value]="ClimbLevel.Transversal">
- <label for="transversal">Transversal</label><br>
- <input [(ngModel)]="level" type="radio" name="level" id="failed" [value]="ClimbLevel.Failed">
- <label for="failed">Failed</label><br>
- <input [(ngModel)]="level" type="radio" name="level" id="failed_with_plenty_of_time" [value]="ClimbLevel.FailedWithPlentyOfTime">
- <label for="failed_with_plenty_of_time">Failed (attempted with more than 10 seconds left)</label><br>
- </form>
- <div class="row">
- <h4>Comments</h4>
- <textarea [(ngModel)]="comment" id="comment"></textarea>
- </div>
- <div class="buttons">
- <button class="btn btn-primary" (click)="prevSection()">Back</button>
- <button class="btn btn-primary" (click)="nextSection()">Next</button>
- </div>
+ <div class="buttons">
+ <button class="btn btn-primary" (click)="prevSection()">Back</button>
+ <button class="btn btn-primary" (click)="nextSection()">Next</button>
</div>
+ </div>
- <div *ngSwitchCase="'Other'" id="defense" class="container-fluid">
- <h4 class="text-center">How much did other robots play defense against this robot?</h4>
- 0 - No defense played against this robot<br/>
- 1 - Minimal defense<br/>
- 2 - Some defense<br/>
- 3 - About half the match was played against defense<br/>
- 4 - Good amount of defense<br/>
- 5 - Constant defense
- <div class="row" style="min-height: 50px">
- <div class="col-10">
- <input type="range" min="0" max="5" [(ngModel)]="defensePlayedOnScore">
- </div>
- <div class="col">
- <h6>{{defensePlayedOnScore}}</h6>
- </div>
- </div>
+ <div *ngSwitchCase="'Review and Submit'" id="review" class="container-fluid">
+ <h4>Team Selection</h4>
+ <ul>
+ <li>Match number: {{matchNumber}}</li>
+ <li>Team number: {{teamNumber}}</li>
+ </ul>
- <h4 class="text-center">How much did this robot play defense against other robots?</h4>
- 0 - This robot did not play defense<br/>
- 1 - Minimal defense<br/>
- 2 - Some defense<br/>
- 3 - Defense was played for about half the match<br/>
- 4 - Good amount of defense<br/>
- 5 - Constant defense
- <div class="row">
- <div class="col-10">
- <input type="range" min="0" max="5" [(ngModel)]="defensePlayedScore">
- </div>
- <div class="col">
- <h6>{{defensePlayedScore}}</h6>
- </div>
- </div>
+ <h4>Auto</h4>
+ <ul>
+ <li>Quadrant: {{quadrant}}</li>
+ <li>Collected Ball 1: {{ball1}}</li>
+ <li>Collected Ball 2: {{ball2}}</li>
+ <li>Collected Ball 3: {{ball3}}</li>
+ <li>Collected Ball 4: {{ball4}}</li>
+ <li>Collected Ball 5: {{ball5}}</li>
+ <li>Upper Shots Made: {{autoUpperShotsMade}}</li>
+ <li>Lower Shots Made: {{autoLowerShotsMade}}</li>
+ <li>Missed Shots: {{autoShotsMissed}}</li>
+ </ul>
- <div class="row">
- <form>
- <input type="checkbox" [(ngModel)]="noShow" name="no_show" id="no_show">
- <label for="no_show">No show</label><br>
- <input type="checkbox" [(ngModel)]="neverMoved" name="never_moved" id="never_moved">
- <label for="never_moved">Never moved</label><br>
- <input type="checkbox" [(ngModel)]="batteryDied" name="battery_died" id="battery_died">
- <label for="battery_died">Battery died</label><br>
- <input type="checkbox" [(ngModel)]="mechanicallyBroke" name="mechanically_broke" id="mechanically_broke">
- <label for="mechanically_broke">Broke (mechanically)</label><br/>
- <input type="checkbox" [(ngModel)]="lostComs" name="lost_coms" id="lost_coms">
- <label for="lost_coms">Lost coms</label>
- </form>
- </div>
+ <h4>TeleOp</h4>
+ <ul>
+ <li>Upper Shots Made: {{teleUpperShotsMade}}</li>
+ <li>Lower Shots Made: {{teleLowerShotsMade}}</li>
+ <li>Missed Shots: {{teleShotsMissed}}</li>
+ </ul>
- <div class="buttons">
- <button class="btn btn-primary" (click)="prevSection()">Back</button>
- <button class="btn btn-primary" (click)="nextSection()">Next</button>
- </div>
+ <h4>Climb</h4>
+ <ul>
+ <li>Level: {{level | levelToString}}</li>
+ <li>Comments: {{comment}}</li>
+ </ul>
+
+ <h4>Other</h4>
+ <ul>
+ <li>Defense Played On Rating: {{defensePlayedOnScore}}</li>
+ <li>Defense Played Rating: {{defensePlayedScore}}</li>
+ <li>No show: {{noShow}}</li>
+ <li>Never moved: {{neverMoved}}</li>
+ <li>Battery died: {{batteryDied}}</li>
+ <li>Broke (mechanically): {{mechanicallyBroke}}</li>
+ <li>Lost coms: {{lostComs}}</li>
+ </ul>
+
+ <span class="error_message">{{ errorMessage }}</span>
+
+ <div class="buttons">
+ <button class="btn btn-primary" (click)="prevSection()">Back</button>
+ <button class="btn btn-primary" (click)="nextSection()">Submit</button>
</div>
+ </div>
- <div *ngSwitchCase="'Review and Submit'" id="review" class="container-fluid">
- <h4>Team Selection</h4>
- <ul>
- <li>Match number: {{matchNumber}}</li>
- <li>Team number: {{teamNumber}}</li>
- </ul>
-
- <h4>Auto</h4>
- <ul>
- <li>Quadrant: {{quadrant}}</li>
- <li>Collected Ball 1: {{ball1}}</li>
- <li>Collected Ball 2: {{ball2}}</li>
- <li>Collected Ball 3: {{ball3}}</li>
- <li>Collected Ball 4: {{ball4}}</li>
- <li>Collected Ball 5: {{ball5}}</li>
- <li>Upper Shots Made: {{autoUpperShotsMade}}</li>
- <li>Lower Shots Made: {{autoLowerShotsMade}}</li>
- <li>Missed Shots: {{autoShotsMissed}}</li>
- </ul>
-
- <h4>TeleOp</h4>
- <ul>
- <li>Upper Shots Made: {{teleUpperShotsMade}}</li>
- <li>Lower Shots Made: {{teleLowerShotsMade}}</li>
- <li>Missed Shots: {{teleShotsMissed}}</li>
- </ul>
-
- <h4>Climb</h4>
- <ul>
- <li>Level: {{level | levelToString}}</li>
- <li>Comments: {{comment}}</li>
- </ul>
-
- <h4>Other</h4>
- <ul>
- <li>Defense Played On Rating: {{defensePlayedOnScore}}</li>
- <li>Defense Played Rating: {{defensePlayedScore}}</li>
- <li>No show: {{noShow}}</li>
- <li>Never moved: {{neverMoved}}</li>
- <li>Battery died: {{batteryDied}}</li>
- <li>Broke (mechanically): {{mechanicallyBroke}}</li>
- <li>Lost coms: {{lostComs}}</li>
- </ul>
-
- <span class="error_message">{{ errorMessage }}</span>
-
- <div class="buttons">
- <button class="btn btn-primary" (click)="prevSection()">Back</button>
- <button class="btn btn-primary" (click)="nextSection()">Submit</button>
- </div>
+ <div *ngSwitchCase="'Success'" id="success" class="container-fluid">
+ <span>Successfully submitted scouting data.</span>
+ <div class="buttons justify-content-end">
+ <button class="btn btn-primary" (click)="nextSection()">Continue</button>
</div>
-
- <div *ngSwitchCase="'Success'" id="success" class="container-fluid">
- <span>Successfully submitted scouting data.</span>
- <div class="buttons justify-content-end">
- <button class="btn btn-primary" (click)="nextSection()">Continue</button>
- </div>
-
- </div>
+ </div>
</ng-container>
diff --git a/scouting/www/import_match_list/import_match_list.component.css b/scouting/www/import_match_list/import_match_list.component.css
index 0570c72..e220645 100644
--- a/scouting/www/import_match_list/import_match_list.component.css
+++ b/scouting/www/import_match_list/import_match_list.component.css
@@ -1,3 +1,3 @@
* {
- padding: 10px;
+ padding: 10px;
}
diff --git a/scouting/www/import_match_list/import_match_list.component.ts b/scouting/www/import_match_list/import_match_list.component.ts
index fd7c5e2..a3fe458 100644
--- a/scouting/www/import_match_list/import_match_list.component.ts
+++ b/scouting/www/import_match_list/import_match_list.component.ts
@@ -1,4 +1,4 @@
-import { Component, OnInit } from '@angular/core';
+import {Component, OnInit} from '@angular/core';
import {Builder, ByteBuffer} from 'flatbuffers';
import {ErrorResponse} from 'org_frc971/scouting/webserver/requests/messages/error_response_generated';
@@ -8,7 +8,7 @@
@Component({
selector: 'app-import-match-list',
templateUrl: './import_match_list.ng.html',
- styleUrls: ['../common.css', './import_match_list.component.css']
+ styleUrls: ['../common.css', './import_match_list.component.css'],
})
export class ImportMatchListComponent {
year: number = new Date().getFullYear();
@@ -17,7 +17,9 @@
errorMessage: string = '';
async importMatchList() {
- const block_alerts = document.getElementById('block_alerts') as HTMLInputElement;
+ const block_alerts = document.getElementById(
+ 'block_alerts'
+ ) as HTMLInputElement;
console.log(block_alerts.checked);
if (!block_alerts.checked) {
if (!window.confirm('Actually import new matches?')) {
@@ -37,8 +39,10 @@
this.progressMessage = 'Importing match list. Please be patient.';
const buffer = builder.asUint8Array();
- const res = await fetch(
- '/requests/refresh_match_list', {method: 'POST', body: buffer});
+ const res = await fetch('/requests/refresh_match_list', {
+ method: 'POST',
+ body: buffer,
+ });
if (res.ok) {
// We successfully submitted the data.
diff --git a/scouting/www/import_match_list/import_match_list.module.ts b/scouting/www/import_match_list/import_match_list.module.ts
index 1da8bec..cdb6fea 100644
--- a/scouting/www/import_match_list/import_match_list.module.ts
+++ b/scouting/www/import_match_list/import_match_list.module.ts
@@ -8,5 +8,4 @@
exports: [ImportMatchListComponent],
imports: [CommonModule, FormsModule],
})
-export class ImportMatchListModule {
-}
+export class ImportMatchListModule {}
diff --git a/scouting/www/import_match_list/import_match_list.ng.html b/scouting/www/import_match_list/import_match_list.ng.html
index 3c7ffa0..fdd7687 100644
--- a/scouting/www/import_match_list/import_match_list.ng.html
+++ b/scouting/www/import_match_list/import_match_list.ng.html
@@ -1,20 +1,20 @@
<div class="header">
- <h2>Import Match List</h2>
+ <h2>Import Match List</h2>
</div>
<div class="container-fluid">
- <div class="row">
- <label for="year">Year</label>
- <input [(ngModel)]="year" type="number" id="year" min="1970" max="2500">
- </div>
- <div class="row">
- <label for="event_code">Event Code</label>
- <input [(ngModel)]="eventCode" type="text" id="event_code">
- </div>
+ <div class="row">
+ <label for="year">Year</label>
+ <input [(ngModel)]="year" type="number" id="year" min="1970" max="2500" />
+ </div>
+ <div class="row">
+ <label for="event_code">Event Code</label>
+ <input [(ngModel)]="eventCode" type="text" id="event_code" />
+ </div>
- <span class="progress_message">{{ progressMessage }}</span>
- <span class="error_message">{{ errorMessage }}</span>
- <div class="text-right">
- <button class="btn btn-primary" (click)="importMatchList()">Import</button>
- </div>
+ <span class="progress_message">{{ progressMessage }}</span>
+ <span class="error_message">{{ errorMessage }}</span>
+ <div class="text-right">
+ <button class="btn btn-primary" (click)="importMatchList()">Import</button>
+ </div>
</div>
diff --git a/scouting/www/index.html b/scouting/www/index.html
index b5c33e6..84777d1 100644
--- a/scouting/www/index.html
+++ b/scouting/www/index.html
@@ -2,10 +2,15 @@
<html>
<head>
<title>FRC971 Scouting Application</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <base href="/">
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <base href="/" />
<script src="./npm/node_modules/zone.js/dist/zone.min.js"></script>
- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
+ <link
+ href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
+ rel="stylesheet"
+ integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"
+ crossorigin="anonymous"
+ />
</head>
<body>
<my-app></my-app>
diff --git a/scouting/www/match_list/match_list.component.css b/scouting/www/match_list/match_list.component.css
index 639960b..e7c071c 100644
--- a/scouting/www/match_list/match_list.component.css
+++ b/scouting/www/match_list/match_list.component.css
@@ -1,5 +1,5 @@
* {
- padding: 10px;
+ padding: 10px;
}
.red {
diff --git a/scouting/www/match_list/match_list.component.ts b/scouting/www/match_list/match_list.component.ts
index f64e4d1..b2a2731 100644
--- a/scouting/www/match_list/match_list.component.ts
+++ b/scouting/www/match_list/match_list.component.ts
@@ -1,13 +1,16 @@
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
-import {ByteBuffer, Builder} from 'flatbuffers'
+import {ByteBuffer, Builder} from 'flatbuffers';
import {ErrorResponse} from 'org_frc971/scouting/webserver/requests/messages/error_response_generated';
import {RequestAllMatches} from 'org_frc971/scouting/webserver/requests/messages/request_all_matches_generated';
-import {Match, RequestAllMatchesResponse} from 'org_frc971/scouting/webserver/requests/messages/request_all_matches_response_generated';
+import {
+ Match,
+ RequestAllMatchesResponse,
+} from 'org_frc971/scouting/webserver/requests/messages/request_all_matches_response_generated';
type TeamInMatch = {
- teamNumber: number,
- matchNumber: number,
- compLevel: string
+ teamNumber: number;
+ matchNumber: number;
+ compLevel: string;
};
const MATCH_TYPE_ORDERING = ['qm', 'ef', 'qf', 'sf', 'f'];
@@ -15,7 +18,7 @@
@Component({
selector: 'app-match-list',
templateUrl: './match_list.ng.html',
- styleUrls: ['../common.css', './match_list.component.css']
+ styleUrls: ['../common.css', './match_list.component.css'],
})
export class MatchListComponent implements OnInit {
@Output() selectedTeamEvent = new EventEmitter<TeamInMatch>();
@@ -27,7 +30,7 @@
this.selectedTeamEvent.emit(teamInMatch);
}
- teamsInMatch(match: Match): {teamNumber: number, color: 'red'|'blue'}[] {
+ teamsInMatch(match: Match): {teamNumber: number; color: 'red' | 'blue'}[] {
return [
{teamNumber: match.r1(), color: 'red'},
{teamNumber: match.r2(), color: 'red'},
@@ -38,7 +41,7 @@
];
}
- matchType(match: Match): string|null {
+ matchType(match: Match): string | null {
switch (match.compLevel()) {
case 'qm':
return 'Quals';
@@ -73,15 +76,16 @@
this.progressMessage = 'Fetching match list. Please be patient.';
const buffer = builder.asUint8Array();
- const res = await fetch(
- '/requests/request/all_matches', {method: 'POST', body: buffer});
+ const res = await fetch('/requests/request/all_matches', {
+ method: 'POST',
+ body: buffer,
+ });
if (res.ok) {
const resBuffer = await res.arrayBuffer();
const fbBuffer = new ByteBuffer(new Uint8Array(resBuffer));
const parsedResponse =
- RequestAllMatchesResponse.getRootAsRequestAllMatchesResponse(
- fbBuffer);
+ RequestAllMatchesResponse.getRootAsRequestAllMatchesResponse(fbBuffer);
// Convert the flatbuffer list into an array. That's more useful.
this.matchList = [];
@@ -118,8 +122,7 @@
const parsedResponse = ErrorResponse.getRootAsErrorResponse(fbBuffer);
const errorMessage = parsedResponse.errorMessage();
- this.errorMessage =
- `Received ${res.status} ${res.statusText}: "${errorMessage}"`;
+ this.errorMessage = `Received ${res.status} ${res.statusText}: "${errorMessage}"`;
}
}
}
diff --git a/scouting/www/match_list/match_list.module.ts b/scouting/www/match_list/match_list.module.ts
index dbec410..0630f81 100644
--- a/scouting/www/match_list/match_list.module.ts
+++ b/scouting/www/match_list/match_list.module.ts
@@ -9,5 +9,4 @@
exports: [MatchListComponent],
imports: [CommonModule, FormsModule],
})
-export class MatchListModule {
-}
+export class MatchListModule {}
diff --git a/scouting/www/match_list/match_list.ng.html b/scouting/www/match_list/match_list.ng.html
index 60a9d75..2f77198 100644
--- a/scouting/www/match_list/match_list.ng.html
+++ b/scouting/www/match_list/match_list.ng.html
@@ -1,20 +1,23 @@
<div class="header">
- <h2>Matches</h2>
+ <h2>Matches</h2>
</div>
<div class="container-fluid">
<div class="row" *ngFor="let match of matchList; index as i">
- <span class="badge bg-secondary rounded-left">{{ displayMatchNumber(match) }}</span>
+ <span class="badge bg-secondary rounded-left">
+ {{ displayMatchNumber(match) }}
+ </span>
<div class="match-row">
<button
- *ngFor="let team of teamsInMatch(match);"
- (click)="setTeamInMatch({
+ *ngFor="let team of teamsInMatch(match);"
+ (click)="setTeamInMatch({
teamNumber: team.teamNumber,
matchNumber: match.matchNumber(),
compLevel: match.compLevel()
})"
- class="match-item"
- [ngClass]="team.color">
+ class="match-item"
+ [ngClass]="team.color"
+ >
{{ team.teamNumber }}
</button>
</div>
diff --git a/scouting/www/notes/notes.component.ts b/scouting/www/notes/notes.component.ts
index 09178f8..0f0eb82 100644
--- a/scouting/www/notes/notes.component.ts
+++ b/scouting/www/notes/notes.component.ts
@@ -2,11 +2,14 @@
import {Builder, ByteBuffer} from 'flatbuffers';
import {ErrorResponse} from 'org_frc971/scouting/webserver/requests/messages/error_response_generated';
import {RequestNotesForTeam} from 'org_frc971/scouting/webserver/requests/messages/request_notes_for_team_generated';
-import {Note as NoteFb, RequestNotesForTeamResponse} from 'org_frc971/scouting/webserver/requests/messages/request_notes_for_team_response_generated';
+import {
+ Note as NoteFb,
+ RequestNotesForTeamResponse,
+} from 'org_frc971/scouting/webserver/requests/messages/request_notes_for_team_response_generated';
import {SubmitNotes} from 'org_frc971/scouting/webserver/requests/messages/submit_notes_generated';
import {SubmitNotesResponse} from 'org_frc971/scouting/webserver/requests/messages/submit_notes_response_generated';
-type Section = 'TeamSelection'|'Data';
+type Section = 'TeamSelection' | 'Data';
interface Note {
readonly data: string;
@@ -15,7 +18,7 @@
@Component({
selector: 'frc971-notes',
templateUrl: './notes.ng.html',
- styleUrls: ['../common.css', './notes.component.css']
+ styleUrls: ['../common.css', './notes.component.css'],
})
export class Notes {
section: Section = 'TeamSelection';
@@ -33,8 +36,10 @@
builder.finish(RequestNotesForTeam.endRequestNotesForTeam(builder));
const buffer = builder.asUint8Array();
- const res = await fetch(
- '/requests/request/notes_for_team', {method: 'POST', body: buffer});
+ const res = await fetch('/requests/request/notes_for_team', {
+ method: 'POST',
+ body: buffer,
+ });
const resBuffer = await res.arrayBuffer();
const fbBuffer = new ByteBuffer(new Uint8Array(resBuffer));
@@ -42,8 +47,9 @@
if (res.ok) {
this.notes = [];
const parsedResponse =
- RequestNotesForTeamResponse.getRootAsRequestNotesForTeamResponse(
- fbBuffer);
+ RequestNotesForTeamResponse.getRootAsRequestNotesForTeamResponse(
+ fbBuffer
+ );
for (let i = 0; i < parsedResponse.notesLength(); i++) {
const fbNote = parsedResponse.notes(i);
this.notes.push({data: fbNote.data()});
@@ -53,24 +59,26 @@
const parsedResponse = ErrorResponse.getRootAsErrorResponse(fbBuffer);
const errorMessage = parsedResponse.errorMessage();
- this.errorMessage =
- `Received ${res.status} ${res.statusText}: "${errorMessage}"`;
+ this.errorMessage = `Received ${res.status} ${res.statusText}: "${errorMessage}"`;
}
}
changeTeam() {
- this.section = "TeamSelection";
+ this.section = 'TeamSelection';
}
-
+
async submitData() {
const builder = new Builder();
const dataFb = builder.createString(this.newData);
builder.finish(
- SubmitNotes.createSubmitNotes(builder, this.teamNumber, dataFb));
+ SubmitNotes.createSubmitNotes(builder, this.teamNumber, dataFb)
+ );
const buffer = builder.asUint8Array();
- const res = await fetch(
- '/requests/submit/submit_notes', {method: 'POST', body: buffer});
+ const res = await fetch('/requests/submit/submit_notes', {
+ method: 'POST',
+ body: buffer,
+ });
if (res.ok) {
this.newData = '';
@@ -82,9 +90,7 @@
const parsedResponse = ErrorResponse.getRootAsErrorResponse(fbBuffer);
const errorMessage = parsedResponse.errorMessage();
- this.errorMessage =
- `Received ${res.status} ${res.statusText}: "${errorMessage}"`;
+ this.errorMessage = `Received ${res.status} ${res.statusText}: "${errorMessage}"`;
}
}
}
-
diff --git a/scouting/www/notes/notes.module.ts b/scouting/www/notes/notes.module.ts
index c537550..881c6db 100644
--- a/scouting/www/notes/notes.module.ts
+++ b/scouting/www/notes/notes.module.ts
@@ -9,6 +9,4 @@
exports: [Notes],
imports: [CommonModule, FormsModule],
})
-export class NotesModule {
-}
-
+export class NotesModule {}
diff --git a/scouting/www/notes/notes.ng.html b/scouting/www/notes/notes.ng.html
index 90f004a..a69ba88 100644
--- a/scouting/www/notes/notes.ng.html
+++ b/scouting/www/notes/notes.ng.html
@@ -3,24 +3,28 @@
<ng-container [ngSwitch]="section">
<div *ngSwitchCase="'TeamSelection'">
<label for="team_number_notes">Team Number</label>
- <input [(ngModel)]="teamNumber" type="number" id="team_number_notes" min="1" max="9999">
+ <input
+ [(ngModel)]="teamNumber"
+ type="number"
+ id="team_number_notes"
+ min="1"
+ max="9999"
+ />
<button class="btn btn-primary" (click)="setTeamNumber()">Select</button>
</div>
<div *ngSwitchCase="'Data'">
- <h3> Scouting team: {{teamNumber}}</h3>
+ <h3>Scouting team: {{teamNumber}}</h3>
<ul *ngFor="let note of notes">
- <li class="note">
- {{ note.data }}
- </li>
+ <li class="note">{{ note.data }}</li>
</ul>
<textarea class="text-input" [(ngModel)]="newData"></textarea>
<div class="buttons">
- <button class="btn btn-primary" (click)="changeTeam()">Change team</button>
+ <button class="btn btn-primary" (click)="changeTeam()">
+ Change team
+ </button>
<button class="btn btn-primary" (click)="submitData()">Submit</button>
</div>
</div>
- <div class="error">
- {{errorMessage}}
- </div>
+ <div class="error">{{errorMessage}}</div>
</ng-container>