Skip to content

Commit b753059

Browse files
Further progress tweaks
1 parent d116c65 commit b753059

File tree

4 files changed

+33
-4
lines changed

4 files changed

+33
-4
lines changed

__tests__/api/BundlePush/SubtaskWithStatus.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,26 @@ describe("SubtaskWithStatus", () => {
7676
subTask.percentComplete = 50;
7777
expect(subTask.percentComplete).toEqual(50);
7878
});
79+
80+
it("should allow really small increments", () => {
81+
const subTask = new SubtaskWithStatus(parentTask, 40);
82+
subTask.percentComplete = 50;
83+
for (let i = 0; i < 40; i++) {
84+
subTask.percentComplete += 0.25;
85+
}
86+
expect(parentTask.percentComplete).toBeCloseTo(24);
87+
88+
});
89+
90+
it("should return subtask stage", () => {
91+
const subTask = new SubtaskWithStatus(parentTask, 40);
92+
subTask.stageName = TaskStage.IN_PROGRESS;
93+
expect(subTask.stageName).toEqual(TaskStage.IN_PROGRESS);
94+
});
95+
96+
it("should return subtask status message", () => {
97+
const subTask = new SubtaskWithStatus(parentTask, 40);
98+
subTask.statusMessage = "Status";
99+
expect(subTask.statusMessage).toEqual("Status");
100+
});
79101
});

src/api/BundleDeploy/BundleDeployer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ export class BundleDeployer {
271271

272272
private updateProgressBar(action: string) {
273273
// Increment the progress bar. This will refresh what the user sees on the console.
274-
this.progressBar.percentComplete += this.PROGRESS_BAR_INCREMENT;
274+
this.progressBar.percentComplete = this.progressBar.percentComplete + this.PROGRESS_BAR_INCREMENT;
275275

276276
// Have a look at the status message for the progress bar, has it been updated with
277277
// the jobid yet? If so, parse it out and refresh the message.

src/api/BundlePush/BundlePusher.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@ export class BundlePusher {
328328
private async undeployExistingBundle(zosMFSession: AbstractSession, bd: BundleDeployer) {
329329
// End the current progress bar so that UNDEPLOY can create its own
330330
this.updateStatus("Undeploying bundle '" + this.params.arguments.name + "' from CICS");
331-
this.endProgressBar();
332331

333332
const targetstateLocal = this.params.arguments.targetstate;
334333
this.params.arguments.targetstate = "DISCARDED";
@@ -350,7 +349,7 @@ export class BundlePusher {
350349
let deployError: Error;
351350
let dfhdployOutput = "";
352351
try {
353-
await bd.deployBundle(zosMFSession,subtask);
352+
await bd.deployBundle(zosMFSession, subtask);
354353
}
355354
catch (error) {
356355
// temporarily ignore the error as we might want to generate additional resource

src/api/BundlePush/SubtaskWithStatus.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ITaskWithStatus, TaskProgress, TaskStage, ImperativeExpect, ImperativeError} from "@zowe/imperative";
1+
import { ITaskWithStatus, TaskProgress, TaskStage, ImperativeExpect, ImperativeError, Logger} from "@zowe/imperative";
22

33

44
export class SubtaskWithStatus {
@@ -20,12 +20,20 @@ export class SubtaskWithStatus {
2020
this.parent.statusMessage = statusMessage;
2121
}
2222

23+
public get statusMessage() {
24+
return this.parent.statusMessage;
25+
}
26+
2327
public set stageName(stageName: TaskStage) {
2428
if (stageName !== TaskStage.COMPLETE && stageName !== TaskStage.NOT_STARTED) {
2529
this.parent.stageName = stageName;
2630
}
2731
}
2832

33+
public get stageName() {
34+
return this.parent.stageName;
35+
}
36+
2937
public set percentComplete(percentComplete: number) {
3038
const delta = percentComplete - this.percentCompleteInternal;
3139
this.percentCompleteInternal = percentComplete;

0 commit comments

Comments
 (0)