added svcapi ui and camunda code
[it/otf.git] / otf-frontend / client / src / app / shared / modules / create-test-form / create-test-form.component.pug
diff --git a/otf-frontend/client/src/app/shared/modules/create-test-form/create-test-form.component.pug b/otf-frontend/client/src/app/shared/modules/create-test-form/create-test-form.component.pug
new file mode 100644 (file)
index 0000000..dbafe0e
--- /dev/null
@@ -0,0 +1,167 @@
+//-  Copyright (c) 2019 AT&T Intellectual Property.                             #\r
+//-                                                                             #\r
+//-  Licensed under the Apache License, Version 2.0 (the "License");            #\r
+//-  you may not use this file except in compliance with the License.           #\r
+//-  You may obtain a copy of the License at                                    #\r
+//-                                                                             #\r
+//-      http://www.apache.org/licenses/LICENSE-2.0                             #\r
+//-                                                                             #\r
+//-  Unless required by applicable law or agreed to in writing, software        #\r
+//-  distributed under the License is distributed on an "AS IS" BASIS,          #\r
+//-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #\r
+//-  See the License for the specific language governing permissions and        #\r
+//-  limitations under the License.                                             #\r
+//- #############################################################################\r
+\r
+\r
+form(#testDefinitionForm="ngForm")\r
+  .row.mb-3\r
+    .col-sm-6(style="justify-content: flex-end;flex-direction: column;display: flex")\r
+\r
+      //- Diagram\r
+      .row(style="height: 100%")\r
+        //- placeholder\r
+        .col-12(*ngIf="!ptd.currentInstance.bpmnXml", style="text-align:center; opacity: .4")\r
+          i.fa.fa-5x.fa-object-group\r
+        //- diagram\r
+        .col-12(#canvas, [hidden]="!ptd.currentInstance.bpmnXml", style="position: relative; cursor: pointer", (click)="enlargeBpmn()")\r
+          button(mat-icon-button, color="primary", style="position: absolute; top: 0px; right: 0px; z-index: 100")\r
+            mat-icon zoom_in\r
+        \r
+\r
+      //- Upload and version\r
+      .row\r
+        .col-sm-6(style="text-align:center")\r
+          input(id="file", #file, type="file", name="file", ng2FileSelect, [uploader]="bpmnUploader", style="display:none", [hidden]="!ptd.currentInstance.isDeployed", (change)="validateFile()", required)\r
+          \r
+          //- when creating new\r
+          button(mat-raised-button, color="accent", *ngIf="!ptd.currentInstance.isDeployed && !ptd.currentInstance.bpmnXml && isNew", [hidden]="isUploading", (click)="isClicked = true", onclick="file.click();")\r
+            | Upload Workflow\r
+          button(mat-raised-button, color="primary", *ngIf="!ptd.currentInstance.isDeployed && ptd.currentInstance.bpmnXml", [hidden]="isUploading", onclick="file.click();")\r
+            | Change Workflow\r
+\r
+          //- when editing\r
+          //- button(mat-raised-button, color="primary", *ngIf="!isNew && ptd.currentInstance.isDeployed", [hidden]="isUploading", (click)="newVersion(this.ptd.processDefinitionKey)", onclick="file.click();")\r
+          //-   | New Version\r
+          h4(*ngIf="ptd.currentInstance.isDeployed") Deployed\r
+          \r
+          mat-spinner(style="margin:auto", [diameter]="30", [hidden]="!isUploading")\r
+\r
+        .col-sm-6\r
+          mat-form-field(*ngIf="ptd.processDefinitionKey != null")\r
+            input(matInput, placeholder="Process Definition Key", name="processDefinitionKey", maxlength="22", [disabled]="hasBeenSaved", (keyup)="checkProcessDefinitionKey()", [(ngModel)]="ptd.processDefinitionKey", required)\r
+            mat-spinner(matSuffix, *ngIf="pStatus == 'loading'", [diameter]="19")\r
+            mat-icon(matSuffix, *ngIf="pStatus == 'unique'", style="color: green") check\r
+            mat-icon(matSuffix, *ngIf="pStatus == 'notUnique'", style="color: red") error_outline\r
+\r
+    .col-sm-6\r
+      mat-form-field(style="width:100%")\r
+        input(matInput, type="text", placeholder="Name", name="name", [disabled]="(existingTd && !hasBeenSaved) || !ptd.currentInstance.bpmnXml", [(ngModel)]="ptd.testName", required)\r
+        mat-error Required\r
+      mat-form-field(style="width:100%")\r
+        input(matInput, type="text", placeholder="Description", name="description", [disabled]="(existingTd && !hasBeenSaved) || !ptd.currentInstance.bpmnXml", [(ngModel)]="ptd.testDescription", required)\r
+        mat-error Required\r
+      //- mat-form-field(style="width:100%")\r
+      //-   mat-select((selectionChange)="markAsDirty()", name="ns", [disabled]="(existingTd && !hasBeenSaved) || !ptd.currentInstance.bpmnXml", placeholder="Group", [(value)]="ptd.groupId", required)\r
+      //-     mat-option(*ngFor="let group of groups", value="{{group._id}}") {{ group.groupName }}\r
+      //-   mat-error Required\r
+      mat-form-field(style="width:100%")\r
+        input(matInput, type="text", *ngIf="!hasBeenSaved", placeholder="Version", name="version", [(ngModel)]="ptd.currentInstance.version", (keyup)="checkVersionUnique()", required)\r
+        mat-select((selectionChange)="switchVersion(ptd.currentVersionName)", placeholder="Version", name="selectedVersion", *ngIf="hasBeenSaved", [(value)]="ptd.currentVersionName", required)\r
+          mat-option(*ngFor="let instance of ptd.bpmnInstances.slice().reverse()", value="{{instance.version}}") {{ instance.version }}\r
+        mat-error Required\r
+        button(mat-button, matSuffix, color="primary", *ngIf="hasBeenSaved", (click)="newVersion(this.ptd.processDefinitionKey)", onclick="file.click();") New\r
+\r
+      button(mat-button, (click)="viewer.download()", color="primary")\r
+        mat-icon cloud_download\r
+        span.ml-2 Download\r
+        \r
+      \r
+  .row\r
+    .col-12(*ngIf="ptd.currentInstance")\r
+      mat-accordion\r
+        mat-expansion-panel([expanded]="ptd.currentInstance.dataTestHeads.length > 0")\r
+          mat-expansion-panel-header\r
+            mat-panel-title Test Heads\r
+            mat-panel-description(*ngIf="ptd.currentInstance.dataTestHeads") {{ ptd.currentInstance.dataTestHeads.length > 0? ptd.currentInstance.dataTestHeads.length : '' }}\r
+          .ps(style="position: relative; max-height: 105px", [perfectScrollbar])\r
+            div(style="white-space: nowrap")\r
+              .mr-4.text-center(*ngFor=("let task of ptd.currentInstance.dataTestHeads; index as i; trackBy: trackByFn"), style="display:inline-block")\r
+                .text-muted {{task.bpmnVthTaskId}}\r
+                button(color="accent", mat-fab, (click)="selectTestHead(i)")\r
+                  i.fa.fw.fa-gears.fa-2x(style="color:white")\r
+                p.text-muted {{ (task.testHead && task.testHead.testHeadName) ? task.testHead.testHeadName : '' }}\r
+      mat-expansion-panel([expanded]="true")\r
+        mat-expansion-panel-header\r
+          mat-panel-title Resources\r
+          mat-panel-description A single .zip file with scripts\r
+        input(type="file", #scripts, id="scripts", name="scripts", hidden,  (change)="markAsDirty()", ng2FileSelect, [uploader]="uploader", accept="application/zip")\r
+        .row(*ngIf="ptd.currentInstance.resourceFileId")\r
+          .col-12\r
+            mat-list\r
+              mat-list-item\r
+                mat-icon(mat-list-icon) insert_drive_file\r
+                h4(mat-line) {{ptd.currentInstance.resourceFileName }}\r
+        .row(*ngIf="!ptd.currentInstance.isDeployed")\r
+          .col-md-3\r
+            //- .mb-2 TESTING GIT TRACKING\r
+            //-   | Multiple Files \r
+            //-   mat-slide-toggle(color="primary", name="isZip", [(ngModel)]="isZip", (change)="uploader.clearQueue()")\r
+            //-   |  .zip\r
+            //- div \r
+            //-   input(*ngIf="!isZip", type="file", name="scripts", ng2FileSelect, [uploader]="uploader", multiple)\r
+            \r
+            button(mat-raised-button, *ngIf="isZip && !ptd.currentInstance.resourceFileId", onclick="scripts.click()", color="primary") Choose File\r
+            button(mat-raised-button, *ngIf="isZip && ptd.currentInstance.resourceFileId", onclick="scripts.click()", color="primary") Replace File\r
+          .col-md-8.ml-2\r
+            div(*ngIf="uploader.queue.length > 0")\r
+              label File:\r
+              ul.list-group(style="position:relative")\r
+                li.list-group-item(*ngFor="let item of uploader.queue")\r
+                  | {{ item?.file?.name }}\r
+                  div.upload-progress([ngStyle]="{'width': item.progress + '%'}")\r
+              //- button.pull-right(mat-button, (click)="upload()") Upload All\r
+              label(*ngIf="ptd.currentInstance.resourceFileId && uploader.queue.length > 0 && !saved") This will replace the previous resouce file\r
+              button.pull-right(mat-button, color="primary", (click)="clearQueue()") Remove All\r
+        .row(*ngIf="ptd.currentInstance.isDeployed")\r
+          .col-12(*ngIf="!ptd.currentInstance.resourceFileId")\r
+            | No resources were deployed with this version\r
+            \r
+\r
+    .col-12(*ngIf="ptd.currentInstance.testDataTemplate != {}")\r
+      h5.text-muted.mt-4 testInputTemplate.yaml\r
+      div(style="border: 1px solid lightgrey; font-size: 16px !important")\r
+        codemirror([config]="codeConfig", [(ngModel)]='ptd.currentInstance.testDataTemplate', name="testConfig")\r
+\r
+  .row(style="height:30px")\r
+  .row.form-buttons\r
+    .col-12.mt-3\r
+      .pull-left\r
+        .mr-3(mat-button, *ngIf="hasBeenSaved && saved && !testDefinitionForm.dirty") saved\r
+          mat-icon(style="color:green") check\r
+      .pull-right\r
+        //save\r
+        button.mr-3(mat-raised-button, *ngIf="!hasBeenSaved && !inProgress", color="primary", [disabled]="!testDefinitionForm.form.valid || !ptd.currentInstance.bpmnXml || !successUpload || pStatus == 'notUnique'", (click)="save()") Save\r
+\r
+        //update\r
+        button.mr-3(mat-raised-button, *ngIf="hasBeenSaved && !inProgress", color="primary", [disabled]="!testDefinitionForm.form.valid || !ptd.currentInstance.bpmnXml  || !testDefinitionForm.dirty || !successUpload", (click)="update()") Update\r
+        \r
+        //save and deploy\r
+        button.mr-3(mat-raised-button, color="accent",  [disabled]="!testDefinitionForm.form.valid || !ptd.currentInstance.bpmnXml || !successUpload || pStatus == 'notUnique'", *ngIf="!ptd.currentInstance.isDeployed && !hasBeenSaved && !saved && !inProgress", (click)="saveDeploy()") Save & Deploy\r
+        \r
+        //update and deploy\r
+        button.mr-3(mat-raised-button, color="accent", [disabled]="!testDefinitionForm.form.valid || !ptd.currentInstance.bpmnXml || !successUpload", *ngIf="!ptd.currentInstance.isDeployed && hasBeenSaved && testDefinitionForm.dirty && !inProgress", (click)="updateDeploy()") Update & Deploy\r
+\r
+        //deploy\r
+        button.mr-3(mat-raised-button, color="accent", [disabled]="!testDefinitionForm.form.valid || !ptd.currentInstance.bpmnXml || !successUpload", *ngIf="!ptd.currentInstance.isDeployed && hasBeenSaved && testDefinitionForm.pristine && !inProgress", (click)="deploy()") Deploy\r
+      \r
+        //delete\r
+        button.mr-3(mat-raised-button, color="warn", *ngIf="hasBeenSaved && !inProgress", (click)="deleteVersion()") Delete Version\r
+\r
+        //- button((click)="print()") print\r
+        \r
+        //In Progress\r
+        button.mr-3(mat-raised-button, *ngIf="inProgress", color="primary", disabled)\r
+          mat-spinner([diameter]="19", style="display:inline")\r
+          div.ml-4(style="display:inline") In Progress\r
+        \r