Skip to content

Commit 803f2b0

Browse files
Sources card (#32)
Adding Sources Card to Backstage --- Co-authored-by: AlinaGoaga <goaga.alina@gmail.com>
1 parent 30d6452 commit 803f2b0

File tree

18 files changed

+692
-275
lines changed

18 files changed

+692
-275
lines changed

packages/app/src/components/catalog/EntityPage.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ import {
6262
FluxEntityOCIRepositoriesCard,
6363
FluxEntityKustomizationsCard,
6464
FluxEntityHelmRepositoriesCard,
65+
FluxEntityDeploymentsCard,
66+
FluxEntitySourcesCard,
6567
} from '@weaveworksoss/backstage-plugin-flux';
6668

6769
const techdocsContent = (
@@ -168,6 +170,12 @@ const serviceEntityPage = (
168170
<Grid item md={12}>
169171
<FluxEntityOCIRepositoriesCard />
170172
</Grid>
173+
<Grid item md={12}>
174+
<FluxEntityDeploymentsCard />
175+
</Grid>
176+
<Grid item md={12}>
177+
<FluxEntitySourcesCard />
178+
</Grid>
171179
</Grid>
172180
</EntityLayout.Route>
173181

plugins/backstage-plugin-flux/dev/index.tsx

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
newTestHelmRepository,
3636
} from './helpers';
3737
import { ReconcileRequestAnnotation } from '../src/hooks';
38+
import { FluxEntitySourcesCard } from '../src/components/FluxEntitySourcesCard';
3839

3940
const fakeEntity: Entity = {
4041
apiVersion: 'backstage.io/v1alpha1',
@@ -450,5 +451,85 @@ createDevApp()
450451
</TestApiProvider>
451452
),
452453
})
454+
.addPage({
455+
title: 'Sources',
456+
path: '/sources',
457+
element: (
458+
<TestApiProvider
459+
apis={[
460+
[
461+
configApiRef,
462+
new ConfigReader({
463+
gitops: { baseUrl: 'https://example.com/wego' },
464+
}),
465+
],
466+
[
467+
kubernetesApiRef,
468+
new StubKubernetesClient([
469+
newTestHelmRepository(
470+
'podinfo',
471+
'https://stefanprodan.github.io/podinfo',
472+
),
473+
newTestOCIRepository(
474+
'podinfo',
475+
'oci://ghcr.io/stefanprodan/manifests/podinfo',
476+
{ verify: true, verified: true },
477+
),
478+
newTestOCIRepository(
479+
'redis',
480+
'oci://registry-1.docker.io/bitnamicharts/redis',
481+
),
482+
newTestOCIRepository(
483+
'postgresql',
484+
'oci://registry-1.docker.io/bitnamicharts/postgresql',
485+
{ verify: true, verified: false },
486+
),
487+
newTestOCIRepository(
488+
'apache',
489+
'oci://registry-1.docker.io/bitnamicharts/apache',
490+
{ ready: false },
491+
),
492+
newTestOCIRepository(
493+
'supabase',
494+
'oci://registry-1.docker.io/bitnamicharts/supabase',
495+
{ verify: true, pending: true },
496+
),
497+
newTestOCIRepository(
498+
'mariadb',
499+
'oci://registry-1.docker.io/bitnamicharts/mariadb',
500+
{ verify: true, verified: false },
501+
),
502+
newTestGitRepository(
503+
'podinfo',
504+
'https://github.com/stefanprodan/podinfo',
505+
{ verify: true, verified: true },
506+
),
507+
newTestGitRepository(
508+
'weave-gitops',
509+
'https://github.com/weaveworks/weave-gitops',
510+
),
511+
newTestGitRepository(
512+
'weaveworks-backstage',
513+
'https://github.com/weaveworks/weaveworks-backstage',
514+
{ verify: true, verified: false },
515+
),
516+
newTestGitRepository(
517+
'weave-gitops-enterprise',
518+
'https://github.com/weaveworks/weave-gitops-enterprise',
519+
),
520+
]),
521+
],
522+
523+
[kubernetesAuthProvidersApiRef, new StubKubernetesAuthProvidersApi()],
524+
]}
525+
>
526+
<EntityProvider entity={fakeEntity}>
527+
<Content>
528+
<FluxEntitySourcesCard />
529+
</Content>
530+
</EntityProvider>
531+
</TestApiProvider>
532+
),
533+
})
453534
.registerPlugin(weaveworksFluxPlugin)
454535
.render();

plugins/backstage-plugin-flux/src/components/FluxEntityDeploymentsCard/FluxDeploymentsTable.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { TableColumn, TableFilter } from '@backstage/core-components';
2+
import { TableColumn } from '@backstage/core-components';
33
import {
44
clusterNameFilteringColumn,
55
idColumn,
@@ -11,6 +11,7 @@ import {
1111
repoColumn,
1212
sourceColumn,
1313
typeColumn,
14+
filters,
1415
} from '../helpers';
1516
import { HelmChart, HelmRelease, Kustomization } from '../../objects';
1617
import { FluxEntityTable } from '../FluxEntityTable';
@@ -27,13 +28,6 @@ export const defaultColumns: TableColumn<Deployment>[] = [
2728
syncColumn(),
2829
];
2930

30-
const filters: TableFilter[] = [
31-
{
32-
column: 'Cluster name',
33-
type: 'multiple-select',
34-
},
35-
];
36-
3731
type Props = {
3832
deployments: Deployment[];
3933
isLoading: boolean;

plugins/backstage-plugin-flux/src/components/FluxEntityGitRepositoriesCard/FluxEntityGitRepositoriesCard.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import React from 'react';
22
import { useEntity } from '@backstage/plugin-catalog-react';
3-
import { InfoCard } from '@backstage/core-components';
3+
import { InfoCard, TableColumn } from '@backstage/core-components';
44
import { useGitRepositories } from '../../hooks/query';
5-
import {
6-
FluxGitRepositoriesTable,
7-
defaultColumns,
8-
} from './FluxGitRepositoriesTable';
95
import { WeaveGitOpsContext } from '../WeaveGitOpsContext';
6+
import {
7+
gitOciDefaultColumns,
8+
FluxSourcesTable,
9+
} from '../FluxEntitySourcesCard/FluxEntitySourcesTable';
10+
import { Source } from '../helpers';
1011

1112
const GitRepositoriesPanel = () => {
1213
const { entity } = useEntity();
@@ -27,10 +28,10 @@ const GitRepositoriesPanel = () => {
2728

2829
return (
2930
<InfoCard title="Git Repositories">
30-
<FluxGitRepositoriesTable
31-
gitRepositories={data || []}
31+
<FluxSourcesTable
32+
sources={data || []}
3233
isLoading={loading && !data}
33-
columns={defaultColumns}
34+
columns={gitOciDefaultColumns as TableColumn<Source>[]}
3435
/>
3536
</InfoCard>
3637
);

plugins/backstage-plugin-flux/src/components/FluxEntityGitRepositoriesCard/FluxGitRepositoriesTable.tsx

Lines changed: 0 additions & 79 deletions
This file was deleted.

plugins/backstage-plugin-flux/src/components/FluxEntityHelmRepositoriesCard/FluxEntityHelmRepositoriesCard.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import React from 'react';
22
import { useEntity } from '@backstage/plugin-catalog-react';
3-
import { InfoCard } from '@backstage/core-components';
3+
import { InfoCard, TableColumn } from '@backstage/core-components';
44
import { useHelmRepositories } from '../../hooks';
5-
import {
6-
FluxHelmRepositoriesTable,
7-
defaultColumns,
8-
} from './FluxHelmRepositoriesTable';
95
import { WeaveGitOpsContext } from '../WeaveGitOpsContext';
6+
import {
7+
helmDefaultColumns,
8+
FluxSourcesTable,
9+
} from '../FluxEntitySourcesCard/FluxEntitySourcesTable';
10+
import { Source } from '../helpers';
1011

1112
const HelmRepositoriesPanel = () => {
1213
const { entity } = useEntity();
@@ -27,10 +28,10 @@ const HelmRepositoriesPanel = () => {
2728

2829
return (
2930
<InfoCard title="Helm Repositories">
30-
<FluxHelmRepositoriesTable
31-
helmRepositories={data || []}
31+
<FluxSourcesTable
32+
sources={data || []}
3233
isLoading={loading && !data}
33-
columns={defaultColumns}
34+
columns={helmDefaultColumns as TableColumn<Source>[]}
3435
/>
3536
</InfoCard>
3637
);

plugins/backstage-plugin-flux/src/components/FluxEntityHelmRepositoriesCard/FluxHelmRepositoriesTable.tsx

Lines changed: 0 additions & 81 deletions
This file was deleted.

0 commit comments

Comments
 (0)