mirror of
https://github.com/ansible/awx.git
synced 2026-04-07 11:09:22 -02:30
Implement Remote Archive SCM Type for ui_next
Signed-off-by: Philip Douglass <philip.douglass@amadeus.com>
This commit is contained in:
@@ -105,6 +105,7 @@ function ProjectLookup({
|
|||||||
[`git`, i18n._(t`Git`)],
|
[`git`, i18n._(t`Git`)],
|
||||||
[`hg`, i18n._(t`Mercurial`)],
|
[`hg`, i18n._(t`Mercurial`)],
|
||||||
[`svn`, i18n._(t`Subversion`)],
|
[`svn`, i18n._(t`Subversion`)],
|
||||||
|
[`archive`, i18n._(t`Remote Archive`)],
|
||||||
[`insights`, i18n._(t`Red Hat Insights`)],
|
[`insights`, i18n._(t`Red Hat Insights`)],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ export default function getResourceAccessConfig(i18n) {
|
|||||||
[`git`, i18n._(t`Git`)],
|
[`git`, i18n._(t`Git`)],
|
||||||
[`hg`, i18n._(t`Mercurial`)],
|
[`hg`, i18n._(t`Mercurial`)],
|
||||||
[`svn`, i18n._(t`Subversion`)],
|
[`svn`, i18n._(t`Subversion`)],
|
||||||
|
[`archive`, i18n._(t`Remote Archive`)],
|
||||||
[`insights`, i18n._(t`Red Hat Insights`)],
|
[`insights`, i18n._(t`Red Hat Insights`)],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -154,6 +155,7 @@ export default function getResourceAccessConfig(i18n) {
|
|||||||
[`git`, i18n._(t`Git`)],
|
[`git`, i18n._(t`Git`)],
|
||||||
[`hg`, i18n._(t`Mercurial`)],
|
[`hg`, i18n._(t`Mercurial`)],
|
||||||
[`svn`, i18n._(t`Subversion`)],
|
[`svn`, i18n._(t`Subversion`)],
|
||||||
|
[`archive`, i18n._(t`Remote Archive`)],
|
||||||
[`insights`, i18n._(t`Red Hat Insights`)],
|
[`insights`, i18n._(t`Red Hat Insights`)],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ describe('<ProjectAdd />', () => {
|
|||||||
['git', 'Git'],
|
['git', 'Git'],
|
||||||
['hg', 'Mercurial'],
|
['hg', 'Mercurial'],
|
||||||
['svn', 'Subversion'],
|
['svn', 'Subversion'],
|
||||||
|
['archive', 'Remote Archive'],
|
||||||
['insights', 'Red Hat Insights'],
|
['insights', 'Red Hat Insights'],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ describe('<ProjectEdit />', () => {
|
|||||||
['git', 'Git'],
|
['git', 'Git'],
|
||||||
['hg', 'Mercurial'],
|
['hg', 'Mercurial'],
|
||||||
['svn', 'Subversion'],
|
['svn', 'Subversion'],
|
||||||
|
['archive', 'Remote Archive'],
|
||||||
['insights', 'Red Hat Insights'],
|
['insights', 'Red Hat Insights'],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ function ProjectList({ i18n }) {
|
|||||||
[`git`, i18n._(t`Git`)],
|
[`git`, i18n._(t`Git`)],
|
||||||
[`hg`, i18n._(t`Mercurial`)],
|
[`hg`, i18n._(t`Mercurial`)],
|
||||||
[`svn`, i18n._(t`Subversion`)],
|
[`svn`, i18n._(t`Subversion`)],
|
||||||
|
[`archive`, i18n._(t`Remote Archive`)],
|
||||||
[`insights`, i18n._(t`Red Hat Insights`)],
|
[`insights`, i18n._(t`Red Hat Insights`)],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -61,6 +61,24 @@ const mockProjects = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
name: 'Project 4',
|
||||||
|
url: '/api/v2/projects/4',
|
||||||
|
type: 'project',
|
||||||
|
scm_type: 'archive',
|
||||||
|
scm_revision: 'odsd9ajf8aagjisooajfij34ikdj3fs994s4daiaos7',
|
||||||
|
summary_fields: {
|
||||||
|
last_job: {
|
||||||
|
id: 9004,
|
||||||
|
status: 'successful',
|
||||||
|
},
|
||||||
|
user_capabilities: {
|
||||||
|
delete: false,
|
||||||
|
update: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
describe('<ProjectList />', () => {
|
describe('<ProjectList />', () => {
|
||||||
@@ -94,7 +112,7 @@ describe('<ProjectList />', () => {
|
|||||||
});
|
});
|
||||||
wrapper.update();
|
wrapper.update();
|
||||||
|
|
||||||
expect(wrapper.find('ProjectListItem')).toHaveLength(3);
|
expect(wrapper.find('ProjectListItem')).toHaveLength(4);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should select project when checked', async () => {
|
test('should select project when checked', async () => {
|
||||||
@@ -133,7 +151,7 @@ describe('<ProjectList />', () => {
|
|||||||
wrapper.update();
|
wrapper.update();
|
||||||
|
|
||||||
const items = wrapper.find('ProjectListItem');
|
const items = wrapper.find('ProjectListItem');
|
||||||
expect(items).toHaveLength(3);
|
expect(items).toHaveLength(4);
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
expect(item.prop('isSelected')).toEqual(true);
|
expect(item.prop('isSelected')).toEqual(true);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import {
|
|||||||
GitSubForm,
|
GitSubForm,
|
||||||
HgSubForm,
|
HgSubForm,
|
||||||
SvnSubForm,
|
SvnSubForm,
|
||||||
|
ArchiveSubForm,
|
||||||
InsightsSubForm,
|
InsightsSubForm,
|
||||||
ManualSubForm,
|
ManualSubForm,
|
||||||
} from './ProjectSubForms';
|
} from './ProjectSubForms';
|
||||||
@@ -240,6 +241,13 @@ function ProjectFormFields({
|
|||||||
scmUpdateOnLaunch={formik.values.scm_update_on_launch}
|
scmUpdateOnLaunch={formik.values.scm_update_on_launch}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
|
archive: (
|
||||||
|
<ArchiveSubForm
|
||||||
|
credential={credentials.scm}
|
||||||
|
onCredentialSelection={handleCredentialSelection}
|
||||||
|
scmUpdateOnLaunch={formik.values.scm_update_on_launch}
|
||||||
|
/>
|
||||||
|
),
|
||||||
insights: (
|
insights: (
|
||||||
<InsightsSubForm
|
<InsightsSubForm
|
||||||
credential={credentials.insights}
|
credential={credentials.insights}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ describe('<ProjectForm />', () => {
|
|||||||
['git', 'Git'],
|
['git', 'Git'],
|
||||||
['hg', 'Mercurial'],
|
['hg', 'Mercurial'],
|
||||||
['svn', 'Subversion'],
|
['svn', 'Subversion'],
|
||||||
|
['archive', 'Remote Archive'],
|
||||||
['insights', 'Red Hat Insights'],
|
['insights', 'Red Hat Insights'],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import 'styled-components/macro';
|
||||||
|
import React from 'react';
|
||||||
|
import { withI18n } from '@lingui/react';
|
||||||
|
import { t } from '@lingui/macro';
|
||||||
|
import {
|
||||||
|
UrlFormField,
|
||||||
|
ScmCredentialFormField,
|
||||||
|
ScmTypeOptions,
|
||||||
|
} from './SharedFields';
|
||||||
|
|
||||||
|
const ArchiveSubForm = ({
|
||||||
|
i18n,
|
||||||
|
credential,
|
||||||
|
onCredentialSelection,
|
||||||
|
scmUpdateOnLaunch,
|
||||||
|
}) => (
|
||||||
|
<>
|
||||||
|
<UrlFormField
|
||||||
|
i18n={i18n}
|
||||||
|
tooltip={
|
||||||
|
<span>
|
||||||
|
{i18n._(t`Example URLs for Remote Archive Source Control include:`)}
|
||||||
|
<ul css={{ margin: '10px 0 10px 20px' }}>
|
||||||
|
<li>https://github.com/username/project/archive/v0.0.1.tar.gz</li>
|
||||||
|
<li>https://github.com/username/project/archive/v0.0.2.zip</li>
|
||||||
|
</ul>
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<ScmCredentialFormField
|
||||||
|
credential={credential}
|
||||||
|
onCredentialSelection={onCredentialSelection}
|
||||||
|
/>
|
||||||
|
<ScmTypeOptions scmUpdateOnLaunch={scmUpdateOnLaunch} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default withI18n()(ArchiveSubForm);
|
||||||
@@ -3,3 +3,4 @@ export { default as HgSubForm } from './HgSubForm';
|
|||||||
export { default as InsightsSubForm } from './InsightsSubForm';
|
export { default as InsightsSubForm } from './InsightsSubForm';
|
||||||
export { default as ManualSubForm } from './ManualSubForm';
|
export { default as ManualSubForm } from './ManualSubForm';
|
||||||
export { default as SvnSubForm } from './SvnSubForm';
|
export { default as SvnSubForm } from './SvnSubForm';
|
||||||
|
export { default as ArchiveSubForm } from './ArchiveSubForm';
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ function ProjectsList({ i18n, nodeResource, onUpdateNodeResource }) {
|
|||||||
[`git`, i18n._(t`Git`)],
|
[`git`, i18n._(t`Git`)],
|
||||||
[`hg`, i18n._(t`Mercurial`)],
|
[`hg`, i18n._(t`Mercurial`)],
|
||||||
[`svn`, i18n._(t`Subversion`)],
|
[`svn`, i18n._(t`Subversion`)],
|
||||||
|
[`archive`, i18n._(t`Remote Archive`)],
|
||||||
[`insights`, i18n._(t`Red Hat Insights`)],
|
[`insights`, i18n._(t`Red Hat Insights`)],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ export const Project = shape({
|
|||||||
created: string,
|
created: string,
|
||||||
name: string.isRequired,
|
name: string.isRequired,
|
||||||
description: string,
|
description: string,
|
||||||
scm_type: oneOf(['', 'git', 'hg', 'svn', 'insights']),
|
scm_type: oneOf(['', 'git', 'hg', 'svn', 'archive', 'insights']),
|
||||||
scm_url: string,
|
scm_url: string,
|
||||||
scm_branch: string,
|
scm_branch: string,
|
||||||
scm_refspec: string,
|
scm_refspec: string,
|
||||||
|
|||||||
Reference in New Issue
Block a user