Skip to content

Commit

Permalink
[#1210] Added paragraph for failed settings fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
msiodelski committed Nov 24, 2023
1 parent 0e9ded9 commit bbe4f0c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion webui/src/app/settings-page/settings-page.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@
<span *ngIf="settingsForm.invalid" class="p-error ml-3"> There are issues in the form values. </span>
</ng-container>
<ng-container *ngSwitchCase="'fail'">
<button pButton type="button" label="Retry" id="retry-button" (click)="retry()" class="mt-2 ml-1"></button>
<div class="text-lg">Fetching current settings from the server failed. Click the button to retry.</div>
<button pButton type="button" label="Retry" id="retry-button" (click)="retry()" class="mt-4"></button>
</ng-container>
<ng-container *ngSwitchDefault>
<p-progressSpinner></p-progressSpinner>
Expand Down
5 changes: 3 additions & 2 deletions webui/src/app/settings-page/settings-page.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import { BrowserAnimationsModule, NoopAnimationsModule } from '@angular/platform
import { FieldsetModule } from 'primeng/fieldset'
import { MessageService } from 'primeng/api'
import { HttpClientTestingModule } from '@angular/common/http/testing'

import { MessagesModule } from 'primeng/messages'

import { SettingsPageComponent } from './settings-page.component'
import { SettingsService } from '../backend/api/api'
import { BreadcrumbsComponent } from '../breadcrumbs/breadcrumbs.component'
Expand Down Expand Up @@ -130,6 +128,9 @@ describe('SettingsPageComponent', () => {
fixture.detectChanges()

expect(messageService.add).toHaveBeenCalledTimes(2)
expect(fixture.debugElement.nativeElement.innerText).toContain(
'Fetching current settings from the server failed.'
)
}))

it('should submit the form', fakeAsync(() => {
Expand Down
2 changes: 1 addition & 1 deletion webui/src/app/settings-page/settings-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,6 @@ export class SettingsPageComponent implements OnInit {
* @returns A boolean value indicating if the control has the error.
*/
hasError(name: string, errType: string): boolean {
return this.settingsForm.get(name)?.hasError(errType)
return !!this.settingsForm.get(name)?.hasError(errType)
}
}

0 comments on commit bbe4f0c

Please sign in to comment.