From b7a1fb55e070dcfc105df65af4a90bb378093c11 Mon Sep 17 00:00:00 2001 From: Zhiqiang Feng Date: Mon, 1 Apr 2019 13:05:46 -0700 Subject: [PATCH 1/4] Dynamically adjust recent template text based on window size --- package-lock.json | 2 +- .../recent-template-list.component.ts | 18 +++++++++++++++++- .../recent-template-list.html | 2 +- src/app/services/ncj/ncj-template.service.ts | 1 + 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 84a543ff10..a1e93fc482 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "batch-explorer", - "version": "2.0.2", + "version": "2.0.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/app/components/gallery/home/recent-template-list/recent-template-list.component.ts b/src/app/components/gallery/home/recent-template-list/recent-template-list.component.ts index 725c5dbaea..0c2f72e9bf 100644 --- a/src/app/components/gallery/home/recent-template-list/recent-template-list.component.ts +++ b/src/app/components/gallery/home/recent-template-list/recent-template-list.component.ts @@ -1,4 +1,4 @@ -import { Component, OnDestroy } from "@angular/core"; +import { Component, HostListener, OnDestroy } from "@angular/core"; import { ElectronRemote } from "@batch-flask/electron"; import { DialogService } from "@batch-flask/ui"; import { NcjTemplateMode } from "app/models"; @@ -23,9 +23,25 @@ export class RecentTemplateListComponent implements OnDestroy { private dialogService: DialogService) { this._subs.push(this.templateService.recentSubmission.subscribe((value) => { this.recentSubmissions = value; + this.onResizeEvent(null); })); } + @HostListener("window:resize", ["$event"]) + public onResizeEvent(event) { + // adjust displayed tempalte name based on window width to keep it in one row + const charcount = window.innerWidth / 4 / 5; + this.recentSubmissions.forEach(submission => { + if (submission.name.length - charcount > 0) { + submission.displayName = "Run template ..." + + submission.name.replace("Run template ", ""). + substr(submission.name.length - charcount + 1, charcount); + } else { + submission.displayName = submission.name; + } + }); + } + public ngOnDestroy() { this._subs.forEach(x => x.unsubscribe()); this._subs = []; diff --git a/src/app/components/gallery/home/recent-template-list/recent-template-list.html b/src/app/components/gallery/home/recent-template-list/recent-template-list.html index 3d8417a7ed..8a3d43eda2 100644 --- a/src/app/components/gallery/home/recent-template-list/recent-template-list.html +++ b/src/app/components/gallery/home/recent-template-list/recent-template-list.html @@ -1,7 +1,7 @@
- {{recent.name}} + {{recent.displayName}} ({{formatMode(recent.mode)}}) diff --git a/src/app/services/ncj/ncj-template.service.ts b/src/app/services/ncj/ncj-template.service.ts index 4f74b3f402..ec574d0aa5 100644 --- a/src/app/services/ncj/ncj-template.service.ts +++ b/src/app/services/ncj/ncj-template.service.ts @@ -20,6 +20,7 @@ const maxRecentSubmissions = 10; export interface RecentSubmissionParams { name: string; + displayName?: string; jobTemplate?: NcjJobTemplate; poolTemplate?: NcjPoolTemplate; mode: NcjTemplateMode; From ed5872a50d062d353f923bb52473e39ea9bf495c Mon Sep 17 00:00:00 2001 From: Zhiqiang Feng Date: Mon, 1 Apr 2019 13:11:44 -0700 Subject: [PATCH 2/4] fix typo --- .../home/recent-template-list/recent-template-list.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/gallery/home/recent-template-list/recent-template-list.component.ts b/src/app/components/gallery/home/recent-template-list/recent-template-list.component.ts index 0c2f72e9bf..d41c74d47a 100644 --- a/src/app/components/gallery/home/recent-template-list/recent-template-list.component.ts +++ b/src/app/components/gallery/home/recent-template-list/recent-template-list.component.ts @@ -29,7 +29,7 @@ export class RecentTemplateListComponent implements OnDestroy { @HostListener("window:resize", ["$event"]) public onResizeEvent(event) { - // adjust displayed tempalte name based on window width to keep it in one row + // adjust displayed template name based on window width to keep it in one row const charcount = window.innerWidth / 4 / 5; this.recentSubmissions.forEach(submission => { if (submission.name.length - charcount > 0) { From aea03b8d3ca238b4207fa8d864fbb5011f4b67cf Mon Sep 17 00:00:00 2001 From: Zhiqiang Feng Date: Mon, 1 Apr 2019 16:02:15 -0700 Subject: [PATCH 3/4] use css to show recent template --- .../recent-template-list.component.ts | 18 +----------------- .../recent-template-list.html | 13 +++++++------ .../recent-template-list.scss | 2 ++ src/app/services/ncj/ncj-template.service.ts | 1 - 4 files changed, 10 insertions(+), 24 deletions(-) diff --git a/src/app/components/gallery/home/recent-template-list/recent-template-list.component.ts b/src/app/components/gallery/home/recent-template-list/recent-template-list.component.ts index d41c74d47a..725c5dbaea 100644 --- a/src/app/components/gallery/home/recent-template-list/recent-template-list.component.ts +++ b/src/app/components/gallery/home/recent-template-list/recent-template-list.component.ts @@ -1,4 +1,4 @@ -import { Component, HostListener, OnDestroy } from "@angular/core"; +import { Component, OnDestroy } from "@angular/core"; import { ElectronRemote } from "@batch-flask/electron"; import { DialogService } from "@batch-flask/ui"; import { NcjTemplateMode } from "app/models"; @@ -23,25 +23,9 @@ export class RecentTemplateListComponent implements OnDestroy { private dialogService: DialogService) { this._subs.push(this.templateService.recentSubmission.subscribe((value) => { this.recentSubmissions = value; - this.onResizeEvent(null); })); } - @HostListener("window:resize", ["$event"]) - public onResizeEvent(event) { - // adjust displayed template name based on window width to keep it in one row - const charcount = window.innerWidth / 4 / 5; - this.recentSubmissions.forEach(submission => { - if (submission.name.length - charcount > 0) { - submission.displayName = "Run template ..." + - submission.name.replace("Run template ", ""). - substr(submission.name.length - charcount + 1, charcount); - } else { - submission.displayName = submission.name; - } - }); - } - public ngOnDestroy() { this._subs.forEach(x => x.unsubscribe()); this._subs = []; diff --git a/src/app/components/gallery/home/recent-template-list/recent-template-list.html b/src/app/components/gallery/home/recent-template-list/recent-template-list.html index 8a3d43eda2..fbcf1e78ce 100644 --- a/src/app/components/gallery/home/recent-template-list/recent-template-list.html +++ b/src/app/components/gallery/home/recent-template-list/recent-template-list.html @@ -1,12 +1,13 @@
- {{recent.displayName}} - ({{formatMode(recent.mode)}}) - - - - + {{recent.name}} + ({{formatMode(recent.mode)}}) + + + + +
diff --git a/src/app/components/gallery/home/recent-template-list/recent-template-list.scss b/src/app/components/gallery/home/recent-template-list/recent-template-list.scss index 5142cf8aa1..15f0743ba4 100644 --- a/src/app/components/gallery/home/recent-template-list/recent-template-list.scss +++ b/src/app/components/gallery/home/recent-template-list/recent-template-list.scss @@ -22,6 +22,7 @@ bl-recent-template-list { .mode { margin-left: 3px; color: $secondary-text; + white-space: nowrap; } &:hover { @@ -44,4 +45,5 @@ bl-recent-template-list { .no-recent { margin: 10px; } + } diff --git a/src/app/services/ncj/ncj-template.service.ts b/src/app/services/ncj/ncj-template.service.ts index ec574d0aa5..4f74b3f402 100644 --- a/src/app/services/ncj/ncj-template.service.ts +++ b/src/app/services/ncj/ncj-template.service.ts @@ -20,7 +20,6 @@ const maxRecentSubmissions = 10; export interface RecentSubmissionParams { name: string; - displayName?: string; jobTemplate?: NcjJobTemplate; poolTemplate?: NcjPoolTemplate; mode: NcjTemplateMode; From 5c1fee1c0ad46611bc203d6ddf15ca06a7dbdda1 Mon Sep 17 00:00:00 2001 From: Zhiqiang Feng Date: Wed, 3 Apr 2019 11:28:21 -0700 Subject: [PATCH 4/4] update change log --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44b11b1f10..9b2b6ff8bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,10 @@ # 2.0.3 ### Bug fixes +* Recent templates from "my library" are a bit too long [\#1969](https://github.com/Azure/BatchExplorer/issues/1969) * Job schedule with autopool fail to display [\#1995](https://github.com/Azure/BatchExplorer/issues/1995) * Pool graphs One Day and One Week option both have value of 1 day [\#1999](https://github.com/Azure/BatchExplorer/issues/1999) -* Microsoft portfolio settings not persisted [\#2004](https://github.com/Azure/BatchExplorer/issues/2004) +* Microsoft portfolio settings not persisted [\#2004](https://github.com/Azure/BatchExplorer/issues/2004) # 2.0.2