mirror of
https://github.com/yldio/copilot.git
synced 2024-11-15 07:40:07 +02:00
feat(cp-frontend): integrate Progressbar into create/edit DG flow
This commit is contained in:
parent
5cade4e17d
commit
4b7027295f
@ -13,6 +13,9 @@ import {
|
|||||||
Input,
|
Input,
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
|
Progressbar,
|
||||||
|
ProgressbarItem,
|
||||||
|
ProgressbarButton,
|
||||||
H3,
|
H3,
|
||||||
typography
|
typography
|
||||||
} from 'joyent-ui-toolkit';
|
} from 'joyent-ui-toolkit';
|
||||||
@ -115,3 +118,55 @@ export const Review = ({ handleSubmit, onCancel, dirty, ...state }) => {
|
|||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const Progress = ({ stage, create, edit }) => {
|
||||||
|
const _nameCompleted = stage !== 'name';
|
||||||
|
const _nameActive = stage === 'name';
|
||||||
|
|
||||||
|
const _name = !create
|
||||||
|
? null
|
||||||
|
: <ProgressbarItem>
|
||||||
|
<ProgressbarButton
|
||||||
|
zIndex="10"
|
||||||
|
completed={_nameCompleted}
|
||||||
|
active={_nameActive}
|
||||||
|
first
|
||||||
|
>
|
||||||
|
Name the group
|
||||||
|
</ProgressbarButton>
|
||||||
|
</ProgressbarItem>;
|
||||||
|
|
||||||
|
const _manifestCompleted = stage === 'review';
|
||||||
|
const _manifestActive = create ? stage === 'manifest' : stage === 'edit';
|
||||||
|
|
||||||
|
const _manifest = (
|
||||||
|
<ProgressbarItem>
|
||||||
|
<ProgressbarButton
|
||||||
|
zIndex="9"
|
||||||
|
completed={_manifestCompleted}
|
||||||
|
active={_manifestActive}
|
||||||
|
first={edit}
|
||||||
|
>
|
||||||
|
Define services
|
||||||
|
</ProgressbarButton>
|
||||||
|
</ProgressbarItem>
|
||||||
|
);
|
||||||
|
|
||||||
|
const _reviewActive = stage === 'review';
|
||||||
|
|
||||||
|
const _review = (
|
||||||
|
<ProgressbarItem>
|
||||||
|
<ProgressbarButton zIndex="8" active={stage === 'review'} last>
|
||||||
|
Review and deploy
|
||||||
|
</ProgressbarButton>
|
||||||
|
</ProgressbarItem>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Progressbar>
|
||||||
|
{_name}
|
||||||
|
{_manifest}
|
||||||
|
{_review}
|
||||||
|
</Progressbar>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
@ -1,18 +1,31 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import DeploymentGroupEditOrCreate from './edit-or-create';
|
import DeploymentGroupEditOrCreate from './edit-or-create';
|
||||||
|
import { Progress } from '@components/deployment-groups/create';
|
||||||
import { LayoutContainer } from '@components/layout';
|
import { LayoutContainer } from '@components/layout';
|
||||||
import { DeploymentGroupsLoading } from '@components/deployment-groups';
|
import { DeploymentGroupsLoading } from '@components/deployment-groups';
|
||||||
import { H2 } from 'joyent-ui-toolkit';
|
import { H2 } from 'joyent-ui-toolkit';
|
||||||
|
|
||||||
export default ({ loading, error, manifest = '', deploymentGroup = null }) =>
|
export default ({
|
||||||
|
loading,
|
||||||
|
error,
|
||||||
|
manifest = '',
|
||||||
|
deploymentGroup = null,
|
||||||
|
match
|
||||||
|
}) => {
|
||||||
|
const stage = match.params.stage;
|
||||||
|
|
||||||
|
return (
|
||||||
<LayoutContainer>
|
<LayoutContainer>
|
||||||
<H2>Creating deployment group</H2>
|
<H2>Creating deployment group</H2>
|
||||||
{loading && <DeploymentGroupsLoading />}
|
{loading && <DeploymentGroupsLoading />}
|
||||||
{error && <span>{error.toString()}</span>}
|
{error && <span>{error.toString()}</span>}
|
||||||
|
<Progress stage={stage} create />
|
||||||
<DeploymentGroupEditOrCreate
|
<DeploymentGroupEditOrCreate
|
||||||
create
|
create
|
||||||
manifest={manifest}
|
manifest={manifest}
|
||||||
deploymentGroup={deploymentGroup}
|
deploymentGroup={deploymentGroup}
|
||||||
/>
|
/>
|
||||||
</LayoutContainer>;
|
</LayoutContainer>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
@ -6,6 +6,7 @@ import ManifestQuery from '@graphql/Manifest.gql';
|
|||||||
import DeploymentGroupBySlugQuery from '@graphql/DeploymentGroupBySlug.gql';
|
import DeploymentGroupBySlugQuery from '@graphql/DeploymentGroupBySlug.gql';
|
||||||
|
|
||||||
import DeploymentGroupEditOrCreate from './edit-or-create';
|
import DeploymentGroupEditOrCreate from './edit-or-create';
|
||||||
|
import { Progress } from '@components/deployment-groups/create';
|
||||||
import { LayoutContainer } from '@components/layout';
|
import { LayoutContainer } from '@components/layout';
|
||||||
import { DeploymentGroupsLoading } from '@components/deployment-groups';
|
import { DeploymentGroupsLoading } from '@components/deployment-groups';
|
||||||
import { H2 } from 'joyent-ui-toolkit';
|
import { H2 } from 'joyent-ui-toolkit';
|
||||||
@ -14,8 +15,10 @@ const Manifest = ({
|
|||||||
loading,
|
loading,
|
||||||
error,
|
error,
|
||||||
manifest = '',
|
manifest = '',
|
||||||
deploymentGroup = null
|
deploymentGroup = null,
|
||||||
|
match
|
||||||
}) => {
|
}) => {
|
||||||
|
const stage = match.params.stage;
|
||||||
const _loading = !loading ? null : <DeploymentGroupsLoading />;
|
const _loading = !loading ? null : <DeploymentGroupsLoading />;
|
||||||
const _error = !error ? null : <span>{error.toString()}</span>;
|
const _error = !error ? null : <span>{error.toString()}</span>;
|
||||||
|
|
||||||
@ -27,7 +30,7 @@ const Manifest = ({
|
|||||||
deploymentGroup={deploymentGroup}
|
deploymentGroup={deploymentGroup}
|
||||||
/>;
|
/>;
|
||||||
|
|
||||||
const _notice = !err &&
|
const _notice = !error &&
|
||||||
!loading &&
|
!loading &&
|
||||||
deploymentGroup &&
|
deploymentGroup &&
|
||||||
deploymentGroup.imported &&
|
deploymentGroup.imported &&
|
||||||
@ -41,6 +44,7 @@ const Manifest = ({
|
|||||||
return (
|
return (
|
||||||
<LayoutContainer>
|
<LayoutContainer>
|
||||||
<H2>Edit Manifest</H2>
|
<H2>Edit Manifest</H2>
|
||||||
|
<Progress stage={stage} edit />
|
||||||
{_error}
|
{_error}
|
||||||
{_loading}
|
{_loading}
|
||||||
{_notice}
|
{_notice}
|
||||||
|
@ -19,7 +19,7 @@ export { Tooltip, TooltipButton, TooltipDivider } from './tooltip';
|
|||||||
export { Dropdown } from './dropdown';
|
export { Dropdown } from './dropdown';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
Progressbar,
|
default as Progressbar,
|
||||||
ProgressbarButton,
|
ProgressbarButton,
|
||||||
ProgressbarItem,
|
ProgressbarItem,
|
||||||
Indicator
|
Indicator
|
||||||
|
@ -46,7 +46,7 @@ const Indicator = ({ first, completed, active, last, ...rest }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledIndicator {...state} {...props}>
|
<StyledIndicator {...state} {...rest}>
|
||||||
<Tick {...state} />
|
<Tick {...state} />
|
||||||
</StyledIndicator>
|
</StyledIndicator>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user