mirror of
https://github.com/skot/ESP-Miner.git
synced 2025-03-17 21:32:52 +01:00
clean up css and network component (#504)
* chore: clean up network component * chore: Clean up extra css too
This commit is contained in:
parent
a5f6af15a2
commit
cccb43553d
@ -1,35 +0,0 @@
|
||||
input[type="text"],
|
||||
input[type="number"],
|
||||
input[type="password"],
|
||||
input[type="range"] {
|
||||
min-width: 250px;
|
||||
max-width: 90%;
|
||||
}
|
||||
|
||||
select {
|
||||
min-width: 268px;
|
||||
max-width: 90%;
|
||||
}
|
||||
|
||||
.restart {
|
||||
margin-bottom: 1.5rem;
|
||||
|
||||
}
|
||||
|
||||
@media only screen and (min-width:900px) {
|
||||
|
||||
input[type="text"],
|
||||
input[type="password"],
|
||||
input[type="number"],
|
||||
input[type="range"] {
|
||||
min-width: 500px
|
||||
}
|
||||
|
||||
select {
|
||||
min-width: 518px
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
color: white;
|
||||
}
|
@ -1,62 +1,10 @@
|
||||
import { HttpErrorResponse, HttpEventType } from '@angular/common/http';
|
||||
import { Component } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
import { map, Observable, shareReplay, startWith } from 'rxjs';
|
||||
import { LoadingService } from 'src/app/services/loading.service';
|
||||
import { SystemService } from 'src/app/services/system.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-network',
|
||||
templateUrl: './network.component.html',
|
||||
styleUrls: ['./network.component.scss']
|
||||
styleUrls: ['./network.component.scss'],
|
||||
})
|
||||
export class NetworkComponent {
|
||||
|
||||
public form!: FormGroup;
|
||||
|
||||
public info$: Observable<any>;
|
||||
|
||||
constructor(
|
||||
private fb: FormBuilder,
|
||||
private systemService: SystemService,
|
||||
private toastr: ToastrService,
|
||||
private toastrService: ToastrService,
|
||||
private loadingService: LoadingService,
|
||||
) {
|
||||
this.info$ = this.systemService.getInfo().pipe(shareReplay({refCount: true, bufferSize: 1}))
|
||||
|
||||
this.info$.pipe(this.loadingService.lockUIUntilComplete())
|
||||
.subscribe(info => {
|
||||
this.form = this.fb.group({
|
||||
hostname: [info.hostname, [Validators.required]],
|
||||
ssid: [info.ssid, [Validators.required]],
|
||||
wifiPass: ['*****'],
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public updateSystem() {
|
||||
|
||||
const form = this.form.getRawValue();
|
||||
|
||||
// Allow an empty wifi password
|
||||
form.wifiPass = form.wifiPass == null ? '' : form.wifiPass;
|
||||
|
||||
if (form.wifiPass === '*****') {
|
||||
delete form.wifiPass;
|
||||
}
|
||||
|
||||
this.systemService.updateSystem(undefined, form)
|
||||
.pipe(this.loadingService.lockUIUntilComplete())
|
||||
.subscribe({
|
||||
next: () => {
|
||||
this.toastr.success('Success!', 'Saved.');
|
||||
},
|
||||
error: (err: HttpErrorResponse) => {
|
||||
this.toastr.error('Error.', `Could not save. ${err.message}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
constructor() {}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user