Addresses needed styling changes to Card and Page Section

These changes were necessary to remove an additional page section
to ProjectJobTemplateList.
This commit is contained in:
Alex Corey
2020-01-29 12:31:22 -05:00
parent 5790aa9780
commit bbea43b1fe
5 changed files with 183 additions and 180 deletions

View File

@@ -1,6 +1,6 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { Card, PageSection } from '@patternfly/react-core'; import { Card } from '@patternfly/react-core';
import { CardBody } from '@components/Card'; import { CardBody } from '@components/Card';
import JobTemplateForm from '../shared/JobTemplateForm'; import JobTemplateForm from '../shared/JobTemplateForm';
import { JobTemplatesAPI } from '@api'; import { JobTemplatesAPI } from '@api';
@@ -61,7 +61,6 @@ function JobTemplateAdd() {
} }
return ( return (
<PageSection>
<Card> <Card>
<CardBody> <CardBody>
<JobTemplateForm <JobTemplateForm
@@ -71,7 +70,6 @@ function JobTemplateAdd() {
</CardBody> </CardBody>
{formSubmitError ? <div>formSubmitError</div> : ''} {formSubmitError ? <div>formSubmitError</div> : ''}
</Card> </Card>
</PageSection>
); );
} }

View File

@@ -150,7 +150,6 @@ class Template extends Component {
} }
return ( return (
<PageSection>
<Card className="awx-c-card"> <Card className="awx-c-card">
{cardHeader} {cardHeader}
<Switch> <Switch>
@@ -221,7 +220,6 @@ class Template extends Component {
/> />
</Switch> </Switch>
</Card> </Card>
</PageSection>
); );
} }
} }

View File

@@ -2,7 +2,7 @@ import React, { Component } from 'react';
import { withRouter } from 'react-router-dom'; import { withRouter } from 'react-router-dom';
import { withI18n } from '@lingui/react'; import { withI18n } from '@lingui/react';
import { t } from '@lingui/macro'; import { t } from '@lingui/macro';
import { Card, PageSection } from '@patternfly/react-core'; import { Card } from '@patternfly/react-core';
import { import {
JobTemplatesAPI, JobTemplatesAPI,
@@ -109,7 +109,13 @@ class TemplatesList extends Component {
} }
async loadTemplates() { async loadTemplates() {
const { location, match } = this.props; const {
location,
match: {
params: { id: projectId },
url,
},
} = this.props;
const { const {
jtActions: cachedJTActions, jtActions: cachedJTActions,
wfjtActions: cachedWFJTActions, wfjtActions: cachedWFJTActions,
@@ -135,8 +141,8 @@ class TemplatesList extends Component {
} else { } else {
wfjtOptionsPromise = WorkflowJobTemplatesAPI.readOptions(); wfjtOptionsPromise = WorkflowJobTemplatesAPI.readOptions();
} }
if (match.url.startsWith('/projects') && match.params.id) { if (url.startsWith('/projects') && projectId) {
params.jobtemplate__project = match.params.id; params.jobtemplate__project = projectId;
} }
const promises = Promise.all([ const promises = Promise.all([

View File

@@ -1,7 +1,8 @@
import React, { Component, Fragment } from 'react'; import React, { Component } from 'react';
import { withI18n } from '@lingui/react'; import { withI18n } from '@lingui/react';
import { t } from '@lingui/macro'; import { t } from '@lingui/macro';
import { Route, withRouter, Switch } from 'react-router-dom'; import { Route, withRouter, Switch } from 'react-router-dom';
import { PageSection } from '@patternfly/react-core';
import { Config } from '@contexts/Config'; import { Config } from '@contexts/Config';
import Breadcrumbs from '@components/Breadcrumbs/Breadcrumbs'; import Breadcrumbs from '@components/Breadcrumbs/Breadcrumbs';
@@ -50,8 +51,9 @@ class Templates extends Component {
const { match, history, location } = this.props; const { match, history, location } = this.props;
const { breadcrumbConfig } = this.state; const { breadcrumbConfig } = this.state;
return ( return (
<Fragment> <>
<Breadcrumbs breadcrumbConfig={breadcrumbConfig} /> <Breadcrumbs breadcrumbConfig={breadcrumbConfig} />
<PageSection>
<Switch> <Switch>
<Route <Route
path={`${match.path}/job_template/add`} path={`${match.path}/job_template/add`}
@@ -91,7 +93,8 @@ class Templates extends Component {
/> />
<Route path={`${match.path}`} render={() => <TemplateList />} /> <Route path={`${match.path}`} render={() => <TemplateList />} />
</Switch> </Switch>
</Fragment> </PageSection>
</>
); );
} }
} }

View File

@@ -94,7 +94,6 @@ class WorkflowJobTemplate extends Component {
} }
return ( return (
<PageSection>
<Card className="awx-c-card"> <Card className="awx-c-card">
{cardHeader} {cardHeader}
<Switch> <Switch>
@@ -147,7 +146,6 @@ class WorkflowJobTemplate extends Component {
/> />
</Switch> </Switch>
</Card> </Card>
</PageSection>
); );
} }
} }