Code cleaned up

This commit is contained in:
piotrpekala7 2020-06-12 16:08:12 +02:00
parent 53b4e064ee
commit 7248a0f183
2 changed files with 0 additions and 16 deletions

View File

@ -48,8 +48,6 @@ export class AddServerDialogComponent implements OnInit {
async getDefaultLocation() { async getDefaultLocation() {
console.log('get default location');
const localServers = await this.numberOfLocalServers(); const localServers = await this.numberOfLocalServers();
if(this.electronService.isElectronApp && localServers === 0) { if(this.electronService.isElectronApp && localServers === 0) {
return 'local'; return 'local';
@ -58,9 +56,7 @@ export class AddServerDialogComponent implements OnInit {
} }
async numberOfLocalServers() { async numberOfLocalServers() {
console.log('calling find all');
const servers = await this.serverService.findAll(); const servers = await this.serverService.findAll();
console.log('servers from add server dialog....');
return servers.filter((server) => server.location === 'local').length; return servers.filter((server) => server.location === 'local').length;
} }
@ -88,9 +84,7 @@ export class AddServerDialogComponent implements OnInit {
} }
async ngOnInit() { async ngOnInit() {
console.log('Start.... ');
this.locations = await this.getLocations(); this.locations = await this.getLocations();
console.log('Locations: ', this.locations);
const defaultLocalServerPath = await this.getDefaultLocalServerPath(); const defaultLocalServerPath = await this.getDefaultLocalServerPath();
const defaultUbridgePath = await this.getDefaultUbridgePath(); const defaultUbridgePath = await this.getDefaultUbridgePath();
@ -141,7 +135,6 @@ export class AddServerDialogComponent implements OnInit {
}) })
}); });
console.log('????');
const defaultLocation = await this.getDefaultLocation(); const defaultLocation = await this.getDefaultLocation();
this.serverForm.get('location').setValue(defaultLocation); this.serverForm.get('location').setValue(defaultLocation);
this.serverForm.get('host').setValue(this.getDefaultHost()); this.serverForm.get('host').setValue(this.getDefaultHost());

View File

@ -23,7 +23,6 @@ export class ServerService {
evt.currentTarget.result.createObjectStore(this.tablename, { keyPath: 'id', autoIncrement: true }); evt.currentTarget.result.createObjectStore(this.tablename, { keyPath: 'id', autoIncrement: true });
}); });
}).catch(() => { }).catch(() => {
console.log('in incognito mode');
this.isIncognitoMode = true; this.isIncognitoMode = true;
}).finally(() => { }).finally(() => {
this.serviceInitialized.emit(true); this.serviceInitialized.emit(true);
@ -39,7 +38,6 @@ export class ServerService {
return promise; return promise;
} }
console.log('pfffff get');
return this.onReady(() => this.indexedDbService.get().getByKey(this.tablename, id)) as Promise<Server>; return this.onReady(() => this.indexedDbService.get().getByKey(this.tablename, id)) as Promise<Server>;
} }
@ -55,7 +53,6 @@ export class ServerService {
return promise; return promise;
} }
console.log('pfffff create');
return this.onReady(() => { return this.onReady(() => {
const promise = new Promise((resolve, reject) => { const promise = new Promise((resolve, reject) => {
this.indexedDbService this.indexedDbService
@ -81,7 +78,6 @@ export class ServerService {
return promise; return promise;
} }
console.log('pfffff update');
return this.onReady(() => { return this.onReady(() => {
const promise = new Promise((resolve, reject) => { const promise = new Promise((resolve, reject) => {
this.indexedDbService this.indexedDbService
@ -103,13 +99,11 @@ export class ServerService {
let server: Server = JSON.parse(localStorage.getItem(n)); let server: Server = JSON.parse(localStorage.getItem(n));
servers.push(server); servers.push(server);
}); });
console.log('pfffff find all iin');
resolve(servers); resolve(servers);
}); });
return promise; return promise;
} }
console.log('pfffff find all');
return this.onReady(() => this.indexedDbService.get().getAll(this.tablename)) as Promise<Server[]>; return this.onReady(() => this.indexedDbService.get().getAll(this.tablename)) as Promise<Server[]>;
} }
@ -124,7 +118,6 @@ export class ServerService {
return promise; return promise;
} }
console.log('pfffff delete');
return this.onReady(() => this.indexedDbService.get().delete(this.tablename, server.id)); return this.onReady(() => this.indexedDbService.get().delete(this.tablename, server.id));
} }
@ -163,8 +156,6 @@ export class ServerService {
} }
protected onReady(query) { protected onReady(query) {
console.log('pfffff');
const promise = new Promise((resolve, reject) => { const promise = new Promise((resolve, reject) => {
this.ready.then( this.ready.then(
() => { () => {