Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
633b0c9
Add HelmRelease section to Add App - WIP
AlinaGoaga Aug 19, 2022
d6827ec
Merge branch 'main' into WG1206
AlinaGoaga Aug 19, 2022
79b21d8
Refactor get profiles query to accept name and namespace for helm rel…
AlinaGoaga Aug 22, 2022
c67a8b5
Refactor get profiles query to accept name and namespace for helm rel…
AlinaGoaga Aug 22, 2022
ddc4a0c
Merge branch 'main' into WG1206
AlinaGoaga Aug 22, 2022
d3aae06
Update types for CreateAutomationsPullRequestRequest
AlinaGoaga Aug 23, 2022
53c0fa1
Merge branch 'main' into WG1206
AlinaGoaga Aug 23, 2022
f9b170d
Regenerate files
AlinaGoaga Aug 23, 2022
64412d7
Update Add App payload
AlinaGoaga Aug 23, 2022
2fd3f7b
Update Add App payload - 2
AlinaGoaga Aug 24, 2022
c751ca1
Update Add App payload - 3
AlinaGoaga Aug 24, 2022
b160142
Solve conflicts with latest app changes
AlinaGoaga Aug 24, 2022
cf5bcd2
Merge branch 'main' into WG1206
AlinaGoaga Aug 25, 2022
963c2b9
Update Add App payload - 4
AlinaGoaga Aug 25, 2022
da56b90
Solve conflicts
AlinaGoaga Aug 25, 2022
58ae8be
Remove dup functions
AlinaGoaga Aug 25, 2022
a03023c
Merge branch 'main' into WG1206
AlinaGoaga Aug 25, 2022
0da6455
Fix context sent to Create Cluster
AlinaGoaga Aug 25, 2022
bfbec4a
Merge branch 'WG1206' of github.com:weaveworks/weave-gitops-enterpris…
AlinaGoaga Aug 25, 2022
853eaa6
Upgrade to weave-gitops that allows profile selection
foot Aug 25, 2022
4ec31be
Merge branch 'main' into WG1206
AlinaGoaga Aug 25, 2022
d59ab6d
regen protos
foot Aug 25, 2022
a2b6b55
Implement PR feedback - 1
AlinaGoaga Aug 25, 2022
5c16d4e
Fixes token
foot Aug 26, 2022
eb03329
Implement PR feedback - 2 - rearrange form fields
AlinaGoaga Aug 26, 2022
fd4383a
Merge branch 'WG1206' of github.com:weaveworks/weave-gitops-enterpris…
AlinaGoaga Aug 26, 2022
d9348b2
Merge branch 'main' into WG1206
AlinaGoaga Aug 26, 2022
7caaa27
Merge branch 'main' into WG1206
AlinaGoaga Aug 26, 2022
eef4484
Update styling in select source
AlinaGoaga Aug 26, 2022
eb1a92b
Style links
AlinaGoaga Aug 26, 2022
55fbdd8
Style links - 2
AlinaGoaga Aug 26, 2022
3f1903e
Style links - 3
AlinaGoaga Aug 26, 2022
df32c40
Bump font size a tiny bit more
foot Aug 29, 2022
963d263
update snapshots
foot Aug 29, 2022
13e9726
Merge branch 'main' into WG1206
AlinaGoaga Aug 29, 2022
a79b79f
Small refactor
AlinaGoaga Aug 29, 2022
749cdd3
Merge branch 'WG1206' of github.com:weaveworks/weave-gitops-enterpris…
AlinaGoaga Aug 29, 2022
f12c0ac
Merge branch 'main' into WG1206
AlinaGoaga Aug 29, 2022
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
1 change: 1 addition & 0 deletions cmd/clusters-service/api/cluster_services.proto
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,7 @@ message Chart {
message ChartSpec {
string chart = 1;
SourceRef source_ref = 2;
string version = 3;
}

message Metadata {
Expand Down
3 changes: 3 additions & 0 deletions cmd/clusters-service/api/cluster_services.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,9 @@
},
"sourceRef": {
"$ref": "#/definitions/v1SourceRef"
},
"version": {
"type": "string"
}
}
},
Expand Down
1,048 changes: 518 additions & 530 deletions cmd/clusters-service/pkg/protos/cluster_services.pb.go

Large diffs are not rendered by default.

190 changes: 76 additions & 114 deletions cmd/clusters-service/pkg/protos/cluster_services.pb.gw.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions cmd/clusters-service/pkg/server/automations.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ func createHelmReleaseObject(hr *capiv1_proto.HelmRelease) *helmv2.HelmRelease {
Name: hr.Spec.Chart.Spec.SourceRef.Name,
Namespace: hr.Spec.Chart.Spec.SourceRef.Namespace,
},
Version: hr.Spec.Chart.Spec.Version,
},
},
Interval: metav1.Duration{Duration: time.Minute * 10},
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/sirupsen/logrus v1.9.0
github.com/spf13/cobra v1.5.0
github.com/stretchr/testify v1.8.0
github.com/weaveworks/weave-gitops v0.9.4-0.20220817125053-721c4723c935
github.com/weaveworks/weave-gitops v0.9.4-0.20220825144206-f72caa29d3c7
github.com/weaveworks/weave-gitops-enterprise-credentials v0.0.2
github.com/weaveworks/weave-gitops-enterprise/common v0.0.0
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1333,8 +1333,8 @@ github.com/weaveworks/policy-agent/api v1.0.4 h1:dznn4I3+tfSniNbERFaAXOMpLsvwW+6
github.com/weaveworks/policy-agent/api v1.0.4/go.mod h1:GbePwORMtByaPqKoD7xuY/oqdq8iagfh5R6NZS14+AA=
github.com/weaveworks/progressive-delivery v0.0.0-20220808183836-c7c637e887d0 h1:49pW4S2L2fqQYGqqr/5Grps55RopEbQcepTnQeNZ+sE=
github.com/weaveworks/progressive-delivery v0.0.0-20220808183836-c7c637e887d0/go.mod h1:XRrKv9SdRa6r/CGlT78c50dyxz+r9DWOiy09npLS3L8=
github.com/weaveworks/weave-gitops v0.9.4-0.20220817125053-721c4723c935 h1:c2zd3+DMocgrszlsQmX2DOxehuR9Qw2IzJ5leFF0pPg=
github.com/weaveworks/weave-gitops v0.9.4-0.20220817125053-721c4723c935/go.mod h1:VQvGWjVAXzEeMkafSyP9nP25TapGyj7GYd6pouJ5uR4=
github.com/weaveworks/weave-gitops v0.9.4-0.20220825144206-f72caa29d3c7 h1:/ah8HBfAMUH2JoBRoorQCAsr6Ool8JgoCGbgCiS4DE0=
github.com/weaveworks/weave-gitops v0.9.4-0.20220825144206-f72caa29d3c7/go.mod h1:sMWzafQ2wnXhNoL+aEbFPOrRPIz8DcqAzOAEn7kM0Zc=
github.com/weaveworks/weave-gitops-enterprise-credentials v0.0.2 h1:7jeiQehqmI4ds6YIq8TW1Vqhlb6V7G2BVRJ8VM3r99I=
github.com/weaveworks/weave-gitops-enterprise-credentials v0.0.2/go.mod h1:6PMYg+VtSNePnP7EXyNG+/hNRNZ3r0mQtolIZU4s/J0=
github.com/xanzy/go-gitlab v0.69.0 h1:sPci9xHzlX+lcJvPqNu3y3BQpePuR2R694Bal4AeyB8=
Expand Down
1 change: 1 addition & 0 deletions ui-cra/src/cluster-services/cluster_services.pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ export type Chart = {
export type ChartSpec = {
chart?: string
sourceRef?: SourceRef
version?: string
}

export type Metadata = {
Expand Down
88 changes: 51 additions & 37 deletions ui-cra/src/components/Applications/Add/form/Partials/AppFields.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { FC, Dispatch } from 'react';
import styled from 'styled-components';
import useProfiles from '../../../../../contexts/Profiles';
import { Input, Select } from '../../../../../utils/form';
import _ from 'lodash';
import { MenuItem } from '@material-ui/core';
import { GitRepository } from '@weaveworks/weave-gitops/ui/lib/api/core/types.pb';
import { GitopsClusterEnriched } from '../../../../../types/custom';
import { ListGitRepositoriesResponse } from '@weaveworks/weave-gitops/ui/lib/api/core/core.pb';
import { useListSources } from '@weaveworks/weave-gitops';
import { Source } from '@weaveworks/weave-gitops/ui/lib/types';
import { DEFAULT_FLUX_KUSTOMIZATION_NAMESPACE } from '../../../../../utils/config';

const FormWrapper = styled.form`
Expand All @@ -22,16 +22,10 @@ const AppFields: FC<{
setFormData: Dispatch<React.SetStateAction<any>> | any;
index?: number;
clusters?: GitopsClusterEnriched[];
GitRepoResponse?: ListGitRepositoriesResponse;
}> = ({
formData,
setFormData,
index = 0,
clusters = undefined,
GitRepoResponse = undefined,
}) => {
}> = ({ formData, setFormData, index = 0, clusters = undefined }) => {
const { setHelmRepo } = useProfiles();
const { data } = useListSources();
const automation = formData.clusterAutomations[index];
let gitResposFilterdList: GitRepository[] = [];

const handleSelectCluster = (event: React.ChangeEvent<any>) => {
const value = event.target.value;
Expand All @@ -48,29 +42,48 @@ const AppFields: FC<{
clusterAutomations: currentAutomation,
});
};

let repos: Source[] | undefined = [];

if (clusters) {
const clusterName = automation.cluster_namespace
? `${automation.cluster_namespace}/${automation.cluster_name}`
: `${automation.cluster_name}`;
gitResposFilterdList = _.filter(GitRepoResponse?.gitRepositories, [
'clusterName',
clusterName,
]);

repos = data?.result.filter(
object =>
object.clusterName === clusterName &&
(object.kind === 'KindGitRepository' ||
object.kind === 'KindHelmRepository'),
);
}

const handleSelectSource = (event: React.ChangeEvent<any>) => {
const value = event.target.value;
const { value } = event.target;
let currentAutomation = [...formData.clusterAutomations];

currentAutomation[index] = {
...automation,
source_name: JSON.parse(value).name,
source_namespace: JSON.parse(value).namespace,
source: value,
};

setFormData({
...formData,
source_name: JSON.parse(value).name,
source_namespace: JSON.parse(value).namespace,
source_type: JSON.parse(value).kind,
source: value,
clusterAutomations: currentAutomation,
});

if (JSON.parse(value).kind === 'KindHelmRepository') {
setHelmRepo({
name: JSON.parse(value).name,
namespace: JSON.parse(value).namespace,
});
}
};

const handleFormData = (
Expand All @@ -86,6 +99,7 @@ const AppFields: FC<{
...automation,
[fieldName as string]: value,
};

setFormData({
...formData,
clusterAutomations: currentAutomation,
Expand Down Expand Up @@ -140,33 +154,33 @@ const AppFields: FC<{
defaultValue={''}
description="The name and type of source"
>
{gitResposFilterdList.length > 0 ? (
gitResposFilterdList?.map(
(option: GitRepository, index: number) => {
return (
<MenuItem key={index} value={JSON.stringify(option)}>
{option.name}
</MenuItem>
);
},
)
{repos ? (
repos.map((option: Source, index: number) => {
return (
<MenuItem key={index} value={JSON.stringify(option)}>
{option?.kind?.slice(4)} : {option.name}
</MenuItem>
);
})
) : (
<MenuItem disabled={true}>
No GitRepository available please select another cluster
No repository available, please select another cluster.
</MenuItem>
)}
</Select>
</>
)}
<Input
className="form-section"
required={true}
name="path"
label="SELECT PATH/CHART"
value={formData.clusterAutomations[index].path}
onChange={event => handleFormData(event, 'path')}
description="Path within the git repository to read yaml files"
/>
{formData.source_type === 'KindGitRepository' ? (
<Input
className="form-section"
required={true}
name="path"
label="SELECT PATH/CHART"
value={formData.clusterAutomations[index].path}
onChange={event => handleFormData(event, 'path')}
description="Path within the git repository to read yaml files"
/>
) : null}
</FormWrapper>
);
};
Expand Down
Loading