From 4455cf2d3b0d6a8b9bc09fc41eb94525ba36b3a1 Mon Sep 17 00:00:00 2001 From: elijahbenizzy Date: Tue, 5 Mar 2024 18:59:50 -0800 Subject: [PATCH] Changes from PR --- docs/concepts/additional-visibility.rst | 18 +++++++++++------- telemetry/ui/src/components/common/href.tsx | 9 ++++++++- .../ui/src/components/routes/ProjectList.tsx | 4 +++- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/docs/concepts/additional-visibility.rst b/docs/concepts/additional-visibility.rst index 885567af..9a6fa14d 100644 --- a/docs/concepts/additional-visibility.rst +++ b/docs/concepts/additional-visibility.rst @@ -25,8 +25,8 @@ For the function-based API, this would look as follows: from burr.visibility import TracingFactory from burr.core import action - @action(reads=['input_var'], writes=['output_var'], __tracer: TracingFactory) - def my_action(state: State) -> Tuple[dict, State]: + @action(reads=['input_var'], writes=['output_var']) + def my_action(state: State, __tracer: TracingFactory) -> Tuple[dict, State]: with __tracer('process_data'): initial_data = _process_data(state['input_var']) with __tracer('validate_data'): @@ -68,19 +68,23 @@ For instance: .. code-block:: python - from burr.visibility import TracingFactory + from burr.visibility import TracingFactory, ArtifactLogger from burr.core import action - @action(reads=['input_var'], writes=['output_var'], __tracer: TracingFactory) - def my_action(state: State) -> Tuple[dict, State]: + @action(reads=['input_var'], writes=['output_var']) + def my_action( + state: State, + __tracer: TracingFactory, + __logger: ArtifactLogger + ) -> Tuple[dict, State]: with __tracer('process_data'): initial_data = _process_data(state['input_var']) with __tracer('validate_data'): validation_results = _validate(initial_data) t.log_artifact(validation_results=validation_results) - with __tracer('transform_data', dependencies=['process_data']) as t: + with __tracer('transform_data', dependencies=['process_data']) transformed_data = _transform(initial_data) - t.log_artifact(transformed_data_size=len(transformed_data)) + __logger.log_artifact(transformed_data_size=len(transformed_data)) return {'output_var': transformed_data}, state.update({'output_var': transformed_data}) diff --git a/telemetry/ui/src/components/common/href.tsx b/telemetry/ui/src/components/common/href.tsx index c5e5e05a..6901d58f 100644 --- a/telemetry/ui/src/components/common/href.tsx +++ b/telemetry/ui/src/components/common/href.tsx @@ -4,7 +4,14 @@ */ export const LinkText = (props: { href: string; text: string }) => { return ( - + { + // Quick trick to ensure that this takes priority and if this has a parent href, it doesn't trigger + e.stopPropagation(); + }} + > {props.text} ); diff --git a/telemetry/ui/src/components/routes/ProjectList.tsx b/telemetry/ui/src/components/routes/ProjectList.tsx index 1927761e..b332fa22 100644 --- a/telemetry/ui/src/components/routes/ProjectList.tsx +++ b/telemetry/ui/src/components/routes/ProjectList.tsx @@ -6,12 +6,14 @@ import { DateDisplay } from '../common/dates'; import { Button } from '../common/button'; import { Chip } from '../common/chip'; import { LinkText } from '../common/href'; +import { useNavigate } from 'react-router-dom'; /** * Table of a project list. Uses the tailwind catalyst component. * This does not load or fetch any data, just renders it */ export const ProjectListTable = (props: { projects: Project[] }) => { + const navigate = useNavigate(); const projectsCopy = [...props.projects]; const projectsSorted = projectsCopy.sort((a, b) => { return a.last_written > b.last_written ? -1 : 1; @@ -44,7 +46,7 @@ export const ProjectListTable = (props: { projects: Project[] }) => { navigate(`/project/${project.id}`)} >