Skip to content

Commit

Permalink
server 404. or error server will auto redirect to login page;\n login…
Browse files Browse the repository at this point in the history
… page: if serveris /,will not show serverUrl field \n exitnode,subnets all disable will show gray color tag
  • Loading branch information
xrain0610 committed Mar 24, 2023
1 parent 0ede220 commit abff4bc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/app/http-api.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export class HttpApiInterceptor implements HttpInterceptor {
localStorage.setItem('serverKey', '');
this.router.navigateByUrl('/login');
}
if (error.status === 404 || error.status == 0) {
this.router.navigateByUrl('/login');
}
console.log(error)
return of(error)
}));
}
Expand Down
6 changes: 4 additions & 2 deletions src/app/views/login/login.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<nz-card style="width:450px; left:calc(50% - 225px);position: fixed; top:calc(50% - 160px)"
[nzTitle]="titleTpl" [nzExtra]="extraTemplate">
<p>Server Url:</p>
<p>{{serverUrl}}</p>
<ng-container *ngIf="serverUrl && serverUrl!=='/'">
<p>Server Url:</p>
<p>{{serverUrl}}</p>
</ng-container>
<p>ApiKeys:</p>
<p><input nz-input [(ngModel)]="apiKeys"/></p>
<p>
Expand Down
14 changes: 11 additions & 3 deletions src/app/views/machine-manager/machine-manager.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,19 @@
<nz-tag nzColor="red" *ngIf="!data.online">Offline</nz-tag>
<ng-container *ngIf="data.subnets && data.subnets.length>0">
<nz-tag nzColor="magenta" *ngIf="data.subnets_enabled_num>0">
SubNet {{data.subnets_enabled_num}}/{{data.subnets.length}}</nz-tag>
SubNet {{data.subnets_enabled_num}}/{{data.subnets.length}}
</nz-tag>
<nz-tag nzColor="default" *ngIf="data.subnets_enabled_num<=0">
SubNet {{data.subnets_enabled_num}}/{{data.subnets.length}}
</nz-tag>
</ng-container>
<ng-container *ngIf="data.exitNodes && data.exitNodes.length>0">
<nz-tag nzColor="geekblue" *ngIf="data.exitNode_enabled_num>0">ExitNode {{data.exitNode_enabled_num}}
/{{data.exitNodes.length}}</nz-tag>
<nz-tag nzColor="geekblue" *ngIf="data.exitNode_enabled_num>0">
ExitNode {{data.exitNode_enabled_num}}/{{data.exitNodes.length}}
</nz-tag>
<nz-tag nzColor="default" *ngIf="data.exitNode_enabled_num<=0">
ExitNode {{data.exitNode_enabled_num}}/{{data.exitNodes.length}}
</nz-tag>
</ng-container>

</td>
Expand Down

0 comments on commit abff4bc

Please sign in to comment.