From fb974c141da8810ce879f76f63d12d08c06b00ef Mon Sep 17 00:00:00 2001 From: Andrew Duncan Date: Tue, 21 Nov 2017 14:02:47 -0500 Subject: [PATCH 1/4] Validation fixes (#150) * fixed some validation errors, use consistent alert * added new test parameter stuff to add tag * can not register duplicate test parameter files * relaxed version naming, added cypress screenshots to git ignore * fixes gary mentioned --- .gitignore | 1 + .../container/add-tag/add-tag.component.html | 101 +++++++++++------- .../container/add-tag/add-tag.component.ts | 27 +++++ .../version-modal.component.html | 26 +++-- .../version-modal/version-modal.component.ts | 20 ++++ src/app/shared/validationMessages.model.ts | 5 +- .../version-modal.component.html | 9 +- .../version-modal/version-modal.component.ts | 9 ++ 8 files changed, 142 insertions(+), 56 deletions(-) diff --git a/.gitignore b/.gitignore index c66cccfc1e..c528a74fa7 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ testem.log /typings src/app/footer/versions.ts cypress/videos +cypress/screenshots # e2e /e2e/*.js diff --git a/src/app/container/add-tag/add-tag.component.html b/src/app/container/add-tag/add-tag.component.html index 6dfa44627e..8a5a58c730 100644 --- a/src/app/container/add-tag/add-tag.component.html +++ b/src/app/container/add-tag/add-tag.component.html @@ -30,7 +30,7 @@
-
+
{{formErrors.versionTag}}
@@ -41,7 +41,7 @@
-
+
{{formErrors.reference}}
@@ -52,7 +52,7 @@
-
+
{{formErrors.dockerfilePath}}
@@ -63,7 +63,7 @@
-
+
{{formErrors.cwlPath}}
@@ -74,64 +74,85 @@
-
+
{{formErrors.wdlPath}}
-
+
-
+
- - + + + + +
+
+
+
+ + + + +
-
+
{{formErrors.cwlTestParameterFilePath}}
-
-
-
-
-
- - +
+ Duplicate test json files are not allowed.
+
+ +
-
+ +
-
+
- - + + + +
-
+
+
+
+ + + + + +
+
{{formErrors.wdlTestParameterFilePath}}
-
-
-
-
-
- - +
+ Duplicate test json files are not allowed.
-
-
+
+ +
diff --git a/src/app/container/add-tag/add-tag.component.ts b/src/app/container/add-tag/add-tag.component.ts index caaf4bc6b3..0d62ae2e76 100644 --- a/src/app/container/add-tag/add-tag.component.ts +++ b/src/app/container/add-tag/add-tag.component.ts @@ -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); @@ -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; + } + } } diff --git a/src/app/container/version-modal/version-modal.component.html b/src/app/container/version-modal/version-modal.component.html index f41746d3df..59cbd4667c 100644 --- a/src/app/container/version-modal/version-modal.component.html +++ b/src/app/container/version-modal/version-modal.component.html @@ -39,7 +39,7 @@
-
+
{{formErrors.reference}}
@@ -58,7 +58,7 @@
-
+
{{formErrors.dockerfilePath}}
@@ -69,7 +69,7 @@
-
+
{{formErrors.cwlPath}}
@@ -80,7 +80,7 @@
-
+
{{formErrors.wdlPath}}
@@ -104,7 +104,7 @@
-
-
+
{{formErrors.cwlTestParameterFilePath}}
+
+ Duplicate test json files are not allowed. +
@@ -139,7 +142,7 @@
-
-
+
{{formErrors.wdlTestParameterFilePath}}
+
+ Duplicate test json files are not allowed. +
-
-
diff --git a/src/app/container/version-modal/version-modal.component.ts b/src/app/container/version-modal/version-modal.component.ts index 849fa2a6f7..60f557e25c 100644 --- a/src/app/container/version-modal/version-modal.component.ts +++ b/src/app/container/version-modal/version-modal.component.ts @@ -17,6 +17,7 @@ import { RefreshService } from '../../shared/refresh.service'; import { ContainersService } from './../../shared/swagger/api/containers.service'; import { DockstoreTool } from './../../shared/swagger/model/dockstoreTool'; +import { ToolDescriptor } from './../../shared/swagger/model/toolDescriptor'; import { ContainertagsService } from './../../shared/swagger/api/containertags.service'; import { DateService } from './../../shared/date.service'; import { ToolVersion } from './../../shared/swagger/model/toolVersion'; @@ -265,4 +266,23 @@ export class VersionModalComponent implements OnInit, AfterViewChecked { getDateTimeMessage(timestamp) { return this.dateService.getDateTimeMessage(timestamp); } + + // Checks if the currently edited test parameter file already exists + hasDuplicateTestJson(type) { + if (type === DescriptorType.CWL) { + if (this.unsavedCWLTestParameterFilePaths.includes(this.unsavedTestCWLFile)) { + return true; + } else { + return false; + } + } else if (type === DescriptorType.WDL) { + if (this.unsavedWDLTestParameterFilePaths.includes(this.unsavedTestWDLFile)) { + return true; + } else { + return false; + } + } else { + return false; + } + } } diff --git a/src/app/shared/validationMessages.model.ts b/src/app/shared/validationMessages.model.ts index 0dd93a0c6c..1cbfc37cea 100644 --- a/src/app/shared/validationMessages.model.ts +++ b/src/app/shared/validationMessages.model.ts @@ -41,7 +41,7 @@ export const validationPatterns = { 'imagePath': '^(([a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*)|_)/([a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*)$', 'toolName': '^[a-zA-Z0-9]+([-_][a-zA-Z0-9]+)*$', 'label': '^(| *([a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)( *, *([a-zA-Z0-9]+(-[a-zA-Z0-9]+)*))* *)$', - 'versionTag': '^[a-zA-Z0-9]+([-_\.][a-zA-Z0-9]+)*$', + 'versionTag': '^[a-zA-Z0-9]+([-_\.]*[a-zA-Z0-9]+)*$', 'reference': '[\\w-]+((/|.)[\\w-]+)*', 'workflowDescriptorPath': '^\/([^\\\/\?\:\*\|\<\>]+\/)*[^\\\/\?\:\*\|\<\>]+\.(cwl|wdl|yaml|yml)', 'workflowName': '[a-zA-Z0-9]+([-_][a-zA-Z0-9]+)*', @@ -67,7 +67,8 @@ export const validationMessages = { 'required': 'This field cannot be empty.', 'minlength': 'Dockerfile Path is too short. (Min. 3 characters.)', 'maxlength': 'Dockerfile Path is too long. (Max 256 characters.)', - 'pattern': 'Invalid Dockerfile Path format. Dockerfile Path must begin with \'/\' and end with \'/Dockerfile\'.' + 'pattern': 'Invalid Dockerfile Path format. Dockerfile Path must begin with \'/\' and end with \'Dockerfile\'. ' + + 'Optionally you can use a string as a prefix or a suffix to \'Dockerfile\', as long as they are separated by a \'.\'.' }, 'gitPath': { 'required': 'This field cannot be empty.', diff --git a/src/app/workflow/version-modal/version-modal.component.html b/src/app/workflow/version-modal/version-modal.component.html index 8f3c0eba03..c687627ea8 100644 --- a/src/app/workflow/version-modal/version-modal.component.html +++ b/src/app/workflow/version-modal/version-modal.component.html @@ -70,14 +70,14 @@
- +
-
-
+
{{formErrors.cwlTestParameterFilePath}}
+
+ Duplicate test json files are not allowed. +
diff --git a/src/app/workflow/version-modal/version-modal.component.ts b/src/app/workflow/version-modal/version-modal.component.ts index 6c7bae41c6..fd5ef3b5f2 100644 --- a/src/app/workflow/version-modal/version-modal.component.ts +++ b/src/app/workflow/version-modal/version-modal.component.ts @@ -124,4 +124,13 @@ export class VersionModalComponent implements OnInit, AfterViewChecked { } } // Validation ends here + + // Checks if the currently edited test parameter file already exists + hasDuplicateTestJson() { + if (this.testParameterFilePaths.includes(this.testParameterFilePath)) { + return true; + } else { + return false; + } + } } From 35d290eb5da5748deef5a986366beeac4d65ab86 Mon Sep 17 00:00:00 2001 From: Denis Yuen Date: Tue, 12 Dec 2017 11:30:06 -0500 Subject: [PATCH 2/4] Fix typo https://github.com/ga4gh/dockstore/issues/1031 (#153) --- .../onboarding/downloadcliclient/downloadcliclient.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/loginComponents/onboarding/downloadcliclient/downloadcliclient.component.ts b/src/app/loginComponents/onboarding/downloadcliclient/downloadcliclient.component.ts index b6fd6493ca..48638c24a5 100644 --- a/src/app/loginComponents/onboarding/downloadcliclient/downloadcliclient.component.ts +++ b/src/app/loginComponents/onboarding/downloadcliclient/downloadcliclient.component.ts @@ -74,7 +74,7 @@ printf "token: ${this.dsToken}\\nserver-url: ${this.dsServerURI}\\n" > ~/.dockst `; this.textData3 = ` #### Part 3 -If you want to launch CWL tools and workflows, Dockstore relies upon [cwltool](https://github.com/common-workflow-language/cwltool) being available on your PATH. This will require [pip](https://pip.pypa.io/en/latest/installing/)" if it is not already installed. +If you want to launch CWL tools and workflows, Dockstore relies upon [cwltool](https://github.com/common-workflow-language/cwltool) being available on your PATH. This will require [pip](https://pip.pypa.io/en/latest/installing/) if it is not already installed. You can install the version of cwltool that we've tested for use with Dockstore using the following commands: 1. Run this to verify that pip has been installed \`pip --version\` From de62380cb46ca46b15f630b0d5cc1e783400ccae Mon Sep 17 00:00:00 2001 From: Denis Yuen Date: Thu, 21 Dec 2017 14:21:39 -0500 Subject: [PATCH 3/4] Update package.json Looks like a broken cypress update --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c4a720794d..8b69b7989e 100644 --- a/package.json +++ b/package.json @@ -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", From 69a68bcc196533e84ef2bcf0cf4ea052595392ea Mon Sep 17 00:00:00 2001 From: Denis Yuen Date: Thu, 4 Jan 2018 11:36:20 -0500 Subject: [PATCH 4/4] Fix login to create tokens of the same scope as account linking --- src/app/shared/auth.model.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/shared/auth.model.ts b/src/app/shared/auth.model.ts index 8e7ef09264..1181d02368 100644 --- a/src/app/shared/auth.model.ts +++ b/src/app/shared/auth.model.ts @@ -14,7 +14,6 @@ * limitations under the License. */ -import { Injectable } from '@angular/core'; import { CustomConfig } from 'ng2-ui-auth'; import { Dockstore } from '../shared/dockstore.model'; @@ -24,7 +23,8 @@ export class AuthConfig extends CustomConfig { providers = { github: { url: Dockstore.API_URI + '/auth/tokens/github', - clientId: Dockstore.GITHUB_CLIENT_ID + clientId: Dockstore.GITHUB_CLIENT_ID, + scope: Dockstore.GITHUB_SCOPE } }; }