Remove update_on_project_update from inventory sources form and corresponding files

This commit is contained in:
Veda Periwal
2022-07-15 11:18:16 -07:00
parent 84d7fa882d
commit 21f551f48a
20 changed files with 3 additions and 121 deletions
@@ -29,17 +29,11 @@ function PromptInventorySourceDetail({ resource }) {
summary_fields, summary_fields,
update_cache_timeout, update_cache_timeout,
update_on_launch, update_on_launch,
update_on_project_update,
verbosity, verbosity,
} = resource; } = resource;
let optionsList = ''; let optionsList = '';
if ( if (overwrite || overwrite_vars || update_on_launch) {
overwrite ||
overwrite_vars ||
update_on_launch ||
update_on_project_update
) {
optionsList = ( optionsList = (
<TextList component={TextListVariants.ul}> <TextList component={TextListVariants.ul}>
{overwrite && ( {overwrite && (
@@ -57,11 +51,6 @@ function PromptInventorySourceDetail({ resource }) {
{t`Update on launch`} {t`Update on launch`}
</TextListItem> </TextListItem>
)} )}
{update_on_project_update && (
<TextListItem component={TextListItemVariants.li}>
{t`Update on project update`}
</TextListItem>
)}
</TextList> </TextList>
); );
} }
@@ -67,7 +67,6 @@ describe('PromptInventorySourceDetail', () => {
</li>, </li>,
<li>Overwrite local variables from remote inventory source</li>, <li>Overwrite local variables from remote inventory source</li>,
<li>Update on launch</li>, <li>Update on launch</li>,
<li>Update on project update</li>,
]) ])
).toEqual(true); ).toEqual(true);
}); });
@@ -112,7 +112,6 @@
"update_on_launch":true, "update_on_launch":true,
"update_cache_timeout":2, "update_cache_timeout":2,
"source_project":8, "source_project":8,
"update_on_project_update":true,
"last_update_failed": true, "last_update_failed": true,
"last_updated":null "last_updated":null
} }
@@ -31,7 +31,6 @@ describe('<InventorySourceAdd />', () => {
source_vars: '---↵', source_vars: '---↵',
update_cache_timeout: 0, update_cache_timeout: 0,
update_on_launch: false, update_on_launch: false,
update_on_project_update: false,
verbosity: 1, verbosity: 1,
}; };
@@ -49,7 +49,6 @@ function InventorySourceDetail({ inventorySource }) {
source_vars, source_vars,
update_cache_timeout, update_cache_timeout,
update_on_launch, update_on_launch,
update_on_project_update,
verbosity, verbosity,
enabled_var, enabled_var,
enabled_value, enabled_value,
@@ -113,12 +112,7 @@ function InventorySourceDetail({ inventorySource }) {
); );
let optionsList = ''; let optionsList = '';
if ( if (overwrite || overwrite_vars || update_on_launch) {
overwrite ||
overwrite_vars ||
update_on_launch ||
update_on_project_update
) {
optionsList = ( optionsList = (
<TextList component={TextListVariants.ul}> <TextList component={TextListVariants.ul}>
{overwrite && ( {overwrite && (
@@ -143,16 +137,6 @@ function InventorySourceDetail({ inventorySource }) {
/> />
</TextListItem> </TextListItem>
)} )}
{update_on_project_update && (
<TextListItem component={TextListItemVariants.li}>
{t`Update on project update`}
<Popover
content={helpText.subFormOptions.updateOnProjectUpdate({
value: source_project,
})}
/>
</TextListItem>
)}
</TextList> </TextList>
); );
} }
@@ -113,7 +113,6 @@ describe('InventorySourceDetail', () => {
'Overwrite local groups and hosts from remote inventory source', 'Overwrite local groups and hosts from remote inventory source',
'Overwrite local variables from remote inventory source', 'Overwrite local variables from remote inventory source',
'Update on launch', 'Update on launch',
'Update on project update',
]).toContain(option.text()); ]).toContain(option.text());
}); });
}); });
@@ -31,7 +31,6 @@ describe('<InventorySourceEdit />', () => {
source_vars: '---↵', source_vars: '---↵',
update_cache_timeout: 0, update_cache_timeout: 0,
update_on_launch: false, update_on_launch: false,
update_on_project_update: false,
verbosity: 1, verbosity: 1,
}; };
const mockInventory = { const mockInventory = {
@@ -73,7 +73,6 @@ const InventorySourceFormFields = ({
source_vars: '---\n', source_vars: '---\n',
update_cache_timeout: 0, update_cache_timeout: 0,
update_on_launch: false, update_on_launch: false,
update_on_project_update: false,
verbosity: 1, verbosity: 1,
enabled_var: '', enabled_var: '',
enabled_value: '', enabled_value: '',
@@ -251,7 +250,6 @@ const InventorySourceForm = ({
source_vars: source?.source_vars || '---\n', source_vars: source?.source_vars || '---\n',
update_cache_timeout: source?.update_cache_timeout || 0, update_cache_timeout: source?.update_cache_timeout || 0,
update_on_launch: source?.update_on_launch || false, update_on_launch: source?.update_on_launch || false,
update_on_project_update: source?.update_on_project_update || false,
verbosity: source?.verbosity || 1, verbosity: source?.verbosity || 1,
enabled_var: source?.enabled_var || '', enabled_var: source?.enabled_var || '',
enabled_value: source?.enabled_value || '', enabled_value: source?.enabled_value || '',
@@ -17,7 +17,6 @@ const initialValues = {
source_vars: '---\n', source_vars: '---\n',
update_cache_timeout: 0, update_cache_timeout: 0,
update_on_launch: true, update_on_launch: true,
update_on_project_update: false,
verbosity: 1, verbosity: 1,
}; };
@@ -17,7 +17,6 @@ const initialValues = {
source_vars: '---\n', source_vars: '---\n',
update_cache_timeout: 0, update_cache_timeout: 0,
update_on_launch: true, update_on_launch: true,
update_on_project_update: false,
verbosity: 1, verbosity: 1,
}; };
@@ -17,7 +17,6 @@ const initialValues = {
source_vars: '---\n', source_vars: '---\n',
update_cache_timeout: 0, update_cache_timeout: 0,
update_on_launch: true, update_on_launch: true,
update_on_project_update: false,
verbosity: 1, verbosity: 1,
}; };
@@ -17,7 +17,6 @@ const initialValues = {
source_vars: '---\n', source_vars: '---\n',
update_cache_timeout: 0, update_cache_timeout: 0,
update_on_launch: true, update_on_launch: true,
update_on_project_update: false,
verbosity: 1, verbosity: 1,
}; };
@@ -17,7 +17,6 @@ const initialValues = {
source_vars: '---\n', source_vars: '---\n',
update_cache_timeout: 0, update_cache_timeout: 0,
update_on_launch: true, update_on_launch: true,
update_on_project_update: false,
verbosity: 1, verbosity: 1,
}; };
@@ -17,7 +17,6 @@ const initialValues = {
source_vars: '---\n', source_vars: '---\n',
update_cache_timeout: 0, update_cache_timeout: 0,
update_on_launch: true, update_on_launch: true,
update_on_project_update: false,
verbosity: 1, verbosity: 1,
}; };
@@ -17,7 +17,6 @@ const initialValues = {
source_vars: '---\n', source_vars: '---\n',
update_cache_timeout: 0, update_cache_timeout: 0,
update_on_launch: true, update_on_launch: true,
update_on_project_update: false,
verbosity: 1, verbosity: 1,
}; };
@@ -121,7 +120,6 @@ describe('<SCMSubForm />', () => {
source_vars: '---\n', source_vars: '---\n',
update_cache_timeout: 0, update_cache_timeout: 0,
update_on_launch: true, update_on_launch: true,
update_on_project_update: false,
verbosity: 1, verbosity: 1,
}; };
let customWrapper; let customWrapper;
@@ -139,63 +137,4 @@ describe('<SCMSubForm />', () => {
customWrapper.update(); customWrapper.update();
expect(customWrapper.find('Select').prop('selections')).toBe('newPath'); expect(customWrapper.find('Select').prop('selections')).toBe('newPath');
}); });
test('Update on project update should be disabled', async () => {
const customInitialValues = {
credential: { id: 1, name: 'Credential' },
custom_virtualenv: '',
overwrite: false,
overwrite_vars: false,
source_path: '/path',
source_project: { id: 1, name: 'Source project' },
source_script: null,
source_vars: '---\n',
update_cache_timeout: 0,
update_on_launch: true,
update_on_project_update: false,
verbosity: 1,
};
let customWrapper;
await act(async () => {
customWrapper = mountWithContexts(
<Formik initialValues={customInitialValues}>
<SCMSubForm />
</Formik>
);
});
expect(
customWrapper
.find('Checkbox[aria-label="Update on project update"]')
.prop('isDisabled')
).toBe(true);
});
test('Update on launch should be disabled', async () => {
const customInitialValues = {
credential: { id: 1, name: 'Credential' },
custom_virtualenv: '',
overwrite: false,
overwrite_vars: false,
source_path: '/path',
source_project: { id: 1, name: 'Source project' },
source_script: null,
source_vars: '---\n',
update_cache_timeout: 0,
update_on_launch: false,
update_on_project_update: true,
verbosity: 1,
};
let customWrapper;
await act(async () => {
customWrapper = mountWithContexts(
<Formik initialValues={customInitialValues}>
<SCMSubForm />
</Formik>
);
});
expect(
customWrapper
.find('Checkbox[aria-label="Update on launch"]')
.prop('isDisabled')
).toBe(true);
});
}); });
@@ -17,7 +17,6 @@ const initialValues = {
source_vars: '---\n', source_vars: '---\n',
update_cache_timeout: 0, update_cache_timeout: 0,
update_on_launch: true, update_on_launch: true,
update_on_project_update: false,
verbosity: 1, verbosity: 1,
}; };
@@ -53,11 +53,10 @@ export const VerbosityField = () => {
); );
}; };
export const OptionsField = ({ showProjectUpdate = false }) => { export const OptionsField = () => {
const [updateOnLaunchField] = useField('update_on_launch'); const [updateOnLaunchField] = useField('update_on_launch');
const [, , updateCacheTimeoutHelper] = useField('update_cache_timeout'); const [, , updateCacheTimeoutHelper] = useField('update_cache_timeout');
const [projectField] = useField('source_project'); const [projectField] = useField('source_project');
const [updatedOnProjectUpdateField] = useField('update_on_project_update');
useEffect(() => { useEffect(() => {
if (!updateOnLaunchField.value) { if (!updateOnLaunchField.value) {
@@ -83,23 +82,11 @@ export const OptionsField = ({ showProjectUpdate = false }) => {
tooltip={helpText.subFormOptions.overwriteVariables} tooltip={helpText.subFormOptions.overwriteVariables}
/> />
<CheckboxField <CheckboxField
isDisabled={updatedOnProjectUpdateField.value}
id="update_on_launch" id="update_on_launch"
name="update_on_launch" name="update_on_launch"
label={t`Update on launch`} label={t`Update on launch`}
tooltip={helpText.subFormOptions.updateOnLaunch(projectField)} tooltip={helpText.subFormOptions.updateOnLaunch(projectField)}
/> />
{showProjectUpdate && (
<CheckboxField
isDisabled={updateOnLaunchField.value}
id="update_on_project_update"
name="update_on_project_update"
label={t`Update on project update`}
tooltip={helpText.subFormOptions.updateOnProjectUpdate(
projectField
)}
/>
)}
</FormCheckboxLayout> </FormCheckboxLayout>
</FormGroup> </FormGroup>
</FormFullWidthLayout> </FormFullWidthLayout>
@@ -17,7 +17,6 @@ const initialValues = {
source_vars: '---\n', source_vars: '---\n',
update_cache_timeout: 0, update_cache_timeout: 0,
update_on_launch: true, update_on_launch: true,
update_on_project_update: false,
verbosity: 1, verbosity: 1,
}; };
@@ -17,7 +17,6 @@ const initialValues = {
source_vars: '---\n', source_vars: '---\n',
update_cache_timeout: 0, update_cache_timeout: 0,
update_on_launch: true, update_on_launch: true,
update_on_project_update: false,
verbosity: 1, verbosity: 1,
}; };
@@ -115,7 +115,6 @@
"update_on_launch":true, "update_on_launch":true,
"update_cache_timeout":2, "update_cache_timeout":2,
"source_project":8, "source_project":8,
"update_on_project_update":true,
"last_update_failed": true, "last_update_failed": true,
"last_updated":null, "last_updated":null,
"execution_environment": 1 "execution_environment": 1