From 4074aff376baed737979a1176ba489a573512f69 Mon Sep 17 00:00:00 2001 From: Chanwit Kaewkasi Date: Fri, 12 Jun 2020 14:19:29 +0700 Subject: [PATCH 1/2] gitops-plugin: add meaningful error message for the cluster listing page --- .../components/ClusterList/ClusterList.tsx | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/plugins/gitops-profiles/src/components/ClusterList/ClusterList.tsx b/plugins/gitops-profiles/src/components/ClusterList/ClusterList.tsx index 0bdad1c8ab..8e5aa15aa9 100644 --- a/plugins/gitops-profiles/src/components/ClusterList/ClusterList.tsx +++ b/plugins/gitops-profiles/src/components/ClusterList/ClusterList.tsx @@ -28,16 +28,21 @@ import { } from '@backstage/core'; import ClusterTable from '../ClusterTable/ClusterTable'; -import { Button, Typography } from '@material-ui/core'; +import { Button } from '@material-ui/core'; import { useAsync, useLocalStorage } from 'react-use'; import { gitOpsApiRef, ListClusterStatusesResponse } from '../../api'; +import { Alert } from '@material-ui/lab'; const ClusterList: FC<{}> = () => { const [loginInfo] = useLocalStorage<{ token: string; username: string; name: string; - }>('githubLoginDetails'); + }>('githubLoginDetails', { + token: '', + username: '', + name: 'Guest', + }); const api = useApi(gitOpsApiRef); @@ -59,9 +64,19 @@ const ClusterList: FC<{}> = () => { } else if (error) { content = ( - - Failed to load cluster, {String(error)} - +
+ + Error encountered while fetching list of GitOps-managed cluster.{' '} + {error.toString()} + + + Please make sure that you start GitOps-API backend on localhost port + 3008 before using this plugin. + + + If you're Guest, please login via GitHub first. + +
); } else { From a064515684a7b6e13f4eb918a020413e14b1619f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Mon, 15 Jun 2020 16:43:36 +0200 Subject: [PATCH 2/2] chore(catalog-backend): split apart example components and register in loop --- .../examples/artist-lookup-component.yaml | 9 +++ .../examples/example-components.yaml | 60 ------------------- .../examples/example-location.yaml | 8 --- .../examples/playback-order-component.yaml | 9 +++ .../examples/podcast-api-component.yaml | 9 +++ .../examples/queue-proxy-component.yaml | 9 +++ .../examples/searcher-component.yaml | 9 +++ .../examples/shuffle-api-component.yaml | 9 +++ plugins/catalog-backend/scripts/mock-data | 25 +++++--- 9 files changed, 70 insertions(+), 77 deletions(-) create mode 100644 plugins/catalog-backend/examples/artist-lookup-component.yaml delete mode 100644 plugins/catalog-backend/examples/example-components.yaml delete mode 100644 plugins/catalog-backend/examples/example-location.yaml create mode 100644 plugins/catalog-backend/examples/playback-order-component.yaml create mode 100644 plugins/catalog-backend/examples/podcast-api-component.yaml create mode 100644 plugins/catalog-backend/examples/queue-proxy-component.yaml create mode 100644 plugins/catalog-backend/examples/searcher-component.yaml create mode 100644 plugins/catalog-backend/examples/shuffle-api-component.yaml diff --git a/plugins/catalog-backend/examples/artist-lookup-component.yaml b/plugins/catalog-backend/examples/artist-lookup-component.yaml new file mode 100644 index 0000000000..5fbb073c1a --- /dev/null +++ b/plugins/catalog-backend/examples/artist-lookup-component.yaml @@ -0,0 +1,9 @@ +apiVersion: backstage.io/v1beta1 +kind: Component +metadata: + name: artist-lookup + description: Artist Lookup +spec: + type: service + lifecycle: experimental + owner: tools@example.com diff --git a/plugins/catalog-backend/examples/example-components.yaml b/plugins/catalog-backend/examples/example-components.yaml deleted file mode 100644 index 4580fa7179..0000000000 --- a/plugins/catalog-backend/examples/example-components.yaml +++ /dev/null @@ -1,60 +0,0 @@ ---- -apiVersion: backstage.io/v1beta1 -kind: Component -metadata: - name: podcast-api - description: Podcast API -spec: - type: service - lifecycle: experimental - owner: tools@example.com ---- -apiVersion: backstage.io/v1beta1 -kind: Component -metadata: - name: artist-lookup - description: Artist Lookup -spec: - type: service - lifecycle: experimental - owner: tools@example.com ---- -apiVersion: backstage.io/v1beta1 -kind: Component -metadata: - name: searcher - description: Searcher -spec: - type: service - lifecycle: production - owner: tools@example.com ---- -apiVersion: backstage.io/v1beta1 -kind: Component -metadata: - name: playback-order - description: Playback Order -spec: - type: service - lifecycle: production - owner: tools@example.com ---- -apiVersion: backstage.io/v1beta1 -kind: Component -metadata: - name: shuffle-api - description: Shuffle API -spec: - type: service - lifecycle: production - owner: tools@example.com ---- -apiVersion: backstage.io/v1beta1 -kind: Component -metadata: - name: queue-proxy - description: Queue Proxy -spec: - type: website - lifecycle: production - owner: tools@example.com diff --git a/plugins/catalog-backend/examples/example-location.yaml b/plugins/catalog-backend/examples/example-location.yaml deleted file mode 100644 index 5c507b29b5..0000000000 --- a/plugins/catalog-backend/examples/example-location.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -apiVersion: backstage.io/v1beta1 -kind: Location -metadata: - name: location-1 -spec: - type: github - target: https://github.com/spotify/backstage/blob/master/plugins/catalog-backend/examples/example-components.yaml diff --git a/plugins/catalog-backend/examples/playback-order-component.yaml b/plugins/catalog-backend/examples/playback-order-component.yaml new file mode 100644 index 0000000000..4ee959f48f --- /dev/null +++ b/plugins/catalog-backend/examples/playback-order-component.yaml @@ -0,0 +1,9 @@ +apiVersion: backstage.io/v1beta1 +kind: Component +metadata: + name: playback-order + description: Playback Order +spec: + type: service + lifecycle: production + owner: tools@example.com diff --git a/plugins/catalog-backend/examples/podcast-api-component.yaml b/plugins/catalog-backend/examples/podcast-api-component.yaml new file mode 100644 index 0000000000..c2c7ee34dd --- /dev/null +++ b/plugins/catalog-backend/examples/podcast-api-component.yaml @@ -0,0 +1,9 @@ +apiVersion: backstage.io/v1beta1 +kind: Component +metadata: + name: podcast-api + description: Podcast API +spec: + type: service + lifecycle: experimental + owner: tools@example.com diff --git a/plugins/catalog-backend/examples/queue-proxy-component.yaml b/plugins/catalog-backend/examples/queue-proxy-component.yaml new file mode 100644 index 0000000000..8298b19f93 --- /dev/null +++ b/plugins/catalog-backend/examples/queue-proxy-component.yaml @@ -0,0 +1,9 @@ +apiVersion: backstage.io/v1beta1 +kind: Component +metadata: + name: queue-proxy + description: Queue Proxy +spec: + type: website + lifecycle: production + owner: tools@example.com diff --git a/plugins/catalog-backend/examples/searcher-component.yaml b/plugins/catalog-backend/examples/searcher-component.yaml new file mode 100644 index 0000000000..ecfd92f470 --- /dev/null +++ b/plugins/catalog-backend/examples/searcher-component.yaml @@ -0,0 +1,9 @@ +apiVersion: backstage.io/v1beta1 +kind: Component +metadata: + name: searcher + description: Searcher +spec: + type: service + lifecycle: production + owner: tools@example.com diff --git a/plugins/catalog-backend/examples/shuffle-api-component.yaml b/plugins/catalog-backend/examples/shuffle-api-component.yaml new file mode 100644 index 0000000000..d45a06e030 --- /dev/null +++ b/plugins/catalog-backend/examples/shuffle-api-component.yaml @@ -0,0 +1,9 @@ +apiVersion: backstage.io/v1beta1 +kind: Component +metadata: + name: shuffle-api + description: Shuffle API +spec: + type: service + lifecycle: production + owner: tools@example.com diff --git a/plugins/catalog-backend/scripts/mock-data b/plugins/catalog-backend/scripts/mock-data index c9e4e35d7b..a21a60fcf3 100755 --- a/plugins/catalog-backend/scripts/mock-data +++ b/plugins/catalog-backend/scripts/mock-data @@ -1,9 +1,16 @@ -#!/usr/bin/env sh -curl \ ---location \ ---request POST 'localhost:7000/catalog/locations' \ ---header 'Content-Type: application/json' \ ---data-raw '{ - "type": "github", - "target": "https://github.com/spotify/backstage/blob/master/plugins/catalog-backend/examples/example-components.yaml" -}' +#!/usr/bin/env bash + +for URL in \ + 'artist-lookup-component.yaml' \ + 'playback-order-component.yaml' \ + 'podcast-api-component.yaml' \ + 'queue-proxy-component.yaml' \ + 'searcher-component.yaml' \ + 'shuffle-api-component.yaml' \ +; do \ + curl \ + --location \ + --request POST 'localhost:7000/catalog/locations' \ + --header 'Content-Type: application/json' \ + --data-raw "{\"type\": \"github\", \"target\": \"https://github.com/spotify/backstage/blob/master/plugins/catalog-backend/examples/${URL}\"}" +done