airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sma...@apache.org
Subject [airavata-sandbox] 05/19: Fixing broken features for web console
Date Wed, 06 Dec 2017 03:13:49 GMT
This is an automated email from the ASF dual-hosted git repository.

smarru pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-sandbox.git

commit ec218c223feecebd81fbe454258cc6f1f466028a
Author: dimuthu.upeksha2@gmail.com <Dimu@1234>
AuthorDate: Sun Nov 19 17:46:09 2017 +0530

    Fixing broken features for web console
---
 .../resources/process/ProcessStatusResource.java   |  5 +-
 .../k8s/compute/impl/SSHComputeOperations.java     |  4 +-
 .../helix/tasks/dataout/DataOutputTask.java        |  6 +-
 .../api/server/controller/WorkflowController.java  |  7 +++
 .../k8s/api/server/model/workflow/Workflow.java    |  2 +-
 .../k8s/api/server/service/ProcessService.java     |  9 ++-
 .../k8s/api/server/service/WorkflowService.java    |  8 ++-
 .../api/server/service/util/ToResourceUtil.java    |  1 +
 .../k8s/gfac/core/HelixWorkflowManager.java        | 31 +++++++++-
 .../web-console/src/app/app.module.ts              |  7 ++-
 .../app/components/dashboard/dashboard.routes.ts   |  5 ++
 .../src/app/components/process/detail/detail.html  | 12 ++--
 .../process/detail/process.detail.component.ts     |  5 +-
 .../src/app/components/workflow/detail/detail.html | 56 ++++++++++++++++++
 .../components/workflow/detail/workflow.detail.ts  | 68 ++++++++++++++++++++++
 .../workflow/list/workflow.list.component.ts       |  2 +-
 .../web-console/src/app/services/util.service.ts   | 13 +++++
 .../src/app/services/workflow.service.ts           |  8 +++
 18 files changed, 228 insertions(+), 21 deletions(-)

diff --git a/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/process/ProcessStatusResource.java
b/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/process/ProcessStatusResource.java
index 40fc9b1..dc7e2f5 100644
--- a/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/process/ProcessStatusResource.java
+++ b/airavata-kubernetes/modules/api-resource/src/main/java/org/apache/airavata/k8s/api/resources/process/ProcessStatusResource.java
@@ -106,7 +106,10 @@ public class ProcessStatusResource {
         COMPLETED(10),
         FAILED(11),
         CANCELLING(12),
-        CANCELED(13);
+        CANCELED(13),
+        ABORTED(14),
+        STOPPED(15),
+        NOT_STARTED(16);
 
         private final int value;
 
diff --git a/airavata-kubernetes/modules/compute-resource-api/src/main/java/org/apache/airavata/k8s/compute/impl/SSHComputeOperations.java
b/airavata-kubernetes/modules/compute-resource-api/src/main/java/org/apache/airavata/k8s/compute/impl/SSHComputeOperations.java
index fb77981..df711b8 100644
--- a/airavata-kubernetes/modules/compute-resource-api/src/main/java/org/apache/airavata/k8s/compute/impl/SSHComputeOperations.java
+++ b/airavata-kubernetes/modules/compute-resource-api/src/main/java/org/apache/airavata/k8s/compute/impl/SSHComputeOperations.java
@@ -169,7 +169,7 @@ public class SSHComputeOperations implements ComputeOperations {
         File _lfile = new File(source);
 
         if (ptimestamp) {
-            command = "T " + (_lfile.lastModified() / 1000) + " 0";
+            command = "T" + (_lfile.lastModified() / 1000) + " 0";
             // The access time should be sent here,
             // but it is not accessible with JavaAPI ;-<
             command += (" " + (_lfile.lastModified() / 1000) + " 0\n");
@@ -341,6 +341,6 @@ public class SSHComputeOperations implements ComputeOperations {
         //ExecutionResult result = operations.executeCommand("sh /opt/sample.sh > /tmp/stdout.txt
2> /tmp/stderr.txt");
         //System.out.println(result.getStdOut());
         //System.out.println(result.getStdErr());
-        operations.transferDataOut("/tmp/stdout.txt", "/tmp/b.txt", "SCP");
+        operations.transferDataIn("/tmp/a.txt", "/tmp/b.txt", "SCP");
     }
 }
diff --git a/airavata-kubernetes/modules/helix-tasks/src/main/java/org/apache/airavata/helix/tasks/dataout/DataOutputTask.java
b/airavata-kubernetes/modules/helix-tasks/src/main/java/org/apache/airavata/helix/tasks/dataout/DataOutputTask.java
index 314e912..62a6712 100644
--- a/airavata-kubernetes/modules/helix-tasks/src/main/java/org/apache/airavata/helix/tasks/dataout/DataOutputTask.java
+++ b/airavata-kubernetes/modules/helix-tasks/src/main/java/org/apache/airavata/helix/tasks/dataout/DataOutputTask.java
@@ -107,10 +107,12 @@ public class DataOutputTask extends AbstractTask {
                                 .setDefaultValue(""),
                         new TaskInputTypeResource()
                                 .setName(PARAMS.IDENTIFIER)
-                                .setType("String"),
+                                .setType("String")
+                                .setDefaultValue(""),
                         new TaskInputTypeResource()
                                 .setName(PARAMS.COMPUTE_RESOURCE)
-                                .setType("Long")));
+                                .setType("Long")
+                                .setDefaultValue("")));
 
         taskTypeResource.getOutPorts().addAll(
                 Arrays.asList(
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/WorkflowController.java
b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/WorkflowController.java
index 136f839..273a59f 100644
--- a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/WorkflowController.java
+++ b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/controller/WorkflowController.java
@@ -2,6 +2,7 @@ package org.apache.airavata.k8s.api.server.controller;
 
 import org.apache.airavata.k8s.api.resources.experiment.ExperimentResource;
 import org.apache.airavata.k8s.api.resources.workflow.WorkflowResource;
+import org.apache.airavata.k8s.api.server.ServerRuntimeException;
 import org.apache.airavata.k8s.api.server.service.WorkflowService;
 import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.*;
@@ -32,6 +33,12 @@ public class WorkflowController {
         return this.workflowService.getAll();
     }
 
+    @GetMapping(path = "{id}", produces = MediaType.APPLICATION_JSON_VALUE)
+    public WorkflowResource findExperimentById(@PathVariable("id") long id) {
+        return this.workflowService.findById(id)
+                .orElseThrow(() -> new ServerRuntimeException("Workflow with id " + id
+ " not found"));
+    }
+
     @GetMapping(path = "{id}/launch", produces = MediaType.APPLICATION_JSON_VALUE)
     public long launchExperiment(@PathVariable("id") long id) {
         return this.workflowService.launchWorkflow(id);
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/workflow/Workflow.java
b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/workflow/Workflow.java
index 82d6bf5..c2bb059 100644
--- a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/workflow/Workflow.java
+++ b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/model/workflow/Workflow.java
@@ -27,7 +27,7 @@ public class Workflow {
     private byte[] workFlowGraph;
 
 
-    @OneToMany(mappedBy = "experiment", cascade = CascadeType.ALL)
+    @OneToMany(mappedBy = "workflow", cascade = CascadeType.ALL)
     private List<ProcessModel> processes = new ArrayList<>();
 
     public long getId() {
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/ProcessService.java
b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/ProcessService.java
index d2b93aa..500e83f 100644
--- a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/ProcessService.java
+++ b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/ProcessService.java
@@ -27,6 +27,7 @@ import org.apache.airavata.k8s.api.server.model.task.TaskModel;
 import org.apache.airavata.k8s.api.server.repository.process.ProcessRepository;
 import org.apache.airavata.k8s.api.resources.process.ProcessResource;
 import org.apache.airavata.k8s.api.server.repository.process.ProcessStatusRepository;
+import org.apache.airavata.k8s.api.server.repository.workflow.WorkflowRepository;
 import org.apache.airavata.k8s.api.server.service.task.TaskService;
 import org.apache.airavata.k8s.api.server.service.util.ToResourceUtil;
 import org.springframework.stereotype.Service;
@@ -48,17 +49,19 @@ public class ProcessService {
     private ExperimentService experimentService;
     private TaskService taskService;
 
-    private WorkflowService workflowService;
+    private WorkflowRepository workflowRepository;
 
     public ProcessService(ProcessRepository processRepository,
                           ProcessStatusRepository processStatusRepository,
                           ExperimentService experimentService,
-                          TaskService taskService) {
+                          TaskService taskService,
+                          WorkflowRepository workflowRepository) {
 
         this.processRepository = processRepository;
         this.processStatusRepository = processStatusRepository;
         this.experimentService = experimentService;
         this.taskService = taskService;
+        this.workflowRepository = workflowRepository;
     }
 
     public long create(ProcessResource resource) {
@@ -77,7 +80,7 @@ public class ProcessService {
         }
 
         if (resource.getWorkflowId() != 0) {
-            processModel.setWorkflow(workflowService.findEntityById(resource.getWorkflowId())
+            processModel.setWorkflow(workflowRepository.findById(resource.getWorkflowId())
                     .orElseThrow(() -> new ServerRuntimeException("Can not find workflow
with id " +
                             resource.getWorkflowId())));
         }
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/WorkflowService.java
b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/WorkflowService.java
index f4492fe..42be414 100644
--- a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/WorkflowService.java
+++ b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/WorkflowService.java
@@ -77,7 +77,9 @@ public class WorkflowService {
 
         long processId = processService.create(new ProcessResource()
                 .setName("Workflow Process : " + workflow.getName() + "-" + UUID.randomUUID().toString())
-                .setCreationTime(System.currentTimeMillis()).setProcessType("WORKFLOW"));
+                .setCreationTime(System.currentTimeMillis())
+                .setProcessType("WORKFLOW")
+                .setWorkflowId(id));
 
         try {
             GraphParser.ParseResult parseResult = GraphParser.parse(new String(workflow.getWorkFlowGraph()));
@@ -132,6 +134,10 @@ public class WorkflowService {
         return workflowResources;
     }
 
+    public Optional<WorkflowResource> findById(long id) {
+        return ToResourceUtil.toResource(findEntityById(id).get());
+    }
+
     @SuppressWarnings("WeakerAccess")
     public Optional<Workflow> findEntityById(long id) {
         return this.workflowRepository.findById(id);
diff --git a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/util/ToResourceUtil.java
b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/util/ToResourceUtil.java
index 22b970f..35c7fde 100644
--- a/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/util/ToResourceUtil.java
+++ b/airavata-kubernetes/modules/microservices/api-server/src/main/java/org/apache/airavata/k8s/api/server/service/util/ToResourceUtil.java
@@ -229,6 +229,7 @@ public class ToResourceUtil {
             resource.setCreationTime(taskModel.getCreationTime());
             resource.setParentProcessId(taskModel.getParentProcess().getId());
             resource.setTaskType(toResource(taskModel.getTaskType()).get());
+            resource.setTaskTypeStr(taskModel.getTaskType().getName());
             resource.setTaskDetail(taskModel.getTaskDetail());
             resource.setStartingTask(taskModel.isStartingTask());
             resource.setStoppingTask(taskModel.isStoppingTask());
diff --git a/airavata-kubernetes/modules/microservices/task-scheduler/src/main/java/org/apache/airavata/k8s/gfac/core/HelixWorkflowManager.java
b/airavata-kubernetes/modules/microservices/task-scheduler/src/main/java/org/apache/airavata/k8s/gfac/core/HelixWorkflowManager.java
index e9dead8..36f66b4 100644
--- a/airavata-kubernetes/modules/microservices/task-scheduler/src/main/java/org/apache/airavata/k8s/gfac/core/HelixWorkflowManager.java
+++ b/airavata-kubernetes/modules/microservices/task-scheduler/src/main/java/org/apache/airavata/k8s/gfac/core/HelixWorkflowManager.java
@@ -54,7 +54,7 @@ public class HelixWorkflowManager {
                 InstanceType.SPECTATOR, "localhost:2199");
 
         try {
-
+            updateProcessStatus(ProcessStatusResource.State.CREATED);
             Workflow.Builder workflowBuilder = createWorkflow();
             WorkflowConfig.Builder config = new WorkflowConfig.Builder().setFailureThreshold(0);
             workflowBuilder.setWorkflowConfig(config.build());
@@ -64,6 +64,8 @@ public class HelixWorkflowManager {
 
             Workflow workflow = workflowBuilder.build();
 
+            updateProcessStatus(ProcessStatusResource.State.VALIDATED);
+
             helixManager.connect();
             TaskDriver taskDriver = new TaskDriver(helixManager);
 
@@ -77,8 +79,12 @@ public class HelixWorkflowManager {
             );
 
             taskDriver.start(workflow);
+
+            updateProcessStatus(ProcessStatusResource.State.STARTED);
+
             logger.info("Started workflow");
             TaskState taskState = taskDriver.pollForWorkflowState(workflow.getName(), TaskState.COMPLETED,
TaskState.FAILED, TaskState.STOPPED, TaskState.ABORTED);
+            updateProcessStatus(taskState);
             System.out.println("Workflow state " + taskState.name());
 
         } catch (Exception ex) {
@@ -146,6 +152,29 @@ public class HelixWorkflowManager {
         }));
     }
 
+    private void updateProcessStatus(TaskState taskState) {
+        switch (taskState) {
+            case ABORTED:
+                updateProcessStatus(ProcessStatusResource.State.ABORTED);
+                break;
+            case COMPLETED:
+                updateProcessStatus(ProcessStatusResource.State.COMPLETED);
+                break;
+            case STOPPED:
+                updateProcessStatus(ProcessStatusResource.State.STOPPED);
+                break;
+            case NOT_STARTED:
+                updateProcessStatus(ProcessStatusResource.State.NOT_STARTED);
+                break;
+            case FAILED:
+                updateProcessStatus(ProcessStatusResource.State.FAILED);
+                break;
+            case IN_PROGRESS:
+                updateProcessStatus(ProcessStatusResource.State.EXECUTING);
+                break;
+        }
+    }
+
     private void updateProcessStatus(ProcessStatusResource.State state) {
         updateProcessStatus(state, "");
     }
diff --git a/airavata-kubernetes/web-console/src/app/app.module.ts b/airavata-kubernetes/web-console/src/app/app.module.ts
index 6e4d842..36d3047 100644
--- a/airavata-kubernetes/web-console/src/app/app.module.ts
+++ b/airavata-kubernetes/web-console/src/app/app.module.ts
@@ -17,6 +17,8 @@ import {ProcessDetailComponent} from "./components/process/detail/process.detail
 import {SetupComponent} from "./components/setup/setup.component";
 import {WorkflowCreateComponent} from "./components/workflow/create/create.component";
 import {WorkflowListComponent} from "./components/workflow/list/workflow.list.component";
+import {WorkflowDetailComponent} from "./components/workflow/detail/workflow.detail";
+import {UtilService} from "./services/util.service";
 
 @NgModule({
   declarations: [
@@ -31,7 +33,8 @@ import {WorkflowListComponent} from "./components/workflow/list/workflow.list.co
     ProcessDetailComponent,
     SetupComponent,
     WorkflowCreateComponent,
-    WorkflowListComponent
+    WorkflowListComponent,
+    WorkflowDetailComponent
   ],
   imports: [
     NgbModule.forRoot(),
@@ -40,7 +43,7 @@ import {WorkflowListComponent} from "./components/workflow/list/workflow.list.co
     HttpModule,
     FormsModule
   ],
-  providers: [],
+  providers: [UtilService],
   bootstrap: [AppComponent]
 })
 export class AppModule { }
diff --git a/airavata-kubernetes/web-console/src/app/components/dashboard/dashboard.routes.ts
b/airavata-kubernetes/web-console/src/app/components/dashboard/dashboard.routes.ts
index c211503..7030474 100644
--- a/airavata-kubernetes/web-console/src/app/components/dashboard/dashboard.routes.ts
+++ b/airavata-kubernetes/web-console/src/app/components/dashboard/dashboard.routes.ts
@@ -10,6 +10,7 @@ import {ProcessDetailComponent} from "../process/detail/process.detail.component
 import {SetupComponent} from "../setup/setup.component";
 import {WorkflowCreateComponent} from "../workflow/create/create.component";
 import {WorkflowListComponent} from "../workflow/list/workflow.list.component";
+import {WorkflowDetailComponent} from "../workflow/detail/workflow.detail";
 
 /**
  * Created by dimuthu on 10/29/17.
@@ -56,5 +57,9 @@ export const DASHBOARD_ROUTES: Routes = [
   {
     path: 'workflow/create',
     component: WorkflowCreateComponent,
+  },
+  {
+    path: 'workflow/detail/:id',
+    component: WorkflowDetailComponent,
   }
 ];
diff --git a/airavata-kubernetes/web-console/src/app/components/process/detail/detail.html
b/airavata-kubernetes/web-console/src/app/components/process/detail/detail.html
index f89265c..76bbe1f 100644
--- a/airavata-kubernetes/web-console/src/app/components/process/detail/detail.html
+++ b/airavata-kubernetes/web-console/src/app/components/process/detail/detail.html
@@ -3,7 +3,7 @@
   <div class="form-group row">
     <label for="name" class="col-sm-2 col-form-label">Creation Time</label>
     <div class="col-sm-10">
-      <input type="text" [(ngModel)]="selectedProcess.creationTime" readonly class="form-control-plaintext"
id="name" name="name" value="email@example.com">
+      <input type="text" readonly class="form-control-plaintext" id="name" name="name"
value="{{this.utilService.toDateString(selectedProcess.creationTime)}}">
     </div>
   </div>
 </form>
@@ -14,16 +14,16 @@
   <thead>
   <tr>
     <th scope="col">Id</th>
+    <th scope="col">Name</th>
     <th scope="col">Type</th>
-    <th scope="col">Detail</th>
     <th scope="col">Current Status</th>
   </tr>
   </thead>
   <tbody>
   <tr *ngFor="let task of this.taskDagFroProcess">
     <th>{{task.id}}</th>
+    <th>{{task.name}}</th>
     <th>{{task.taskTypeStr}}</th>
-    <th>{{task.taskDetail}}</th>
     <th>{{task.taskStatus.length > 0 ? task.taskStatus[task.taskStatus.length -1].stateStr
: "NO STATUS"}}</th>
   </tr>
   </tbody>
@@ -46,8 +46,8 @@
       <thead>
       <tr>
         <th scope="col">Task Id</th>
+        <th scope="col">Task Name</th>
         <th scope="col">Task Type</th>
-        <th scope="col">Task Detail</th>
         <th scope="col">Status</th>
         <th scope="col">Occurred Time</th>
         <th scope="col">Reason</th>
@@ -57,10 +57,10 @@
       <template ngFor let-task [ngForOf]="this.taskDagFroProcess">
         <tr *ngFor="let status of task.taskStatus">
           <td>{{task.id}}</td>
+          <td>{{task.name}}</td>
           <td>{{task.taskTypeStr}}</td>
-          <td>{{task.taskDetail}}</td>
           <td>{{status.stateStr}}</td>
-          <td>{{status.timeOfStateChange}}</td>
+          <td>{{this.utilService.toDateString(status.timeOfStateChange)}}</td>
           <td>{{status.reason}}</td>
         </tr>
       </template>
diff --git a/airavata-kubernetes/web-console/src/app/components/process/detail/process.detail.component.ts
b/airavata-kubernetes/web-console/src/app/components/process/detail/process.detail.component.ts
index c9e554d..6207383 100644
--- a/airavata-kubernetes/web-console/src/app/components/process/detail/process.detail.component.ts
+++ b/airavata-kubernetes/web-console/src/app/components/process/detail/process.detail.component.ts
@@ -7,6 +7,7 @@ import {Process} from "../../../models/process/process.model";
 import {Task} from "../../../models/task/task.model";
 import {TaskStatus} from "../../../models/task/task.status.model";
 import {DataEntry} from "../../../models/data/data.entry.model";
+import {UtilService} from "../../../services/util.service";
 
 @Component({
   templateUrl: './detail.html',
@@ -21,12 +22,14 @@ export class ProcessDetailComponent {
   outputs: Array<DataEntry> = [];
 
   constructor(private modalService: NgbModal, private activatedRoute: ActivatedRoute,
-              private processService: ProcessService, private taskService: TaskService){
+              private processService: ProcessService, private taskService: TaskService,
+              private utilService: UtilService){
 
     let processId = this.activatedRoute.snapshot.params["id"];
     processService.getProcessById(processId).subscribe(data => {
       this.selectedProcess = data;
       this.taskDagFroProcess = this.selectedProcess.tasks;
+      this.taskDagFroProcess.sort((t1, t2) => {return t1.id - t2.id})
     }, err => console.log(err));
   }
 
diff --git a/airavata-kubernetes/web-console/src/app/components/workflow/detail/detail.html
b/airavata-kubernetes/web-console/src/app/components/workflow/detail/detail.html
new file mode 100644
index 0000000..011b36a
--- /dev/null
+++ b/airavata-kubernetes/web-console/src/app/components/workflow/detail/detail.html
@@ -0,0 +1,56 @@
+<div class="">
+  <div class="">
+  <form>
+    <div class="form-group row">
+      <label for="name" class="col-sm-2 col-form-label">Name</label>
+      <div class="col-sm-10">
+        <input type="text" [(ngModel)]="selectedWorkflow.name" readonly class="form-control-plaintext"
id="name" name="name" value="email@example.com">
+      </div>
+    </div>
+
+    <div class="form-group row">
+      <label for="appProcess" class="col-sm-2 col-form-label">Application Processes</label>
+      <div class="col-sm-10">
+        <button type="button" id="appProcess" name="appProcess" class="btn" (click)="openProcessesAsModel(processContent)">Processes</button>
+      </div>
+    </div>
+  </form>
+  <button type="button" class="btn" (click)="launchWorkflow()">Launch</button>
+  </div>
+</div>
+
+
+<ng-template #processContent let-c="close" let-d="dismiss">
+
+  <div class="modal-header">
+    <h4 class="modal-title">Experiment Processes</h4>
+    <button type="button" class="close" aria-label="Close" (click)="d('Cross click')">
+      <span aria-hidden="true">&times;</span>
+    </button>
+  </div>
+
+  <div class="modal-body">
+    <table class="table">
+      <thead>
+      <tr>
+        <th scope="col">Id</th>
+        <th scope="col">Creation Time</th>
+        <th scope="col">Last State</th>
+        <th scope="col"></th>
+      </tr>
+      </thead>
+      <tbody>
+      <tr *ngFor="let process of this.processes">
+        <th>{{process.id}}</th>
+        <th>{{process.creationTime}}</th>
+        <th>{{process.processStatuses.length > 0 ? process.processStatuses[process.processStatuses.length
-1].stateStr : "" }}</th>
+        <td><button (click)="routeToProcessPage(process.id)">Detail</button></td>
+      </tr>
+      </tbody>
+    </table>
+  </div>
+
+  <div class="modal-footer">
+    <button type="button" class="btn btn-outline-dark" (click)="c('Close click')">Close</button>
+  </div>
+</ng-template>
diff --git a/airavata-kubernetes/web-console/src/app/components/workflow/detail/workflow.detail.ts
b/airavata-kubernetes/web-console/src/app/components/workflow/detail/workflow.detail.ts
new file mode 100644
index 0000000..99482f7
--- /dev/null
+++ b/airavata-kubernetes/web-console/src/app/components/workflow/detail/workflow.detail.ts
@@ -0,0 +1,68 @@
+import {ViewEncapsulation, Component} from "@angular/core";
+import {ActivatedRoute, Router} from "@angular/router";
+import {NgbModal, NgbModalRef} from "@ng-bootstrap/ng-bootstrap";
+import {Process} from "../../../models/process/process.model";
+import {ProcessService} from "../../../services/process.service";
+import {ProcessStatus} from "../../../models/process/process.status.model";
+import {WorkFlow} from "../../../models/workflow/workflow.model";
+import {WorkflowService} from "../../../services/workflow.service";
+
+/**
+ * Created by dimuthu on 10/29/17.
+ */
+
+@Component({
+  templateUrl: './detail.html',
+  encapsulation: ViewEncapsulation.None,
+  providers: [WorkflowService, ProcessService]
+})
+export class WorkflowDetailComponent {
+
+  selectedWorkflow: WorkFlow = new WorkFlow();
+  processes: Array<Process> = [];
+  processLastState: ProcessStatus = new ProcessStatus();
+  processListModel: NgbModalRef;
+
+  constructor(private modalService: NgbModal,private activatedRoute: ActivatedRoute,
+              private workflowService: WorkflowService, private processService: ProcessService,
+              private router: Router) {
+
+    let workflowId = this.activatedRoute.snapshot.params["id"];
+    this.workflowService.getWorkflowById(workflowId)
+      .subscribe(data => {this.selectedWorkflow = data}, err => {console.log(err)});
+  }
+
+  launchWorkflow() {
+    this.workflowService.launchWorkflow(this.selectedWorkflow.id).subscribe(data => {
+      alert("Workflow launching started");
+    },
+      err => {
+        console.log(err);
+        alert("Workflow launch failed");
+      }
+    )
+  }
+
+  routeToProcessPage(id: number) {
+    this.processListModel.close();
+    this.router.navigateByUrl("/process/detail/" + id);
+  }
+
+  openAsModel(content) {
+    this.modalService.open(content, {size: "lg"}).result.then((result) => {}, (reason)
=> {});
+  }
+
+  openProcessesAsModel(content) {
+    this.processes = [];
+    this.selectedWorkflow.processIds.forEach(id => {
+      this.processService.getProcessById(id).subscribe(data => {
+        this.processes.push(data);
+        this.processes.sort((p1, p2) => {return p1.id - p2.id;})
+      }, err => {
+        console.log(err);
+      });
+    });
+    this.processListModel = this.modalService.open(content, {size: "lg"});
+    this.processListModel.result.then((result) => {}, (reason) => {});
+  }
+}
diff --git a/airavata-kubernetes/web-console/src/app/components/workflow/list/workflow.list.component.ts
b/airavata-kubernetes/web-console/src/app/components/workflow/list/workflow.list.component.ts
index fc8b9ad..3838ae4 100644
--- a/airavata-kubernetes/web-console/src/app/components/workflow/list/workflow.list.component.ts
+++ b/airavata-kubernetes/web-console/src/app/components/workflow/list/workflow.list.component.ts
@@ -33,7 +33,7 @@ export class WorkflowListComponent {
   }
 
   routeToDetailPage(id: number) {
-    this.router.navigateByUrl("/experiment/detail/"+id);
+    this.router.navigateByUrl("/workflow/detail/"+id);
   }
 
   routeToCreatePage() {
diff --git a/airavata-kubernetes/web-console/src/app/services/util.service.ts b/airavata-kubernetes/web-console/src/app/services/util.service.ts
new file mode 100644
index 0000000..fafda55
--- /dev/null
+++ b/airavata-kubernetes/web-console/src/app/services/util.service.ts
@@ -0,0 +1,13 @@
+import {Injectable} from "@angular/core";
+
+@Injectable()
+export class UtilService {
+
+  toDateString(timestamp: number) {
+    return new Date(timestamp).toString();
+  }
+
+  toTimeString(timestamp: number) {
+    return new Date(timestamp).toLocaleTimeString();
+  }
+}
diff --git a/airavata-kubernetes/web-console/src/app/services/workflow.service.ts b/airavata-kubernetes/web-console/src/app/services/workflow.service.ts
index f652bd9..bc345b4 100644
--- a/airavata-kubernetes/web-console/src/app/services/workflow.service.ts
+++ b/airavata-kubernetes/web-console/src/app/services/workflow.service.ts
@@ -14,4 +14,12 @@ export class WorkflowService {
   getAllWorkflows() {
     return this.apiService.get("workflow").map(res => res.json());
   }
+
+  getWorkflowById(id: number) {
+    return this.apiService.get("workflow/" + id).map(res => res.json());
+  }
+
+  launchWorkflow(id: number) {
+    return this.apiService.get("workflow/" + id + "/launch");
+  }
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@airavata.apache.org" <commits@airavata.apache.org>.

Mime
View raw message