mirror of
https://github.com/ansible/awx.git
synced 2026-01-16 20:30:46 -03: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:
commit
40b020c370
@ -138,7 +138,7 @@ function getRouteConfig(i18n) {
|
||||
screen: InstanceGroups,
|
||||
},
|
||||
{
|
||||
title: i18n._(t`Integrations`),
|
||||
title: i18n._(t`Applications`),
|
||||
path: '/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 { t } from '@lingui/macro';
|
||||
import {
|
||||
PageSection,
|
||||
PageSectionVariants,
|
||||
Title,
|
||||
} from '@patternfly/react-core';
|
||||
import { Route, Switch } from 'react-router-dom';
|
||||
|
||||
class Applications extends Component {
|
||||
render() {
|
||||
const { i18n } = this.props;
|
||||
const { light } = PageSectionVariants;
|
||||
import ApplicationsList from './ApplicationsList';
|
||||
import ApplicationAdd from './ApplicationAdd';
|
||||
import Application from './Application';
|
||||
import Breadcrumbs from '../../components/Breadcrumbs';
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<PageSection variant={light} className="pf-m-condensed">
|
||||
<Title size="2xl">{i18n._(t`Applications`)}</Title>
|
||||
</PageSection>
|
||||
<PageSection />
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
function Applications({ i18n }) {
|
||||
const [breadcrumbConfig, setBreadcrumbConfig] = useState({
|
||||
'/applications': i18n._(t`Applications`),
|
||||
'/applications/add': i18n._(t`Create New Application`),
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
@ -7,12 +7,10 @@ import Applications from './Applications';
|
||||
describe('<Applications />', () => {
|
||||
let pageWrapper;
|
||||
let pageSections;
|
||||
let title;
|
||||
|
||||
beforeEach(() => {
|
||||
pageWrapper = mountWithContexts(<Applications />);
|
||||
pageSections = pageWrapper.find('PageSection');
|
||||
title = pageWrapper.find('Title');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@ -21,9 +19,7 @@ describe('<Applications />', () => {
|
||||
|
||||
test('initially renders without crashing', () => {
|
||||
expect(pageWrapper.length).toBe(1);
|
||||
expect(pageSections.length).toBe(2);
|
||||
expect(title.length).toBe(1);
|
||||
expect(title.props().size).toBe('2xl');
|
||||
expect(pageSections.length).toBe(1);
|
||||
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';
|
||||
Loading…
x
Reference in New Issue
Block a user