Skip to content

Commit

Permalink
Rename references to Controller (AAP-9148) (ansible#232)
Browse files Browse the repository at this point in the history
* rename folder controller to awx

* all files renamed

* rename usages of controller within files

* updated translations

* Rename build script, directory and env variables

* prettier fixes
  • Loading branch information
vidyanambiar authored Feb 27, 2023
1 parent 13962e6 commit 19a0d05
Show file tree
Hide file tree
Showing 233 changed files with 910 additions and 360 deletions.
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Ignore generated interfaces
frontend/controller/interfaces/generated-from-swagger
frontend/awx/interfaces/generated-from-swagger

.dockerignore
.gitignore
Expand Down
2 changes: 1 addition & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default defineConfig({
},
},
},
specPattern: 'frontend/controller/**/*.cy.tsx',
specPattern: 'frontend/awx/**/*.cy.tsx',
supportFile: 'cypress/support/component.ts',
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/// <reference types="cypress" />

import { randomString } from '../../../../framework/utils/random-string';
import { Organization } from '../../../../frontend/controller/interfaces/Organization';
import { Organization } from '../../../../frontend/awx/interfaces/Organization';
import { ItemsResponse } from '../../../../frontend/Data';

describe('organizations', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
/// <reference types="cypress" />

import { randomString } from '../../../../framework/utils/random-string';
import { Organization } from '../../../../frontend/controller/interfaces/Organization';
import { User } from '../../../../frontend/controller/interfaces/User';
import { Team } from '../../../../frontend/controller/interfaces/Team';
import { Organization } from '../../../../frontend/awx/interfaces/Organization';
import { User } from '../../../../frontend/awx/interfaces/User';
import { Team } from '../../../../frontend/awx/interfaces/Team';

describe('teams', () => {
let organization: Organization;
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/// <reference types="cypress" />

import { randomString } from '../../../../framework/utils/random-string';
import { Organization } from '../../../../frontend/controller/interfaces/Organization';
import { Project } from '../../../../frontend/controller/interfaces/Project';
import { Organization } from '../../../../frontend/awx/interfaces/Organization';
import { Project } from '../../../../frontend/awx/interfaces/Project';
import { ItemsResponse } from '../../../../frontend/Data';

describe('projects', () => {
Expand Down
4 changes: 2 additions & 2 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ Cypress.Commands.add('login', () => {
const password = Cypress.env('password') ? (Cypress.env('password') as string) : 'admin';

cy.clickButton(/^Add automation server$/);
cy.typeByLabel(/^Name$/, 'Controller');
cy.typeByLabel(/^Name$/, 'AWX');
cy.typeByLabel(/^Url$/, server);
cy.get('.pf-c-select__toggle').click();
cy.clickButton('AWX Ansible server');
cy.get('button[type=submit]').click();

cy.contains('a', /^Controller$/).click();
cy.contains('a', /^AWX$/).click();
cy.typeByLabel(/^Username$/, username);
cy.typeByLabel(/^Password$/, password);
cy.get('button[type=submit]').click();
Expand Down
16 changes: 8 additions & 8 deletions docs/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ This UI will be the single visible component of the platform and should be a sma

The project is broken into three parts.

| Path | Description |
| ---------- | --------------------------------------------------------------------------------------- |
| /frontend | The React web application for the Ansible UI. |
| /proxy | The proxy that hosts the web application and proxies calls to controller and hub hosts. |
| /framework | A framework for building applications using [PatternFly](https://www.patternfly.org) |
| Path | Description |
| ---------- | ------------------------------------------------------------------------------------ |
| /frontend | The React web application for the Ansible UI. |
| /proxy | The proxy that hosts the web application and proxies calls to AWX and hub hosts. |
| /framework | A framework for building applications using [PatternFly](https://www.patternfly.org) |

In addition the frontend is broken down into the structure needed for supporting both controller, hub, and EDA.
In addition the frontend is broken down into the structure needed for supporting both AWX, hub, and EDA.

| Path | Description |
| ---------------------- | ----------------------------------------------------- |
| /frontend/controller | The source code for the controller UI. |
| /frontend/awx | The source code for the AWX UI. |
| /frontend/hub | The source code for the hub UI. |
| /frontend/event-driven | The source code for the event driven architecture UI. |

Under each one of these, the directory structure should match the use navigation that is shown in the UI.

> Example: /frontend/controller/access/users
> Example: /frontend/awx/access/users
## Testing

Expand Down
2 changes: 1 addition & 1 deletion frontend/Data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ async function requestCommon<ResponseBody>(
'msg' in body &&
typeof body.msg === 'string'
) {
error.name = 'Controller Error';
error.name = 'Error';
error.message = body.msg;
}
return error;
Expand Down
6 changes: 3 additions & 3 deletions frontend/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Disclaimer } from './common/Disclaimer';
import { Login } from './common/Login';
import { PageNotFound } from './common/PageNotFound';
import { shouldShowAutmationServers } from './common/should-show-autmation-servers';
import { Controller } from './controller/Controller';
import { AWX } from './awx/Awx';
import { EventDriven } from './eda/EventDriven';
import { Hub } from './hub/Hub';
import { RouteE } from './Routes';
Expand All @@ -35,15 +35,15 @@ export default function Main() {
function Routing() {
const navigate = useNavigate();

const { showAutomationServers, showController, showHub, showEda } = shouldShowAutmationServers();
const { showAutomationServers, showAWX, showHub, showEda } = shouldShowAutmationServers();

return (
<PageFramework navigate={navigate}>
<Routes>
{showAutomationServers && (
<Route path={RouteE.AutomationServers} element={<AutomationServersRoute />} />
)}
{showController && <Route path={RouteE.Controller + '/*'} element={<Controller />} />}
{showAWX && <Route path={RouteE.AWX + '/*'} element={<AWX />} />}
{showHub && <Route path={RouteE.Hub + '/*'} element={<Hub />} />}
{showEda && <Route path={RouteE.Eda + '/*'} element={<EventDriven />} />}
<Route path={RouteE.Login} element={<Login />} />
Expand Down
6 changes: 3 additions & 3 deletions frontend/Routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
export enum RouteE {
Login = '/login',

Controller = '/controller',
AWX = '/controller',

// Views
Dashboard = '/controller/dashboard',
Expand Down Expand Up @@ -121,10 +121,10 @@ export enum RouteE {

APIToken = '/hub/api-token',

ControllerDebug = '/controller/debug',
AwxDebug = '/controller/debug',

AutomationServers = '/automation-servers',
ControllerAutomationServers = '/controller/automation-servers',
AwxAutomationServers = '/controller/automation-servers',
HubAutomationServers = '/hub/automation-servers',

// Event Driven Automation
Expand Down
10 changes: 5 additions & 5 deletions frontend/controller/Controller.tsx → frontend/awx/Awx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ import { useState } from 'react';
import { AnsibleMasthead } from '../common/Masthead';
import { WebSocketProvider } from './common/useAwxWebSocket';
import { ActiveUserProvider } from '../common/useActiveUser';
import { ControllerRouter } from './ControllerRouter';
import { ControllerSidebar } from './ControllerSidebar';
import { AwxRouter } from './AwxRouter';
import { AwxSidebar } from './AwxSidebar';

export function Controller() {
export function AWX() {
const [isNavOpen, setNavOpen] = useState(() => window.innerWidth >= 1200);
return (
<WebSocketProvider>
<ActiveUserProvider>
<Page
header={<AnsibleMasthead isNavOpen={isNavOpen} setNavOpen={setNavOpen} />}
sidebar={<ControllerSidebar isNavOpen={isNavOpen} setNavOpen={setNavOpen} />}
sidebar={<AwxSidebar isNavOpen={isNavOpen} setNavOpen={setNavOpen} />}
>
<ControllerRouter />
<AwxRouter />
</Page>
</ActiveUserProvider>
</WebSocketProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import Settings from './settings/Settings';
import Jobs from './views/jobs/Jobs';
import { WorkflowJobTemplateDetail } from './resources/templates/WorkflowJobTemplateDetail';

export function ControllerRouter() {
export function AwxRouter() {
return (
<Suspense
fallback={
Expand All @@ -44,105 +44,87 @@ export function ControllerRouter() {
>
<Routes>
<Route
path={RouteE.ControllerAutomationServers.replace(RouteE.Controller, '')}
path={RouteE.AwxAutomationServers.replace(RouteE.AWX, '')}
element={<AutomationServers />}
/>
<Route path={RouteE.Dashboard.replace(RouteE.Controller, '')} element={<Dashboard />} />
<Route path={RouteE.Jobs.replace(RouteE.Controller, '')} element={<Jobs />} />
<Route path={RouteE.Dashboard.replace(RouteE.AWX, '')} element={<Dashboard />} />
<Route path={RouteE.Jobs.replace(RouteE.AWX, '')} element={<Jobs />} />
{/* <Route path={RouteE.Schedules} element={<Schedules />} /> */}
{/* <Route path={RouteE.ActivityStream} element={<ActivityStreeam />} /> */}
{/* <Route path={RouteE.WorkflowApprovals} element={<WorkflowApprovals />} /> */}

<Route path={RouteE.Templates.replace(RouteE.Controller, '')} element={<Templates />} />
<Route path={RouteE.Templates.replace(RouteE.AWX, '')} element={<Templates />} />
<Route
path={RouteE.JobTemplateDetails.replace(RouteE.Controller, '')}
path={RouteE.JobTemplateDetails.replace(RouteE.AWX, '')}
element={<TemplateDetail />}
/>
<Route
path={RouteE.WorkflowJobTemplateDetails.replace(RouteE.Controller, '')}
path={RouteE.WorkflowJobTemplateDetails.replace(RouteE.AWX, '')}
element={<WorkflowJobTemplateDetail />}
/>
<Route
path={RouteE.CreateJobTemplate.replace(RouteE.Controller, '')}
path={RouteE.CreateJobTemplate.replace(RouteE.AWX, '')}
element={<CreateJobTemplate />}
/>

<Route path={RouteE.Credentials.replace(RouteE.Controller, '')} element={<Credentials />} />
<Route path={RouteE.Credentials.replace(RouteE.AWX, '')} element={<Credentials />} />

<Route path={RouteE.Projects.replace(RouteE.Controller, '')} element={<Projects />} />
<Route
path={RouteE.ProjectDetails.replace(RouteE.Controller, '')}
element={<ProjectPage />}
/>
<Route path={RouteE.Projects.replace(RouteE.AWX, '')} element={<Projects />} />
<Route path={RouteE.ProjectDetails.replace(RouteE.AWX, '')} element={<ProjectPage />} />
{/* <Route path={RouteE.ProjectEdit} element={<ProjectEdit />} /> */}

<Route path={RouteE.Inventories.replace(RouteE.Controller, '')} element={<Inventories />} />
<Route path={RouteE.Inventories.replace(RouteE.AWX, '')} element={<Inventories />} />

<Route path={RouteE.Hosts.replace(RouteE.Controller, '')} element={<Hosts />} />
<Route path={RouteE.Hosts.replace(RouteE.AWX, '')} element={<Hosts />} />

<Route path={RouteE.Organizations.replace(RouteE.AWX, '')} element={<Organizations />} />
<Route
path={RouteE.Organizations.replace(RouteE.Controller, '')}
element={<Organizations />}
/>
<Route
path={RouteE.OrganizationDetails.replace(RouteE.Controller, '')}
path={RouteE.OrganizationDetails.replace(RouteE.AWX, '')}
element={<OrganizationPage />}
/>
<Route
path={RouteE.CreateOrganization.replace(RouteE.Controller, '')}
path={RouteE.CreateOrganization.replace(RouteE.AWX, '')}
element={<CreateOrganization />}
/>
<Route
path={RouteE.EditOrganization.replace(RouteE.Controller, '')}
path={RouteE.EditOrganization.replace(RouteE.AWX, '')}
element={<EditOrganization />}
/>

<Route path={RouteE.Users.replace(RouteE.Controller, '')} element={<Users />} />
<Route path={RouteE.UserDetails.replace(RouteE.Controller, '')} element={<UserPage />} />
<Route path={RouteE.CreateUser.replace(RouteE.Controller, '')} element={<CreateUser />} />
<Route path={RouteE.EditUser.replace(RouteE.Controller, '')} element={<EditUser />} />
<Route
path={RouteE.AddRolesToUser.replace(RouteE.Controller, '')}
element={<AddRolesToUser />}
/>
<Route path={RouteE.Users.replace(RouteE.AWX, '')} element={<Users />} />
<Route path={RouteE.UserDetails.replace(RouteE.AWX, '')} element={<UserPage />} />
<Route path={RouteE.CreateUser.replace(RouteE.AWX, '')} element={<CreateUser />} />
<Route path={RouteE.EditUser.replace(RouteE.AWX, '')} element={<EditUser />} />
<Route path={RouteE.AddRolesToUser.replace(RouteE.AWX, '')} element={<AddRolesToUser />} />

<Route path={RouteE.Teams.replace(RouteE.Controller, '')} element={<Teams />} />
<Route path={RouteE.TeamDetails.replace(RouteE.Controller, '')} element={<TeamPage />} />
<Route path={RouteE.CreateTeam.replace(RouteE.Controller, '')} element={<CreateTeam />} />
<Route path={RouteE.EditTeam.replace(RouteE.Controller, '')} element={<EditTeam />} />
<Route
path={RouteE.AddRolesToTeam.replace(RouteE.Controller, '')}
element={<AddRolesToTeam />}
/>
<Route path={RouteE.Teams.replace(RouteE.AWX, '')} element={<Teams />} />
<Route path={RouteE.TeamDetails.replace(RouteE.AWX, '')} element={<TeamPage />} />
<Route path={RouteE.CreateTeam.replace(RouteE.AWX, '')} element={<CreateTeam />} />
<Route path={RouteE.EditTeam.replace(RouteE.AWX, '')} element={<EditTeam />} />
<Route path={RouteE.AddRolesToTeam.replace(RouteE.AWX, '')} element={<AddRolesToTeam />} />

{/* <Route path={RouteE.CredentialTypes} element={<CredentialTypes />} /> */}
{/* <Route path={RouteE.Notifications} element={<Notifications />} /> */}
{/* <Route path={RouteE.ManagementJobs} element={<ManagementJobs />} /> */}

<Route
path={RouteE.InstanceGroups.replace(RouteE.Controller, '')}
element={<InstanceGroups />}
/>
<Route path={RouteE.InstanceGroups.replace(RouteE.AWX, '')} element={<InstanceGroups />} />

<Route path={RouteE.Instances.replace(RouteE.Controller, '')} element={<Instances />} />
<Route path={RouteE.Instances.replace(RouteE.AWX, '')} element={<Instances />} />
<Route
path={RouteE.InstanceDetails.replace(RouteE.Controller, '')}
path={RouteE.InstanceDetails.replace(RouteE.AWX, '')}
element={<InstanceDetails />}
/>
<Route
path={RouteE.EditInstance.replace(RouteE.Controller, '')}
element={<EditInstance />}
/>
<Route path={RouteE.EditInstance.replace(RouteE.AWX, '')} element={<EditInstance />} />

{/* <Route path={RouteE.Applications} element={<Applications />} /> */}
<Route
path={RouteE.ExecutionEnvironments.replace(RouteE.Controller, '')}
path={RouteE.ExecutionEnvironments.replace(RouteE.AWX, '')}
element={<ExecutionEnvironments />}
/>

<Route path={RouteE.Settings.replace(RouteE.Controller, '')} element={<Settings />} />
<Route path={RouteE.Settings.replace(RouteE.AWX, '')} element={<Settings />} />

<Route path={RouteE.ControllerDebug.replace(RouteE.Controller, '')} element={<Debug />} />
<Route path={RouteE.AwxDebug.replace(RouteE.AWX, '')} element={<Debug />} />
</Routes>
</Suspense>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import { CommonSidebar } from '../common/CommonSidebar';
import { isRouteActive } from '../common/Masthead';
import { RouteE } from '../Routes';

export function ControllerSidebar(props: {
isNavOpen: boolean;
setNavOpen: (open: boolean) => void;
}) {
export function AwxSidebar(props: { isNavOpen: boolean; setNavOpen: (open: boolean) => void }) {
const { isNavOpen, setNavOpen } = props;
const { t } = useTranslation();
const location = useLocation();
Expand All @@ -25,15 +22,6 @@ export function ControllerSidebar(props: {
);
return (
<CommonSidebar isNavOpen={isNavOpen} setNavOpen={setNavOpen}>
{/* <NavExpandable
key="controller"
title="Controller"
isExpanded
isActive={isRouteActive(
[RouteE.Dashboard, RouteE.Jobs, RouteE.Schedules, RouteE.ActivityStream, RouteE.WorkflowApprovals],
location
)}
> */}
<NavExpandable
key="views"
title="Views"
Expand Down Expand Up @@ -190,8 +178,8 @@ export function ControllerSidebar(props: {
{/* </NavExpandable> */}
{process.env.NODE_ENV === 'development' && (
<NavItem
isActive={isRouteActive(RouteE.ControllerDebug, location)}
onClick={() => onClick(RouteE.ControllerDebug)}
isActive={isRouteActive(RouteE.AwxDebug, location)}
onClick={() => onClick(RouteE.AwxDebug)}
>
{t('Debug')}
</NavItem>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useActiveUser } from '../../../common/useActiveUser';
import { RouteE } from '../../../Routes';
import { Team } from '../../interfaces/Team';
import { AccessRole, User } from '../../interfaces/User';
import { useControllerView } from '../../useControllerView';
import { useAwxView } from '../../useAwxView';
import { useDeleteAccessRole } from './useDeleteAccessRole';
import { useSelectUsersAddTeams } from '../users/hooks/useSelectUsersAddTeams';
import { useUsersFilters } from '../users/hooks/useUsersFilters';
Expand Down Expand Up @@ -43,7 +43,7 @@ export function ResourceAccessList(props: { url: string; resource: ResourceType

const tableColumns = useAccessColumns(undefined, deleteRole);

const view = useControllerView<User>({
const view = useAwxView<User>({
url: url,
queryParams: {
order_by: 'first_name',
Expand Down
Loading

0 comments on commit 19a0d05

Please sign in to comment.