generated from kubefirst/react-app-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: pass ref on to FinalForm for programmatic submission of form * wip: stub out menu flow * refactor: update cluster details component to match design. * fix:add type to ClusterResponse * update: type createCluster response * update: pick adminEmail, domainName, gitProvider off cluster. add instanceSize to type * update: rename finalForm to clusterCreation * chore: add CreateClusterFlow to cluster management * fix: should not have typed first arg
- Loading branch information
Showing
17 changed files
with
480 additions
and
372 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
import { Story } from '@storybook/react'; | ||
|
||
import ClusterDetails from '.'; | ||
|
||
import { ClusterInfo } from '../clusterTable/clusterTable'; | ||
import { ClusterStatus, ClusterType } from '../../types/provision'; | ||
import { InstallationType } from '../../types/redux'; | ||
|
||
export default { | ||
title: 'Components/ClusterDetails', | ||
component: ClusterDetails, | ||
}; | ||
|
||
const cluster: ClusterInfo = { | ||
clusterName: 'kuberfirst-mgmt2', | ||
type: ClusterType.MANAGEMENT, | ||
cloudProvider: InstallationType.AWS, | ||
cloudRegion: 'ap-southeast-1', | ||
creationDate: '05 Apr 2023, 12:24:56', | ||
adminEmail: '[email protected]', | ||
gitProvider: 'Github', | ||
domainName: 'yourdomain.com', | ||
gitUser: 'Eleanor Carroll', | ||
status: ClusterStatus.PROVISIONED, | ||
nodes: 2, | ||
instanceSize: '8 CPU Cores / 64 GB RAM / 120 GB NvME storage / 8 TB Data Transfer', | ||
}; | ||
|
||
const DefaultTemplate: Story = (args) => <ClusterDetails cluster={cluster} {...args} />; | ||
|
||
export const Default = DefaultTemplate.bind({}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,36 @@ | ||
import styled from 'styled-components'; | ||
import { styled as muiStyled, typographyClasses } from '@mui/material'; | ||
|
||
import ColumnComponent from '../column'; | ||
import RowComponent from '../row'; | ||
|
||
export const Container = styled.div``; | ||
|
||
export const Header = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
padding: 24px; | ||
& svg { | ||
cursor: pointer; | ||
} | ||
`; | ||
import Typography from '../typography'; | ||
import { EXCLUSIVE_PLUM, VOLCANIC_SAND } from '../../constants/colors'; | ||
|
||
export const Content = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 32px; | ||
padding: 24px; | ||
`; | ||
|
||
export const Column = styled(ColumnComponent)` | ||
gap: 8px; | ||
justify-content: space-between; | ||
width: 100%; | ||
`; | ||
|
||
export const Row = styled(RowComponent)` | ||
width: 100%; | ||
gap: 156px; | ||
`; | ||
|
||
export const StyledLabel = muiStyled(Typography)(() => ({ | ||
[`&.${typographyClasses.root}`]: { | ||
color: EXCLUSIVE_PLUM, | ||
width: '196px', | ||
}, | ||
})); | ||
|
||
export const StyledValue = muiStyled(Typography)(() => ({ | ||
[`&.${typographyClasses.root}`]: { | ||
color: VOLCANIC_SAND, | ||
width: '196px', | ||
}, | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,9 @@ const clusters: ClusterInfo[] = [ | |
creationDate: '05 Apr 2023, 12:24:56', | ||
gitUser: 'Eleanor Carroll', | ||
status: ClusterStatus.PROVISIONED, | ||
adminEmail: '[email protected]', | ||
gitProvider: 'Github', | ||
domainName: 'yourdomain.com', | ||
nodes: 2, | ||
}, | ||
{ | ||
|
@@ -31,6 +34,9 @@ const clusters: ClusterInfo[] = [ | |
creationDate: '05 Apr 2023, 12:24:56', | ||
gitUser: 'Eleanor Carroll', | ||
status: ClusterStatus.ERROR, | ||
adminEmail: '[email protected]', | ||
gitProvider: 'Github', | ||
domainName: 'yourdomain.com', | ||
}, | ||
{ | ||
clusterName: 'kuberfirst-mgmt2', | ||
|
@@ -41,6 +47,9 @@ const clusters: ClusterInfo[] = [ | |
creationDate: '05 Apr 2023, 12:24:56', | ||
gitUser: 'Eleanor Carroll', | ||
status: ClusterStatus.DELETING, | ||
adminEmail: '[email protected]', | ||
gitProvider: 'Github', | ||
domainName: 'yourdomain.com', | ||
}, | ||
{ | ||
clusterName: 'kuberfirst-mgmt2', | ||
|
@@ -51,6 +60,9 @@ const clusters: ClusterInfo[] = [ | |
creationDate: '05 Apr 2023, 12:24:56', | ||
gitUser: 'Eleanor Carroll', | ||
status: ClusterStatus.PROVISIONED, | ||
adminEmail: '[email protected]', | ||
gitProvider: 'Github', | ||
domainName: 'yourdomain.com', | ||
}, | ||
{ | ||
clusterName: 'kuberfirst-mgmt2', | ||
|
@@ -61,6 +73,9 @@ const clusters: ClusterInfo[] = [ | |
creationDate: '05 Apr 2023, 12:24:56', | ||
gitUser: 'Eleanor Carroll', | ||
status: ClusterStatus.PROVISIONED, | ||
adminEmail: '[email protected]', | ||
gitProvider: 'Github', | ||
domainName: 'yourdomain.com', | ||
}, | ||
]; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
containers/clusterForms/clusterCreation/clusterCreation.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React, { useRef } from 'react'; | ||
import { Story } from '@storybook/react'; | ||
import { FormProvider, useForm } from 'react-hook-form'; | ||
|
||
import ClusterCreationForm, { ClusterConfig } from '.'; | ||
|
||
export default { | ||
title: 'Forms/ClusterCreationForm', | ||
component: ClusterCreationForm, | ||
}; | ||
|
||
const DefaultTemplate: Story = () => { | ||
const methods = useForm<ClusterConfig>(); | ||
|
||
const formRef = useRef<HTMLFormElement>(null); | ||
|
||
const handleClick = () => { | ||
if (formRef.current) { | ||
formRef.current.requestSubmit(); | ||
} | ||
}; | ||
|
||
return ( | ||
<FormProvider {...methods}> | ||
<ClusterCreationForm | ||
ref={formRef} | ||
onFormSubmit={(config) => console.log('the form values =>', config)} | ||
/> | ||
<button onClick={handleClick}>Submit me</button> | ||
</FormProvider> | ||
); | ||
}; | ||
|
||
export const Default = DefaultTemplate.bind({}); |
7 changes: 7 additions & 0 deletions
7
containers/clusterForms/clusterCreation/clusterCreation.styled.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const Form = styled.form` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 32px; | ||
`; |
Oops, something went wrong.