mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
Merge pull request #7312 from nixocio/ui_issue_7301
Add stub files for Credential Types Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
commit
cb1a3e4199
25
awx/ui_next/src/screens/CredentialType/CredentialType.jsx
Normal file
25
awx/ui_next/src/screens/CredentialType/CredentialType.jsx
Normal file
@ -0,0 +1,25 @@
|
||||
import React from 'react';
|
||||
import { Route, Switch, Redirect } from 'react-router-dom';
|
||||
|
||||
import CredentialTypeDetails from './CredentialTypeDetails';
|
||||
import CredentialTypeEdit from './CredentialTypeEdit';
|
||||
|
||||
function CredentialType() {
|
||||
return (
|
||||
<Switch>
|
||||
<Redirect
|
||||
from="/credential_types/:id"
|
||||
to="/credential_types/:id/details"
|
||||
exact
|
||||
/>
|
||||
<Route path="/credential_types/:id/edit">
|
||||
<CredentialTypeEdit />
|
||||
</Route>
|
||||
<Route path="/credential_types/:id/details">
|
||||
<CredentialTypeDetails />
|
||||
</Route>
|
||||
</Switch>
|
||||
);
|
||||
}
|
||||
|
||||
export default CredentialType;
|
||||
@ -0,0 +1,14 @@
|
||||
import React from 'react';
|
||||
import { Card, PageSection } from '@patternfly/react-core';
|
||||
|
||||
function CredentialTypeAdd() {
|
||||
return (
|
||||
<PageSection>
|
||||
<Card>
|
||||
<div>Credentials Type Add</div>
|
||||
</Card>
|
||||
</PageSection>
|
||||
);
|
||||
}
|
||||
|
||||
export default CredentialTypeAdd;
|
||||
@ -0,0 +1 @@
|
||||
export { default } from './CredentialTypeAdd';
|
||||
@ -0,0 +1,12 @@
|
||||
import React from 'react';
|
||||
import { Card, PageSection } from '@patternfly/react-core';
|
||||
|
||||
function CredentialTypeDetails() {
|
||||
return (
|
||||
<PageSection>
|
||||
<Card>Credential Type Details</Card>
|
||||
</PageSection>
|
||||
);
|
||||
}
|
||||
|
||||
export default CredentialTypeDetails;
|
||||
@ -0,0 +1 @@
|
||||
export { default } from './CredentialTypeDetails';
|
||||
@ -0,0 +1,12 @@
|
||||
import React from 'react';
|
||||
import { Card, PageSection } from '@patternfly/react-core';
|
||||
|
||||
function CredentialTypeEdit() {
|
||||
return (
|
||||
<PageSection>
|
||||
<Card>Credential Type Edit</Card>
|
||||
</PageSection>
|
||||
);
|
||||
}
|
||||
|
||||
export default CredentialTypeEdit;
|
||||
@ -0,0 +1 @@
|
||||
export { default } from './CredentialTypeEdit';
|
||||
@ -0,0 +1,14 @@
|
||||
import React from 'react';
|
||||
import { Card, PageSection } from '@patternfly/react-core';
|
||||
|
||||
function CredentialTypeList() {
|
||||
return (
|
||||
<PageSection>
|
||||
<Card>
|
||||
<div>Credential Type List</div>
|
||||
</Card>
|
||||
</PageSection>
|
||||
);
|
||||
}
|
||||
|
||||
export default CredentialTypeList;
|
||||
@ -0,0 +1 @@
|
||||
export { default } from './CredentialTypeList';
|
||||
@ -1,26 +1,48 @@
|
||||
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 CredentialTypes extends Component {
|
||||
render() {
|
||||
const { i18n } = this.props;
|
||||
const { light } = PageSectionVariants;
|
||||
import CredentialTypeAdd from './CredentialTypeAdd';
|
||||
import CredentialTypeList from './CredentialTypeList';
|
||||
import CredentialType from './CredentialType';
|
||||
import Breadcrumbs from '../../components/Breadcrumbs';
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<PageSection variant={light} className="pf-m-condensed">
|
||||
<Title size="2xl">{i18n._(t`Credential Types`)}</Title>
|
||||
</PageSection>
|
||||
<PageSection />
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
function CredentialTypes({ i18n }) {
|
||||
const [breadcrumbConfig, setBreadcrumbConfig] = useState({
|
||||
'/credential_types': i18n._(t`Credential Types`),
|
||||
'/credential_types/add': i18n._(t`Create Credential Types`),
|
||||
});
|
||||
|
||||
const buildBreadcrumbConfig = useCallback(
|
||||
credentialTypes => {
|
||||
if (!credentialTypes) {
|
||||
return;
|
||||
}
|
||||
setBreadcrumbConfig({
|
||||
'/credential_types': i18n._(t`Credential Types`),
|
||||
'/credential_types/add': i18n._(t`Create Credential Types`),
|
||||
[`/credential_types/${credentialTypes.id}`]: `${credentialTypes.name}`,
|
||||
});
|
||||
},
|
||||
[i18n]
|
||||
);
|
||||
return (
|
||||
<>
|
||||
<Breadcrumbs breadcrumbConfig={breadcrumbConfig} />
|
||||
<Switch>
|
||||
<Route path="/credential_types/add">
|
||||
<CredentialTypeAdd />
|
||||
</Route>
|
||||
<Route path="/credential_types/:id">
|
||||
<CredentialType setBreadcrumb={buildBreadcrumbConfig} />
|
||||
</Route>
|
||||
<Route path="/credential_types">
|
||||
<CredentialTypeList />
|
||||
</Route>
|
||||
</Switch>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default withI18n()(CredentialTypes);
|
||||
|
||||
@ -4,15 +4,13 @@ import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
|
||||
import CredentialTypes from './CredentialTypes';
|
||||
|
||||
describe('<CredentialTypes />', () => {
|
||||
describe('<CredentialTypes/>', () => {
|
||||
let pageWrapper;
|
||||
let pageSections;
|
||||
let title;
|
||||
|
||||
beforeEach(() => {
|
||||
pageWrapper = mountWithContexts(<CredentialTypes />);
|
||||
pageSections = pageWrapper.find('PageSection');
|
||||
title = pageWrapper.find('Title');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@ -21,9 +19,7 @@ describe('<CredentialTypes />', () => {
|
||||
|
||||
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');
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user