Skip to content

Commit

Permalink
Merge pull request #735 from freenas/fix/legacy-ui-switch-dialog-33426
Browse files Browse the repository at this point in the history
Add confirm dialogs to options to switch to legacy UI
  • Loading branch information
erincodepirate committed May 19, 2018
2 parents 3d3568a + d5bd8b5 commit 94317ac
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
12 changes: 12 additions & 0 deletions src/app/components/common/topbar/topbar.component.ts
Expand Up @@ -258,4 +258,16 @@ export class TopbarComponent implements OnInit, OnDestroy {
this.snackBar.open(`Resilvering ${this.resilveringDetails.name} - ${Math.ceil(this.resilveringDetails.scan.percentage)}%`, ok);
});
}

onGoToLegacy() {
this.translate.get('Switch to Legacy UI').subscribe((gotolegacy: string) => {
this.translate.get("Switch to Legacy UI?").subscribe((gotolegacy_prompt) => {
this.dialogService.confirm("Switch to Legacy UI", "Switch to Legacy UI?", true).subscribe((res) => {
if (res) {
window.location.href = '/legacy/';
}
});
});
});
}
}
3 changes: 2 additions & 1 deletion src/app/components/common/topbar/topbar.template.html
Expand Up @@ -99,10 +99,11 @@
<mat-icon>info_outline</mat-icon>
<span>{{'About' | translate}}</span>
</button>
<a name="settings-legacy-ui" mat-menu-item href="/legacy/">
<a name="settings-legacy-ui" mat-menu-item (click)="onGoToLegacy()">
<mat-icon>keyboard_return</mat-icon>
<span>{{'Legacy UI' | translate}}</span>
</a>
<!--href="/legacy/" -->
</mat-menu>
<mat-menu #languageMenu="matMenu" [overlapTrigger]="false" xPosition="after">
<ng-container *ngFor="let lang of language.availableLangs">
Expand Down
2 changes: 1 addition & 1 deletion src/app/views/sessions/signin/signin.component.html
Expand Up @@ -36,7 +36,7 @@
{{"System is not yet available, please wait" | translate}}
</ng-template>
<div>
<a mat-button color="primary" href="/legacy/">{{"Legacy UI" | translate}}</a>
<a mat-button color="primary" (click)="onGoToLegacy()" >{{"Legacy UI" | translate}}</a>
</div>
<div>
<span fxFlex class="copyright-txt">FreeNAS® © 2018 - <a href="http://www.ixsystems.com" target="_blank" title="iXsystems, Inc."> iXsystems, Inc</a>.</span>
Expand Down
16 changes: 15 additions & 1 deletion src/app/views/sessions/signin/signin.component.ts
Expand Up @@ -4,6 +4,7 @@ import { MatProgressBar, MatButton, MatSnackBar } from '@angular/material';
import { TranslateService } from '@ngx-translate/core';

import {WebSocketService} from '../../../services/ws.service';
import { DialogService } from '../../../services/dialog.service';

@Component({
selector: 'app-signin',
Expand All @@ -23,7 +24,8 @@ export class SigninComponent implements OnInit {
password: ''
}
constructor(private ws: WebSocketService, private router: Router,
private snackBar: MatSnackBar, public translate: TranslateService) {
private snackBar: MatSnackBar, public translate: TranslateService,
private dialogService: DialogService) {
this.ws = ws;
this.ws.call('system.is_freenas').subscribe((res)=>{
this.logo_ready = true;
Expand Down Expand Up @@ -100,4 +102,16 @@ export class SigninComponent implements OnInit {
});
}

onGoToLegacy() {
this.translate.get('Switch to Legacy UI').subscribe((gotolegacy: string) => {
this.translate.get("Switch to Legacy UI?").subscribe((gotolegacy_prompt) => {
this.dialogService.confirm("Switch to Legacy UI", "Switch to Legacy UI?", true).subscribe((res) => {
if (res) {
window.location.href = '/legacy/';
}
});
});
});
}

}

0 comments on commit 94317ac

Please sign in to comment.