mirror of
https://github.com/ansible/awx.git
synced 2026-02-26 07:26:03 -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:
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 { 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 CredentialTypes extends Component {
|
import CredentialTypeAdd from './CredentialTypeAdd';
|
||||||
render() {
|
import CredentialTypeList from './CredentialTypeList';
|
||||||
const { i18n } = this.props;
|
import CredentialType from './CredentialType';
|
||||||
const { light } = PageSectionVariants;
|
import Breadcrumbs from '../../components/Breadcrumbs';
|
||||||
|
|
||||||
return (
|
function CredentialTypes({ i18n }) {
|
||||||
<Fragment>
|
const [breadcrumbConfig, setBreadcrumbConfig] = useState({
|
||||||
<PageSection variant={light} className="pf-m-condensed">
|
'/credential_types': i18n._(t`Credential Types`),
|
||||||
<Title size="2xl">{i18n._(t`Credential Types`)}</Title>
|
'/credential_types/add': i18n._(t`Create Credential Types`),
|
||||||
</PageSection>
|
});
|
||||||
<PageSection />
|
|
||||||
</Fragment>
|
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);
|
export default withI18n()(CredentialTypes);
|
||||||
|
|||||||
@@ -4,15 +4,13 @@ import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
|||||||
|
|
||||||
import CredentialTypes from './CredentialTypes';
|
import CredentialTypes from './CredentialTypes';
|
||||||
|
|
||||||
describe('<CredentialTypes />', () => {
|
describe('<CredentialTypes/>', () => {
|
||||||
let pageWrapper;
|
let pageWrapper;
|
||||||
let pageSections;
|
let pageSections;
|
||||||
let title;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
pageWrapper = mountWithContexts(<CredentialTypes />);
|
pageWrapper = mountWithContexts(<CredentialTypes />);
|
||||||
pageSections = pageWrapper.find('PageSection');
|
pageSections = pageWrapper.find('PageSection');
|
||||||
title = pageWrapper.find('Title');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -21,9 +19,7 @@ describe('<CredentialTypes />', () => {
|
|||||||
|
|
||||||
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');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user