Skip to content

Commit

Permalink
fixed lag in showing active session dot
Browse files Browse the repository at this point in the history
  • Loading branch information
urz9999 committed Oct 22, 2020
1 parent 11d2e6b commit 237e677
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Leapp",
"version": "0.2.6",
"version": "0.2.7",
"author": {
"name": "noovolari",
"email": "[email protected]"
Expand Down
3 changes: 2 additions & 1 deletion src/app/services/azure-account.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {ConfigurationService} from '../services-system/configuration.service';
import {AzureAccount} from '../models/azure-account';
import {Session} from '../models/session';
import {v4 as uuidv4} from 'uuid';
import {AppService, ToastLevel} from '../services-system/app.service';
import {AppService, LoggerLevel, ToastLevel} from '../services-system/app.service';
import {AccountType} from '../models/AccountType';

@Injectable({
Expand Down Expand Up @@ -79,6 +79,7 @@ export class AzureAccountService extends NativeService {
const workspace = this.configurationService.getDefaultWorkspaceSync();
return workspace.sessions.filter(sess => ((sess.account as AzureAccount).subscriptionId === subscriptionId))[0] as AzureAccount;
} catch (err) {
this.appService.logger(err, LoggerLevel.ERROR, this, err.stack);
return null;
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/app/services/provider-manager.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ export class ProviderManagerService {

return created;
} catch (err) {
this.appService.logger(err, LoggerLevel.ERROR, this, err.stack);
this.appService.toast(err, ToastLevel.ERROR);
return false;
}
Expand Down Expand Up @@ -248,6 +249,7 @@ export class ProviderManagerService {

return created;
} catch (err) {
this.appService.logger(err, LoggerLevel.ERROR, this, err.stack);
this.appService.toast(err, ToastLevel.ERROR);
return false;
}
Expand Down
11 changes: 7 additions & 4 deletions src/app/services/workspace.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,13 @@ export class WorkspaceService extends NativeService {
try {
this.idpWindow.close();
} catch (e) {
this.appService.logger(e, LoggerLevel.ERROR, this);
this.appService.logger(e, LoggerLevel.ERROR, this, e.stack);
}
}

// Sometimes it can arrive here (tested) so the REAL way to block everything is to use the credential emit element!!!
this.credentialEmit.emit({status: err.stack, accountName: session.account.accountName});
this.appService.logger(err, LoggerLevel.ERROR, this, err.stack);
throw new Error(err);
});
}
Expand Down Expand Up @@ -162,6 +163,8 @@ export class WorkspaceService extends NativeService {
err.error.text.indexOf('net::ERR_NAME_NOT_RESOLVED') > -1 ||
err.error.text.indexOf('net::ERR_INTERNET_DISCONNECTED') > -1 ||
err.error.text.indexOf('net::ERR_NETWORK_IO_SUSPENDED') > -1) {

this.appService.logger('There was a problem with your connection', LoggerLevel.ERROR, this, err.error.text);
observer.error('There was a problem with your connection. Please retry.');
observer.complete();
} else {
Expand Down Expand Up @@ -339,7 +342,7 @@ export class WorkspaceService extends NativeService {
// Save the federated one
this.configurationService.updateWorkspaceSync(workspace);
} catch (err) {
this.appService.logger(err, LoggerLevel.ERROR, this);
this.appService.logger(err, LoggerLevel.ERROR, this, err.stack);
this.appService.toast(err, ToastLevel.ERROR);

// Emit ko
Expand Down Expand Up @@ -387,7 +390,7 @@ export class WorkspaceService extends NativeService {
this.credentialEmit.emit({status: 'ok', accountName: account.accountName});
}
} catch (err) {
this.appService.logger(err, LoggerLevel.ERROR,this);
this.appService.logger(err, LoggerLevel.ERROR, this, err.stack);
this.appService.toast(err, ToastLevel.ERROR);

// Emit ko
Expand Down Expand Up @@ -453,7 +456,7 @@ export class WorkspaceService extends NativeService {

// Catch any error show it and return false
this.appService.toast(err, ToastLevel.WARN, 'Create new workspace');
this.appService.logger(err, LoggerLevel.WARN, this);
this.appService.logger('create new workspace error:', LoggerLevel.WARN, this, err.stack);
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/session/session-card/session-card.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</span>

<ng-container dropdown placement="right" [autoClose]="true">
<a dropdownToggle class="drop-list-container" aria-controls="drop-list" (click)="openDropDown($event);" >
<a dropdownToggle class="drop-list-container" aria-controls="drop-list">
<i class="fa fa-ellipsis-v"></i>
</a>
<div id="drop-list" *dropdownMenu class="dropdown-menu drop-list dropdown-menu-right" role="menu" aria-labelledby="button-basic">
Expand Down
2 changes: 1 addition & 1 deletion src/app/session/session-card/session-card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export class SessionCardComponent implements OnInit {
}

openDropDown(event) {
//event.stopPropagation();
event.stopPropagation();
}

// ============================== //
Expand Down
11 changes: 7 additions & 4 deletions src/app/session/session/session.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component, OnDestroy, OnInit} from '@angular/core';
import {Component, NgZone, OnDestroy, OnInit} from '@angular/core';
import {WorkspaceService} from '../../services/workspace.service';
import {ConfigurationService} from '../../services-system/configuration.service';
import {ActivatedRoute, Router} from '@angular/router';
Expand Down Expand Up @@ -52,7 +52,8 @@ export class SessionComponent extends AntiMemLeak implements OnInit, OnDestroy {
private fileService: FileService,
private credentialsService: CredentialsService,
private sessionService: SessionService,
private menuService: MenuService
private menuService: MenuService,
private zone: NgZone
) { super(); }

ngOnInit() {
Expand Down Expand Up @@ -104,8 +105,10 @@ export class SessionComponent extends AntiMemLeak implements OnInit, OnDestroy {
* getSession
*/
getSessions() {
this.activeSessions = this.sessionService.listSessions().filter( session => session.active === true);
this.notActiveSessions = this.sessionService.listSessions().filter( session => session.active === false);
this.zone.run(() => {
this.activeSessions = this.sessionService.listSessions().filter( session => session.active === true);
this.notActiveSessions = this.sessionService.listSessions().filter( session => session.active === false);
});
}

/**
Expand Down

0 comments on commit 237e677

Please sign in to comment.