-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* init * fix: filter out poor networks
- Loading branch information
Showing
7 changed files
with
214 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
main/http_server/axe-os/src/app/services/dialog.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { Component, Injectable } from '@angular/core'; | ||
import { Observable, Subject } from 'rxjs'; | ||
import { DialogService as PrimeDialogService, DynamicDialogConfig } from 'primeng/dynamicdialog'; | ||
|
||
interface DialogOption { | ||
label: string; | ||
value: string; | ||
} | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class DialogService { | ||
constructor(private primeDialogService: PrimeDialogService) {} | ||
|
||
open(title: string, options: DialogOption[]): Observable<string> { | ||
const result = new Subject<string>(); | ||
|
||
const ref = this.primeDialogService.open(DialogListComponent, { | ||
header: title, | ||
width: '400px', | ||
data: { | ||
options: options, | ||
onSelect: (value: string) => { | ||
result.next(value); | ||
ref.close(); | ||
} | ||
} | ||
}); | ||
|
||
ref.onClose.subscribe(() => { | ||
result.complete(); | ||
}); | ||
|
||
return result.asObservable(); | ||
} | ||
} | ||
|
||
@Component({ | ||
template: ` | ||
<style> | ||
::ng-deep .p-button:focus { | ||
box-shadow: none !important; | ||
background-color: var(--primary-color) !important; | ||
} | ||
</style> | ||
<div class="flex flex-column gap-2"> | ||
<p-button *ngFor="let option of config.data.options" | ||
[label]="option.label" | ||
(onClick)="config.data.onSelect(option.value)" | ||
styleClass="w-full text-left" | ||
></p-button> | ||
</div> | ||
` | ||
}) | ||
export class DialogListComponent { | ||
constructor(public config: DynamicDialogConfig) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters