-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add execution environments files (#7909)
Update navigation bar and routing system to add execution environments. Also, add stub files for the remaining related work. See: #7885 Also: #7884
- Loading branch information
1 parent
d506fb5
commit 638d2fd
Showing
13 changed files
with
172 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
awx/ui_next/src/screens/ExecutionEnvironment/ExecutionEnvironment.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react'; | ||
import { Route, Redirect, Switch } from 'react-router-dom'; | ||
|
||
import ExecutionEnvironmentDetails from './ExecutionEnvironmentDetails'; | ||
import ExecutionEnvironmentEdit from './ExecutionEnvironmentEdit'; | ||
|
||
function ExecutionEnvironment() { | ||
return ( | ||
<Switch> | ||
<Redirect | ||
from="/execution_environments/:id" | ||
to="/execution_environments/:id/details" | ||
exact | ||
/> | ||
<Route path="/execution_environments/:id/edit"> | ||
<ExecutionEnvironmentEdit /> | ||
</Route> | ||
<Route path="/execution_environments/:id/details"> | ||
<ExecutionEnvironmentDetails /> | ||
</Route> | ||
</Switch> | ||
); | ||
} | ||
|
||
export default ExecutionEnvironment; |
14 changes: 14 additions & 0 deletions
14
...next/src/screens/ExecutionEnvironment/ExecutionEnvironmentAdd/ExecutionEnvironmentAdd.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import { Card, PageSection } from '@patternfly/react-core'; | ||
|
||
function ExecutionEnvironmentAdd() { | ||
return ( | ||
<PageSection> | ||
<Card> | ||
<div>Add Execution Environments</div> | ||
</Card> | ||
</PageSection> | ||
); | ||
} | ||
|
||
export default ExecutionEnvironmentAdd; |
1 change: 1 addition & 0 deletions
1
awx/ui_next/src/screens/ExecutionEnvironment/ExecutionEnvironmentAdd/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './ExecutionEnvironmentAdd'; |
14 changes: 14 additions & 0 deletions
14
.../screens/ExecutionEnvironment/ExecutionEnvironmentDetails/ExecutionEnvironmentDetails.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import { Card, PageSection } from '@patternfly/react-core'; | ||
|
||
function ExecutionEnvironmentDetails() { | ||
return ( | ||
<PageSection> | ||
<Card> | ||
<div>Execution environments details</div> | ||
</Card> | ||
</PageSection> | ||
); | ||
} | ||
|
||
export default ExecutionEnvironmentDetails; |
1 change: 1 addition & 0 deletions
1
awx/ui_next/src/screens/ExecutionEnvironment/ExecutionEnvironmentDetails/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './ExecutionEnvironmentDetails'; |
14 changes: 14 additions & 0 deletions
14
...xt/src/screens/ExecutionEnvironment/ExecutionEnvironmentEdit/ExecutionEnvironmentEdit.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import { Card, PageSection } from '@patternfly/react-core'; | ||
|
||
function ExecutionEnvironmentEdit() { | ||
return ( | ||
<PageSection> | ||
<Card> | ||
<div>Edit Execution environments</div> | ||
</Card> | ||
</PageSection> | ||
); | ||
} | ||
|
||
export default ExecutionEnvironmentEdit; |
1 change: 1 addition & 0 deletions
1
awx/ui_next/src/screens/ExecutionEnvironment/ExecutionEnvironmentEdit/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './ExecutionEnvironmentEdit'; |
14 changes: 14 additions & 0 deletions
14
...xt/src/screens/ExecutionEnvironment/ExecutionEnvironmentList/ExecutionEnvironmentList.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import { Card, PageSection } from '@patternfly/react-core'; | ||
|
||
function ExecutionEnvironmentList() { | ||
return ( | ||
<PageSection> | ||
<Card> | ||
<div>List Execution environments</div> | ||
</Card> | ||
</PageSection> | ||
); | ||
} | ||
|
||
export default ExecutionEnvironmentList; |
1 change: 1 addition & 0 deletions
1
awx/ui_next/src/screens/ExecutionEnvironment/ExecutionEnvironmentList/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './ExecutionEnvironmentList'; |
53 changes: 53 additions & 0 deletions
53
awx/ui_next/src/screens/ExecutionEnvironment/ExecutionEnvironments.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React, { useState, useCallback } from 'react'; | ||
import { withI18n } from '@lingui/react'; | ||
import { t } from '@lingui/macro'; | ||
import { Route, Switch } from 'react-router-dom'; | ||
|
||
import ExecutionEnvironment from './ExecutionEnvironment'; | ||
import ExecutionEnvironmentAdd from './ExecutionEnvironmentAdd'; | ||
import ExecutionEnvironmentList from './ExecutionEnvironmentList'; | ||
import Breadcrumbs from '../../components/Breadcrumbs'; | ||
|
||
function ExecutionEnvironments({ i18n }) { | ||
const [breadcrumbConfig, setBreadcrumbConfig] = useState({ | ||
'/execution_environments': i18n._(t`Execution environments`), | ||
'/execution_environments/add': i18n._(t`Create Execution environments`), | ||
}); | ||
|
||
const buildBreadcrumbConfig = useCallback( | ||
executionEnvironments => { | ||
if (!executionEnvironments) { | ||
return; | ||
} | ||
setBreadcrumbConfig({ | ||
'/execution_environments': i18n._(t`Execution environments`), | ||
'/execution_environments/add': i18n._(t`Create Execution environments`), | ||
[`/execution_environments/${executionEnvironments.id}`]: `${executionEnvironments.name}`, | ||
[`/execution_environments/${executionEnvironments.id}/edit`]: i18n._( | ||
t`Edit details` | ||
), | ||
[`/execution_environments/${executionEnvironments.id}/details`]: i18n._( | ||
t`Details` | ||
), | ||
}); | ||
}, | ||
[i18n] | ||
); | ||
return ( | ||
<> | ||
<Breadcrumbs breadcrumbConfig={breadcrumbConfig} /> | ||
<Switch> | ||
<Route path="/execution_environments/add"> | ||
<ExecutionEnvironmentAdd /> | ||
</Route> | ||
<Route path="/execution_environments/:id"> | ||
<ExecutionEnvironment setBreadcrumb={buildBreadcrumbConfig} /> | ||
</Route> | ||
<Route path="/execution_environments"> | ||
<ExecutionEnvironmentList /> | ||
</Route> | ||
</Switch> | ||
</> | ||
); | ||
} | ||
export default withI18n()(ExecutionEnvironments); |
25 changes: 25 additions & 0 deletions
25
awx/ui_next/src/screens/ExecutionEnvironment/ExecutionEnvironments.test.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react'; | ||
|
||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers'; | ||
|
||
import ExecutionEnvironments from './ExecutionEnvironments'; | ||
|
||
describe('<ExecutionEnvironments/>', () => { | ||
let pageWrapper; | ||
let pageSections; | ||
|
||
beforeEach(() => { | ||
pageWrapper = mountWithContexts(<ExecutionEnvironments />); | ||
pageSections = pageWrapper.find('PageSection'); | ||
}); | ||
|
||
afterEach(() => { | ||
pageWrapper.unmount(); | ||
}); | ||
|
||
test('initially renders without crashing', () => { | ||
expect(pageWrapper.length).toBe(1); | ||
expect(pageSections.length).toBe(1); | ||
expect(pageSections.first().props().variant).toBe('light'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './ExecutionEnvironments'; |