mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 01:17:37 -02:30
Merge pull request #7284 from AlexSCorey/7232-ApplicationsRouteStub
Adds routing stubs for Applications Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
@@ -138,7 +138,7 @@ function getRouteConfig(i18n) {
|
|||||||
screen: InstanceGroups,
|
screen: InstanceGroups,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n._(t`Integrations`),
|
title: i18n._(t`Applications`),
|
||||||
path: '/applications',
|
path: '/applications',
|
||||||
screen: Applications,
|
screen: Applications,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Route, Switch, Redirect } from 'react-router-dom';
|
||||||
|
import ApplicationEdit from '../ApplicationEdit';
|
||||||
|
import ApplicationDetails from '../ApplicationDetails';
|
||||||
|
|
||||||
|
function Application() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Switch>
|
||||||
|
<Redirect
|
||||||
|
from="/applications/:id"
|
||||||
|
to="/applications/:id/details"
|
||||||
|
exact
|
||||||
|
/>
|
||||||
|
<Route path="/applications/:id/edit">
|
||||||
|
<ApplicationEdit />
|
||||||
|
</Route>
|
||||||
|
<Route path="/applications/:id/details">
|
||||||
|
<ApplicationDetails />
|
||||||
|
</Route>
|
||||||
|
</Switch>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Application;
|
||||||
1
awx/ui_next/src/screens/Application/Application/index.js
Normal file
1
awx/ui_next/src/screens/Application/Application/index.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { default } from './Application';
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Card, PageSection } from '@patternfly/react-core';
|
||||||
|
|
||||||
|
function ApplicatonAdd() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<PageSection>
|
||||||
|
<Card>
|
||||||
|
<div>Applications Add</div>
|
||||||
|
</Card>
|
||||||
|
</PageSection>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export default ApplicatonAdd;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export { default } from './ApplicationAdd';
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Card, PageSection } from '@patternfly/react-core';
|
||||||
|
|
||||||
|
function ApplicationDetails() {
|
||||||
|
return (
|
||||||
|
<PageSection>
|
||||||
|
<Card>Application Details</Card>
|
||||||
|
</PageSection>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export default ApplicationDetails;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export { default } from './ApplicationDetails';
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Card, PageSection } from '@patternfly/react-core';
|
||||||
|
|
||||||
|
function ApplicationEdit() {
|
||||||
|
return (
|
||||||
|
<PageSection>
|
||||||
|
<Card>Application Edit</Card>
|
||||||
|
</PageSection>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export default ApplicationEdit;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export { default } from './ApplicationEdit';
|
||||||
@@ -1,26 +1,49 @@
|
|||||||
import React, { Component, Fragment } from 'react';
|
import React, { useState, useCallback } from 'react';
|
||||||
import { withI18n } from '@lingui/react';
|
import { withI18n } from '@lingui/react';
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import {
|
import { Route, Switch } from 'react-router-dom';
|
||||||
PageSection,
|
|
||||||
PageSectionVariants,
|
|
||||||
Title,
|
|
||||||
} from '@patternfly/react-core';
|
|
||||||
|
|
||||||
class Applications extends Component {
|
import ApplicationsList from './ApplicationsList';
|
||||||
render() {
|
import ApplicationAdd from './ApplicationAdd';
|
||||||
const { i18n } = this.props;
|
import Application from './Application';
|
||||||
const { light } = PageSectionVariants;
|
import Breadcrumbs from '../../components/Breadcrumbs';
|
||||||
|
|
||||||
return (
|
function Applications({ i18n }) {
|
||||||
<Fragment>
|
const [breadcrumbConfig, setBreadcrumbConfig] = useState({
|
||||||
<PageSection variant={light} className="pf-m-condensed">
|
'/applications': i18n._(t`Applications`),
|
||||||
<Title size="2xl">{i18n._(t`Applications`)}</Title>
|
'/applications/add': i18n._(t`Create New Application`),
|
||||||
</PageSection>
|
});
|
||||||
<PageSection />
|
|
||||||
</Fragment>
|
const buildBreadcrumbConfig = useCallback(
|
||||||
);
|
application => {
|
||||||
}
|
if (!application) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setBreadcrumbConfig({
|
||||||
|
'/applications': i18n._(t`Applications`),
|
||||||
|
'/applications/add': i18n._(t`Create New Application`),
|
||||||
|
[`/application/${application.id}`]: `${application.name}`,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[i18n]
|
||||||
|
);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Breadcrumbs breadcrumbConfig={breadcrumbConfig} />
|
||||||
|
<Switch>
|
||||||
|
<Route path="/applications/add">
|
||||||
|
<ApplicationAdd />
|
||||||
|
</Route>
|
||||||
|
<Route path="/applications/:id">
|
||||||
|
<Application setBreadcrumb={buildBreadcrumbConfig} />
|
||||||
|
</Route>
|
||||||
|
<Route path="/applications">
|
||||||
|
<ApplicationsList />
|
||||||
|
</Route>
|
||||||
|
</Switch>
|
||||||
|
</>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withI18n()(Applications);
|
export default withI18n()(Applications);
|
||||||
|
|||||||
@@ -7,12 +7,10 @@ import Applications from './Applications';
|
|||||||
describe('<Applications />', () => {
|
describe('<Applications />', () => {
|
||||||
let pageWrapper;
|
let pageWrapper;
|
||||||
let pageSections;
|
let pageSections;
|
||||||
let title;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
pageWrapper = mountWithContexts(<Applications />);
|
pageWrapper = mountWithContexts(<Applications />);
|
||||||
pageSections = pageWrapper.find('PageSection');
|
pageSections = pageWrapper.find('PageSection');
|
||||||
title = pageWrapper.find('Title');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -21,9 +19,7 @@ describe('<Applications />', () => {
|
|||||||
|
|
||||||
test('initially renders without crashing', () => {
|
test('initially renders without crashing', () => {
|
||||||
expect(pageWrapper.length).toBe(1);
|
expect(pageWrapper.length).toBe(1);
|
||||||
expect(pageSections.length).toBe(2);
|
expect(pageSections.length).toBe(1);
|
||||||
expect(title.length).toBe(1);
|
|
||||||
expect(title.props().size).toBe('2xl');
|
|
||||||
expect(pageSections.first().props().variant).toBe('light');
|
expect(pageSections.first().props().variant).toBe('light');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Card, PageSection } from '@patternfly/react-core';
|
||||||
|
|
||||||
|
function ApplicationsList() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<PageSection>
|
||||||
|
<Card>
|
||||||
|
<div>Applications List</div>
|
||||||
|
</Card>
|
||||||
|
</PageSection>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export default ApplicationsList;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export { default } from './ApplicationsList';
|
||||||
Reference in New Issue
Block a user