+
+
{render({ routeGroups })}
diff --git a/awx/ui_next/src/App.test.jsx b/awx/ui_next/src/App.test.jsx
index 5a69647dfa..88a1f394a9 100644
--- a/awx/ui_next/src/App.test.jsx
+++ b/awx/ui_next/src/App.test.jsx
@@ -14,13 +14,14 @@ describe('', () => {
const version = '222';
beforeEach(() => {
- ConfigAPI.read = () => Promise.resolve({
- data: {
- ansible_version,
- custom_virtualenvs,
- version
- }
- });
+ ConfigAPI.read = () =>
+ Promise.resolve({
+ data: {
+ ansible_version,
+ custom_virtualenvs,
+ version,
+ },
+ });
MeAPI.read = () => Promise.resolve({ data: { results: [{}] } });
});
@@ -43,15 +44,13 @@ describe('', () => {
{
groupTitle: 'Group Two',
groupId: 'group_two',
- routes: [
- { title: 'Fiz', path: '/fiz' },
- ]
- }
+ routes: [{ title: 'Fiz', path: '/fiz' }],
+ },
]}
- render={({ routeGroups }) => (
- routeGroups.map(({ groupId }) => ())
- )}
- />,
+ render={({ routeGroups }) =>
+ routeGroups.map(({ groupId }) => )
+ }
+ />
);
// page components
@@ -70,7 +69,7 @@ describe('', () => {
expect(appWrapper.find('#group_two').length).toBe(1);
});
- test('opening the about modal renders prefetched config data', async (done) => {
+ test('opening the about modal renders prefetched config data', async done => {
const wrapper = mountWithContexts();
wrapper.update();
@@ -83,7 +82,11 @@ describe('', () => {
await waitForElement(wrapper, aboutDropdown);
wrapper.find(aboutDropdown).simulate('click');
- const button = await waitForElement(wrapper, aboutButton, el => !el.props().disabled);
+ const button = await waitForElement(
+ wrapper,
+ aboutButton,
+ el => !el.props().disabled
+ );
button.simulate('click');
// check about modal content
@@ -108,7 +111,7 @@ describe('', () => {
});
});
- test('onLogout makes expected call to api client', async (done) => {
+ test('onLogout makes expected call to api client', async done => {
const appWrapper = mountWithContexts().find('App');
appWrapper.instance().handleLogout();
await asyncFlush();
diff --git a/awx/ui_next/src/RootProvider.jsx b/awx/ui_next/src/RootProvider.jsx
index 9165ae4d23..48fdf3200c 100644
--- a/awx/ui_next/src/RootProvider.jsx
+++ b/awx/ui_next/src/RootProvider.jsx
@@ -1,24 +1,21 @@
import React, { Component } from 'react';
-import {
- I18nProvider,
-} from '@lingui/react';
+import { I18nProvider } from '@lingui/react';
-import {
- HashRouter
-} from 'react-router-dom';
+import { HashRouter } from 'react-router-dom';
import ja from '../build/locales/ja/messages';
import en from '../build/locales/en/messages';
-export function getLanguage (nav) {
- const language = (nav.languages && nav.languages[0]) || nav.language || nav.userLanguage;
+export function getLanguage(nav) {
+ const language =
+ (nav.languages && nav.languages[0]) || nav.language || nav.userLanguage;
const languageWithoutRegionCode = language.toLowerCase().split(/[_-]+/)[0];
return languageWithoutRegionCode;
}
class RootProvider extends Component {
- render () {
+ render() {
const { children } = this.props;
const catalogs = { en, ja };
@@ -26,10 +23,7 @@ class RootProvider extends Component {
return (
-
+
{children}
diff --git a/awx/ui_next/src/RootProvider.test.jsx b/awx/ui_next/src/RootProvider.test.jsx
index e89f37a8f7..45b87782f6 100644
--- a/awx/ui_next/src/RootProvider.test.jsx
+++ b/awx/ui_next/src/RootProvider.test.jsx
@@ -3,8 +3,16 @@ import { getLanguage } from './RootProvider';
describe('RootProvider.jsx', () => {
test('getLanguage returns the expected language code', () => {
expect(getLanguage({ languages: ['es-US'] })).toEqual('es');
- expect(getLanguage({ languages: ['es-US'], language: 'fr-FR', userLanguage: 'en-US' })).toEqual('es');
- expect(getLanguage({ language: 'fr-FR', userLanguage: 'en-US' })).toEqual('fr');
+ expect(
+ getLanguage({
+ languages: ['es-US'],
+ language: 'fr-FR',
+ userLanguage: 'en-US',
+ })
+ ).toEqual('es');
+ expect(getLanguage({ language: 'fr-FR', userLanguage: 'en-US' })).toEqual(
+ 'fr'
+ );
expect(getLanguage({ userLanguage: 'en-US' })).toEqual('en');
});
});
diff --git a/awx/ui_next/src/api/Base.js b/awx/ui_next/src/api/Base.js
index bc26bc0657..d884f8061c 100644
--- a/awx/ui_next/src/api/Base.js
+++ b/awx/ui_next/src/api/Base.js
@@ -2,40 +2,40 @@ import axios from 'axios';
const defaultHttp = axios.create({
xsrfCookieName: 'csrftoken',
- xsrfHeaderName: 'X-CSRFToken'
+ xsrfHeaderName: 'X-CSRFToken',
});
class Base {
- constructor (http = defaultHttp, baseURL) {
+ constructor(http = defaultHttp, baseURL) {
this.http = http;
this.baseUrl = baseURL;
}
- create (data) {
+ create(data) {
return this.http.post(this.baseUrl, data);
}
- destroy (id) {
+ destroy(id) {
return this.http.delete(`${this.baseUrl}${id}/`);
}
- read (params = {}) {
+ read(params = {}) {
return this.http.get(this.baseUrl, { params });
}
- readDetail (id) {
+ readDetail(id) {
return this.http.get(`${this.baseUrl}${id}/`);
}
- readOptions () {
+ readOptions() {
return this.http.options(this.baseUrl);
}
- replace (id, data) {
+ replace(id, data) {
return this.http.put(`${this.baseUrl}${id}/`, data);
}
- update (id, data) {
+ update(id, data) {
return this.http.patch(`${this.baseUrl}${id}/`, data);
}
}
diff --git a/awx/ui_next/src/api/Base.test.jsx b/awx/ui_next/src/api/Base.test.jsx
index 6cd21c6be5..df6d874bd0 100644
--- a/awx/ui_next/src/api/Base.test.jsx
+++ b/awx/ui_next/src/api/Base.test.jsx
@@ -3,14 +3,14 @@ import Base from './Base';
describe('Base', () => {
const createPromise = () => Promise.resolve();
const mockBaseURL = '/api/v2/organizations/';
- const mockHttp = ({
+ const mockHttp = {
delete: jest.fn(createPromise),
get: jest.fn(createPromise),
options: jest.fn(createPromise),
patch: jest.fn(createPromise),
post: jest.fn(createPromise),
- put: jest.fn(createPromise)
- });
+ put: jest.fn(createPromise),
+ };
const BaseAPI = new Base(mockHttp, mockBaseURL);
@@ -18,7 +18,7 @@ describe('Base', () => {
jest.clearAllMocks();
});
- test('create calls http method with expected data', async (done) => {
+ test('create calls http method with expected data', async done => {
const data = { name: 'test ' };
await BaseAPI.create(data);
@@ -28,17 +28,19 @@ describe('Base', () => {
done();
});
- test('destroy calls http method with expected data', async (done) => {
+ test('destroy calls http method with expected data', async done => {
const resourceId = 1;
await BaseAPI.destroy(resourceId);
expect(mockHttp.delete).toHaveBeenCalledTimes(1);
- expect(mockHttp.delete.mock.calls[0][0]).toEqual(`${mockBaseURL}${resourceId}/`);
+ expect(mockHttp.delete.mock.calls[0][0]).toEqual(
+ `${mockBaseURL}${resourceId}/`
+ );
done();
});
- test('read calls http method with expected data', async (done) => {
+ test('read calls http method with expected data', async done => {
const defaultParams = {};
const testParams = { foo: 'bar' };
@@ -51,17 +53,19 @@ describe('Base', () => {
done();
});
- test('readDetail calls http method with expected data', async (done) => {
+ test('readDetail calls http method with expected data', async done => {
const resourceId = 1;
await BaseAPI.readDetail(resourceId);
expect(mockHttp.get).toHaveBeenCalledTimes(1);
- expect(mockHttp.get.mock.calls[0][0]).toEqual(`${mockBaseURL}${resourceId}/`);
+ expect(mockHttp.get.mock.calls[0][0]).toEqual(
+ `${mockBaseURL}${resourceId}/`
+ );
done();
});
- test('readOptions calls http method with expected data', async (done) => {
+ test('readOptions calls http method with expected data', async done => {
await BaseAPI.readOptions();
expect(mockHttp.options).toHaveBeenCalledTimes(1);
@@ -69,27 +73,31 @@ describe('Base', () => {
done();
});
- test('replace calls http method with expected data', async (done) => {
+ test('replace calls http method with expected data', async done => {
const resourceId = 1;
const data = { name: 'test ' };
await BaseAPI.replace(resourceId, data);
expect(mockHttp.put).toHaveBeenCalledTimes(1);
- expect(mockHttp.put.mock.calls[0][0]).toEqual(`${mockBaseURL}${resourceId}/`);
+ expect(mockHttp.put.mock.calls[0][0]).toEqual(
+ `${mockBaseURL}${resourceId}/`
+ );
expect(mockHttp.put.mock.calls[0][1]).toEqual(data);
done();
});
- test('update calls http method with expected data', async (done) => {
+ test('update calls http method with expected data', async done => {
const resourceId = 1;
const data = { name: 'test ' };
await BaseAPI.update(resourceId, data);
expect(mockHttp.patch).toHaveBeenCalledTimes(1);
- expect(mockHttp.patch.mock.calls[0][0]).toEqual(`${mockBaseURL}${resourceId}/`);
+ expect(mockHttp.patch.mock.calls[0][0]).toEqual(
+ `${mockBaseURL}${resourceId}/`
+ );
expect(mockHttp.patch.mock.calls[0][1]).toEqual(data);
done();
diff --git a/awx/ui_next/src/api/index.js b/awx/ui_next/src/api/index.js
index c87e753f2b..204985b31d 100644
--- a/awx/ui_next/src/api/index.js
+++ b/awx/ui_next/src/api/index.js
@@ -36,5 +36,5 @@ export {
UnifiedJobTemplatesAPI,
UnifiedJobsAPI,
UsersAPI,
- WorkflowJobTemplatesAPI
+ WorkflowJobTemplatesAPI,
};
diff --git a/awx/ui_next/src/api/mixins/InstanceGroups.mixin.js b/awx/ui_next/src/api/mixins/InstanceGroups.mixin.js
index 2317fb9270..3deff44bf7 100644
--- a/awx/ui_next/src/api/mixins/InstanceGroups.mixin.js
+++ b/awx/ui_next/src/api/mixins/InstanceGroups.mixin.js
@@ -1,15 +1,23 @@
-const InstanceGroupsMixin = (parent) => class extends parent {
- readInstanceGroups (resourceId, params = {}) {
- return this.http.get(`${this.baseUrl}${resourceId}/instance_groups/`, { params });
- }
+const InstanceGroupsMixin = parent =>
+ class extends parent {
+ readInstanceGroups(resourceId, params = {}) {
+ return this.http.get(`${this.baseUrl}${resourceId}/instance_groups/`, {
+ params,
+ });
+ }
- associateInstanceGroup (resourceId, instanceGroupId) {
- return this.http.post(`${this.baseUrl}${resourceId}/instance_groups/`, { id: instanceGroupId });
- }
+ associateInstanceGroup(resourceId, instanceGroupId) {
+ return this.http.post(`${this.baseUrl}${resourceId}/instance_groups/`, {
+ id: instanceGroupId,
+ });
+ }
- disassociateInstanceGroup (resourceId, instanceGroupId) {
- return this.http.post(`${this.baseUrl}${resourceId}/instance_groups/`, { id: instanceGroupId, disassociate: true });
- }
-};
+ disassociateInstanceGroup(resourceId, instanceGroupId) {
+ return this.http.post(`${this.baseUrl}${resourceId}/instance_groups/`, {
+ id: instanceGroupId,
+ disassociate: true,
+ });
+ }
+ };
export default InstanceGroupsMixin;
diff --git a/awx/ui_next/src/api/models/Config.js b/awx/ui_next/src/api/models/Config.js
index a944f4b994..f8e89df245 100644
--- a/awx/ui_next/src/api/models/Config.js
+++ b/awx/ui_next/src/api/models/Config.js
@@ -1,7 +1,7 @@
import Base from '../Base';
class Config extends Base {
- constructor (http) {
+ constructor(http) {
super(http);
this.baseUrl = '/api/v2/config/';
}
diff --git a/awx/ui_next/src/api/models/InstanceGroups.js b/awx/ui_next/src/api/models/InstanceGroups.js
index 7eaad069e3..94464e0f42 100644
--- a/awx/ui_next/src/api/models/InstanceGroups.js
+++ b/awx/ui_next/src/api/models/InstanceGroups.js
@@ -1,7 +1,7 @@
import Base from '../Base';
class InstanceGroups extends Base {
- constructor (http) {
+ constructor(http) {
super(http);
this.baseUrl = '/api/v2/instance_groups/';
}
diff --git a/awx/ui_next/src/api/models/JobTemplates.js b/awx/ui_next/src/api/models/JobTemplates.js
index dd1e5269fa..de24e298a7 100644
--- a/awx/ui_next/src/api/models/JobTemplates.js
+++ b/awx/ui_next/src/api/models/JobTemplates.js
@@ -2,7 +2,7 @@ import Base from '../Base';
import InstanceGroupsMixin from '../mixins/InstanceGroups.mixin';
class JobTemplates extends InstanceGroupsMixin(Base) {
- constructor (http) {
+ constructor(http) {
super(http);
this.baseUrl = '/api/v2/job_templates/';
@@ -10,11 +10,11 @@ class JobTemplates extends InstanceGroupsMixin(Base) {
this.readLaunch = this.readLaunch.bind(this);
}
- launch (id, data) {
+ launch(id, data) {
return this.http.post(`${this.baseUrl}${id}/launch/`, data);
}
- readLaunch (id) {
+ readLaunch(id) {
return this.http.get(`${this.baseUrl}${id}/launch/`);
}
}
diff --git a/awx/ui_next/src/api/models/Jobs.js b/awx/ui_next/src/api/models/Jobs.js
index cea169b72a..295ee815e8 100644
--- a/awx/ui_next/src/api/models/Jobs.js
+++ b/awx/ui_next/src/api/models/Jobs.js
@@ -1,7 +1,7 @@
import Base from '../Base';
class Jobs extends Base {
- constructor (http) {
+ constructor(http) {
super(http);
this.baseUrl = '/api/v2/jobs/';
}
diff --git a/awx/ui_next/src/api/models/Me.js b/awx/ui_next/src/api/models/Me.js
index ca0b336e26..77663567e9 100644
--- a/awx/ui_next/src/api/models/Me.js
+++ b/awx/ui_next/src/api/models/Me.js
@@ -1,7 +1,7 @@
import Base from '../Base';
class Me extends Base {
- constructor (http) {
+ constructor(http) {
super(http);
this.baseUrl = '/api/v2/me/';
}
diff --git a/awx/ui_next/src/api/models/Organizations.js b/awx/ui_next/src/api/models/Organizations.js
index 77970ad00c..c8531b3ecd 100644
--- a/awx/ui_next/src/api/models/Organizations.js
+++ b/awx/ui_next/src/api/models/Organizations.js
@@ -3,16 +3,16 @@ import NotificationsMixin from '../mixins/Notifications.mixin';
import InstanceGroupsMixin from '../mixins/InstanceGroups.mixin';
class Organizations extends InstanceGroupsMixin(NotificationsMixin(Base)) {
- constructor (http) {
+ constructor(http) {
super(http);
this.baseUrl = '/api/v2/organizations/';
}
- readAccessList (id, params = {}) {
+ readAccessList(id, params = {}) {
return this.http.get(`${this.baseUrl}${id}/access_list/`, { params });
}
- readTeams (id, params = {}) {
+ readTeams(id, params = {}) {
return this.http.get(`${this.baseUrl}${id}/teams/`, { params });
}
}
diff --git a/awx/ui_next/src/api/models/Organizations.test.jsx b/awx/ui_next/src/api/models/Organizations.test.jsx
index 31f6148c60..19a1958dae 100644
--- a/awx/ui_next/src/api/models/Organizations.test.jsx
+++ b/awx/ui_next/src/api/models/Organizations.test.jsx
@@ -5,7 +5,7 @@ describe('OrganizationsAPI', () => {
const orgId = 1;
const searchParams = { foo: 'bar' };
const createPromise = () => Promise.resolve();
- const mockHttp = ({ get: jest.fn(createPromise) });
+ const mockHttp = { get: jest.fn(createPromise) };
const OrganizationsAPI = new Organizations(mockHttp);
@@ -13,24 +13,36 @@ describe('OrganizationsAPI', () => {
jest.clearAllMocks();
});
- test('read access list calls get with expected params', async (done) => {
+ test('read access list calls get with expected params', async done => {
await OrganizationsAPI.readAccessList(orgId);
await OrganizationsAPI.readAccessList(orgId, searchParams);
expect(mockHttp.get).toHaveBeenCalledTimes(2);
- expect(mockHttp.get.mock.calls[0]).toContainEqual(`/api/v2/organizations/${orgId}/access_list/`, { params: {} });
- expect(mockHttp.get.mock.calls[1]).toContainEqual(`/api/v2/organizations/${orgId}/access_list/`, { params: searchParams });
+ expect(mockHttp.get.mock.calls[0]).toContainEqual(
+ `/api/v2/organizations/${orgId}/access_list/`,
+ { params: {} }
+ );
+ expect(mockHttp.get.mock.calls[1]).toContainEqual(
+ `/api/v2/organizations/${orgId}/access_list/`,
+ { params: searchParams }
+ );
done();
});
- test('read teams calls get with expected params', async (done) => {
+ test('read teams calls get with expected params', async done => {
await OrganizationsAPI.readTeams(orgId);
await OrganizationsAPI.readTeams(orgId, searchParams);
expect(mockHttp.get).toHaveBeenCalledTimes(2);
- expect(mockHttp.get.mock.calls[0]).toContainEqual(`/api/v2/organizations/${orgId}/teams/`, { params: {} });
- expect(mockHttp.get.mock.calls[1]).toContainEqual(`/api/v2/organizations/${orgId}/teams/`, { params: searchParams });
+ expect(mockHttp.get.mock.calls[0]).toContainEqual(
+ `/api/v2/organizations/${orgId}/teams/`,
+ { params: {} }
+ );
+ expect(mockHttp.get.mock.calls[1]).toContainEqual(
+ `/api/v2/organizations/${orgId}/teams/`,
+ { params: searchParams }
+ );
done();
});
diff --git a/awx/ui_next/src/api/models/Root.js b/awx/ui_next/src/api/models/Root.js
index 6e2bd0cfd9..ffba170c41 100644
--- a/awx/ui_next/src/api/models/Root.js
+++ b/awx/ui_next/src/api/models/Root.js
@@ -1,13 +1,13 @@
import Base from '../Base';
class Root extends Base {
- constructor (http) {
+ constructor(http) {
super(http);
this.baseUrl = '/api/';
this.redirectURL = '/api/v2/config/';
}
- async login (username, password, redirect = this.redirectURL) {
+ async login(username, password, redirect = this.redirectURL) {
const loginUrl = `${this.baseUrl}login/`;
const un = encodeURIComponent(username);
const pw = encodeURIComponent(password);
@@ -22,7 +22,7 @@ class Root extends Base {
return response;
}
- logout () {
+ logout() {
return this.http.get(`${this.baseUrl}logout/`);
}
}
diff --git a/awx/ui_next/src/api/models/Root.test.jsx b/awx/ui_next/src/api/models/Root.test.jsx
index 4b3c3401ba..3fb79cdfc9 100644
--- a/awx/ui_next/src/api/models/Root.test.jsx
+++ b/awx/ui_next/src/api/models/Root.test.jsx
@@ -2,7 +2,10 @@ import Root from './Root';
describe('RootAPI', () => {
const createPromise = () => Promise.resolve();
- const mockHttp = ({ get: jest.fn(createPromise), post: jest.fn(createPromise) });
+ const mockHttp = {
+ get: jest.fn(createPromise),
+ post: jest.fn(createPromise),
+ };
const RootAPI = new Root(mockHttp);
@@ -10,7 +13,7 @@ describe('RootAPI', () => {
jest.clearAllMocks();
});
- test('login calls get and post with expected content headers', async (done) => {
+ test('login calls get and post with expected content headers', async done => {
const headers = { 'Content-Type': 'application/x-www-form-urlencoded' };
await RootAPI.login('username', 'password');
@@ -24,18 +27,22 @@ describe('RootAPI', () => {
done();
});
- test('login sends expected data', async (done) => {
+ test('login sends expected data', async done => {
await RootAPI.login('foo', 'bar');
await RootAPI.login('foo', 'bar', 'baz');
expect(mockHttp.post).toHaveBeenCalledTimes(2);
- expect(mockHttp.post.mock.calls[0]).toContainEqual('username=foo&password=bar&next=%2Fapi%2Fv2%2Fconfig%2F');
- expect(mockHttp.post.mock.calls[1]).toContainEqual('username=foo&password=bar&next=baz');
+ expect(mockHttp.post.mock.calls[0]).toContainEqual(
+ 'username=foo&password=bar&next=%2Fapi%2Fv2%2Fconfig%2F'
+ );
+ expect(mockHttp.post.mock.calls[1]).toContainEqual(
+ 'username=foo&password=bar&next=baz'
+ );
done();
});
- test('logout calls expected http method', async (done) => {
+ test('logout calls expected http method', async done => {
await RootAPI.logout();
expect(mockHttp.get).toHaveBeenCalledTimes(1);
diff --git a/awx/ui_next/src/api/models/Teams.js b/awx/ui_next/src/api/models/Teams.js
index fb373bb3bc..585eb1086d 100644
--- a/awx/ui_next/src/api/models/Teams.js
+++ b/awx/ui_next/src/api/models/Teams.js
@@ -1,17 +1,20 @@
import Base from '../Base';
class Teams extends Base {
- constructor (http) {
+ constructor(http) {
super(http);
this.baseUrl = '/api/v2/teams/';
}
- associateRole (teamId, roleId) {
+ associateRole(teamId, roleId) {
return this.http.post(`${this.baseUrl}${teamId}/roles/`, { id: roleId });
}
- disassociateRole (teamId, roleId) {
- return this.http.post(`${this.baseUrl}${teamId}/roles/`, { id: roleId, disassociate: true });
+ disassociateRole(teamId, roleId) {
+ return this.http.post(`${this.baseUrl}${teamId}/roles/`, {
+ id: roleId,
+ disassociate: true,
+ });
}
}
diff --git a/awx/ui_next/src/api/models/Teams.test.jsx b/awx/ui_next/src/api/models/Teams.test.jsx
index 88b832d7ba..9bcbe65413 100644
--- a/awx/ui_next/src/api/models/Teams.test.jsx
+++ b/awx/ui_next/src/api/models/Teams.test.jsx
@@ -4,7 +4,7 @@ describe('TeamsAPI', () => {
const teamId = 1;
const roleId = 7;
const createPromise = () => Promise.resolve();
- const mockHttp = ({ post: jest.fn(createPromise) });
+ const mockHttp = { post: jest.fn(createPromise) };
const TeamsAPI = new Teams(mockHttp);
@@ -12,23 +12,29 @@ describe('TeamsAPI', () => {
jest.clearAllMocks();
});
- test('associate role calls post with expected params', async (done) => {
+ test('associate role calls post with expected params', async done => {
await TeamsAPI.associateRole(teamId, roleId);
expect(mockHttp.post).toHaveBeenCalledTimes(1);
- expect(mockHttp.post.mock.calls[0]).toContainEqual(`/api/v2/teams/${teamId}/roles/`, { id: roleId });
+ expect(mockHttp.post.mock.calls[0]).toContainEqual(
+ `/api/v2/teams/${teamId}/roles/`,
+ { id: roleId }
+ );
done();
});
- test('read teams calls post with expected params', async (done) => {
+ test('read teams calls post with expected params', async done => {
await TeamsAPI.disassociateRole(teamId, roleId);
expect(mockHttp.post).toHaveBeenCalledTimes(1);
- expect(mockHttp.post.mock.calls[0]).toContainEqual(`/api/v2/teams/${teamId}/roles/`, {
- id: roleId,
- disassociate: true
- });
+ expect(mockHttp.post.mock.calls[0]).toContainEqual(
+ `/api/v2/teams/${teamId}/roles/`,
+ {
+ id: roleId,
+ disassociate: true,
+ }
+ );
done();
});
diff --git a/awx/ui_next/src/api/models/UnifiedJobTemplates.js b/awx/ui_next/src/api/models/UnifiedJobTemplates.js
index 80b5f5af45..79d70610eb 100644
--- a/awx/ui_next/src/api/models/UnifiedJobTemplates.js
+++ b/awx/ui_next/src/api/models/UnifiedJobTemplates.js
@@ -1,7 +1,7 @@
import Base from '../Base';
class UnifiedJobTemplates extends Base {
- constructor (http) {
+ constructor(http) {
super(http);
this.baseUrl = '/api/v2/unified_job_templates/';
}
diff --git a/awx/ui_next/src/api/models/UnifiedJobs.js b/awx/ui_next/src/api/models/UnifiedJobs.js
index 0ad142201c..4ba18fdd00 100644
--- a/awx/ui_next/src/api/models/UnifiedJobs.js
+++ b/awx/ui_next/src/api/models/UnifiedJobs.js
@@ -1,7 +1,7 @@
import Base from '../Base';
class UnifiedJobs extends Base {
- constructor (http) {
+ constructor(http) {
super(http);
this.baseUrl = '/api/v2/unified_jobs/';
}
diff --git a/awx/ui_next/src/api/models/Users.js b/awx/ui_next/src/api/models/Users.js
index d386e2333c..a76c4e49b7 100644
--- a/awx/ui_next/src/api/models/Users.js
+++ b/awx/ui_next/src/api/models/Users.js
@@ -1,17 +1,20 @@
import Base from '../Base';
class Users extends Base {
- constructor (http) {
+ constructor(http) {
super(http);
this.baseUrl = '/api/v2/users/';
}
- associateRole (userId, roleId) {
+ associateRole(userId, roleId) {
return this.http.post(`${this.baseUrl}${userId}/roles/`, { id: roleId });
}
- disassociateRole (userId, roleId) {
- return this.http.post(`${this.baseUrl}${userId}/roles/`, { id: roleId, disassociate: true });
+ disassociateRole(userId, roleId) {
+ return this.http.post(`${this.baseUrl}${userId}/roles/`, {
+ id: roleId,
+ disassociate: true,
+ });
}
}
diff --git a/awx/ui_next/src/api/models/Users.test.jsx b/awx/ui_next/src/api/models/Users.test.jsx
index 469f7a01d9..10ec37411d 100644
--- a/awx/ui_next/src/api/models/Users.test.jsx
+++ b/awx/ui_next/src/api/models/Users.test.jsx
@@ -4,7 +4,7 @@ describe('UsersAPI', () => {
const userId = 1;
const roleId = 7;
const createPromise = () => Promise.resolve();
- const mockHttp = ({ post: jest.fn(createPromise) });
+ const mockHttp = { post: jest.fn(createPromise) };
const UsersAPI = new Users(mockHttp);
@@ -12,23 +12,29 @@ describe('UsersAPI', () => {
jest.clearAllMocks();
});
- test('associate role calls post with expected params', async (done) => {
+ test('associate role calls post with expected params', async done => {
await UsersAPI.associateRole(userId, roleId);
expect(mockHttp.post).toHaveBeenCalledTimes(1);
- expect(mockHttp.post.mock.calls[0]).toContainEqual(`/api/v2/users/${userId}/roles/`, { id: roleId });
+ expect(mockHttp.post.mock.calls[0]).toContainEqual(
+ `/api/v2/users/${userId}/roles/`,
+ { id: roleId }
+ );
done();
});
- test('read users calls post with expected params', async (done) => {
+ test('read users calls post with expected params', async done => {
await UsersAPI.disassociateRole(userId, roleId);
expect(mockHttp.post).toHaveBeenCalledTimes(1);
- expect(mockHttp.post.mock.calls[0]).toContainEqual(`/api/v2/users/${userId}/roles/`, {
- id: roleId,
- disassociate: true
- });
+ expect(mockHttp.post.mock.calls[0]).toContainEqual(
+ `/api/v2/users/${userId}/roles/`,
+ {
+ id: roleId,
+ disassociate: true,
+ }
+ );
done();
});
diff --git a/awx/ui_next/src/api/models/WorkflowJobTemplates.js b/awx/ui_next/src/api/models/WorkflowJobTemplates.js
index 8f553d4eb1..92bbccd9b0 100644
--- a/awx/ui_next/src/api/models/WorkflowJobTemplates.js
+++ b/awx/ui_next/src/api/models/WorkflowJobTemplates.js
@@ -1,7 +1,7 @@
import Base from '../Base';
class WorkflowJobTemplates extends Base {
- constructor (http) {
+ constructor(http) {
super(http);
this.baseUrl = '/api/v2/workflow_job_templates/';
}
diff --git a/awx/ui_next/src/app.scss b/awx/ui_next/src/app.scss
index b15ebc0a61..22a874d349 100644
--- a/awx/ui_next/src/app.scss
+++ b/awx/ui_next/src/app.scss
@@ -80,7 +80,6 @@
--pf-c-data-list__cell--PaddingTop: 16px;
--pf-c-data-list__cell-cell--PaddingTop: 16px;
-
&.pf-c-data-list__cell--divider {
--pf-c-data-list__cell-cell--MarginRight: 0;
--pf-c-data-list__cell--PaddingTop: 12px;
diff --git a/awx/ui_next/src/components/About/About.jsx b/awx/ui_next/src/components/About/About.jsx
index 3b75c233d7..785ecf4a19 100644
--- a/awx/ui_next/src/components/About/About.jsx
+++ b/awx/ui_next/src/components/About/About.jsx
@@ -6,14 +6,14 @@ import {
AboutModal,
TextContent,
TextList,
- TextListItem
+ TextListItem,
} from '@patternfly/react-core';
import { BrandName } from '../../variables';
import brandLogoImg from '../../../images/brand-logo.svg';
class About extends React.Component {
- static createSpeechBubble (version) {
+ static createSpeechBubble(version) {
let text = `${BrandName} ${version}`;
let top = '';
let bottom = '';
@@ -30,20 +30,14 @@ class About extends React.Component {
return top + text + bottom;
}
- constructor (props) {
+ constructor(props) {
super(props);
this.createSpeechBubble = this.constructor.createSpeechBubble.bind(this);
}
- render () {
- const {
- ansible_version,
- version,
- isOpen,
- onClose,
- i18n
- } = this.props;
+ render() {
+ const { ansible_version, version, isOpen, onClose, i18n } = this.props;
const speechBubble = this.createSpeechBubble(version);
@@ -57,7 +51,7 @@ class About extends React.Component {
brandImageAlt={i18n._(t`Brand Image`)}
>
- { speechBubble }
+ {speechBubble}
{`
\\
\\ ^__^
@@ -72,7 +66,7 @@ class About extends React.Component {
{i18n._(t`Ansible Version`)}
- { ansible_version }
+ {ansible_version}
diff --git a/awx/ui_next/src/components/About/About.test.jsx b/awx/ui_next/src/components/About/About.test.jsx
index 28ef329ab9..caed85e454 100644
--- a/awx/ui_next/src/components/About/About.test.jsx
+++ b/awx/ui_next/src/components/About/About.test.jsx
@@ -7,17 +7,13 @@ describe('', () => {
let closeButton;
const onClose = jest.fn();
test('initially renders without crashing', () => {
- aboutWrapper = mountWithContexts(
-
- );
+ aboutWrapper = mountWithContexts();
expect(aboutWrapper.length).toBe(1);
aboutWrapper.unmount();
});
test('close button calls onClose handler', () => {
- aboutWrapper = mountWithContexts(
-
- );
+ aboutWrapper = mountWithContexts();
closeButton = aboutWrapper.find('AboutModalBoxCloseButton Button');
closeButton.simulate('click');
expect(onClose).toBeCalled();
diff --git a/awx/ui_next/src/components/AddRole/AddResourceRole.jsx b/awx/ui_next/src/components/AddRole/AddResourceRole.jsx
index d9dc7642f5..7bf58c3cb7 100644
--- a/awx/ui_next/src/components/AddRole/AddResourceRole.jsx
+++ b/awx/ui_next/src/components/AddRole/AddResourceRole.jsx
@@ -8,14 +8,13 @@ import SelectRoleStep from './SelectRoleStep';
import SelectableCard from './SelectableCard';
import { TeamsAPI, UsersAPI } from '../../api';
-const readUsers = async (queryParams) => UsersAPI.read(
- Object.assign(queryParams, { is_superuser: false })
-);
+const readUsers = async queryParams =>
+ UsersAPI.read(Object.assign(queryParams, { is_superuser: false }));
-const readTeams = async (queryParams) => TeamsAPI.read(queryParams);
+const readTeams = async queryParams => TeamsAPI.read(queryParams);
class AddResourceRole extends React.Component {
- constructor (props) {
+ constructor(props) {
super(props);
this.state = {
@@ -25,67 +24,69 @@ class AddResourceRole extends React.Component {
currentStepId: 1,
};
- this.handleResourceCheckboxClick = this.handleResourceCheckboxClick.bind(this);
+ this.handleResourceCheckboxClick = this.handleResourceCheckboxClick.bind(
+ this
+ );
this.handleResourceSelect = this.handleResourceSelect.bind(this);
this.handleRoleCheckboxClick = this.handleRoleCheckboxClick.bind(this);
this.handleWizardNext = this.handleWizardNext.bind(this);
this.handleWizardSave = this.handleWizardSave.bind(this);
}
- handleResourceCheckboxClick (user) {
+ handleResourceCheckboxClick(user) {
const { selectedResourceRows } = this.state;
- const selectedIndex = selectedResourceRows
- .findIndex(selectedRow => selectedRow.id === user.id);
+ const selectedIndex = selectedResourceRows.findIndex(
+ selectedRow => selectedRow.id === user.id
+ );
if (selectedIndex > -1) {
selectedResourceRows.splice(selectedIndex, 1);
this.setState({ selectedResourceRows });
} else {
this.setState(prevState => ({
- selectedResourceRows: [...prevState.selectedResourceRows, user]
+ selectedResourceRows: [...prevState.selectedResourceRows, user],
}));
}
}
- handleRoleCheckboxClick (role) {
+ handleRoleCheckboxClick(role) {
const { selectedRoleRows } = this.state;
- const selectedIndex = selectedRoleRows
- .findIndex(selectedRow => selectedRow.id === role.id);
+ const selectedIndex = selectedRoleRows.findIndex(
+ selectedRow => selectedRow.id === role.id
+ );
if (selectedIndex > -1) {
selectedRoleRows.splice(selectedIndex, 1);
this.setState({ selectedRoleRows });
} else {
this.setState(prevState => ({
- selectedRoleRows: [...prevState.selectedRoleRows, role]
+ selectedRoleRows: [...prevState.selectedRoleRows, role],
}));
}
}
- handleResourceSelect (resourceType) {
+ handleResourceSelect(resourceType) {
this.setState({
selectedResource: resourceType,
selectedResourceRows: [],
- selectedRoleRows: []
+ selectedRoleRows: [],
});
}
- handleWizardNext (step) {
+ handleWizardNext(step) {
this.setState({
currentStepId: step.id,
});
}
- async handleWizardSave () {
- const {
- onSave
- } = this.props;
+ async handleWizardSave() {
+ const { onSave } = this.props;
const {
selectedResourceRows,
selectedRoleRows,
- selectedResource
+ selectedResource,
} = this.state;
try {
@@ -95,11 +96,17 @@ class AddResourceRole extends React.Component {
for (let j = 0; j < selectedRoleRows.length; j++) {
if (selectedResource === 'users') {
roleRequests.push(
- UsersAPI.associateRole(selectedResourceRows[i].id, selectedRoleRows[j].id)
+ UsersAPI.associateRole(
+ selectedResourceRows[i].id,
+ selectedRoleRows[j].id
+ )
);
} else if (selectedResource === 'teams') {
roleRequests.push(
- TeamsAPI.associateRole(selectedResourceRows[i].id, selectedRoleRows[j].id)
+ TeamsAPI.associateRole(
+ selectedResourceRows[i].id,
+ selectedRoleRows[j].id
+ )
);
}
}
@@ -112,25 +119,21 @@ class AddResourceRole extends React.Component {
}
}
- render () {
+ render() {
const {
selectedResource,
selectedResourceRows,
selectedRoleRows,
currentStepId,
} = this.state;
- const {
- onClose,
- roles,
- i18n
- } = this.props;
+ const { onClose, roles, i18n } = this.props;
const userColumns = [
- { name: i18n._(t`Username`), key: 'username', isSortable: true }
+ { name: i18n._(t`Username`), key: 'username', isSortable: true },
];
const teamColumns = [
- { name: i18n._(t`Name`), key: 'name', isSortable: true }
+ { name: i18n._(t`Name`), key: 'name', isSortable: true },
];
let wizardTitle = '';
@@ -164,7 +167,7 @@ class AddResourceRole extends React.Component {
/>
),
- enableNext: selectedResource !== null
+ enableNext: selectedResource !== null,
},
{
id: 2,
@@ -195,7 +198,7 @@ class AddResourceRole extends React.Component {
)}