Skip to content

Disable Next button unless source URL is valid - #2492

Merged
openshift-bot merged 1 commit into
openshift:masterfrom
spadgett:validate-source-url
May 26, 2015
Merged

openshift-bot merged 1 commit into
openshift:masterfrom
spadgett:validate-source-url

Conversation

@spadgett

Copy link
Copy Markdown
Member

Fixes #2388

openshift_management_console

@spadgett

Copy link
Copy Markdown
Member Author

@liggitt let me know what you think. Input type="url" doesn't work because it doesn't like git: or ssh://. I tried to be conservative with the regex.

@liggitt

liggitt commented May 26, 2015

Copy link
Copy Markdown
Contributor

can you run the validation in javascript? I'd much rather do this:

var u = URI(value);
return u.is("absolute") && u.is("url");

I'd rather just check basic things on that page

@spadgett

Copy link
Copy Markdown
Member Author

@liggitt Will is('url') reject things like [email protected]:user/project.git. I assume that's valid.

@liggitt

liggitt commented May 26, 2015

Copy link
Copy Markdown
Contributor

hmm... looks like it doesn't. I really don't want to get in the business of thorough url validation here

@spadgett

Copy link
Copy Markdown
Member Author

@liggitt Yeah, I understand... I'd say we either do very basic regex validation -- I've tried to keep it simple -- or just stick to required only and let it fail later.

FWIW, here's the regex:

debuggex__online_visual_regex_tester__javascript__python__and_pcre_

@liggitt

liggitt commented May 26, 2015

Copy link
Copy Markdown
Contributor

yeah, even that misses things like git+ssh...

@liggitt liggitt self-assigned this May 26, 2015
Comment thread assets/app/views/create.html Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could go super-simple and do (ssh://|http://|https://|git).+...
Is there any indication there's an invalid value?
Is that case-sensitive?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an indication of an invalid value when you blur the field.
It is case sensitive.

@spadgett
spadgett force-pushed the validate-source-url branch from b96fcb7 to f4114c8 Compare May 26, 2015 18:59
@spadgett

Copy link
Copy Markdown
Member Author

@liggitt OK, an even simpler regex. Let me know what you think.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep the pattern in the controller... it's used by assets/test/spec/controllers/create.js

@spadgett
spadgett force-pushed the validate-source-url branch from f4114c8 to b155755 Compare May 26, 2015 19:56
@spadgett

Copy link
Copy Markdown
Member Author

@liggitt one more look... Now using ng-pattern="sourceURLPattern"

@liggitt

liggitt commented May 26, 2015

Copy link
Copy Markdown
Contributor

[merge]

@openshift-bot

Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/2097/) (Image: devenv-fedora_1627)

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin up to b155755

@openshift-bot

Copy link
Copy Markdown
Contributor

[Test]ing while waiting on the merge queue

@openshift-bot

Copy link
Copy Markdown
Contributor

openshift-bot pushed a commit that referenced this pull request May 26, 2015
@openshift-bot
openshift-bot merged commit 1a06c50 into openshift:master May 26, 2015
@spadgett
spadgett deleted the validate-source-url branch May 27, 2015 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Source repository input does not validate value as URL

3 participants