Skip to content

Commit

Permalink
Merge branch 'hotfix/2.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
denis-yuen committed Jan 4, 2018
2 parents 30e1360 + 69a68bc commit cc9d3e6
Show file tree
Hide file tree
Showing 11 changed files with 146 additions and 60 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ testem.log
/typings
src/app/footer/versions.ts
cypress/videos
cypress/screenshots

# e2e
/e2e/*.js
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"@types/jasmine": "2.5.38",
"@types/jasminewd2": "~2.0.2",
"codelyzer": "~3.1.1",
"cypress": "0.20.1",
"cypress": "1.0.3",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
Expand Down
101 changes: 61 additions & 40 deletions src/app/container/add-tag/add-tag.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h4 class="modal-title">Add Version Tag</h4>
</label>
<div class="col-sm-9 col-md-9 col-lg-9">
<input id="versionTagInput" type="text" class="form-control" name="versionTag" [(ngModel)]="unsavedVersion.name" maxlength="128" [pattern]="validationPatterns.versionTag" required title="Docker Image tag name." placeholder="e.g. develop" />
<div *ngIf="formErrors.versionTag" class="form-error-messages">
<div *ngIf="formErrors.versionTag" class="form-error-messages alert alert-danger">
{{formErrors.versionTag}}
</div>
</div>
Expand All @@ -41,7 +41,7 @@ <h4 class="modal-title">Add Version Tag</h4>
</label>
<div class="col-sm-9 col-md-9 col-lg-9">
<input id="gitReferenceInput" type="text" class="form-control" name="reference" [(ngModel)]="unsavedVersion.reference" maxlength="128" [pattern]="validationPatterns.reference" title="Git branch or tag name." placeholder="e.g. develop" required/>
<div *ngIf="formErrors.reference" class="form-error-messages">
<div *ngIf="formErrors.reference" class="form-error-messages alert alert-danger">
{{formErrors.reference}}
</div>
</div>
Expand All @@ -52,7 +52,7 @@ <h4 class="modal-title">Add Version Tag</h4>
</label>
<div class="col-sm-9 col-md-9 col-lg-9">
<input type="text" class="form-control" #name="ngModel" id="dockerfilePath" name="dockerfilePath" [(ngModel)]="unsavedVersion.dockerfile_path" minlength="3" maxlength="256" [pattern]="validationPatterns.dockerfilePath" required title="Relative path to the Dockerfile in the Git repository." placeholder="e.g. /Dockerfile" [disabled]="!editMode" />
<div *ngIf="formErrors.dockerfilePath" class="form-error-messages">
<div *ngIf="formErrors.dockerfilePath" class="form-error-messages alert alert-danger">
{{formErrors.dockerfilePath}}
</div>
</div>
Expand All @@ -63,7 +63,7 @@ <h4 class="modal-title">Add Version Tag</h4>
</label>
<div class="col-sm-9 col-md-9 col-lg-9">
<input type="text" class="form-control" name="cwlPath" [(ngModel)]="unsavedVersion.cwl_path" minlength="3" maxlength="128" [pattern]="validationPatterns.cwlPath" required title="Relative path to the CWL Descriptor in the Git repository." placeholder="e.g. /Dockstore.cwl" [disabled]="!editMode" />
<div *ngIf="formErrors.cwlPath" class="form-error-messages">
<div *ngIf="formErrors.cwlPath" class="form-error-messages alert alert-danger">
{{formErrors.cwlPath}}
</div>
</div>
Expand All @@ -74,64 +74,85 @@ <h4 class="modal-title">Add Version Tag</h4>
</label>
<div class="col-sm-9 col-md-9 col-lg-9">
<input type="text" class="form-control" name="wdlPath" [(ngModel)]="unsavedVersion.wdl_path" minlength="3" maxlength="128" [pattern]="validationPatterns.wdlPath" required title="Relative path to the WDL Descriptor in the Git repository." placeholder="e.g. /Dockstore.wdl" [disabled]="!editMode" />
<div *ngIf="formErrors.wdlPath" class="form-error-messages">
<div *ngIf="formErrors.wdlPath" class="form-error-messages alert alert-danger">
{{formErrors.wdlPath}}
</div>
</div>
</div>
<div class="form-group form-group-sm" style="clear:both;">
<div class="form-group form-group-sm">
<label class="col-sm-3 col-md-3 col-lg-3 control-label">
CWL Test Parameter File(s):
</label>
<div class="col-sm-9 col-md-9 col-lg-9 test_parameter_div">
<div class="col-sm-9 col-md-9 col-lg-9 form-margin" [ngClass]="{ 'col-sm-offset-3' : i > 0 }" *ngFor="let item of unsavedCWLTestParameterFilePaths; let i = index;trackBy:trackByIndex;">
<div class="input-group">
<input type="text" #model1="ngModel" class="form-control" name="cwlTestParameterFilePath" [(ngModel)]="unsavedTestCWLFile" minlength="3" maxlength="128" [pattern]="validationPatterns.testFilePath" title="Relative path to a CWL Test Parameter File in the Git repository." placeholder="e.g. /test.cwl.json" [disabled]="!editMode" ng-class="editMode ? 'test_parameter_input' : ''" />
<button title="Add CWL test parameter file" type="button" class="btn btn-success test_parameter_add_button" (click)="addTestParameterFile(DescriptorType.CWL)" ng-hide="!editMode" [disabled]="model1.invalid || unsavedTestCWLFile.length < 1">
<span class="glyphicon glyphicon-plus"></span>
</button>
<input [ngClass]="{ 'input-right-button' : editMode, 'input-no-button' : !editMode }" type="text" class="form-control" name="unsavedCWLTestParameterFilePaths[{{i}}]" [(ngModel)]="unsavedCWLTestParameterFilePaths[i]" minlength="3" maxlength="128" [pattern]="validationPatterns.testFilePath" title="Relative path to a CWL Test Parameter File in the Git repository." placeholder="e.g. /test.cwl.json" disabled ng-class="editMode ? 'test_parameter_input' : ''" />
<span class="input-group-btn">
<button title="Remove CWL test parameter file" type="button" class="btn btn-default form-sm-button" *ngIf="editMode" (click)="removeTestParameterFile(i, DescriptorType.CWL)">
<span class="glyphicon glyphicon-remove"></span>
</button>
</span>
</div>
</div>
<div class="col-sm-9 col-md-9 col-lg-9" [ngClass]="{'col-sm-offset-3' : unsavedCWLTestParameterFilePaths.length > 0}" *ngIf="editMode">
<div class="input-group full-width">
<input [ngClass]="{ 'input-right-button' : editMode }" type="text" #model1="ngModel" class="form-control" name="cwlTestParameterFilePath" [(ngModel)]="unsavedTestCWLFile" minlength="3" maxlength="128" [pattern]="validationPatterns.testFilePath" title="Relative path to a CWL Test Parameter File in the Git repository." placeholder="e.g. /test.cwl.json" [disabled]="!editMode" ng-class="editMode ? 'test_parameter_input' : ''"/>
<span class="input-group-btn">
<button title="Add CWL test parameter file" type="button" class="btn btn-default form-sm-button" [disabled]="hasDuplicateTestJson('cwl')" (click)="addTestParameterFile(DescriptorType.CWL)" *ngIf="editMode && !(model1.invalid || unsavedTestCWLFile.length == 0)">
<span class="glyphicon glyphicon-plus"></span>
</button>
<button title="Enter a valid path" type="button" class="btn btn-default form-sm-button" [disabled]="model1.invalid || unsavedTestCWLFile.length == 0" *ngIf="editMode && (model1.invalid || unsavedTestCWLFile.length == 0)">
<span class="glyphicon glyphicon-plus"></span>
</button>
</span>
</div>
<div *ngIf="formErrors.cwlTestParameterFilePath" class="form-error-messages">
<div *ngIf="formErrors.cwlTestParameterFilePath" class="form-error-messages alert alert-danger">
{{formErrors.cwlTestParameterFilePath}}
</div>
</div>
</div>
<div class="form-group form-group-sm" style="clear:both;">
<div class="col-sm-offset-3 col-sm-9 col-md-9 col-lg-9 test_parameter_div" *ngFor="let item of unsavedCWLTestParameterFilePaths; let i = index;trackBy:trackByIndex;">
<div class="input-group">
<input type="text" class="form-control" name="unsavedCWLTestParameterFilePaths[{{i}}]" [(ngModel)]="unsavedCWLTestParameterFilePaths[i]" [disabled] minlength="3" maxlength="128" [pattern]="validationPatterns.testFilePath" title="Relative path to a CWL Test Parameter File in the Git repository." placeholder="e.g. /test.cwl.json" [disabled]="!editMode" ng-class="editMode ? 'test_parameter_input' : ''" />
<button title="Remove CWL test parameter file" type="button" class="btn btn-danger test_parameter_remove_button" ng-hide="!editMode" (click)="removeTestParameterFile(i, DescriptorType.CWL)">
<span class="glyphicon glyphicon-minus"></span>
</button>
<div *ngIf="hasDuplicateTestJson('cwl')" class="alert alert-danger">
Duplicate test json files are not allowed.
</div>
</div>
<div class="col-sm-9 col-md-9 col-lg-9" *ngIf="unsavedCWLTestParameterFilePaths.length == 0 && !editMode">
<input class="form-control" placeholder="None provided" [disabled]="true"/>
</div>
</div>
<div class="form-group form-group-sm" style="clear:both;">

<div class="form-group form-group form-group-sm">
<label class="col-sm-3 col-md-3 col-lg-3 control-label">
WDL Test Parameter File(s):
</label>
<div class="col-sm-9 col-md-9 col-lg-9 test_parameter_div">
<div class="col-sm-9 col-md-9 col-lg-9 form-margin" *ngFor="let item of unsavedWDLTestParameterFilePaths; let i = index;trackBy:trackByIndex;">
<div class="input-group">
<input type="text" #model2="ngModel" class="form-control" name="wdlTestParameterFilePath" [(ngModel)]="unsavedTestWDLFile" minlength="3" maxlength="128" [pattern]="validationPatterns.testFilePath" title="Relative path to a WDL Test Parameter File in the Git repository." placeholder="e.g. /test.wdl.json" [disabled]="!editMode" ng-class="editMode ? 'test_parameter_input' : ''" />
<button title="Add WDL test parameter file" type="button" class="btn btn-success test_parameter_add_button" (click)="addTestParameterFile(DescriptorType.WDL)" ng-hide="!editMode" [disabled]="model2.invalid || unsavedTestWDLFile.length < 1">
<span class="glyphicon glyphicon-plus"></span>
</button>
<input [ngClass]="{ 'input-right-button' : editMode, 'input-no-button' : !editMode }" type="text" class="form-control" name="unsavedWDLTestParameterFilePaths[{{i}}]" [(ngModel)]="unsavedWDLTestParameterFilePaths[i]" minlength="3" maxlength="128" [pattern]="validationPatterns.testFilePath" title="Relative path to a WDL Test Parameter File in the Git repository." placeholder="e.g. /test.wdl.json" disabled ng-class="editMode ? 'test_parameter_input' : ''" />
<span class="input-group-btn">
<button title="Remove WDL test parameter file" type="button" class="btn btn-default form-sm-button" *ngIf="editMode" (click)="removeTestParameterFile(i, DescriptorType.WDL)">
<span class="glyphicon glyphicon-remove"></span>
</button>
</span>
</div>
<div *ngIf="formErrors.wdlTestParameterFilePath" class="form-error-messages">
</div>
<div class="col-sm-9 col-md-9 col-lg-9" [ngClass]="{'col-sm-offset-3' : unsavedWDLTestParameterFilePaths.length > 0}" *ngIf="editMode">
<div class="input-group full-width">
<input [ngClass]="{ 'input-right-button' : editMode }" type="text" #model1="ngModel" class="form-control" name="wdlTestParameterFilePath" [(ngModel)]="unsavedTestWDLFile" minlength="3" maxlength="128" [pattern]="validationPatterns.testFilePath" title="Relative path to a WDL Test Parameter File in the Git repository." placeholder="e.g. /test.wdl.json" [disabled]="!editMode" ng-class="editMode ? 'test_parameter_input' : ''"/>
<span class="input-group-btn">
<button title="Add WDL test parameter file" type="button" class="btn btn-default form-sm-button" [disabled]="hasDuplicateTestJson('wdl')" (click)="addTestParameterFile(DescriptorType.WDL)" *ngIf="editMode && !(model1.invalid || unsavedTestWDLFile.length == 0)">
<span class="glyphicon glyphicon-plus"></span>
</button>
<button title="Enter a valid path" type="button" class="btn btn-default form-sm-button" [disabled]="model1.invalid || unsavedTestWDLFile.length == 0" *ngIf="editMode && (model1.invalid || unsavedTestWDLFile.length == 0)">
<span class="glyphicon glyphicon-plus"></span>
</button>
</span>
</div>
<div *ngIf="formErrors.wdlTestParameterFilePath" class="form-error-messages alert alert-danger">
{{formErrors.wdlTestParameterFilePath}}
</div>
</div>
</div>
<div class="form-group form-group-sm" style="clear:both;">
<div class="col-sm-offset-3 col-sm-9 col-md-9 col-lg-9 test_parameter_div" *ngFor="let item of unsavedWDLTestParameterFilePaths; let i = index;">
<div class="input-group">
<input type="text" class="form-control" name="unsavedWDLTestParameterFilePaths[{{i}}]" [(ngModel)]="unsavedWDLTestParameterFilePaths[i]" minlength="3" maxlength="128" [pattern]="validationPatterns.testFilePath" title="Relative path to a WDL Test Parameter File in the Git repository." placeholder="e.g. /test.wdl.json" [disabled]="!editMode" ng-class="editMode ? 'test_parameter_input' : ''" />
<button title="Remove WDL test parameter file" type="button" class="btn btn-danger test_parameter_remove_button" ng-hide="!editMode" (click)="removeTestParameterFile(i, DescriptorType.WDL)">
<span class="glyphicon glyphicon-minus"></span>
</button>
<div *ngIf="hasDuplicateTestJson('wdl')" class="alert alert-danger">
Duplicate test json files are not allowed.
</div>
</div>
</div>
<div class="col-sm-9 col-md-9 col-lg-9 col-sm-offset-3">
<div class="col-sm-9 col-md-9 col-lg-9" *ngIf="unsavedWDLTestParameterFilePaths.length == 0 && !editMode">
<input class="form-control" placeholder="None provided" [disabled]="true"/>
</div>
</div>
<div class="form-group form-group-sm" ng-if="editMode">
<label class="col-sm-3 control-label">
Expand All @@ -156,7 +177,7 @@ <h4 class="modal-title">Add Version Tag</h4>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" (click)="addTagModal.hide()">Close</button>
<button id="addVersionTagButton" type="button" (click)="addTagModal.hide(); addTag()" class="btn btn-primary" [disabled]="!addTagForm.form.valid">
<button id="addVersionTagButton" type="button" (click)="addTagModal.hide(); addTag()" class="btn btn-primary" [disabled]="!addTagForm.form.valid || hasDuplicateTestJson('wdl') || hasDuplicateTestJson('cwl')">
Add Tag
</button>
</div>
Expand Down
27 changes: 27 additions & 0 deletions src/app/container/add-tag/add-tag.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ export class AddTagComponent implements OnInit, AfterViewChecked {
this.tool.tags = response;
const id = this.tool.id;
const tagName = this.unsavedVersion.name;
// Store the unsaved test files if valid and exist
if (this.unsavedTestCWLFile.length > 0) {
this.addTestParameterFile(DescriptorType.CWL);
}
if (this.unsavedTestWDLFile.length > 0) {
this.addTestParameterFile(DescriptorType.WDL);
}

this.containersService.addTestParameterFiles(id, this.unsavedCWLTestParameterFilePaths, null, tagName, 'CWL').subscribe();
this.containersService.addTestParameterFiles(id, this.unsavedWDLTestParameterFilePaths, null, tagName, 'WDL').subscribe();
this.containerService.setTool(this.tool);
Expand Down Expand Up @@ -159,4 +167,23 @@ export class AddTagComponent implements OnInit, AfterViewChecked {
}
}
// Validation ends here
// Checks if the currently edited test parameter file already exists
// TODO: This code is repeated in version-modal.component.ts for tools, move it somewhere common
hasDuplicateTestJson(type) {
if (type === 'cwl') {
if (this.unsavedCWLTestParameterFilePaths.includes(this.unsavedTestCWLFile)) {
return true;
} else {
return false;
}
} else if (type === 'wdl') {
if (this.unsavedWDLTestParameterFilePaths.includes(this.unsavedTestWDLFile)) {
return true;
} else {
return false;
}
} else {
return false;
}
}
}
Loading

0 comments on commit cc9d3e6

Please sign in to comment.