From 83efe6f99954ec439aca79021e0d476adda20cf0 Mon Sep 17 00:00:00 2001 From: Tony Li Date: Mon, 5 Aug 2024 10:53:14 -0700 Subject: [PATCH] chore(artifacts): Add weave support to enable artifact version tags in UI (server) (#1986) * chore(weave): wip - boilerplate for opArtifactVersionTags * chore(weave): wip - starter boilerplate for artifact version tags * chore(weave): add tags field to Artifact gql schema * chore(weave): autoformatting * chore(weave): fix returnType for opArtifactVersionTags * chore(weave): handle 'artifactVersion-tags' in gql.ts * chore(weave): fix required fragment for artifact vertsion tags * chore(weave): fix python weave op for version tags * chore(weave): fix python weave op for version tags * chore(weave): fix python weave op for version tags * chore(weave): fix python weave op for version tags * chore(weave): fix python weave op for version tags * chore(weave): fix python weave op for version tags * chore(weave): fix python weave op for version tags * chore(weave): fix python weave op for version tags * chore(weave): adapt PanelArtifactVersionAliases -> PanelArtifactVersionTags * chore(weave): fix return type * chore(weave): adapt PanelArtifactVersionAliases -> PanelArtifactVersionTags * chore(weave): fixes for PanelArtifactVersionTags * chore(weave): fixes for PanelArtifactVersionTags * chore(weave): fixes for PanelArtifactVersionTags * chore(weave): fixes for PanelArtifactVersionTags * chore(weave): fixes for PanelArtifactVersionTags * chore(weave): fixes for PanelArtifactVersionTags * chore(weave): fixes for PanelArtifactVersionTags * chore(weave): drop unused Tag type for artifacts * chore(ui): cleanup and fixes * chore(ui): revert returnType for opArtifactRawTags * chore(weave): fixes for pr comments * chore(ui): require all Tag fields -- we need them anyway * chore(ui): fix/simplify/consolidate weave type definitions * chore(ui): rename artifactVersionTags op -> artifactVersionRawTags op for consistency * chore(weave): split off changes in weave-js/ --- wb_schema.gql | 1 + .../legacy/ops_domain/artifact_version_ops.py | 27 +++++++++++++++++++ weave/legacy/panels/panel_legacy.py | 1 + 3 files changed, 29 insertions(+) diff --git a/wb_schema.gql b/wb_schema.gql index 3cdad0f16e6..ce587bb0ee9 100644 --- a/wb_schema.gql +++ b/wb_schema.gql @@ -566,6 +566,7 @@ type Artifact { currentManifest: ArtifactManifest historyStep: Int64 ttlDurationSeconds: Int64! + tags: [Tag!]! } type ArtifactManifestConnection { diff --git a/weave/legacy/ops_domain/artifact_version_ops.py b/weave/legacy/ops_domain/artifact_version_ops.py index 4469897849c..020cc3987ab 100644 --- a/weave/legacy/ops_domain/artifact_version_ops.py +++ b/weave/legacy/ops_domain/artifact_version_ops.py @@ -258,6 +258,33 @@ def metadata( ) +@op( + name="artifactVersion-rawTags", + output_type=types.List( + types.TypedDict( + { + "id": types.String(), + "name": types.String(), + "tagCategoryName": types.String(), + "attributes": types.String(), + } + ) + ), + plugins=wb_gql_op_plugin( + lambda inputs, inner: """ + tags { + id + name + tagCategoryName + attributes + } + """ + ), +) +def artifact_version_raw_tags(artifact: wdt.ArtifactVersion): + return artifact["tags"] + + @op( name="artifactVersion-createdBy", plugins=wb_gql_op_plugin( diff --git a/weave/legacy/panels/panel_legacy.py b/weave/legacy/panels/panel_legacy.py index 5ad965c55a1..4673c7ab3e8 100644 --- a/weave/legacy/panels/panel_legacy.py +++ b/weave/legacy/panels/panel_legacy.py @@ -31,6 +31,7 @@ class LPanel: LPanel("run-overview", "PanelRunOverview"), LPanel("none", "PanelNone"), LPanel("artifactVersionAliases", "PanelArtifactVersionAliases"), + LPanel("artifactVersionTags", "PanelArtifactVersionTags"), LPanel("netron", "PanelNetron"), LPanel("object", "PanelObject"), LPanel("audio-file", "PanelAudioFile"),