Skip to content

Commit

Permalink
Zowe Suite v1.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zowe-robot authored Apr 23, 2020
2 parents 68e1cf5 + 6fadb5f commit 37a447f
Show file tree
Hide file tree
Showing 15 changed files with 242 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
<label [hidden]="!expiredPassword && !changePassword" for="confirmNewPassword" i18n="label|Label for password@@confirm-new-password-label">Confirm New Password</label>
<input [hidden]="!expiredPassword && !changePassword" class="confirmNewPassword" id="confirmNewPasswordInput" aria-labelledby="confirmNewPassword" tabindex="1" type="password" name="confirmNewPassword"[(ngModel)]="confirmNewPassword" maxlength="100" [attr.disabled]="locked?'':null" (keyup)="considerSubmit($event)"/>
</form>
<p class="login-error">{{errorMessage || "&nbsp;"}}</p>
<p class="login-error">{{this.translation.translate(errorMessage)}}</p>
<div class="fa fa-spinner fa-spin fa-5x" [hidden]="!isLoading"></div>
<button [hidden]="!expiredPassword && !changePassword"
class="login-button" (click)="attemptPasswordReset()" [disabled]="locked">
{{this.expiredPassword ? this.translation.translate("Change Password") : this.translation.translate("SavePassword")}}
</button>
<div>
<button
<button id="#org.zowe.zlux.ng2desktop_loginButton"
class="login-button"
(click)="attemptLogin()"
[hidden]="!needLogin || expiredPassword"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ export class LoginComponent implements OnInit {
password: string;
newPassword: string;
confirmNewPassword: string;
errorMessage: string | null;
errorMessage: string;
loginMessage: string;
private idleWarnModal: any;
private lastActive: number = 0;
expiredPassword: boolean;
private passwordServices: string[];
private passwordServices: Set<string>;

constructor(
private authenticationService: AuthenticationManager,
Expand All @@ -61,14 +61,14 @@ export class LoginComponent implements OnInit {
this.password = '';
this.newPassword = '';
this.confirmNewPassword = '';
this.errorMessage = null;
this.errorMessage = '';
this.expiredPassword = false;
this.passwordServices = [];
this.passwordServices = new Set<string>();
this.authenticationService.loginScreenVisibilityChanged.subscribe((eventReason: MVDHosting.LoginScreenChangeReason) => {
switch (eventReason) {
case MVDHosting.LoginScreenChangeReason.UserLogout:
this.needLogin = true;
this.passwordServices = [];
this.passwordServices.clear();
break;
case MVDHosting.LoginScreenChangeReason.UserLogin:
this.errorMessage = '';
Expand Down Expand Up @@ -157,7 +157,7 @@ export class LoginComponent implements OnInit {
}

ngOnInit(): void {
this.passwordServices = [];
this.passwordServices.clear();
const storedUsername = this.authenticationService.defaultUsername();
if (storedUsername != null) {
this.username = storedUsername;
Expand All @@ -172,7 +172,7 @@ export class LoginComponent implements OnInit {
let plugins = Object.keys(jsonMessage.categories[keys[i]].plugins);
for (let j = 0; j < plugins.length; j++) {
if (jsonMessage.categories[keys[i]].plugins[plugins[j]].canChangePassword) {
this.passwordServices.push(plugins[j]);
this.passwordServices.add(plugins[j]);
}
}
}
Expand Down Expand Up @@ -225,12 +225,12 @@ export class LoginComponent implements OnInit {
attemptPasswordReset(): void {
if (this.newPassword != this.confirmNewPassword) {
this.errorMessage = "New passwords do not match. Please try again.";
} else if (this.passwordServices.length == 0) {
this.errorMessage = "No password reset auth service available."
} else if (this.passwordServices.length != 1) {
this.errorMessage = "Multiple password reset services not available at this time.";
} else if (this.passwordServices.size == 0) {
this.errorMessage = "No password reset service available."
} else if (this.passwordServices.size != 1) {
this.errorMessage = "Multiple password reset is not available.";
} else {
this.authenticationService.performPasswordReset(this.username, this.password, this.newPassword, this.passwordServices[0]).subscribe(
this.authenticationService.performPasswordReset(this.username, this.password, this.newPassword, this.passwordServices.values().next().value).subscribe(
result => {
if (this.needLogin) {
this.password = this.newPassword;
Expand All @@ -248,20 +248,20 @@ export class LoginComponent implements OnInit {
error => {
let jsonMessage = error.json();
this.loginMessage = "";
this.errorMessage = "Error: " + jsonMessage.response;
this.errorMessage = jsonMessage.response;
}
)
}
}

attemptLogin(): void {
this.errorMessage = null;
this.errorMessage = '';
this.needLogin = false;
this.locked = true;
this.isLoading = true;
// See https://github.com/angular/angular/issues/22426
this.cdr.detectChanges();
this.passwordServices = [];
this.passwordServices.clear();
if (this.username==null || this.username==''){
this.errorMessage= this.translation.translate('UsernameRequired');
this.password = '';
Expand All @@ -279,7 +279,7 @@ export class LoginComponent implements OnInit {
let plugins = Object.keys(jsonMessage.categories[keys[i]].plugins);
for (let j = 0; j < plugins.length; j++) {
if (jsonMessage.categories[keys[i]].plugins[plugins[j]].canChangePassword) {
this.passwordServices.push(plugins[j]);
this.passwordServices.add(plugins[j]);
}
}
}
Expand All @@ -305,7 +305,7 @@ export class LoginComponent implements OnInit {
let plugins = Object.keys(jsonMessage.categories[keys[i]].plugins);
for (let j = 0; j < plugins.length; j++) {
if (jsonMessage.categories[keys[i]].plugins[plugins[j]].canChangePassword) {
this.passwordServices.push(plugins[j]);
this.passwordServices.add(plugins[j]);
}
}
}
Expand Down
20 changes: 18 additions & 2 deletions virtual-desktop/src/app/context-menu/context-menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
ViewChild,
ViewChildren,
AfterViewInit,
QueryList
QueryList,
} from '@angular/core';

import { ContextMenuItem } from 'pluginlib/inject-resources';
Expand Down Expand Up @@ -136,7 +136,7 @@ export class ContextMenuComponent implements AfterViewInit {

constructor(
private elementRef: ElementRef,
private sanitizer:DomSanitizer
private sanitizer:DomSanitizer,
) {
this.complete = new EventEmitter<void>();
}
Expand Down Expand Up @@ -318,13 +318,17 @@ export class ContextMenuComponent implements AfterViewInit {
newIndex = mod(newIndex - 1, this.menuItems.length)
}
this.activeIndex = newIndex;
event.stopPropagation();
event.preventDefault();
break;
case 'ArrowDown':
newIndex = mod(this.activeIndex + 1, this.menuItems.length)
while (this.menuItems[newIndex].disabled) {
newIndex = mod(newIndex + 1, this.menuItems.length)
}
this.activeIndex = newIndex;
event.stopPropagation();
event.preventDefault();
break;
case 'ArrowRight':
if (this._propagateChildLeft) {
Expand All @@ -341,6 +345,8 @@ export class ContextMenuComponent implements AfterViewInit {
}, 0)
}
}
event.stopPropagation();
event.preventDefault();
break;
case 'ArrowLeft':
if (this._propagateChildLeft) {
Expand All @@ -357,6 +363,8 @@ export class ContextMenuComponent implements AfterViewInit {
this.setActiveIndex(-1);
}
}
event.stopPropagation();
event.preventDefault();
break;
case 'Enter':
let item = this.menuItems[this.activeIndex];
Expand All @@ -366,10 +374,18 @@ export class ContextMenuComponent implements AfterViewInit {
if (!item.preventCloseMenu) {
this.closeContextMenu();
}
event.stopPropagation();
event.preventDefault();
break;
case 'Escape':
this.closeContextMenu();
event.stopPropagation();
event.preventDefault();
break;
}
}
}

}


Expand Down
3 changes: 0 additions & 3 deletions virtual-desktop/src/app/context-menu/context-menu.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,12 @@ import { CommonModule } from '@angular/common';
],
exports: [
ContextMenuComponent
],
providers: [
]
})
export class ContextMenuModule {

}


/*
This program and the accompanying materials are
made available under the terms of the Eclipse Public License v2.0 which accompanies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@
left: 45px;
}

.launch-widget-row.active {
background-color: #a6a6a6;
}

/*
This program and the accompanying materials are
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,23 @@
</div>

<ng-template [ngIf]="isActive">
<div class="launch-widget-popup">
<div class="launch-widget-popup" (click)="setSearchFocus();">
<div style="cursor: pointer" class="refresh-plugins" (click)="refresh()">
{{translation.translate("Refresh Applications")}}
<i style="padding: 5px" class="fa fa-refresh" (click)="refresh()"></i>
</div>
<div style="margin: 20px"></div>
<div class="launch-menu-scroller">
<div class="launch-widget-row" *ngFor="let item of displayItems | sortBy: 'label'" (click)="clicked(item)" [title]="item.tooltip" (contextmenu)="onRightClick($event, item)">
<img class="icon" [src]="item.image">
<p>{{item.label}}</p>
</div>
<div #menudiv class="launch-menu-scroller">
<div class="launch-widget-row" *ngFor="let item of displayItems | sortBy: 'label'; let i = index;"
(click)="clicked(item)" [title]="item.tooltip" (contextmenu)="onRightClick($event, item)"
[class.active]="i==this.activeIndex"
(mouseover)="this.activeIndex=i" >
<img class="icon" [src]="item.image">
<p>{{item.label}}</p>
</div>
</div>
<div class="launch-menu-search">
<input style="width:95%" type="text" placeholder="{{translation.translate('Search')}}" [(ngModel)]="appFilter" (input)="filterMenuItems()">
<input #searchapp style="width:95%" type="text" placeholder="{{translation.translate('Search')}}" [(ngModel)]="appFilter" (input)="filterMenuItems()" >
</div>
</div>
<div class="launch-widget-caret caret-down"></div>
Expand Down
Loading

0 comments on commit 37a447f

Please sign in to comment.