From f44844843cb86ed3491db38dd7726e55ef20a61a Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Thu, 8 Jun 2017 17:21:55 -0700 Subject: [PATCH 01/10] Hook model & service --- app/models/index.ts | 2 ++ app/models/job-hook-task-execution-info.ts | 41 ++++++++++++++++++++++ app/models/job-hook-task.ts | 19 ++++++++++ app/services/job-hook-task.service.ts | 29 +++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 app/models/job-hook-task-execution-info.ts create mode 100644 app/models/job-hook-task.ts create mode 100644 app/services/job-hook-task.service.ts diff --git a/app/models/index.ts b/app/models/index.ts index 9e1d729b82..44c7bc6e39 100644 --- a/app/models/index.ts +++ b/app/models/index.ts @@ -20,6 +20,8 @@ export * from "./job"; export * from "./job-action"; export * from "./job-constraints"; export * from "./job-execution-information"; +export * from "./job-hook-task-execution-info"; +export * from "./job-hook-task"; export * from "./job-manager-task"; export * from "./job-preparation-task"; export * from "./job-release-task"; diff --git a/app/models/job-hook-task-execution-info.ts b/app/models/job-hook-task-execution-info.ts new file mode 100644 index 0000000000..bf345a431f --- /dev/null +++ b/app/models/job-hook-task-execution-info.ts @@ -0,0 +1,41 @@ +import { Model, Prop, Record } from "app/core"; +import { FailureInfoAttributes } from "./failure-info"; + +export type JobHookTaskState = "running" | "completed"; +export const JobHookTaskState = { + running: "running" as JobHookTaskState, + completed: "completed" as JobHookTaskState, +}; + +export type JobHookTaskResult = "success" | "failure"; +export const JobHookTaskResult = { + success: "success" as JobHookTaskResult, + failure: "failure" as JobHookTaskResult, +}; + +export interface JobHookTaskExecutionInfoAttributes { + state: JobHookTaskState; + startTime: Date; + endTime: Date; + taskRootDirectory: string; + taskRootDirectoryUrl: string; + exitCode: number; + failureInfo: FailureInfoAttributes; + retryCount: number; + lastRetryTime: Date; + result: JobHookTaskResult; +} + +@Model() +export class JobHookTaskExecutionInfo extends Record { + @Prop() public state: JobHookTaskState; + @Prop() public startTime: Date; + @Prop() public endTime: Date; + @Prop() public taskRootDirectory: string; + @Prop() public taskRootDirectoryUrl: string; + @Prop() public exitCode: number; + @Prop() public failureInfo: FailureInfoAttributes; + @Prop() public retryCount: number; + @Prop() public lastRetryTime: Date; + @Prop() public result: JobHookTaskResult; +} diff --git a/app/models/job-hook-task.ts b/app/models/job-hook-task.ts new file mode 100644 index 0000000000..dec53de96d --- /dev/null +++ b/app/models/job-hook-task.ts @@ -0,0 +1,19 @@ +import { Model, Prop, Record } from "app/core"; +import { JobHookTaskExecutionInfo } from "./job-hook-task-execution-info"; + +export interface JobHookTaskAttributes { + poolId: string; + nodeId: string; + nodeUrl: string; + jobPreparationTaskExecutionInfo: JobHookTaskExecutionInfo; + jobReleaseTaskExecutionInfo: JobHookTaskExecutionInfo; +} + +@Model() +export class JobHookTask extends Record { + @Prop() public poolId: string; + @Prop() public nodeId: string; + @Prop() public nodeUrl: string; + @Prop() public jobPreparationTaskExecutionInfo: JobHookTaskExecutionInfo; + @Prop() public jobReleaseTaskExecutionInfo: JobHookTaskExecutionInfo; +} diff --git a/app/services/job-hook-task.service.ts b/app/services/job-hook-task.service.ts new file mode 100644 index 0000000000..7ba5dbe43b --- /dev/null +++ b/app/services/job-hook-task.service.ts @@ -0,0 +1,29 @@ +import { Injectable } from "@angular/core"; + +import { JobHookTask } from "app/models"; +import { BatchClientService } from "./batch-client.service"; +import { RxBatchListProxy, RxListProxy, TargetedDataCache } from "./core"; +import { ServiceBase } from "./service-base"; + +export interface JobHookTaskListParams { + jobId?: string; +} + +@Injectable() +export class JobService extends ServiceBase { + private _cache = new TargetedDataCache({ + key: ({ jobId }) => jobId, + }); + + constructor(batchService: BatchClientService) { + super(batchService); + } + + public list(initialOptions: any = {}): RxListProxy { + return new RxBatchListProxy(JobHookTask, this.batchService, { + cache: ({ jobId }) => this._cache.getCache({ jobId }), + proxyConstructor: (client, params, options) => client.job.listHookTasks(options), + initialOptions, + }); + } +} From 9498ef88f7d062616504d305a395462b92f17fac Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Tue, 13 Jun 2017 09:21:13 -0700 Subject: [PATCH 02/10] Display table --- app/app.module.ts | 2 + app/components/job/details/job-details.html | 4 ++ .../job/details/job-details.module.ts | 3 +- .../job-hook-task-browser/index.ts | 1 + .../job-hook-task-browser.component.ts | 45 +++++++++++++++++++ .../job-hook-task-browser.html | 23 ++++++++++ app/components/job/job.module.ts | 3 +- app/core/record/helpers.ts | 4 +- app/core/record/record.ts | 15 +++++-- app/models/job-hook-task-execution-info.ts | 5 +++ app/models/job-hook-task.ts | 13 +++++- app/services/index.ts | 1 + app/services/job-hook-task.service.ts | 7 +-- client/api/batch-client-proxy/jobProxy.ts | 13 ++++++ client/main.ts | 2 +- 15 files changed, 129 insertions(+), 12 deletions(-) create mode 100644 app/components/job/job-hook-task/job-hook-task-browser/index.ts create mode 100644 app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.component.ts create mode 100644 app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.html diff --git a/app/app.module.ts b/app/app.module.ts index 2ce9a714fb..d47e38ff8a 100644 --- a/app/app.module.ts +++ b/app/app.module.ts @@ -43,6 +43,7 @@ import { FileSystemService, GithubDataService, HttpUploadService, + JobHookTaskService, JobService, LocalFileStorage, NodeService, @@ -103,6 +104,7 @@ const modules = [ FileSystemService, GithubDataService, HttpUploadService, + JobHookTaskService, JobService, LocalFileStorage, NodeService, diff --git a/app/components/job/details/job-details.html b/app/components/job/details/job-details.html index 080934cba6..fb60c29ded 100644 --- a/app/components/job/details/job-details.html +++ b/app/components/job/details/job-details.html @@ -40,6 +40,10 @@ Configuration + + Prep/Release tasks + + diff --git a/app/components/job/details/job-details.module.ts b/app/components/job/details/job-details.module.ts index 53e993e00e..f94d7f957d 100644 --- a/app/components/job/details/job-details.module.ts +++ b/app/components/job/details/job-details.module.ts @@ -5,6 +5,7 @@ import { BaseModule } from "app/components/base"; import { FileBrowseModule } from "app/components/file/browse"; import { FileDetailsModule } from "app/components/file/details"; import { TaskBrowseModule } from "app/components/task/browse"; +import { JobHookTaskModule } from "../job-hook-task"; import { JobErrorDisplayComponent } from "./error-display"; import { JobConfigurationComponent } from "./job-configuration.component"; import { JobDefaultComponent } from "./job-default.component"; @@ -20,7 +21,7 @@ const components = [ ]; const modules = [ - BaseModule, FileBrowseModule, FileDetailsModule, TaskBrowseModule, + BaseModule, FileBrowseModule, FileDetailsModule, TaskBrowseModule, JobHookTaskModule, ]; @NgModule({ diff --git a/app/components/job/job-hook-task/job-hook-task-browser/index.ts b/app/components/job/job-hook-task/job-hook-task-browser/index.ts new file mode 100644 index 0000000000..d764f60008 --- /dev/null +++ b/app/components/job/job-hook-task/job-hook-task-browser/index.ts @@ -0,0 +1 @@ +export * from "./job-hook-task-browser.component"; diff --git a/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.component.ts b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.component.ts new file mode 100644 index 0000000000..8bd42a44d4 --- /dev/null +++ b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.component.ts @@ -0,0 +1,45 @@ +import { Component, Input, OnDestroy, OnInit } from "@angular/core"; + +import { Job, JobHookTask } from "app/models"; +import { JobHookTaskListParams, JobHookTaskService } from "app/services"; +import { RxListProxy } from "app/services/core"; +import { DateUtils } from "app/utils"; + +type HookTaskType = "preparationTask" | "releaseTask"; +const HookTaskType = { + preparationTask: "preparationTask" as HookTaskType, + releaseTask: "releaseTask" as HookTaskType, +}; + +@Component({ + selector: "bl-job-hook-task-browser", + templateUrl: "job-hook-task-browser.html", +}) +export class JobHookTaskBrowserComponent implements OnInit, OnDestroy { + @Input() + public job: Job; + + public data: RxListProxy; + + public type: HookTaskType = "preparationTask"; + + constructor(jobHookTaskService: JobHookTaskService) { + this.data = jobHookTaskService.list(); + this.data.items.subscribe((items) => { + console.log("Items", items.toJS()); + }); + } + + public ngOnInit() { + this.data.params = { jobId: this.job.id }; + this.data.fetchNext().subscribe(() => console.log("Banana"), (e) => console.error("Ee", e)); + } + + public ngOnDestroy() { + this.data.dispose(); + } + + public formatDate(date: Date) { + return DateUtils.prettyDate(date, 7); + } +} diff --git a/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.html b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.html new file mode 100644 index 0000000000..2551f0d40c --- /dev/null +++ b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.html @@ -0,0 +1,23 @@ +
+ + +
+ + + NodeId + State + Status + Created + Started + Exit code + + + + {{task.nodeId}} + {{task[type]?.state}} + {{task[type]?.result}} + {{formatDate(task[type]?.startTime)}} + {{formatDate(task[type]?.endTime)}} + {{task[type]?.exitCode}} + + diff --git a/app/components/job/job.module.ts b/app/components/job/job.module.ts index d8cfffa30d..aa96ba00e3 100644 --- a/app/components/job/job.module.ts +++ b/app/components/job/job.module.ts @@ -7,13 +7,14 @@ import { JobAdvancedFilterComponent } from "app/components/job/browse/filter/job import { JobListComponent } from "app/components/job/browse/job-list.component"; import { JobDetailsModule } from "app/components/job/details"; import { JobHomeComponent } from "app/components/job/home/job-home.component"; +import { JobHookTaskModule } from "./job-hook-task"; const components = [ JobAdvancedFilterComponent, JobHomeComponent, JobListComponent, JobStatsPreviewComponent, ]; const modules = [ - JobActionModule, JobDetailsModule, ...commonModules, + JobActionModule, JobDetailsModule, JobHookTaskModule, ...commonModules, ]; @NgModule({ diff --git a/app/core/record/helpers.ts b/app/core/record/helpers.ts index e9bb1fe9cf..7a885dae99 100644 --- a/app/core/record/helpers.ts +++ b/app/core/record/helpers.ts @@ -1,5 +1,6 @@ import { Type } from "@angular/core"; +import { exists } from "app/utils"; import { RecordSetAttributeError } from "./errors"; import { Record } from "./record"; @@ -36,7 +37,8 @@ export function updateTypeMetadata(ctr: Type, attr: string, type: TypeMetad export function setProp(ctr: Type, attr: string) { Object.defineProperty(ctr.prototype, attr, { get: function (this: Record) { - return (this as any)._map.get(attr) || (this as any)._defaultValues[attr]; + const value = (this as any)._map.get(attr); + return exists(value) ? value : (this as any)._defaultValues[attr]; }, set: function (this: Record, value: T) { if ((this as any)._initialized) { diff --git a/app/core/record/record.ts b/app/core/record/record.ts index b1aa516f3c..564f9a5d65 100644 --- a/app/core/record/record.ts +++ b/app/core/record/record.ts @@ -1,6 +1,6 @@ import { List, Map } from "immutable"; -import { nil } from "app/utils"; +import { exists, nil } from "app/utils"; import { metadataForRecord, primitives } from "./helpers"; /** @@ -31,7 +31,7 @@ export class Record { public merge(other: Partial): this { const ctr: any = this.constructor; - return new ctr({ ...this.toJS(), ...other as any}); + return new ctr({ ...this.toJS(), ...other as any }); } /** @@ -74,13 +74,22 @@ export class Record { continue; } const value = (data as any)[key]; - if (value && typeMetadata && !primitives.has(typeMetadata.type.name)) { + if (key === "exitCode") { + console.log("Value is", value, key); + } + if (exists(value) && typeMetadata && !primitives.has(typeMetadata.type.name)) { + if (key === "exitCode") { + console.log("Value2 is", value, key); + } if (typeMetadata.list) { obj[key] = List(value && value.map(x => new typeMetadata.type(x))); } else { obj[key] = new typeMetadata.type(value); } } else { + if (key === "exitCode") { + console.log("Value falsy is", value, key); + } obj[key] = value; } } diff --git a/app/models/job-hook-task-execution-info.ts b/app/models/job-hook-task-execution-info.ts index bf345a431f..ce6a1b6186 100644 --- a/app/models/job-hook-task-execution-info.ts +++ b/app/models/job-hook-task-execution-info.ts @@ -38,4 +38,9 @@ export class JobHookTaskExecutionInfo extends Record { @Prop() public poolId: string; @Prop() public nodeId: string; @Prop() public nodeUrl: string; - @Prop() public jobPreparationTaskExecutionInfo: JobHookTaskExecutionInfo; - @Prop() public jobReleaseTaskExecutionInfo: JobHookTaskExecutionInfo; + @Prop() public preparationTask: JobHookTaskExecutionInfo; + @Prop() public releaseTask: JobHookTaskExecutionInfo; + + constructor(data: JobHookTaskAttributes) { + super({ + ...data, + id: `${data.poolId}|${data.nodeId}`, + preparationTask: data.jobPreparationTaskExecutionInfo, + releaseTask: data.jobReleaseTaskExecutionInfo, + }); + } } diff --git a/app/services/index.ts b/app/services/index.ts index b6294586a8..1e3d94308e 100644 --- a/app/services/index.ts +++ b/app/services/index.ts @@ -9,6 +9,7 @@ export * from "./fs.service"; export * from "./github-data.service"; export * from "./http-upload-service"; export * from "./job-service"; +export * from "./job-hook-task.service"; export * from "./local-file-storage.service"; export * from "./pool-service"; export * from "./node-service"; diff --git a/app/services/job-hook-task.service.ts b/app/services/job-hook-task.service.ts index 7ba5dbe43b..87bc063aca 100644 --- a/app/services/job-hook-task.service.ts +++ b/app/services/job-hook-task.service.ts @@ -10,10 +10,10 @@ export interface JobHookTaskListParams { } @Injectable() -export class JobService extends ServiceBase { +export class JobHookTaskService extends ServiceBase { private _cache = new TargetedDataCache({ key: ({ jobId }) => jobId, - }); + }, "nodeUrl"); constructor(batchService: BatchClientService) { super(batchService); @@ -22,8 +22,9 @@ export class JobService extends ServiceBase { public list(initialOptions: any = {}): RxListProxy { return new RxBatchListProxy(JobHookTask, this.batchService, { cache: ({ jobId }) => this._cache.getCache({ jobId }), - proxyConstructor: (client, params, options) => client.job.listHookTasks(options), + proxyConstructor: (client, params, options) => client.job.listHookTasks(params.jobId, options), initialOptions, + initialParams: {jobId: null}, }); } } diff --git a/client/api/batch-client-proxy/jobProxy.ts b/client/api/batch-client-proxy/jobProxy.ts index 7fbf0bc0e4..0c1cfbc87b 100644 --- a/client/api/batch-client-proxy/jobProxy.ts +++ b/client/api/batch-client-proxy/jobProxy.ts @@ -82,4 +82,17 @@ export default class JobProxy { public patch(jobId: string, attributes: any, options?: any): Promise { return this.client.job.patch(jobId, attributes, wrapOptions(options)); } + + /** + */ + public listHookTasks(jobId: string, options?: models.JobListPreparationAndReleaseTaskStatusNextOptions) { + const entity = { + list: this.client.job.listPreparationAndReleaseTaskStatus.bind(this.client.job), + listNext: this.client.job.listPreparationAndReleaseTaskStatusNext.bind(this.client.job), + }; + + // returns all of the tasklets, there is no nextLink data + return new ListProxy(entity, [jobId], + wrapOptions({ jobListPreparationAndReleaseTaskStatusNextOptions: options })); + } } diff --git a/client/main.ts b/client/main.ts index 0e520c085f..18b595818e 100644 --- a/client/main.ts +++ b/client/main.ts @@ -11,7 +11,7 @@ function createWindow() { windows.splashScreen.create(); windows.splashScreen.updateMessage("Loading app"); - // windows.main.debugCrash(); // Uncomment to debug any login/bootrstrap problems(Window doesn't show up) + windows.main.debugCrash(); // Uncomment to debug any login/bootrstrap problems(Window doesn't show up) windows.main.create(); protocol.registerStringProtocol("urn", (request, callback) => { From 9e112ca9cdf0a192bb937cb6af4e4c85a7ad819b Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Tue, 13 Jun 2017 09:21:27 -0700 Subject: [PATCH 03/10] Mising files --- app/components/job/job-hook-task/index.ts | 1 + .../job/job-hook-task/job-hook-task.module.ts | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 app/components/job/job-hook-task/index.ts create mode 100644 app/components/job/job-hook-task/job-hook-task.module.ts diff --git a/app/components/job/job-hook-task/index.ts b/app/components/job/job-hook-task/index.ts new file mode 100644 index 0000000000..51df75ee09 --- /dev/null +++ b/app/components/job/job-hook-task/index.ts @@ -0,0 +1 @@ +export * from "./job-hook-task.module"; diff --git a/app/components/job/job-hook-task/job-hook-task.module.ts b/app/components/job/job-hook-task/job-hook-task.module.ts new file mode 100644 index 0000000000..bf121245f9 --- /dev/null +++ b/app/components/job/job-hook-task/job-hook-task.module.ts @@ -0,0 +1,22 @@ +import { NgModule } from "@angular/core"; + +import { commonModules } from "app/common"; +import { JobHookTaskBrowserComponent } from "./job-hook-task-browser"; + +const components = [ + JobHookTaskBrowserComponent, +]; + +const modules = [ + ...commonModules, +]; + +@NgModule({ + declarations: components, + exports: [...modules, ...components], + imports: [...modules], + entryComponents: [ + ], +}) +export class JobHookTaskModule { +} From a873388efff49da283a9d992b7a08c4db04dc5b7 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Thu, 15 Jun 2017 14:54:47 -0700 Subject: [PATCH 04/10] Wip --- .../job-hook-task-browser.component.ts | 38 +++++++++++++ .../job-hook-task-browser.html | 56 ++++++++++++------- .../job-hook-task-browser.scss | 24 ++++++++ .../job-hook-task-details/index.ts | 1 + .../job-hook-task-details.component.ts | 13 +++++ .../job-hook-task-details.html | 11 ++++ .../job-hook-task-details.scss | 0 .../job/job-hook-task/job-hook-task.module.ts | 4 ++ app/models/job-hook-task.ts | 6 +- 9 files changed, 131 insertions(+), 22 deletions(-) create mode 100644 app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.scss create mode 100644 app/components/job/job-hook-task/job-hook-task-details/index.ts create mode 100644 app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.component.ts create mode 100644 app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.html create mode 100644 app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.scss diff --git a/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.component.ts b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.component.ts index 8bd42a44d4..dc4c7528e8 100644 --- a/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.component.ts +++ b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.component.ts @@ -1,9 +1,15 @@ import { Component, Input, OnDestroy, OnInit } from "@angular/core"; +import { FormControl } from "@angular/forms"; +import { List } from "immutable"; +import { Subscription } from "rxjs"; import { Job, JobHookTask } from "app/models"; import { JobHookTaskListParams, JobHookTaskService } from "app/services"; import { RxListProxy } from "app/services/core"; import { DateUtils } from "app/utils"; +import { FilterBuilder } from "app/utils/filter-builder"; + +import "./job-hook-task-browser.scss"; type HookTaskType = "preparationTask" | "releaseTask"; const HookTaskType = { @@ -16,18 +22,37 @@ const HookTaskType = { templateUrl: "job-hook-task-browser.html", }) export class JobHookTaskBrowserComponent implements OnInit, OnDestroy { + public HookTaskType = HookTaskType; + + public onlyFailedControl = new FormControl(false); + @Input() public job: Job; public data: RxListProxy; + public tasks: List; + public pickedTaskId: string; + public pickedTask: JobHookTask; + public type: HookTaskType = "preparationTask"; + private _sub: Subscription; constructor(jobHookTaskService: JobHookTaskService) { this.data = jobHookTaskService.list(); this.data.items.subscribe((items) => { + this.tasks = items; console.log("Items", items.toJS()); }); + + this._sub = this.onlyFailedControl.valueChanges.subscribe((onlyFailed) => { + console.log("ONly failed", onlyFailed); + const filter = FilterBuilder.prop("jobPreparationTaskExecutionInfo/exitCode").ne(0).toOData(); + this.data.patchOptions({ + filter: filter, + }); + this.data.fetchNext(); + }); } public ngOnInit() { @@ -37,9 +62,22 @@ export class JobHookTaskBrowserComponent implements OnInit, OnDestroy { public ngOnDestroy() { this.data.dispose(); + this._sub.unsubscribe(); } public formatDate(date: Date) { return DateUtils.prettyDate(date, 7); } + + public updateType(type) { + this.type = type; + } + + public pickTask(id: string) { + this.pickedTaskId = id; + this.pickedTask = this.tasks.filter(x => x.id === id).first(); + } + public get hasReleasedTask() { + return Boolean(this.job.jobReleaseTask); + } } diff --git a/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.html b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.html index 2551f0d40c..3f3c2cda09 100644 --- a/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.html +++ b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.html @@ -1,23 +1,37 @@ -
- - +
+
+ Only failed +
+
+
+ Preparation Tasks +
+
+ Release tasks +
+
- - - NodeId - State - Status - Created - Started - Exit code - +
+ + + NodeId + State + Status + Created + Started + Exit code + - - {{task.nodeId}} - {{task[type]?.state}} - {{task[type]?.result}} - {{formatDate(task[type]?.startTime)}} - {{formatDate(task[type]?.endTime)}} - {{task[type]?.exitCode}} - - + + {{task.nodeId}} + {{task[type]?.state}} + {{task[type]?.result}} + {{formatDate(task[type]?.startTime)}} + {{formatDate(task[type]?.endTime)}} + {{task[type]?.exitCode}} + + +
+ +
+
diff --git a/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.scss b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.scss new file mode 100644 index 0000000000..ae896a45ae --- /dev/null +++ b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.scss @@ -0,0 +1,24 @@ +bl-job-hook-task-browser { + .filters { + display: flex; + } + + .type-toggle { + margin: 10px; + text-align: right; + cursor: pointer; + > .option { + display: inline-block; + } + + > .option.active { + text-decoration: underline; + cursor: default; + } + + > .option.disabled { + opacity: 0.5; + cursor: default; + } + } +} \ No newline at end of file diff --git a/app/components/job/job-hook-task/job-hook-task-details/index.ts b/app/components/job/job-hook-task/job-hook-task-details/index.ts new file mode 100644 index 0000000000..ba3b5d0b74 --- /dev/null +++ b/app/components/job/job-hook-task/job-hook-task-details/index.ts @@ -0,0 +1 @@ +export * from "./job-hook-task-details.component"; \ No newline at end of file diff --git a/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.component.ts b/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.component.ts new file mode 100644 index 0000000000..0b7618bfc6 --- /dev/null +++ b/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.component.ts @@ -0,0 +1,13 @@ +import { Component, Input } from "@angular/core"; +import { JobHookTask } from "app/models"; + +import "./job-hook-task-details.scss"; + +@Component({ + selector: "bl-job-hook-task-details", + templateUrl: "job-hook-task-details.html", +}) +export class JobHookTaskDetailsComponent { + @Input() + public task: JobHookTask; +} diff --git a/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.html b/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.html new file mode 100644 index 0000000000..9625581f23 --- /dev/null +++ b/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.html @@ -0,0 +1,11 @@ +
+ + + + + + + +
+ +Task: {{task}} {{task?.id}} diff --git a/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.scss b/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/app/components/job/job-hook-task/job-hook-task.module.ts b/app/components/job/job-hook-task/job-hook-task.module.ts index bf121245f9..d0f7dc2263 100644 --- a/app/components/job/job-hook-task/job-hook-task.module.ts +++ b/app/components/job/job-hook-task/job-hook-task.module.ts @@ -1,13 +1,17 @@ import { NgModule } from "@angular/core"; import { commonModules } from "app/common"; +import { FileBrowseModule } from "app/components/file/browse"; import { JobHookTaskBrowserComponent } from "./job-hook-task-browser"; +import { JobHookTaskDetailsComponent } from "./job-hook-task-details"; const components = [ JobHookTaskBrowserComponent, + JobHookTaskDetailsComponent, ]; const modules = [ + FileBrowseModule, ...commonModules, ]; diff --git a/app/models/job-hook-task.ts b/app/models/job-hook-task.ts index 3810555a6d..ec8e433112 100644 --- a/app/models/job-hook-task.ts +++ b/app/models/job-hook-task.ts @@ -17,10 +17,14 @@ export class JobHookTask extends Record { @Prop() public preparationTask: JobHookTaskExecutionInfo; @Prop() public releaseTask: JobHookTaskExecutionInfo; + /** + * Id is a computed attribute using the pool and the node id. It is not returned by the server + */ + @Prop() public id: string; constructor(data: JobHookTaskAttributes) { super({ ...data, - id: `${data.poolId}|${data.nodeId}`, + id: `${data.poolId}/${data.nodeId}`, preparationTask: data.jobPreparationTaskExecutionInfo, releaseTask: data.jobReleaseTaskExecutionInfo, }); From c05cb9102dcebbb5400dfb169b94b6f7f740ecd8 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Fri, 16 Jun 2017 18:39:04 -0700 Subject: [PATCH 05/10] Prep task display better --- .../job-hook-task-browser.component.ts | 15 +++++++++++- .../job-hook-task-browser.html | 24 ++++++++++--------- .../job-hook-task-browser.scss | 17 ++++++++++--- .../job-hook-task-details.component.ts | 7 ++++++ .../job-hook-task-details.html | 4 +--- app/models/job-hook-task-execution-info.ts | 4 ++-- 6 files changed, 51 insertions(+), 20 deletions(-) diff --git a/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.component.ts b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.component.ts index dc4c7528e8..e51f2922f2 100644 --- a/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.component.ts +++ b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.component.ts @@ -3,7 +3,7 @@ import { FormControl } from "@angular/forms"; import { List } from "immutable"; import { Subscription } from "rxjs"; -import { Job, JobHookTask } from "app/models"; +import { Job, JobHookTask, JobHookTaskResult, JobHookTaskState } from "app/models"; import { JobHookTaskListParams, JobHookTaskService } from "app/services"; import { RxListProxy } from "app/services/core"; import { DateUtils } from "app/utils"; @@ -73,9 +73,22 @@ export class JobHookTaskBrowserComponent implements OnInit, OnDestroy { this.type = type; } + public status(task: JobHookTask) { + const { state, result } = task[this.type]; + + if (state === JobHookTaskState.running) { + return "runnning"; + } else if (result === JobHookTaskResult.success) { + return "success"; + } else { + return "failure"; + } + } + public pickTask(id: string) { this.pickedTaskId = id; this.pickedTask = this.tasks.filter(x => x.id === id).first(); + console.log("pick a task", id, this.pickedTask, this.tasks.map(x => x.id).toArray()); } public get hasReleasedTask() { return Boolean(this.job.jobReleaseTask); diff --git a/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.html b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.html index 3f3c2cda09..f4df942fdd 100644 --- a/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.html +++ b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.html @@ -15,23 +15,25 @@ NodeId - State - Status - Created - Started + Status + Started + Completed Exit code - + {{task.nodeId}} - {{task[type]?.state}} - {{task[type]?.result}} - {{formatDate(task[type]?.startTime)}} - {{formatDate(task[type]?.endTime)}} + + + + + + {{formatDate(task[type]?.startTime)}} + {{formatDate(task[type]?.endTime)}} {{task[type]?.exitCode}} -
- +
+
diff --git a/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.scss b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.scss index ae896a45ae..460afdebeb 100644 --- a/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.scss +++ b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.scss @@ -1,8 +1,19 @@ +@import "app/styles/variables"; + bl-job-hook-task-browser { .filters { display: flex; } - + + .content { + display: flex; + + > .details { + border-left: 1px solid $border-color; + width: 600px; + } + } + .type-toggle { margin: 10px; text-align: right; @@ -15,10 +26,10 @@ bl-job-hook-task-browser { text-decoration: underline; cursor: default; } - + > .option.disabled { opacity: 0.5; cursor: default; } } -} \ No newline at end of file +} diff --git a/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.component.ts b/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.component.ts index 0b7618bfc6..bb1d100505 100644 --- a/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.component.ts +++ b/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.component.ts @@ -10,4 +10,11 @@ import "./job-hook-task-details.scss"; export class JobHookTaskDetailsComponent { @Input() public task: JobHookTask; + + @Input() + public type: string = "preparationTask"; + + public get currentFolder() { + return this.task[this.type].taskRootDirectory; + } } diff --git a/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.html b/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.html index 9625581f23..94e1e62bc0 100644 --- a/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.html +++ b/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.html @@ -1,4 +1,4 @@ -
+
@@ -7,5 +7,3 @@
- -Task: {{task}} {{task?.id}} diff --git a/app/models/job-hook-task-execution-info.ts b/app/models/job-hook-task-execution-info.ts index ce6a1b6186..fb33986605 100644 --- a/app/models/job-hook-task-execution-info.ts +++ b/app/models/job-hook-task-execution-info.ts @@ -9,8 +9,8 @@ export const JobHookTaskState = { export type JobHookTaskResult = "success" | "failure"; export const JobHookTaskResult = { - success: "success" as JobHookTaskResult, - failure: "failure" as JobHookTaskResult, + success: "Success" as JobHookTaskResult, + failure: "Failure" as JobHookTaskResult, }; export interface JobHookTaskExecutionInfoAttributes { From 8c1642c063326c8d027ca97e702fd9ebae1e2f59 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Mon, 19 Jun 2017 09:28:10 -0700 Subject: [PATCH 06/10] better style --- .../job-hook-task-browser/job-hook-task-browser.scss | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.scss b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.scss index 460afdebeb..22a8ce7e6c 100644 --- a/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.scss +++ b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.scss @@ -7,8 +7,10 @@ bl-job-hook-task-browser { .content { display: flex; + border-top: 1px solid #d5d5d5; > .details { + padding-top: 10px; border-left: 1px solid $border-color; width: 600px; } From 088ef801bd6e982791114a3d1f5eabd75b1f486d Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Tue, 20 Jun 2017 15:55:04 -0700 Subject: [PATCH 07/10] WIP --- app/app.module.ts | 2 ++ .../base/focus-section/focus-section.module.ts | 2 +- app/components/base/form/form.module.ts | 2 +- app/components/base/quick-list/quick-list.module.ts | 2 +- app/components/base/sidebar/sidebar.ts | 2 +- app/components/base/tabs/tab-group.component.ts | 7 +++++-- app/components/job/details/job-details.component.ts | 3 +++ app/components/job/details/job-details.html | 4 ++-- package.json | 2 +- .../background-task/background-task-tracker.spec.ts | 2 +- .../form/server-error/server-error.component.spec.ts | 2 +- .../base/form/simple-form/simple-form.spec.ts | 2 +- .../app/components/base/sidebar/sidebar-spec-helper.ts | 2 +- test/app/components/base/tabs/tabs.spec.ts | 2 +- yarn.lock | 10 ++++++---- 15 files changed, 28 insertions(+), 18 deletions(-) diff --git a/app/app.module.ts b/app/app.module.ts index 6cc9354a8b..04cbd96092 100644 --- a/app/app.module.ts +++ b/app/app.module.ts @@ -28,6 +28,7 @@ import { TaskModule } from "app/components/task/task.module"; import { BatchLabsErrorHandler } from "app/error-handler"; // services +import { HttpModule } from "@angular/http"; import { PollService } from "app/services/core"; import { AccountService, @@ -87,6 +88,7 @@ const modules = [ FormsModule, MaterialModule, ReactiveFormsModule, + HttpModule, RouterModule.forRoot(routes, { useHash: true }), BaseModule, ...modules, diff --git a/app/components/base/focus-section/focus-section.module.ts b/app/components/base/focus-section/focus-section.module.ts index f90b557d74..61d3ac3a24 100644 --- a/app/components/base/focus-section/focus-section.module.ts +++ b/app/components/base/focus-section/focus-section.module.ts @@ -16,7 +16,7 @@ import { FocusSectionComponent } from "./focus-section.component"; BrowserModule, FormsModule, RouterModule, - MaterialModule.forRoot(), + MaterialModule, ], }) export class FocusSectionModule { diff --git a/app/components/base/form/form.module.ts b/app/components/base/form/form.module.ts index 021d461f8d..3fc13df601 100644 --- a/app/components/base/form/form.module.ts +++ b/app/components/base/form/form.module.ts @@ -43,7 +43,7 @@ const components = [ BrowserModule, ButtonsModule, FormsModule, - MaterialModule.forRoot(), + MaterialModule, ReactiveFormsModule, RouterModule, ...modules, diff --git a/app/components/base/quick-list/quick-list.module.ts b/app/components/base/quick-list/quick-list.module.ts index 29019cb3d7..19c5094092 100644 --- a/app/components/base/quick-list/quick-list.module.ts +++ b/app/components/base/quick-list/quick-list.module.ts @@ -26,7 +26,7 @@ import { QuickListComponent, QuickListItemStatusComponent } from "./quick-list.c BrowserModule, FormsModule, RouterModule, - MaterialModule.forRoot(), + MaterialModule, ContextMenuModule, ], }) diff --git a/app/components/base/sidebar/sidebar.ts b/app/components/base/sidebar/sidebar.ts index c708e25d61..9c96fe5106 100644 --- a/app/components/base/sidebar/sidebar.ts +++ b/app/components/base/sidebar/sidebar.ts @@ -24,7 +24,7 @@ import { SidebarPageComponent } from "./sidebar-page"; imports: [ BrowserModule, FormsModule, - MaterialModule.forRoot(), + MaterialModule, ], providers: [ SidebarManager, diff --git a/app/components/base/tabs/tab-group.component.ts b/app/components/base/tabs/tab-group.component.ts index 772cd57b79..89620322f5 100644 --- a/app/components/base/tabs/tab-group.component.ts +++ b/app/components/base/tabs/tab-group.component.ts @@ -1,5 +1,5 @@ import { - AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChildren, Input, OnInit, QueryList, + AfterViewInit, ChangeDetectorRef, Component, ContentChildren, Input, OnInit, QueryList, } from "@angular/core"; import { ActivatedRoute, Router } from "@angular/router"; @@ -8,7 +8,6 @@ import { TabComponent } from "./tab.component"; @Component({ selector: "bl-tab-group", templateUrl: "tab-group.html", - changeDetection: ChangeDetectionStrategy.OnPush, }) export class TabGroupComponent implements AfterViewInit, OnInit { @Input() @@ -57,6 +56,10 @@ export class TabGroupComponent implements AfterViewInit, OnInit { }); } + public detectChanges() { + this.changeDetector.markForCheck(); + } + private _updateSelectedTab() { if (!this.tabs) { return; diff --git a/app/components/job/details/job-details.component.ts b/app/components/job/details/job-details.component.ts index ae8f933fd3..e391655f19 100644 --- a/app/components/job/details/job-details.component.ts +++ b/app/components/job/details/job-details.component.ts @@ -38,6 +38,8 @@ export class JobDetailsComponent implements OnInit, OnDestroy { public decorator: JobDecorator; public data: RxEntityProxy; + public hasHookTask = false; + private _paramsSubscriber: Subscription; constructor( @@ -51,6 +53,7 @@ export class JobDetailsComponent implements OnInit, OnDestroy { this.data = this.jobService.get(null, {}); this.data.item.subscribe((job) => { this.job = job; + this.hasHookTask = Boolean(job && job.jobPreparationTask); if (job) { this.decorator = new JobDecorator(job); } diff --git a/app/components/job/details/job-details.html b/app/components/job/details/job-details.html index fb60c29ded..7b9ab124c3 100644 --- a/app/components/job/details/job-details.html +++ b/app/components/job/details/job-details.html @@ -40,9 +40,9 @@ Configuration - + Prep/Release tasks - + diff --git a/package.json b/package.json index da7fb9b24c..3c1ad96328 100644 --- a/package.json +++ b/package.json @@ -158,7 +158,7 @@ "@angular/core": "4.1.2", "@angular/forms": "4.1.2", "@angular/http": "4.1.2", - "@angular/material": "2.0.0-beta.3", + "@angular/material": "~2.0.0-beta.7", "@angular/platform-browser": "4.1.2", "@angular/platform-browser-dynamic": "4.1.2", "@angular/router": "4.1.2", diff --git a/test/app/components/base/background-task/background-task-tracker.spec.ts b/test/app/components/base/background-task/background-task-tracker.spec.ts index 9af59722df..262c1832fb 100644 --- a/test/app/components/base/background-task/background-task-tracker.spec.ts +++ b/test/app/components/base/background-task/background-task-tracker.spec.ts @@ -13,7 +13,7 @@ describe("BackgroundTaskTrackerComponent", () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [MaterialModule.forRoot(), BackgroundTaskModule], + imports: [MaterialModule, BackgroundTaskModule], declarations: [ ], }); diff --git a/test/app/components/base/form/server-error/server-error.component.spec.ts b/test/app/components/base/form/server-error/server-error.component.spec.ts index 10c0623988..139b48f22d 100644 --- a/test/app/components/base/form/server-error/server-error.component.spec.ts +++ b/test/app/components/base/form/server-error/server-error.component.spec.ts @@ -30,7 +30,7 @@ describe("ServerErrorComponent", () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [MaterialModule.forRoot()], + imports: [MaterialModule], declarations: [ ServerErrorComponent, ServerErrorTestComponent, diff --git a/test/app/components/base/form/simple-form/simple-form.spec.ts b/test/app/components/base/form/simple-form/simple-form.spec.ts index 7c8cdb71e3..099d15d1b0 100644 --- a/test/app/components/base/form/simple-form/simple-form.spec.ts +++ b/test/app/components/base/form/simple-form/simple-form.spec.ts @@ -50,7 +50,7 @@ describe("SimpleFormComponent", () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ReactiveFormsModule, MaterialModule.forRoot()], + imports: [ReactiveFormsModule, MaterialModule], declarations: [ SubmitButtonComponent, FormTestComponent, diff --git a/test/app/components/base/sidebar/sidebar-spec-helper.ts b/test/app/components/base/sidebar/sidebar-spec-helper.ts index 3a747fcc5c..991dc605a7 100644 --- a/test/app/components/base/sidebar/sidebar-spec-helper.ts +++ b/test/app/components/base/sidebar/sidebar-spec-helper.ts @@ -47,7 +47,7 @@ export class AppTestComponent implements AfterViewInit { export function setupSidebarTest() { TestBed.configureTestingModule({ declarations: [FakeComponent, AppTestComponent], - imports: [SidebarModule.forRoot(), MaterialModule.forRoot()], + imports: [SidebarModule.forRoot(), MaterialModule], }); TestBed.overrideModule(BrowserDynamicTestingModule, { diff --git a/test/app/components/base/tabs/tabs.spec.ts b/test/app/components/base/tabs/tabs.spec.ts index 15aff0ad2c..2f72a32297 100644 --- a/test/app/components/base/tabs/tabs.spec.ts +++ b/test/app/components/base/tabs/tabs.spec.ts @@ -41,7 +41,7 @@ describe("Tabs", () => { }; TestBed.configureTestingModule({ - imports: [MaterialModule.forRoot(), TabsModule, NoopAnimationsModule], + imports: [MaterialModule, TabsModule, NoopAnimationsModule], declarations: [TabTestComponent], providers: [ { provide: Router, useValue: routerSpy }, diff --git a/yarn.lock b/yarn.lock index c75fa5bd22..c0f0e39ecc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -54,9 +54,11 @@ version "4.1.2" resolved "https://registry.yarnpkg.com/@angular/http/-/http-4.1.2.tgz#fc378c3330c0410e1fb8aac2546329a6887776e4" -"@angular/material@2.0.0-beta.3": - version "2.0.0-beta.3" - resolved "https://registry.yarnpkg.com/@angular/material/-/material-2.0.0-beta.3.tgz#ec31dee61d7300ece28fee476852db236ded1e13" +"@angular/material@~2.0.0-beta.7": + version "2.0.0-beta.7" + resolved "https://registry.yarnpkg.com/@angular/material/-/material-2.0.0-beta.7.tgz#2584aaf1ffbe24779916345f1ac82921ccbc2577" + dependencies: + tslib "^1.7.1" "@angular/platform-browser-dynamic@4.1.2": version "4.1.2" @@ -6201,7 +6203,7 @@ tsickle@^0.21.0: source-map "^0.5.6" source-map-support "^0.4.2" -tslib@^1.6.0: +tslib@^1.6.0, tslib@^1.7.1: version "1.7.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.7.1.tgz#bc8004164691923a79fe8378bbeb3da2017538ec" From 3716cfaf37b37530eae5e1c384a08f179a8e9fa9 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Tue, 20 Jun 2017 16:18:21 -0700 Subject: [PATCH 08/10] Wip --- .../job-hook-task-browser.component.ts | 30 +++++++++++++++++-- .../job-hook-task-browser.html | 18 +++++------ .../job-hook-task-details.component.ts | 3 +- 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.component.ts b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.component.ts index e51f2922f2..207041be45 100644 --- a/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.component.ts +++ b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.component.ts @@ -32,6 +32,7 @@ export class JobHookTaskBrowserComponent implements OnInit, OnDestroy { public data: RxListProxy; public tasks: List; + public displayItems: any[]; public pickedTaskId: string; public pickedTask: JobHookTask; @@ -43,6 +44,7 @@ export class JobHookTaskBrowserComponent implements OnInit, OnDestroy { this.data.items.subscribe((items) => { this.tasks = items; console.log("Items", items.toJS()); + this._computeDisplayItems(); }); this._sub = this.onlyFailedControl.valueChanges.subscribe((onlyFailed) => { @@ -70,11 +72,20 @@ export class JobHookTaskBrowserComponent implements OnInit, OnDestroy { } public updateType(type) { + if (type === HookTaskType.releaseTask && !this.hasReleaseTask) { + return; + } this.type = type; + this._computeDisplayItems(); } public status(task: JobHookTask) { - const { state, result } = task[this.type]; + const info = task[this.type]; + + if (!info) { + return "waiting"; + } + const { state, result } = info; if (state === JobHookTaskState.running) { return "runnning"; @@ -90,7 +101,22 @@ export class JobHookTaskBrowserComponent implements OnInit, OnDestroy { this.pickedTask = this.tasks.filter(x => x.id === id).first(); console.log("pick a task", id, this.pickedTask, this.tasks.map(x => x.id).toArray()); } - public get hasReleasedTask() { + + public get hasReleaseTask() { return Boolean(this.job.jobReleaseTask); } + + private _computeDisplayItems() { + this.displayItems = this.tasks.map((task) => { + const info = task[this.type]; + return { + id: task.id, + nodeId: task.nodeId, + status: this.status(task), + startTime: this.formatDate(info && info.startTime), + endTime: this.formatDate(info && info.endTime), + exitCode: info && info.exitCode, + }; + }).toArray(); + } } diff --git a/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.html b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.html index f4df942fdd..65bae66381 100644 --- a/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.html +++ b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.html @@ -21,19 +21,19 @@ Exit code - + {{task.nodeId}} - - - - + + + + - {{formatDate(task[type]?.startTime)}} - {{formatDate(task[type]?.endTime)}} - {{task[type]?.exitCode}} + {{task.startTime}} + {{task.endTime}} + {{task.exitCode}}
- +
diff --git a/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.component.ts b/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.component.ts index bb1d100505..3d2de3e517 100644 --- a/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.component.ts +++ b/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.component.ts @@ -15,6 +15,7 @@ export class JobHookTaskDetailsComponent { public type: string = "preparationTask"; public get currentFolder() { - return this.task[this.type].taskRootDirectory; + const info = this.task[this.type]; + return info && info.taskRootDirectory; } } From 0be27441bff23aab206f307a7af805f0994ea761 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Tue, 20 Jun 2017 16:21:34 -0700 Subject: [PATCH 09/10] Show files only after --- .../job-hook-task-details/job-hook-task-details.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.html b/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.html index 94e1e62bc0..13cad4c69f 100644 --- a/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.html +++ b/app/components/job/job-hook-task/job-hook-task-details/job-hook-task-details.html @@ -3,7 +3,7 @@ - +
From 101ccc0f971f1279a22d6c52144a4114e14a30d0 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Tue, 20 Jun 2017 16:38:35 -0700 Subject: [PATCH 10/10] Fix tslint and only fail --- .../job-hook-task-browser.component.ts | 19 +++++++++++-------- .../job-hook-task-details/index.ts | 2 +- app/core/record/record.ts | 9 --------- app/models/job-hook-task-execution-info.ts | 5 ----- src/client/api/batch-client-proxy/jobProxy.ts | 2 +- src/client/main.ts | 2 +- 6 files changed, 14 insertions(+), 25 deletions(-) diff --git a/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.component.ts b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.component.ts index 207041be45..20d760d1d0 100644 --- a/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.component.ts +++ b/app/components/job/job-hook-task/job-hook-task-browser/job-hook-task-browser.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnDestroy, OnInit } from "@angular/core"; +import { Component, Input, OnChanges, OnDestroy, SimpleChanges } from "@angular/core"; import { FormControl } from "@angular/forms"; import { List } from "immutable"; import { Subscription } from "rxjs"; @@ -21,7 +21,7 @@ const HookTaskType = { selector: "bl-job-hook-task-browser", templateUrl: "job-hook-task-browser.html", }) -export class JobHookTaskBrowserComponent implements OnInit, OnDestroy { +export class JobHookTaskBrowserComponent implements OnDestroy, OnChanges { public HookTaskType = HookTaskType; public onlyFailedControl = new FormControl(false); @@ -43,12 +43,10 @@ export class JobHookTaskBrowserComponent implements OnInit, OnDestroy { this.data = jobHookTaskService.list(); this.data.items.subscribe((items) => { this.tasks = items; - console.log("Items", items.toJS()); this._computeDisplayItems(); }); this._sub = this.onlyFailedControl.valueChanges.subscribe((onlyFailed) => { - console.log("ONly failed", onlyFailed); const filter = FilterBuilder.prop("jobPreparationTaskExecutionInfo/exitCode").ne(0).toOData(); this.data.patchOptions({ filter: filter, @@ -57,9 +55,15 @@ export class JobHookTaskBrowserComponent implements OnInit, OnDestroy { }); } - public ngOnInit() { - this.data.params = { jobId: this.job.id }; - this.data.fetchNext().subscribe(() => console.log("Banana"), (e) => console.error("Ee", e)); + public ngOnChanges(changes: SimpleChanges) { + if (changes.job) { + const { previousValue, currentValue } = changes.job; + if (previousValue && currentValue && previousValue.id === currentValue.id) { + return; + } + this.data.params = { jobId: this.job.id }; + this.data.refresh(); + } } public ngOnDestroy() { @@ -99,7 +103,6 @@ export class JobHookTaskBrowserComponent implements OnInit, OnDestroy { public pickTask(id: string) { this.pickedTaskId = id; this.pickedTask = this.tasks.filter(x => x.id === id).first(); - console.log("pick a task", id, this.pickedTask, this.tasks.map(x => x.id).toArray()); } public get hasReleaseTask() { diff --git a/app/components/job/job-hook-task/job-hook-task-details/index.ts b/app/components/job/job-hook-task/job-hook-task-details/index.ts index ba3b5d0b74..0919a7edfc 100644 --- a/app/components/job/job-hook-task/job-hook-task-details/index.ts +++ b/app/components/job/job-hook-task/job-hook-task-details/index.ts @@ -1 +1 @@ -export * from "./job-hook-task-details.component"; \ No newline at end of file +export * from "./job-hook-task-details.component"; diff --git a/app/core/record/record.ts b/app/core/record/record.ts index 77a1cbe81f..970de05245 100644 --- a/app/core/record/record.ts +++ b/app/core/record/record.ts @@ -79,22 +79,13 @@ export class Record { } const value = (data as any)[key]; - if (key === "exitCode") { - console.log("Value is", value, key); - } if (exists(value) && typeMetadata && !primitives.has(typeMetadata.type.name)) { - if (key === "exitCode") { - console.log("Value2 is", value, key); - } if (typeMetadata.list) { obj[key] = List(value && value.map(x => new typeMetadata.type(x))); } else { obj[key] = new typeMetadata.type(value); } } else { - if (key === "exitCode") { - console.log("Value falsy is", value, key); - } obj[key] = value; } } diff --git a/app/models/job-hook-task-execution-info.ts b/app/models/job-hook-task-execution-info.ts index fb33986605..4900fa16e6 100644 --- a/app/models/job-hook-task-execution-info.ts +++ b/app/models/job-hook-task-execution-info.ts @@ -38,9 +38,4 @@ export class JobHookTaskExecutionInfo extends Record {