Skip to content

Commit

Permalink
Removed repo format validation
Browse files Browse the repository at this point in the history
  • Loading branch information
eva-vashkevich committed Oct 30, 2024
1 parent e2731eb commit 5fa0206
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 29 deletions.
1 change: 0 additions & 1 deletion shell/assets/translations/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6067,7 +6067,6 @@ validation:
localhost: If the Server URL is internal to the Rancher server (e.g. localhost) the downstream clusters may not be able to communicate with Rancher.
trailingForwardSlash: Server URL should not have a trailing forward slash.
url: Server URL must be an URL.
repo: Repository URL must be a valid HTTPS or SSH URL to a git repository.
stringLength:
between: '"{key}" should be between {min} and {max} {max, plural, =1 {character} other {characters}}'
exactly: '"{key}" should be {count, plural, =1 {# character} other {# characters}}'
Expand Down
2 changes: 1 addition & 1 deletion shell/edit/fleet.cattle.io.gitrepo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export default {
stepTargetInfo,
addRepositorySteps,
displayHelmRepoURLRegex: false,
fvFormRuleSets: [{ path: 'spec.repo', rules: ['required', 'repo'] }]
fvFormRuleSets: [{ path: 'spec.repo', rules: ['required'] }]
};
},
Expand Down
23 changes: 0 additions & 23 deletions shell/utils/validators/formRules/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1112,29 +1112,6 @@ describe('formRules', () => {
expect(formRuleResult).toStrictEqual(expectedResult);
});

describe('repo', () => {
const message = JSON.stringify({ message: 'validation.setting.repo' });
const testCases = [
['', undefined],
['https://github.com/rancher/fleet-examples.git', undefined],
['[email protected]:rancher/fleet-examples.git', undefined],
['http://100.100.100.127', undefined],
['aaaAAAA111//', message],
['/', message],
['+1', message],
[undefined, undefined]
];

it.each(testCases)(
'should return undefined or correct message based on the provided url',
(val, expected) => {
const formRuleResult = formRules.repo(val);

expect(formRuleResult).toStrictEqual(expected);
}
);
});

describe.each([
['minValue', 2, [3], [1]],
['maxValue', 256, [1], [300]],
Expand Down
5 changes: 1 addition & 4 deletions shell/utils/validators/formRules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,6 @@ export default function(t: Translation, { key = 'Value' }: ValidationOptions): {
return runValidators(val, [startHyphen('label'), endHyphen('label'), startDot('label'), endDot('label'), required]);
};

const repo: Validator = (val) => val && !/((git|ssh|http(s)?)|(git@[\w\.]+))(\:(\/\/)?)([\w\.@\:/\-~]+)(\.git)?(\/)?/.test(val) ? t('validation.setting.repo') : undefined;

return {
absolutePath,
alphanumeric,
Expand Down Expand Up @@ -501,7 +499,6 @@ export default function(t: Translation, { key = 'Value' }: ValidationOptions): {
servicePort,
subDomain,
testRule,
wildcardHostname,
repo
wildcardHostname
};
}

0 comments on commit 5fa0206

Please sign in to comment.