mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add support for file:// git urls
This commit is contained in:
parent
b847e962aa
commit
528db67c34
@ -1193,6 +1193,7 @@ RED.projects.settings = (function() {
|
|||||||
editRepoButton.attr('disabled',true);
|
editRepoButton.attr('disabled',true);
|
||||||
addRemoteDialog.slideDown(200, function() {
|
addRemoteDialog.slideDown(200, function() {
|
||||||
addRemoteDialog[0].scrollIntoView();
|
addRemoteDialog[0].scrollIntoView();
|
||||||
|
validateForm();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1287,7 +1288,7 @@ RED.projects.settings = (function() {
|
|||||||
|
|
||||||
var validateForm = function() {
|
var validateForm = function() {
|
||||||
var validName = /^[a-zA-Z0-9\-_]+$/.test(remoteNameInput.val());
|
var validName = /^[a-zA-Z0-9\-_]+$/.test(remoteNameInput.val());
|
||||||
var validRepo = /^(?:git|ssh|https?|[\d\w\.\-_]+@[\w\.]+):(?:\/\/)?[\w\.@:\/~_-]+\.git(?:\/?|\#[\d\w\.\-_]+?)$/.test(remoteURLInput.val());
|
var validRepo = /^(?:file|git|ssh|https?|[\d\w\.\-_]+@[\w\.]+):(?:\/\/)?[\w\.@:\/~_-]+(?:\.git)?(?:\/?|\#[\d\w\.\-_]+?)$/.test(remoteURLInput.val());
|
||||||
saveButton.attr('disabled',(!validName || !validRepo))
|
saveButton.attr('disabled',(!validName || !validRepo))
|
||||||
remoteNameInput.toggleClass('input-error',remoteNameInputChanged&&!validName);
|
remoteNameInput.toggleClass('input-error',remoteNameInputChanged&&!validName);
|
||||||
if (popover) {
|
if (popover) {
|
||||||
|
@ -681,7 +681,7 @@ RED.projects = (function() {
|
|||||||
} else if (projectType === 'clone') {
|
} else if (projectType === 'clone') {
|
||||||
var repo = projectRepoInput.val();
|
var repo = projectRepoInput.val();
|
||||||
|
|
||||||
var validRepo = /^(?:git|ssh|https?|[\d\w\.\-_]+@[\w\.]+):(?:\/\/)?[\w\.@:\/~_-]+\.git(?:\/?|\#[\d\w\.\-_]+?)$/.test(repo);
|
var validRepo = /^(?:file|git|ssh|https?|[\d\w\.\-_]+@[\w\.]+):(?:\/\/)?[\w\.@:\/~_-]+(?:\/?|\#[\d\w\.\-_]+?)$/.test(repo);
|
||||||
if (!validRepo) {
|
if (!validRepo) {
|
||||||
if (projectRepoChanged) {
|
if (projectRepoChanged) {
|
||||||
projectRepoInput.addClass("input-error");
|
projectRepoInput.addClass("input-error");
|
||||||
@ -700,7 +700,7 @@ RED.projects = (function() {
|
|||||||
$(".projects-dialog-screen-create-row-creds").show();
|
$(".projects-dialog-screen-create-row-creds").show();
|
||||||
$(".projects-dialog-screen-create-row-sshkey").hide();
|
$(".projects-dialog-screen-create-row-sshkey").hide();
|
||||||
} else {
|
} else {
|
||||||
$(".projects-dialog-screen-create-row-creds").show();
|
$(".projects-dialog-screen-create-row-creds").hide();
|
||||||
$(".projects-dialog-screen-create-row-sshkey").hide();
|
$(".projects-dialog-screen-create-row-sshkey").hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -888,13 +888,13 @@ RED.projects = (function() {
|
|||||||
row = $('<div class="hide form-row projects-dialog-screen-create-row projects-dialog-screen-create-row-clone"></div>').appendTo(container);
|
row = $('<div class="hide form-row projects-dialog-screen-create-row projects-dialog-screen-create-row-clone"></div>').appendTo(container);
|
||||||
$('<label for="projects-dialog-screen-create-project-repo">Git repository URL</label>').appendTo(row);
|
$('<label for="projects-dialog-screen-create-project-repo">Git repository URL</label>').appendTo(row);
|
||||||
projectRepoInput = $('<input id="projects-dialog-screen-create-project-repo" type="text" placeholder="https://git.example.com/path/my-project.git"></input>').appendTo(row);
|
projectRepoInput = $('<input id="projects-dialog-screen-create-project-repo" type="text" placeholder="https://git.example.com/path/my-project.git"></input>').appendTo(row);
|
||||||
$('<label class="projects-edit-form-sublabel"><small>https:// or ssh://</small></label>').appendTo(row);
|
$('<label class="projects-edit-form-sublabel"><small>https://, ssh:// or file://</small></label>').appendTo(row);
|
||||||
|
|
||||||
var projectRepoChanged = false;
|
var projectRepoChanged = false;
|
||||||
projectRepoInput.on("change keyup paste",function() {
|
projectRepoInput.on("change keyup paste",function() {
|
||||||
projectRepoChanged = true;
|
projectRepoChanged = true;
|
||||||
var repo = $(this).val();
|
var repo = $(this).val();
|
||||||
var m = /\/([^/]+)\.git/.exec(repo);
|
var m = /\/([^/]+?)(?:\.git)?$/.exec(repo);
|
||||||
if (m) {
|
if (m) {
|
||||||
var projectName = projectNameInput.val();
|
var projectName = projectNameInput.val();
|
||||||
if (projectName === "" || projectName === autoInsertedName) {
|
if (projectName === "" || projectName === autoInsertedName) {
|
||||||
|
Loading…
Reference in New Issue
Block a user