From 59e2551801954c1a81e947b4390be143af095726 Mon Sep 17 00:00:00 2001 From: Omer Farooq <17722640+o-farooq@users.noreply.github.com> Date: Sat, 7 Nov 2020 23:10:41 +1300 Subject: [PATCH] updated names and added changeset --- .changeset/wicked-impalas-tan.md | 5 +++ plugins/tech-radar/src/api.ts | 6 ++-- .../src/components/RadarComponent.tsx | 8 +++-- plugins/tech-radar/src/sampleData.ts | 36 +++++++++---------- plugins/tech-radar/src/utils/types.ts | 4 +-- 5 files changed, 33 insertions(+), 26 deletions(-) create mode 100644 .changeset/wicked-impalas-tan.md diff --git a/.changeset/wicked-impalas-tan.md b/.changeset/wicked-impalas-tan.md new file mode 100644 index 0000000000..ea68175d74 --- /dev/null +++ b/.changeset/wicked-impalas-tan.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-tech-radar': minor +--- + +Added tech radar blip history backend support and normalized the datastructure diff --git a/plugins/tech-radar/src/api.ts b/plugins/tech-radar/src/api.ts index 10b8f480f2..0c30c9374c 100644 --- a/plugins/tech-radar/src/api.ts +++ b/plugins/tech-radar/src/api.ts @@ -37,12 +37,12 @@ export interface RadarEntry { quadrant: string; title: string; url: string; - history: Array; + timeline: Array; } -export interface RadarEntryHistory { +export interface RadarEntrySnapshot { date: Date; - ring: string; + ringId: string; description?: string; moved?: MovedState; } diff --git a/plugins/tech-radar/src/components/RadarComponent.tsx b/plugins/tech-radar/src/components/RadarComponent.tsx index 525949d040..583a7c91e0 100644 --- a/plugins/tech-radar/src/components/RadarComponent.tsx +++ b/plugins/tech-radar/src/components/RadarComponent.tsx @@ -56,11 +56,13 @@ const RadarComponent = (props: TechRadarComponentProps): JSX.Element => { id: entry.key, quadrant: loaderResponse!.quadrants.find(q => q.id === entry.quadrant)!, title: entry.title, - ring: loaderResponse!.rings.find(r => r.id === entry.history[0].ring)!, - history: entry.history.map(e => { + ring: loaderResponse!.rings.find( + r => r.id === entry.timeline[0].ringId, + )!, + history: entry.timeline.map(e => { return { date: e.date, - ring: loaderResponse!.rings.find(a => a.id === e.ring)!, + ring: loaderResponse!.rings.find(a => a.id === e.ringId)!, description: e.description, moved: e.moved, }; diff --git a/plugins/tech-radar/src/sampleData.ts b/plugins/tech-radar/src/sampleData.ts index 7d4ff6198f..914bc30931 100644 --- a/plugins/tech-radar/src/sampleData.ts +++ b/plugins/tech-radar/src/sampleData.ts @@ -35,10 +35,10 @@ quadrants.push({ id: 'process', name: 'Process' }); const entries = new Array(); entries.push({ - history: [ + timeline: [ { moved: 0, - ring: 'use', + ringId: 'use', date: new Date('2020-08-06'), description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua', @@ -51,10 +51,10 @@ entries.push({ quadrant: 'languages', }); entries.push({ - history: [ + timeline: [ { moved: 0, - ring: 'use', + ringId: 'use', date: new Date('2020-08-06'), description: 'Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat', @@ -67,10 +67,10 @@ entries.push({ quadrant: 'languages', }); entries.push({ - history: [ + timeline: [ { moved: 0, - ring: 'use', + ringId: 'use', date: new Date('2020-08-06'), }, ], @@ -81,10 +81,10 @@ entries.push({ quadrant: 'frameworks', }); entries.push({ - history: [ + timeline: [ { moved: 0, - ring: 'use', + ringId: 'use', date: new Date('2020-08-06'), }, ], @@ -95,10 +95,10 @@ entries.push({ quadrant: 'frameworks', }); entries.push({ - history: [ + timeline: [ { moved: 0, - ring: 'use', + ringId: 'use', date: new Date('2020-08-06'), }, ], @@ -109,10 +109,10 @@ entries.push({ quadrant: 'process', }); entries.push({ - history: [ + timeline: [ { moved: 0, - ring: 'assess', + ringId: 'assess', date: new Date('2020-08-06'), }, ], @@ -123,10 +123,10 @@ entries.push({ quadrant: 'process', }); entries.push({ - history: [ + timeline: [ { moved: 0, - ring: 'use', + ringId: 'use', date: new Date('2020-08-06'), }, ], @@ -137,9 +137,9 @@ entries.push({ quadrant: 'process', }); entries.push({ - history: [ + timeline: [ { - ring: 'hold', + ringId: 'hold', date: new Date('2020-08-06'), }, ], @@ -150,9 +150,9 @@ entries.push({ quadrant: 'process', }); entries.push({ - history: [ + timeline: [ { - ring: 'use', + ringId: 'use', date: new Date('2020-08-06'), }, ], diff --git a/plugins/tech-radar/src/utils/types.ts b/plugins/tech-radar/src/utils/types.ts index 65c14f38c6..3322a67dcb 100644 --- a/plugins/tech-radar/src/utils/types.ts +++ b/plugins/tech-radar/src/utils/types.ts @@ -69,10 +69,10 @@ export type Entry = { // How this entry has recently moved; -1 for "down", +1 for "up", 0 for not moved moved?: MovedState; active?: boolean; - history?: Array; + timeline?: Array; }; -export type EntryHistory = { +export type EntrySnapshot = { date: Date; ring: Ring; description?: string;