From acf3e00e5561add2d79c4381ac15198ca9c0aedb Mon Sep 17 00:00:00 2001 From: Graeme Christie Date: Thu, 22 Feb 2024 11:24:39 +0800 Subject: [PATCH] Fixed logs href to append -quickstart Filtered out internal/microsoft hidden-link: tags Signed-off-by: Graeme Christie Added changeset Signed-off-by: Graeme Christie Fixed filtering tags as object, not array Signed-off-by: Graeme Christie Added null coelesce in case azure api returns undefined/null tags response Signed-off-by: Graeme Christie Fixed filtering to include all 'hidden-' tags - see https://learn.microsoft.com/en-us/community/content/hidden-tags-azure Signed-off-by: Graeme Christie Update .changeset/violet-chicken-smell.md Co-authored-by: Deepankumar Signed-off-by: Graeme Christie Update violet-chicken-smell.md Signed-off-by: Graeme Christie Update .changeset/violet-chicken-smell.md Co-authored-by: Deepankumar Signed-off-by: Graeme Christie --- .changeset/violet-chicken-smell.md | 5 +++++ plugins/azure-sites-backend/src/api/AzureSitesApi.ts | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 .changeset/violet-chicken-smell.md diff --git a/.changeset/violet-chicken-smell.md b/.changeset/violet-chicken-smell.md new file mode 100644 index 0000000000..d88c231e4b --- /dev/null +++ b/.changeset/violet-chicken-smell.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-azure-sites-backend': minor +--- + +Azure Sites list now hides the internal/microsoft only `hidden-` tags from the list of tags that are returned. Updated the log endpoint to /logstream-quickstart rather than just /logstream to stream logs in the Azure Portal UI. diff --git a/plugins/azure-sites-backend/src/api/AzureSitesApi.ts b/plugins/azure-sites-backend/src/api/AzureSitesApi.ts index b8660c5989..5f58ebdb3d 100644 --- a/plugins/azure-sites-backend/src/api/AzureSitesApi.ts +++ b/plugins/azure-sites-backend/src/api/AzureSitesApi.ts @@ -78,9 +78,17 @@ export class AzureSitesApi { subscriptions: this.config.subscriptions, }); for (const v of result.data) { + const tags = Object.fromEntries( + Object.entries(v.properties.tags ?? {}).filter( + ([k, _]) => !k.startsWith('hidden-'), + ), + ); + items.push({ href: `${this.baseHref(this.config.domain)}${v.id!}`, - logstreamHref: `${this.baseHref(this.config.domain)}${v.id!}/logStream`, + logstreamHref: `${this.baseHref( + this.config.domain, + )}${v.id!}/logStream-quickstart`, name: v.name!, kind: v.kind!, resourceGroup: v.resourceGroup!, @@ -90,7 +98,7 @@ export class AzureSitesApi { usageState: v.properties.usageState!, state: v.properties.state!, containerSize: v.properties.containerSize!, - tags: v.properties.tags!, + tags, }); } return { items: items };