Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test control #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lsimonson-astranis
Copy link

No description provided.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This pull request introduces a new TestControlComponent for managing test execution in the OpenHTF web GUI, focusing on test selection, starting, and aborting functionality.

  • Added test-control.component.ts, html, and scss files implementing the new component with dropdown test selection and start/abort buttons
  • Integrated <htf-test-control> into station.component.html, adjusting layout for the new component
  • Updated stations.module.ts to declare TestControlComponent and import FormsModule for form controls
  • Modified station.component.spec.ts to include TestControlComponent in test suite configuration
  • Minor formatting improvements in base.scss and main.scss for better code readability

8 file(s) reviewed, 10 comment(s)
Edit PR Review Bot Settings | Greptile

<div [@animateIn]="'in'" *ngIf="testRunning()">

<div class="htf-layout-widget-body">
<div [innerHTML]="control"></div>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Using [innerHTML] can be a security risk if the content is not sanitized. Ensure 'control' is properly sanitized before binding.

<div [innerHTML]="control"></div>

<div class="u-font-size-large">
<button type="button" class="htf-rounded-button-red u-font-size-large" (click)="abort()">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: There's an extra space in the class attribute between 'htf-rounded-button-red' and 'u-font-size-large'.

Suggested change
<button type="button" class="htf-rounded-button-red u-font-size-large" (click)="abort()">
<button type="button" class="htf-rounded-button-red u-font-size-large" (click)="abort()">

Comment on lines +20 to +24
:host ::ng-deep ol,
:host ::ng-deep ul {
padding-left: 25px;
margin: 0;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider using more specific selectors to avoid potential conflicts with other components

Suggested change
:host ::ng-deep ol,
:host ::ng-deep ul {
padding-left: 25px;
margin: 0;
}
:host ::ng-deep .custom-ol,
:host ::ng-deep .custom-ul {
padding-left: 25px;
margin: 0;
}

Comment on lines +43 to +56
ul {
list-style: none;
padding: 0;
margin: 0;
width: 100%;
max-height: 300px;
overflow-y: auto;
border: 1px solid #ccc;
border-top: none;
border-radius: 0 0 4px 4px;
position: absolute;
background-color: #fff;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider using classes instead of element selectors for better specificity and reusability

Suggested change
ul {
list-style: none;
padding: 0;
margin: 0;
width: 100%;
max-height: 300px;
overflow-y: auto;
border: 1px solid #ccc;
border-top: none;
border-radius: 0 0 4px 4px;
position: absolute;
background-color: #fff;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.custom-ul {
list-style: none;
padding: 0;
margin: 0;
width: 100%;
max-height: 300px;
overflow-y: auto;
border: 1px solid #ccc;
border-top: none;
border-radius: 0 0 4px 4px;
position: absolute;
background-color: #fff;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

Comment on lines +58 to +62
li {
padding: 10px;
cursor: pointer;
transition: background-color 0.3s;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider using a class selector for list items instead of the element selector

Suggested change
li {
padding: 10px;
cursor: pointer;
transition: background-color 0.3s;
}
.custom-li {
padding: 10px;
cursor: pointer;
transition: background-color 0.3s;
}

Comment on lines +69 to +72
li:hover {
background-color: #f2f2f2;
cursor: pointer;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Redundant cursor property, already set on line 60

Suggested change
li:hover {
background-color: #f2f2f2;
cursor: pointer;
}
li:hover {
background-color: #f2f2f2;
}

Comment on lines +74 to +77
li:hover.selected {
background-color: #3498db;
color: #fff;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider combining this with the .selected class to reduce specificity

Suggested change
li:hover.selected {
background-color: #3498db;
color: #fff;
}
li.selected:hover {
background-color: #3498db;
color: #fff;
}

Comment on lines +48 to +49
options: RequestOptions
stationBaseUrl: string
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider adding type annotations for these properties

Suggested change
options: RequestOptions
stationBaseUrl: string
options: RequestOptions;
stationBaseUrl: string;

protected http: Http, protected flashMessage: FlashMessageService) {
let headers = new Headers({'Content-Type': 'application/json'});
this.options = new RequestOptions({headers});
this.stationBaseUrl = getStationBaseUrl(this.config.dashboardEnabled, this.station);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: this.station is undefined in the constructor

Suggested change
this.stationBaseUrl = getStationBaseUrl(this.config.dashboardEnabled, this.station);
if (!this.station) {
throw new Error('Station is required');
}
this.stationBaseUrl = getStationBaseUrl(this.config.dashboardEnabled, this.station);

Comment on lines +103 to +106
this.http.get(testsUrl, this.options).subscribe((resp: Response) => {
this.tests = resp.json().tests;
this.filteredTests = this.tests.slice();
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Add error handling for the HTTP GET request

Suggested change
this.http.get(testsUrl, this.options).subscribe((resp: Response) => {
this.tests = resp.json().tests;
this.filteredTests = this.tests.slice();
});
this.http.get(testsUrl, this.options).subscribe((resp: Response) => {
this.tests = resp.json().tests;
this.filteredTests = this.tests.slice();
}, (error: Response) => {
this.flashMessage.error('Failed to load tests', messageFromErrorResponse(error));
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant