Skip to content

Commit

Permalink
Merge pull request #208 from 1000TurquoisePogs/bugfix/new-menu-items-…
Browse files Browse the repository at this point in the history
…and-duplication

Bugfix for item menu duplication on re-login
  • Loading branch information
1000TurquoisePogs authored Apr 1, 2020
2 parents 69f2331 + e27e8f3 commit c4b3340
Show file tree
Hide file tree
Showing 14 changed files with 53 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
<ng-template [ngIf]="isActive">
<div class="launch-widget-popup">
<div style="cursor: pointer" class="refresh-plugins" (click)="refresh()">
Refresh applications
{{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" (click)="clicked(item)" [title]="item.tooltip" (contextmenu)="onRightClick($event, item)">
<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>
<div class="launch-menu-search">
<input style="width:95%" type="text" placeholder="Search Applications" [(ngModel)]="appFilter" (input)="filterMenuItems()">
<input 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
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { LaunchbarWidgetComponent } from './launchbar-widget/launchbar-widget.co
import { LaunchbarInstanceViewComponent } from './launchbar-instance-view/launchbar-instance-view.component';
import { MatSnackBarModule } from '@angular/material';
import { SnackbarComponent } from './shared/snackbar/snackbar.component'
import { SortArray } from './shared/sort-array'
import {MAT_SNACK_BAR_DATA} from '@angular/material';


Expand All @@ -39,6 +40,7 @@ import {MAT_SNACK_BAR_DATA} from '@angular/material';
LaunchbarWidgetComponent,
LaunchbarInstanceViewComponent,
SnackbarComponent,
SortArray
],
entryComponents: [SnackbarComponent],
exports: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { generateInstanceActions } from '../shared/context-utils';
styleUrls: ['./launchbar.component.css', '../shared/shared.css'],
providers: [PluginsDataService]
})
export class LaunchbarComponent {
export class LaunchbarComponent implements MVDHosting.LogoutActionInterface {
allItems: LaunchbarItem[];
runItems: LaunchbarItem[];
isActive: boolean;
Expand All @@ -54,6 +54,7 @@ export class LaunchbarComponent {
// Workaround for AoT problem with namespaces (see angular/angular#15613)
this.applicationManager = this.injector.get(MVDHosting.Tokens.ApplicationManagerToken);
this.authenticationManager = this.injector.get(MVDHosting.Tokens.AuthenticationManagerToken);
this.authenticationManager.registerPreLogoutAction(this);
this.pluginManager = this.injector.get(MVDHosting.Tokens.PluginManagerToken);
this.allItems = [];
this.runItems = [];
Expand All @@ -78,6 +79,11 @@ export class LaunchbarComponent {
this.pluginManager.loadApplicationPluginDefinitions(true);
}

onLogout(): boolean {
this.allItems = [];
return true;
}

ngDoCheck(): void {
if (this.authenticationManager.getUsername() != null) {
this.loggedIn = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
This program and the accompanying materials are
made available under the terms of the Eclipse Public License v2.0 which accompanies
this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
*/

import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
name: "sortBy"
})
export class SortArray implements PipeTransform {
transform(array: any[], attribute: string): any[] {
array.sort((a: any, b: any) => {
if (a[attribute] < b[attribute]) {
return -1;
} else if (a[attribute] > b[attribute]) {
return 1;
} else {
return 0;
}
});
return array;
}
}
1 change: 1 addition & 0 deletions virtual-desktop/src/assets/i18n/messages.de.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"Restart Now": "Jetzt neu starten",
"Retry": "Wiederholen",
"Russian": "Russisch",
"Search": "Suchen",
"Select": "Auswählen",
"Session could not be renewed. Logout will occur unless renewed. Click here to retry.": "Sitzung konnte nicht erneuert werden. Abmeldung erfolgt, falls Sitzung nicht erneuert wird. Hier clicken, um zu wiederholen.",
"Session Expired": "Sitzung abgelaufen",
Expand Down
1 change: 1 addition & 0 deletions virtual-desktop/src/assets/i18n/messages.fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"Restart Now": "Redémarrer Maintenant",
"Retry": "Réessayer",
"Russian": "Russe",
"Search": "Chercher",
"Select": "Sélectionner",
"Session could not be renewed. Logout will occur unless renewed. Click here to retry.": "La session n'a pas pu être renouvelée. Cliquez ici pour réessayer.",
"Session Expired": "La session a expiré",
Expand Down
2 changes: 1 addition & 1 deletion virtual-desktop/src/assets/i18n/messages.fr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

<note priority="1" from="description">Title of Sign out button</note>
<note priority="1" from="meaning">signout button</note>
<context-group purpose="location"><context context-type="sourcefile">src/app/window-manager/mvd-window-manager/launchbar/launchbar-widget/launchbar-widget.component.ts</context><context context-type="linenumber">16</context></context-group></trans-unit>
<context-group purpose="location"><context context-type="sourcefile">src/app/window-manager/mvd-window-manager/launchbar/launchbar-widget/launchbar-widget.component.ts</context><context context-type="linenumber">14</context></context-group></trans-unit>
</body>
</file>
</xliff>
2 changes: 2 additions & 0 deletions virtual-desktop/src/assets/i18n/messages.ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
"Open in New Browser Tab": "新しいブラウザー・タブで開く",
"PinToTaskbar": "アプリケーションをピン留めする",
"Properties":"プロパティー",
"Refresh Applications": "アプリケーションを再ロード",
"Restart Later": "後で再起動",
"Restart Now": "今すぐ再起動",
"Retry": "再試行",
"Russian": "ロシア語",
"Search": "検索",
"Select": "選択",
"Session could not be renewed. Logout will occur unless renewed. Click here to retry.": "セッションを更新できませんでした。更新しないとログアウトされます。再試行するにはここをクリックしてください。",
"Session Expired": "セッションの期限が切れました。",
Expand Down
2 changes: 1 addition & 1 deletion virtual-desktop/src/assets/i18n/messages.ja.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

<note priority="1" from="description">Title of Sign out button</note>
<note priority="1" from="meaning">signout button</note>
<context-group purpose="location"><context context-type="sourcefile">src/app/window-manager/mvd-window-manager/launchbar/launchbar-widget/launchbar-widget.component.ts</context><context context-type="linenumber">16</context></context-group></trans-unit>
<context-group purpose="location"><context context-type="sourcefile">src/app/window-manager/mvd-window-manager/launchbar/launchbar-widget/launchbar-widget.component.ts</context><context context-type="linenumber">14</context></context-group></trans-unit>
</body>
</file>
</xliff>
2 changes: 2 additions & 0 deletions virtual-desktop/src/assets/i18n/messages.ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
"Open in New Browser Tab": "Открыть в новой вкладке браузера",
"PinToTaskbar": "Закрепить",
"Properties": "Свойства",
"Refresh Applications": "Обновить приложения",
"Restart Later": "Перезагрузить позже",
"Restart Now": "Перезагрузить сейчас",
"Retry": "Повторить",
"Russian": "Русский",
"Search": "Поиск",
"Select": "Выбрать",
"Session could not be renewed. Logout will occur unless renewed. Click here to retry.": "Сессия не смогла быть продлена. Произойдет выход если нет продления. Нажмите сюда чтобы повторить попытку.",
"Session Expired": "Сессия истекла",
Expand Down
2 changes: 1 addition & 1 deletion virtual-desktop/src/assets/i18n/messages.ru.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

<note priority="1" from="description">Title of Sign out button</note>
<note priority="1" from="meaning">signout button</note>
<context-group purpose="location"><context context-type="sourcefile">src/app/window-manager/mvd-window-manager/launchbar/launchbar-widget/launchbar-widget.component.ts</context><context context-type="linenumber">16</context></context-group></trans-unit>
<context-group purpose="location"><context context-type="sourcefile">src/app/window-manager/mvd-window-manager/launchbar/launchbar-widget/launchbar-widget.component.ts</context><context context-type="linenumber">14</context></context-group></trans-unit>
</body>
</file>
</xliff>
2 changes: 1 addition & 1 deletion virtual-desktop/src/assets/i18n/messages.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<source>Log out</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/window-manager/mvd-window-manager/launchbar/launchbar-widget/launchbar-widget.component.ts</context>
<context context-type="linenumber">16</context>
<context context-type="linenumber">14</context>
</context-group>
<note priority="1" from="description">Title of Sign out button</note>
<note priority="1" from="meaning">signout button</note>
Expand Down
1 change: 1 addition & 0 deletions virtual-desktop/src/assets/i18n/messages.zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"Restart Now": "立即重新启动",
"Retry": "重试",
"Russian": "俄语",
"Search": "查找",
"Select": "选择",
"Session could not be renewed. Logout will occur unless renewed. Click here to retry.": "会话无法续订。即将登出。点击此处重试",
"Session Expired": "会话已过期",
Expand Down
2 changes: 1 addition & 1 deletion virtual-desktop/src/assets/i18n/messages.zh.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

<note priority="1" from="description">Title of Sign out button</note>
<note priority="1" from="meaning">signout button</note>
<context-group purpose="location"><context context-type="sourcefile">src/app/window-manager/mvd-window-manager/launchbar/launchbar-widget/launchbar-widget.component.ts</context><context context-type="linenumber">16</context></context-group></trans-unit>
<context-group purpose="location"><context context-type="sourcefile">src/app/window-manager/mvd-window-manager/launchbar/launchbar-widget/launchbar-widget.component.ts</context><context context-type="linenumber">14</context></context-group></trans-unit>

</body>
</file>
Expand Down

0 comments on commit c4b3340

Please sign in to comment.