Small Cleaning and autorun bug fix

This commit is contained in:
Myx
2022-01-02 05:45:05 +01:00
parent bcdab6b162
commit 01bf3770fc
49 changed files with 208 additions and 16420 deletions

View File

@@ -1,6 +1,5 @@
#container {
text-align: center;
position: absolute;
left: 0;
right: 0;

View File

@@ -1,6 +1,5 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { ExploreContainerComponent } from './explore-container.component';
describe('ExploreContainerComponent', () => {

View File

@@ -11,5 +11,4 @@ export class ExploreContainerComponent implements OnInit {
constructor() { }
ngOnInit() {}
}

View File

@@ -1,9 +1,7 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { ExploreContainerComponent } from './explore-container.component';
@NgModule({

View File

@@ -4,7 +4,6 @@ import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { HomePage } from './home.page';
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
import { HomePageRoutingModule } from './home-routing.module';
import { RouterModule } from '@angular/router';

View File

@@ -1,8 +1,6 @@
<ion-header [translucent]="true">
<ion-toolbar>
<ion-title>
Home
</ion-title>
<ion-title>Home</ion-title>
</ion-toolbar>
</ion-header>
@@ -17,7 +15,7 @@
<ion-grid>
<ion-row>
<ion-col>
<ion-card class="noselect" (click)="presentAlert('shutdown')">
<ion-card class="noselect" (click)="commandAlert('shutdown')">
<ion-card-header>
<ion-card-title>Shutdown</ion-card-title>
</ion-card-header>
@@ -30,7 +28,7 @@
<ion-row>
<ion-col>
<ion-card class="noselect" (click)="presentAlert('sleep')">
<ion-card class="noselect" (click)="commandAlert('sleep')">
<ion-card-header>
<ion-card-title>Sleep</ion-card-title>
</ion-card-header>
@@ -40,7 +38,7 @@
</ion-card>
</ion-col>
<ion-col>
<ion-card class="noselect" (click)="presentAlert('reboot')">
<ion-card class="noselect" (click)="commandAlert('reboot')">
<ion-card-header>
<ion-card-title>Reboot</ion-card-title>
</ion-card-header>
@@ -52,7 +50,7 @@
</ion-row>
<ion-row>
<ion-col>
<ion-card class="noselect" (click)="presentAlert('logout')">
<ion-card class="noselect" (click)="commandAlert('logout')">
<ion-card-header>
<ion-card-title>Logout</ion-card-title>
</ion-card-header>

View File

@@ -1,7 +1,6 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
import { HomePage } from './home.page';
describe('HomePage', () => {

View File

@@ -12,17 +12,16 @@ import { getAddress, getCommandType, getPort, getProtocol } from '../../store/go
})
export class HomePage implements OnInit{
commandtype$ = this.store.select(getCommandType);
port = null;
address = '';
protocol = '';
constructor(
public alertController: AlertController,
private httpCommand: NetworkRequestsService,
private store: Store) {}
commandtype$ = this.store.select(getCommandType);
port = null;
address = "";
protocol = "";
private store: Store
) {}
ngOnInit() {
this.store
@@ -38,27 +37,21 @@ export class HomePage implements OnInit{
.subscribe(protocol => (this.protocol = protocol));
}
async presentAlert(commandType) {
async commandAlert(commandValue) {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
cssClass: 'alert',
header: 'Are you sure?',
message: `You are about to send a ${commandType} command to the device.`,
message: `You are about to send a ${commandValue} command to the device.`,
buttons: [
{
text: 'Cancel',
role: 'cancel',
cssClass: 'secondary',
handler: (blah) => {
console.log('Confirm Cancel: blah');
this.commandtype$.subscribe(commandType => {
console.log(commandType);
});
}
cssClass: 'secondary'
}, {
text: 'Send',
handler: () => {
this.store.dispatch(new SendCommandChanged(commandType));
this.httpCommand.sendCommand(commandType, this.address, this.port, this.protocol);
this.store.dispatch(new SendCommandChanged(commandValue));
this.httpCommand.sendCommand(commandValue, this.address, this.port, this.protocol);
}
}
]

View File

@@ -1,5 +1,4 @@
<ion-tabs>
<ion-tab-bar slot="bottom">
<ion-tab-button tab="home">
<ion-icon name="home-sharp"></ion-icon>
@@ -16,5 +15,4 @@
<ion-label>Settings</ion-label>
</ion-tab-button>
</ion-tab-bar>
</ion-tabs>
</ion-tabs>

View File

@@ -7,7 +7,5 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MenuPage {
constructor() {}
}

View File

@@ -1,11 +1,9 @@
import { IonicModule } from '@ionic/angular';
import { RouterModule } from '@angular/router';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { SearchHostPage } from './searchHost.page';
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
import { SearchHostPageRoutingModule } from './searchHost-routing.module';
@NgModule({

View File

@@ -1,17 +1,15 @@
<ion-header [translucent]="true">
<ion-toolbar>
<ion-title>
Search Host
</ion-title>
<ion-title>Search Host</ion-title>
</ion-toolbar>
</ion-header>
<ion-content [fullscreen]="true">
<ion-header collapse="condense">
<ion-toolbar>
<ion-title size="large">Tab 2</ion-title>
<ion-title size="large">WOL</ion-title>
</ion-toolbar>
</ion-header>
<app-explore-container name="Tab 2 page"></app-explore-container>
<app-explore-container name="WOL"></app-explore-container>
</ion-content>

View File

@@ -1,7 +1,6 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
import { SearchHostPage } from './searchHost.page';
describe('SearchHostPage', () => {

View File

@@ -1,29 +1,8 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-searchHost',
selector: 'app-searchhost',
templateUrl: 'searchHost.page.html',
styleUrls: ['searchHost.page.scss']
})
export class SearchHostPage {
constructor() {}
testText = '';
test() {
// console.log("!test")
// // Zeroconf.watchAddressFamily = 'ipv4';
// // Zeroconf.watch('_http._tcp.', 'local.').subscribe(result => {
// // this.testText = JSON.stringify(result.service.ipv4Addresses);
// // console.log(JSON.stringify(result.service.ipv4Addresses))
// // });
// ServiceDiscovery.getNetworkServices('ssdp:all')
// .then(devices => {
// console.log(JSON.stringify(devices))
// this.testText = JSON.stringify(devices)
// })
// .catch(error => console.error(error));
}
}
export class SearchHostPage { }

View File

@@ -1,6 +1,6 @@
<ion-list>
<ion-list-header>
<ion-label (click)="test()"> Remote Server Settings </ion-label>
<ion-label> Remote Server Settings </ion-label>
</ion-list-header>
<ion-item>
<ion-label position="fixed">Protocol</ion-label>

View File

@@ -1,8 +1,4 @@
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { ServerSettingsComponent } from './serverSettings.component';
describe('ServerSettingsComponent', () => {

View File

@@ -1,6 +1,5 @@
import { getAddress, getPort, getProtocol } from './../../../store/gotobed.selectors';
import { Store } from '@ngrx/store';
import { Component, OnInit } from '@angular/core';
import { PortSettingsChanged, ProtocolSettingsChanged, SaveAddressSettings } from 'src/app/store/gotobed.actions';
import { GotobedState } from 'src/app/store/gotobed.state';
@@ -12,38 +11,37 @@ import { InputCustomEvent } from 'src/app/gotobed.models';
styleUrls: ['./serverSettings.component.scss']
})
export class ServerSettingsComponent implements OnInit{
constructor(private _store: Store<GotobedState>) { }
port = null;
address = "";
protocol = "";
address = '';
protocol = '';
constructor(private store: Store<GotobedState>) { }
ngOnInit() {
console.log("#Render server settings");
this._store
console.log('#Render server settings');
this.store
.select(getPort)
.subscribe(port => (this.port = port));
this._store
this.store
.select(getAddress)
.subscribe(address => (this.address = address));
this._store
this.store
.select(getProtocol)
.subscribe(protocol => (this.protocol = protocol));
}
onProtocolChange(protocol: InputCustomEvent){
console.log(protocol.detail.value)
this._store.dispatch(new ProtocolSettingsChanged(protocol.detail.value));
console.log(protocol.detail.value);
this.store.dispatch(new ProtocolSettingsChanged(protocol.detail.value));
}
onAddressChange(address: InputCustomEvent){
console.log(address.detail.value)
this._store.dispatch(new SaveAddressSettings(address.detail.value));
console.log(address.detail.value);
this.store.dispatch(new SaveAddressSettings(address.detail.value));
}
onPortChange(port: InputCustomEvent){
console.log(port.detail.value)
this._store.dispatch(new PortSettingsChanged(port.detail.value));
console.log(port.detail.value);
this.store.dispatch(new PortSettingsChanged(port.detail.value));
}
}

View File

@@ -6,7 +6,6 @@ import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { SettingsPage } from './settings.page';
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
import { SettingsPageRoutingModule } from './settings-routing.module';
@NgModule({

View File

@@ -1,12 +1,10 @@
<ion-header [translucent]="true">
<ion-toolbar>
<ion-title>
Settings
</ion-title>
<ion-title>Settings</ion-title>
</ion-toolbar>
</ion-header>
<<ion-content [fullscreen]="true">
<ion-content [fullscreen]="true">
<ion-header collapse="condense">
<ion-toolbar>
<ion-title size="large">Settings</ion-title>

View File

@@ -1,7 +1,6 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
import { SettingsPage } from './settings.page';
describe('SettingsPage', () => {

View File

@@ -5,8 +5,4 @@ import { Component } from '@angular/core';
templateUrl: 'settings.page.html',
styleUrls: ['settings.page.scss']
})
export class SettingsPage {
constructor() {}
}
export class SettingsPage { }