Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
5725e87
Add new /v1/profiles endpoint
yiannistri Oct 18, 2021
7062f07
Implement options pattern to reduce number of arguments in RunInProce…
yiannistri Oct 18, 2021
16b562b
Add charts package
yiannistri Oct 18, 2021
c15143e
Add chart tests
yiannistri Oct 18, 2021
3fa524b
Wire in profile helm repository
yiannistri Oct 19, 2021
590510d
WG196 Create profiles context and prelim section in form and nav
AlinaGoaga Oct 19, 2021
766be32
WG196 Select profiles dropdown WIP
AlinaGoaga Oct 19, 2021
0e99316
WG196 Select profiles dropdown WIP2
AlinaGoaga Oct 19, 2021
8bc7b24
Return profiles response
yiannistri Oct 19, 2021
b30a0d1
Merge branch 'main' of github.com:weaveworks/weave-gitops-enterprise …
AlinaGoaga Oct 20, 2021
2dc1af8
Merge branch 'get-profiles' of github.com:weaveworks/weave-gitops-ent…
AlinaGoaga Oct 20, 2021
96a9d98
Comment out some dependencies to stop continuous loop
AlinaGoaga Oct 20, 2021
055fe43
WG196 Yaml preview - WIP
AlinaGoaga Oct 20, 2021
9480b00
WG196 Yaml preview - WIP2
AlinaGoaga Oct 20, 2021
add7617
WG196 Preview dialog - updated
AlinaGoaga Oct 20, 2021
5254fa5
WG196 Update yaml content - WIP
AlinaGoaga Oct 20, 2021
1b403e1
Solve conflicts with master
AlinaGoaga Oct 21, 2021
10de0af
WG196 Get/update yaml content for profiles
AlinaGoaga Oct 22, 2021
32d8289
WG196 Get/update yaml content for profiles - updated
AlinaGoaga Oct 22, 2021
a1075c4
WG196 Update add cluster payload
AlinaGoaga Oct 22, 2021
a9ee3fe
Merge branch 'main' of github.com:weaveworks/weave-gitops-enterprise …
AlinaGoaga Oct 22, 2021
e926b21
Fix bug on refresh create form
AlinaGoaga Oct 22, 2021
27b3930
fixes request param
foot Oct 22, 2021
d295a8b
Merge remote-tracking branch 'origin/main' into WG196-cluster-create-…
foot Oct 23, 2021
b32e583
rm foot.github
foot Oct 23, 2021
f5bde0e
where that typeinfo at
foot Oct 23, 2021
0793c96
wip
foot Oct 23, 2021
576c337
WG196 Include defaults when profiles are selected
AlinaGoaga Oct 24, 2021
4a0022a
WG196 Updated profiles doesnt update properly - WIP
AlinaGoaga Oct 24, 2021
47b7c57
WG196 Updated profiles updates correctly following changes in profile…
AlinaGoaga Oct 24, 2021
c1fb7e9
Refactor - 1
AlinaGoaga Oct 25, 2021
a04e7a3
Refactor 2 - make select dropdown reusable
AlinaGoaga Oct 25, 2021
a9810c9
Solve conflicts with main
AlinaGoaga Oct 26, 2021
8f33cac
Solve conflicts with main - updated
AlinaGoaga Oct 26, 2021
cecb8cc
Add error catching when getting profile yamls
AlinaGoaga Oct 27, 2021
7bbec7d
Merge branch 'main' of github.com:weaveworks/weave-gitops-enterprise …
AlinaGoaga Oct 27, 2021
804f76a
Fix bug in multi select dropdown
AlinaGoaga Oct 27, 2021
fad5b3e
Merge branch 'refactor-form-profile' of github.com:weaveworks/weave-g…
AlinaGoaga Oct 27, 2021
4938d04
Merge branch 'main' of github.com:weaveworks/weave-gitops-enterprise …
AlinaGoaga Oct 27, 2021
b471b2e
Extract template fields from form - WIP
AlinaGoaga Oct 27, 2021
89e0573
Extract template fields from form - WIP2
AlinaGoaga Oct 27, 2021
2ded5ca
Extract template fields from form
AlinaGoaga Oct 27, 2021
ca9c029
Extract credetials from form
AlinaGoaga Oct 27, 2021
0354f1d
Extract credetials from form - 2
AlinaGoaga Oct 27, 2021
f4d9fa5
Merge branch 'main' of github.com:weaveworks/weave-gitops-enterprise …
AlinaGoaga Nov 1, 2021
40bd868
Merge branch 'main' of github.com:weaveworks/weave-gitops-enterprise …
AlinaGoaga Nov 1, 2021
7688ec2
Remove abort controller from profiles
AlinaGoaga Nov 1, 2021
a53bd85
Merge branch 'refactor-form-profile' of github.com:weaveworks/weave-g…
AlinaGoaga Nov 1, 2021
1572329
Extract gitops from form
AlinaGoaga Nov 1, 2021
67d2065
Extract gitops from form - 2
AlinaGoaga Nov 1, 2021
cf4ffd5
Extract preview from form
AlinaGoaga Nov 1, 2021
b0b180a
Extract preview from form - 2
AlinaGoaga Nov 1, 2021
5cc8d8f
Fixes form split (#256)
AlinaGoaga Nov 2, 2021
d41bf47
Solve bug where form data doesnt update on change - updated 2
AlinaGoaga Nov 2, 2021
16fa7af
Merge branch 'main' of github.com:weaveworks/weave-gitops-enterprise …
AlinaGoaga Nov 3, 2021
1a1607d
Solve conflicts with main
AlinaGoaga Nov 4, 2021
7ee61f7
Update tests
AlinaGoaga Nov 4, 2021
3c8dd5c
Merge branch 'main' of github.com:weaveworks/weave-gitops-enterprise …
AlinaGoaga Nov 4, 2021
c13279b
Merge branch 'main' of github.com:weaveworks/weave-gitops-enterprise …
AlinaGoaga Nov 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added cmd/mccp/mccp
Binary file not shown.
4 changes: 2 additions & 2 deletions test/acceptance/test/pages/create_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func ScrollWindow(webDriver *agouti.Page, xOffSet int, yOffSet int) {

// This function waits for previw and gitops to appear (become visible)
func WaitForDynamicSecToAppear(webDriver *agouti.Page) {
Eventually(webDriver.FindByXPath(`//div[contains(., "Preview")]/following-sibling::textarea`)).Should(BeFound())
Eventually(webDriver.FindByXPath(`//div[@name="Preview"]/following-sibling::textarea[1]`)).Should(BeFound())
Eventually(webDriver.FindByXPath(`//div[contains(., "Preview")]/parent::div/following-sibling::div/div[text()="GitOps"]`)).Should(BeFound())
}

Expand Down Expand Up @@ -111,7 +111,7 @@ func GetParameterOption(webDriver *agouti.Page, value string) *agouti.Selection
func GetPreview(webDriver *agouti.Page) Preview {
return Preview{
PreviewLabel: webDriver.FindByName("Preview"),
PreviewText: webDriver.FindByXPath(`//div[contains(., "Preview")]/following-sibling::textarea`),
PreviewText: webDriver.FindByXPath(`//div[@name="Preview"]/following-sibling::textarea[1]`),
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React, {
FC,
FormEvent,
useCallback,
useMemo,
useState,
Dispatch,
} from 'react';
import useCredentials from './../../../../../contexts/Credentials';
import { Credential } from '../../../../../types/custom';
import { Dropdown, DropdownItem } from 'weaveworks-ui-components';

const Credentials: FC<{
onSelect: Dispatch<React.SetStateAction<Credential | null>>;
}> = ({ onSelect }) => {
const { credentials, loading, getCredential } = useCredentials();
const [infraCredential, setInfraCredential] =
useState<Credential | null>(null);

const credentialsItems: DropdownItem[] = useMemo(
() => [
...credentials.map((credential: Credential) => {
const { kind, namespace, name } = credential;
return {
label: `${kind}/${namespace || 'default'}/${name}`,
value: name || '',
};
}),
{ label: 'None', value: '' },
],
[credentials],
);

const handleSelectCredentials = useCallback(
(event: FormEvent<HTMLInputElement>, value: string) => {
const credential = getCredential(value);
setInfraCredential(credential);
onSelect(credential);
},
[getCredential, onSelect],
);

return (
<div className="credentials">
<span>Infrastructure provider credentials:</span>
<Dropdown
value={infraCredential?.name}
disabled={loading}
items={credentialsItems}
onChange={handleSelectCredentials}
/>
</div>
);
};

export default Credentials;
127 changes: 127 additions & 0 deletions ui-cra/src/components/Clusters/Create/Form/Partials/GitOps.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
import React, { FC, useCallback, useState, Dispatch, ChangeEvent } from 'react';
import { FormStep } from '../Steps';
import { Input } from '../../../../../utils/form';
import { makeStyles, createStyles } from '@material-ui/core/styles';
import { Button } from 'weaveworks-ui-components';
import weaveTheme from 'weaveworks-ui-components/lib/theme';

const base = weaveTheme.spacing.base;

const useStyles = makeStyles(theme =>
createStyles({
createCTA: {
display: 'flex',
justifyContent: 'center',
paddingTop: base,
},
}),
);

const GitOps: FC<{
activeStep: string | undefined;
setActiveStep: Dispatch<React.SetStateAction<string | undefined>>;
clickedStep: string;
setClickedStep: Dispatch<React.SetStateAction<string>>;
onSubmit: (gitOps: {
head_branch: string;
title: string;
description: string;
commit_message: string;
}) => Promise<void>;
}> = ({ activeStep, setActiveStep, clickedStep, setClickedStep, onSubmit }) => {
const classes = useStyles();

const random = Math.random().toString(36).substring(7);

const [branchName, setBranchName] = useState<string>(
`create-clusters-branch-${random}`,
);
const [pullRequestTitle, setPullRequestTitle] = useState<string>(
'Creates capi cluster',
);
const [commitMessage, setCommitMessage] = useState<string>(
'Creates capi cluster',
);
const [pullRequestDescription, setPullRequestDescription] = useState<string>(
'This PR creates a new cluster',
);

const handleChangeBranchName = useCallback(
(event: ChangeEvent<HTMLInputElement>) => setBranchName(event.target.value),
[],
);

const handleChangePullRequestTitle = useCallback(
(event: ChangeEvent<HTMLInputElement>) =>
setPullRequestTitle(event.target.value),
[],
);

const handleChangeCommitMessage = useCallback(
(event: ChangeEvent<HTMLInputElement>) =>
setCommitMessage(event.target.value),
[],
);

const handleChangePRDescription = useCallback(
(event: ChangeEvent<HTMLInputElement>) =>
setPullRequestDescription(event.target.value),
[],
);

const handleGitOps = useCallback(
() =>
onSubmit({
head_branch: branchName,
title: pullRequestTitle,
description: pullRequestDescription,
commit_message: commitMessage,
}),
[
branchName,
pullRequestTitle,
pullRequestDescription,
commitMessage,
onSubmit,
],
);

return (
<FormStep
title="GitOps"
active={activeStep === 'GitOps'}
clicked={clickedStep === 'GitOps'}
setActiveStep={setActiveStep}
>
<Input
label="Create branch"
placeholder={branchName}
onChange={handleChangeBranchName}
/>
<Input
label="Pull request title"
placeholder={pullRequestTitle}
onChange={handleChangePullRequestTitle}
/>
<Input
label="Commit message"
placeholder={commitMessage}
onChange={handleChangeCommitMessage}
/>
<Input
label="Pull request description"
placeholder={pullRequestDescription}
onChange={handleChangePRDescription}
multiline
rows={4}
/>
<div className={classes.createCTA} onClick={handleGitOps}>
<Button onClick={() => setClickedStep('GitOps')}>
Create Pull Request
</Button>
</div>
</FormStep>
);
};

export default GitOps;
46 changes: 46 additions & 0 deletions ui-cra/src/components/Clusters/Create/Form/Partials/Preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React, { FC, Dispatch } from 'react';
import { FormStep } from '../Steps';
import { makeStyles, createStyles } from '@material-ui/core/styles';
import weaveTheme from 'weaveworks-ui-components/lib/theme';
import TextareaAutosize from '@material-ui/core/TextareaAutosize';

const xs = weaveTheme.spacing.xs;

const useStyles = makeStyles(() =>
createStyles({
textarea: {
width: '100%',
padding: xs,
border: '1px solid #E5E5E5',
},
}),
);

const Preview: FC<{
activeStep: string | undefined;
setActiveStep: Dispatch<React.SetStateAction<string | undefined>>;
clickedStep: string;
PRPreview: string;
}> = ({ activeStep, setActiveStep, clickedStep, PRPreview }) => {
const classes = useStyles();

return (
<FormStep
title="Preview"
active={activeStep === 'Preview'}
clicked={clickedStep === 'Preview'}
setActiveStep={setActiveStep}
>
<TextareaAutosize
className={classes.textarea}
value={PRPreview}
readOnly
/>
<span>
You may edit these as part of the pull request with your git provider.
</span>
</FormStep>
);
};

export default Preview;
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import React, {
} from 'react';
import ListItemText from '@material-ui/core/ListItemText';
import { makeStyles } from '@material-ui/core/styles';
import { Profile, UpdatedProfile } from '../../../types/custom';
import { Profile, UpdatedProfile } from '../../../../../types/custom';
import Box from '@material-ui/core/Box';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import useProfiles from './../../../contexts/Profiles';
import useNotifications from './../../../contexts/Notifications';
import useProfiles from '../../../../../contexts/Profiles';
import useNotifications from '../../../../../contexts/Notifications';
import {
Dialog,
DialogContent,
Expand All @@ -22,12 +22,12 @@ import {
TextareaAutosize,
} from '@material-ui/core';
import Typography from '@material-ui/core/Typography';
import { CloseIconButton } from '../../../assets/img/close-icon-button';
import { Loader } from '../../Loader';
import { OnClickAction } from '../../Action';
import { CloseIconButton } from '../../../../../assets/img/close-icon-button';
import { Loader } from '../../../../Loader';
import { OnClickAction } from '../../../../Action';
import weaveTheme from 'weaveworks-ui-components/lib/theme';
import Button from '@material-ui/core/Button';
import { GitOpsBlue } from './../../../muiTheme';
import { GitOpsBlue } from '../../../../../muiTheme';

const xs = weaveTheme.spacing.xs;

Expand Down
Loading