diff --git a/awx/ui_next/src/screens/Organization/OrganizationAccess/__snapshots__/OrganizationAccessItem.test.jsx.snap b/awx/ui_next/src/screens/Organization/OrganizationAccess/__snapshots__/OrganizationAccessItem.test.jsx.snap
index 8e8c16a6dd..754d0fe75c 100644
--- a/awx/ui_next/src/screens/Organization/OrganizationAccess/__snapshots__/OrganizationAccessItem.test.jsx.snap
+++ b/awx/ui_next/src/screens/Organization/OrganizationAccess/__snapshots__/OrganizationAccessItem.test.jsx.snap
@@ -693,7 +693,7 @@ exports[` initially renders succesfully 1`] = `
isReadOnly={false}
onClick={[Function]}
>
- initially renders succesfully 1`] = `
-
+
diff --git a/awx/ui_next/src/screens/Organization/OrganizationNotifications/__snapshots__/OrganizationNotifications.test.jsx.snap b/awx/ui_next/src/screens/Organization/OrganizationNotifications/__snapshots__/OrganizationNotifications.test.jsx.snap
index e59d0e142a..080d13087e 100644
--- a/awx/ui_next/src/screens/Organization/OrganizationNotifications/__snapshots__/OrganizationNotifications.test.jsx.snap
+++ b/awx/ui_next/src/screens/Organization/OrganizationNotifications/__snapshots__/OrganizationNotifications.test.jsx.snap
@@ -385,10 +385,6 @@ exports[` initially renders succesfully 1`] = `
onSort={[Function]}
qsConfig={
Object {
- "dateFields": Array [
- "modified",
- "created",
- ],
"defaultParams": Object {
"order_by": "name",
"page": 1,
@@ -443,10 +439,6 @@ exports[` initially renders succesfully 1`] = `
onSort={[Function]}
qsConfig={
Object {
- "dateFields": Array [
- "modified",
- "created",
- ],
"defaultParams": Object {
"order_by": "name",
"page": 1,
@@ -626,24 +618,6 @@ exports[` initially renders succesfully 1`] = `
]
}
onSearch={[Function]}
- qsConfig={
- Object {
- "dateFields": Array [
- "modified",
- "created",
- ],
- "defaultParams": Object {
- "order_by": "name",
- "page": 1,
- "page_size": 5,
- },
- "integerFields": Array [
- "page",
- "page_size",
- ],
- "namespace": "notification",
- }
- }
sortedColumnKey="name"
>
initially renders succesfully 1`] = `
}
i18n={"/i18n/"}
onSearch={[Function]}
- qsConfig={
- Object {
- "dateFields": Array [
- "modified",
- "created",
- ],
- "defaultParams": Object {
- "order_by": "name",
- "page": 1,
- "page_size": 5,
- },
- "integerFields": Array [
- "page",
- "page_size",
- ],
- "namespace": "notification",
- }
- }
sortedColumnKey="name"
>
', () => {
const defaultProps = {
description: '',
@@ -94,7 +96,10 @@ describe('', () => {
const changeState = new Promise(resolve => {
formik.setState(
{
- values: jobTemplateData,
+ values: {
+ ...jobTemplateData,
+ labels: [],
+ }
},
() => resolve()
);
diff --git a/awx/ui_next/src/screens/Template/JobTemplateEdit/JobTemplateEdit.test.jsx b/awx/ui_next/src/screens/Template/JobTemplateEdit/JobTemplateEdit.test.jsx
index 3f43faf279..cd7ef7a141 100644
--- a/awx/ui_next/src/screens/Template/JobTemplateEdit/JobTemplateEdit.test.jsx
+++ b/awx/ui_next/src/screens/Template/JobTemplateEdit/JobTemplateEdit.test.jsx
@@ -34,6 +34,9 @@ const mockJobTemplate = {
labels: {
results: [{ name: 'Sushi', id: 1 }, { name: 'Major', id: 2 }],
},
+ inventory: {
+ organization_id: 1,
+ },
},
};
@@ -170,16 +173,12 @@ describe('', () => {
description: 'new description',
job_type: 'check',
};
- const newLabels = [
- { associate: true, id: 3 },
- { associate: true, id: 3 },
- { name: 'Maple', organization: 1 },
- { name: 'Tree', organization: 1 },
- ];
- const removedLabels = [
- { disassociate: true, id: 1 },
- { disassociate: true, id: 2 },
- ];
+ const labels = [
+ { id: 3, name: 'Foo', isNew: true },
+ { id: 4, name: 'Bar', isNew: true },
+ { id: 5, name: 'Maple' },
+ { id: 6, name: 'Tree' },
+ ]
JobTemplatesAPI.update.mockResolvedValue({
data: { ...updatedTemplateData },
});
@@ -190,8 +189,7 @@ describe('', () => {
values: {
...mockJobTemplate,
...updatedTemplateData,
- newLabels,
- removedLabels,
+ labels,
},
},
() => resolve()
diff --git a/awx/ui_next/src/screens/Template/shared/JobTemplateForm.jsx b/awx/ui_next/src/screens/Template/shared/JobTemplateForm.jsx
index d7eb506975..a4e5227a2a 100644
--- a/awx/ui_next/src/screens/Template/shared/JobTemplateForm.jsx
+++ b/awx/ui_next/src/screens/Template/shared/JobTemplateForm.jsx
@@ -588,7 +588,7 @@ const FormikApp = withFormik({
inventory: template.inventory || '',
project: template.project || '',
playbook: template.playbook || '',
- labels: summary_fields.labels.results,
+ labels: summary_fields.labels.results || [],
forks: template.forks || 0,
limit: template.limit || '',
verbosity: template.verbosity || '0',
diff --git a/awx/ui_next/src/screens/Template/shared/JobTemplateForm.test.jsx b/awx/ui_next/src/screens/Template/shared/JobTemplateForm.test.jsx
index 0d53e4b405..cf2da14304 100644
--- a/awx/ui_next/src/screens/Template/shared/JobTemplateForm.test.jsx
+++ b/awx/ui_next/src/screens/Template/shared/JobTemplateForm.test.jsx
@@ -70,7 +70,7 @@ describe('', () => {
jest.clearAllMocks();
});
- test('should render labels MultiSelect', async () => {
+ test('should render LabelsSelect', async () => {
const wrapper = mountWithContexts(
', () => {
expect(LabelsAPI.read).toHaveBeenCalled();
expect(JobTemplatesAPI.readInstanceGroups).toHaveBeenCalled();
wrapper.update();
- expect(
- wrapper
- .find('FormGroup[fieldId="template-labels"] MultiSelect')
- .prop('associatedItems')
- ).toEqual(mockData.summary_fields.labels.results);
+ const select = wrapper.find('LabelSelect');
+ expect(select).toHaveLength(1);
+ expect(select.prop('value')).toEqual(
+ mockData.summary_fields.labels.results
+ );
});
test('should update form values on input changes', async () => {