From 3dd2c25e0e3afdd0ebb758112485c232c51f91d1 Mon Sep 17 00:00:00 2001
From: Andrew Kapuscinski <akapusci@nrao.edu>
Date: Wed, 7 Jul 2021 12:13:01 -0600
Subject: [PATCH] added button to /workspaces page for creating a std imaging
 capability request

---
 .../app/workspaces/workspaces.component.html  | 34 +++++++++++++++++++
 .../app/workspaces/workspaces.component.ts    | 23 +++++++++++++
 2 files changed, 57 insertions(+)

diff --git a/apps/web/src/app/workspaces/workspaces.component.html b/apps/web/src/app/workspaces/workspaces.component.html
index efb65dc24..acdad6e68 100644
--- a/apps/web/src/app/workspaces/workspaces.component.html
+++ b/apps/web/src/app/workspaces/workspaces.component.html
@@ -72,3 +72,37 @@
     </div>
   </div>
 </div>
+<div class="container-fluid py-3">
+  <div class="row p-3 mt-4">
+    <div class="col-4">
+      <div class="md-form">
+        <label for="cmsPathInput" class="">CMS Path</label>
+        <input
+          type="text"
+          id="cmsPathInput"
+          (change)="setCmsPath($event.target.value)"
+          class="form-control"
+        />
+      </div>
+    </div>
+    <div class="col-3">
+      <div class="md-form">
+        <label for="sdmId" class="">SDM ID</label>
+        <input
+          type="text"
+          id="sdmIdInput"
+          (change)="setSdmId($event.target.value)"
+          class="form-control"
+        />
+      </div>
+    </div>
+    <div class="col-3 mb-0 align-self-md-end">
+      <button 
+        class="btn btn-lg btn-info"
+        id="cms-imaging-submit"
+        (click)="standardLaunchCapabilityOnClick('std_cms_imaging')">
+        <span class="fas fa-cog"></span><span class="pl-2">Create Standard Imaging Request</span>
+      </button>
+    </div>
+  </div>
+</div>
diff --git a/apps/web/src/app/workspaces/workspaces.component.ts b/apps/web/src/app/workspaces/workspaces.component.ts
index 9e7bc592c..0e3afc76c 100644
--- a/apps/web/src/app/workspaces/workspaces.component.ts
+++ b/apps/web/src/app/workspaces/workspaces.component.ts
@@ -15,6 +15,8 @@ export class WorkspacesComponent implements OnInit {
   public productLocator: string;
   public userEmail: string;
   public inputFileList: FileList;
+  public cmsPath: string;
+  public sdmId: string;
 
   constructor(
     private capabilityLauncher: CapabilityLauncherService,
@@ -38,12 +40,17 @@ export class WorkspacesComponent implements OnInit {
    * OnClick method that creates a capability request a given capability and submits it with the standard parameters:
    * - Product locator
    * - User email
+   * - CMS Path
+   * - SDM ID
    * FIXME: Remove check for calibration once it is implemented
    */
   standardLaunchCapabilityOnClick(capabilityName: string): void {
+    if (capabilityName == "std_cms_imaging") { this.productLocator = undefined; }
     this.launchCapability(capabilityName, {
       product_locator: this.productLocator,
       user_email: this.userEmail,
+      cms_path: this.cmsPath,
+      sdmId: this.sdmId,
     });
   }
 
@@ -71,6 +78,22 @@ export class WorkspacesComponent implements OnInit {
     this.inputFileList = inputFileList;
   }
 
+  /**
+   * method to set the CMS Path for Standard Imaging
+   * @param path CMS path for imaging
+   */
+  setCmsPath(path: string): void {
+    this.cmsPath = path;
+  }
+
+  /**
+   * method to set the SDM ID for Standard Imaging
+   * @param path SDM ID for imaging
+   */
+  setSdmId(id: string): void {
+    this.sdmId = id;
+  }
+
   /**
    * Method that uses the capabilityLauncher service to launch a capability
    * @param capabilityName  Name of capability
-- 
GitLab