Skip to content

Add name to an existing dataclip #3409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open

Conversation

midigofrank
Copy link
Collaborator

@midigofrank midigofrank commented Jul 15, 2025

Description

  • Allow users to name existing dataclips.
  • Only project editors are allowed to name dataclips.
  • You can search and filter using the name

Closes #311

Validation steps

Log in as a project editor, admin, owner

  1. Click to open the job panel
  2. On the job panel, click Run and then choose Existing on the select box that appears
  3. Choose any of the listed dataclips.
  4. Just above the dataclip uuid, you'll see an input box with a placeholder Enter label
  5. Type in any name, and then go back to the dataclip menu.
  6. You'll notice that the name you set above is now displayed instead of the uuid.
  7. In the dataclip search bar, you'll see a tag icon. Click on it.
  8. Of all the listed dataclips, notice that only the ones with the names will be listed. (in our case it will only be one)

Log in as a project viewer

When logged in a viewer, you don't get access to the input box for naming a dataclip.

  • If the dataclip has a name, you'll see the label, but not in an input box
  • If the dataclip has no name, you won't even get to see the label row

Additional notes for the reviewer

  • I have reduced the x padding of the buttons to have the fit one line when you open the inspector
  • I have disabled credo warnings for the dataclip filter Enum.reduce

AI Usage

Please disclose how you've used AI in this work (it's cool, we just want to know!):

  • Code generation (copilot but not intellisense)
  • Learning or fact checking
  • Strategy / design
  • Optimisation / refactoring
  • Translation / spellchecking / doc gen
  • Other
  • I have not used AI

You can read more details in our Responsible AI Policy

Pre-submission checklist

  • I have performed a self-review of my code.
  • I have implemented and tested all related authorization policies. (e.g., :owner, :admin, :editor, :viewer)
  • I have updated the changelog.
  • I have ticked a box in "AI usage" in this PR

@midigofrank midigofrank self-assigned this Jul 15, 2025
@github-project-automation github-project-automation bot moved this to New Issues in v2 Jul 15, 2025
@midigofrank midigofrank changed the title Name a dataclip Add name to an existing dataclip Jul 15, 2025
@midigofrank midigofrank force-pushed the 311-name-a-dataclip branch from 619e77e to a49b2f4 Compare July 15, 2025 12:59
Copy link

codecov bot commented Jul 15, 2025

Codecov Report

Attention: Patch coverage is 75.55556% with 11 lines in your changes missing coverage. Please review.

Project coverage is 90.01%. Comparing base (a53b139) to head (0edd1a7).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
lib/lightning/invocation.ex 64.28% 10 Missing ⚠️
lib/lightning_web/live/workflow_live/edit.ex 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3409      +/-   ##
==========================================
+ Coverage   89.99%   90.01%   +0.01%     
==========================================
  Files         368      369       +1     
  Lines       14408    14436      +28     
==========================================
+ Hits        12967    12994      +27     
- Misses       1441     1442       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@midigofrank midigofrank force-pushed the 311-name-a-dataclip branch from a49b2f4 to 3611687 Compare July 17, 2025 08:52
@midigofrank midigofrank force-pushed the 311-name-a-dataclip branch from 3611687 to c8e7207 Compare July 17, 2025 13:50
@midigofrank midigofrank marked this pull request as ready for review July 17, 2025 15:11
@midigofrank
Copy link
Collaborator Author

@taylordowns2000 as always, your feature breaking skills are always appreciated

@midigofrank midigofrank requested a review from stuartc July 17, 2025 15:21
@midigofrank
Copy link
Collaborator Author

@doc-han how do you rate my gpt-assisted React skills?

Copy link
Member

@taylordowns2000 taylordowns2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @midigofrank , looking great. Started a canvas for the UI. The only big things I can see from a logic perspective are:

  1. it crashes on duplicates
  2. the search by name doesn't work
[error] GenServer #PID<0.6943.0> terminating
** (Ecto.ConstraintError) constraint error when attempting to update struct:

    * "dataclips_name_project_id_index" (unique_constraint)

@github-project-automation github-project-automation bot moved this from New Issues to In review in v2 Jul 17, 2025
@midigofrank midigofrank requested review from elias-ba and removed request for stuartc July 18, 2025 11:48
Copy link
Member

@taylordowns2000 taylordowns2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all good except for vertical alignment of text and icons in the list view.

Image

Copy link
Member

@taylordowns2000 taylordowns2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UI looks great!

  1. please add an audit trail event for the creation and removal of a label, then i think we're good
  2. please add a flash message when a label is added "Label created. Dataclip will be saved permanently."
  3. please add a flash message when a label is removed "Label deleted. Dataclip will be purged when your retention policy limit is reached."

@midigofrank
Copy link
Collaborator Author

@taylordowns2000 I've added the audits and flash messages

* not just prefix for name

* update remaining mentions :name_prefix

---------

Co-authored-by: Frank Midigo <[email protected]>
Copy link
Member

@taylordowns2000 taylordowns2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great, but it seems as though the search doesn't return a named dataclip when that named dataclip is the next cron run. In this image, I'd expect "long" to match and it does. I'd also expect "here" to match, but it returns no results.

image

This isn't likely a big problem, as the next cron run will almost never be named/saved. But it's still strange enough to warrant some investigation. Please see if you can get it to return when searching for the name of the next cron run.

@midigofrank
Copy link
Collaborator Author

@midigofrank
Copy link
Collaborator Author

I have run into a situation where if the query is of base 16, like abc, the filter will only search for uuids. Because of this, I'm changing the id_prefix filter to be name_or_id_part.

@taylordowns2000 taylordowns2000 removed the request for review from doc-han July 21, 2025 08:42
Copy link
Member

@taylordowns2000 taylordowns2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@midigofrank , as of the last commit 0edd1a7 I'm seeing this crash when searching for either a name or a UUID:

[error] GenServer #PID<0.874.0> terminating
** (FunctionClauseError) no function clause matching in String.downcase/2
    (elixir 1.18.3) lib/string.ex:930: String.downcase(nil, :default)
    (lightning 2.13.5) lib/lightning/invocation.ex:884: anonymous fn/2 in Lightning.Invocation.dataclip_matches_filters?/2
    (elixir 1.18.3) lib/enum.ex:383: anonymous fn/3 in Enum.all?/2
    (elixir 1.18.3) lib/enum.ex:4968: Enumerable.List.reduce/3
    (elixir 1.18.3) lib/enum.ex:382: Enum.all?/2
    (lightning 2.13.5) lib/lightning/invocation.ex:838: Lightning.Invocation.list_dataclips_with_cron_state/3
    (lightning 2.13.5) lib/lightning_web/live/workflow_live/new_manual_run.ex:26: LightningWeb.WorkflowLive.NewManualRun.search_selectable_dataclips/4
    (lightning 2.13.5) lib/lightning_web/live/workflow_live/edit.ex:1533: LightningWeb.WorkflowLive.Edit.handle_event/3
    (phoenix_live_view 1.0.9) lib/phoenix_live_view/channel.ex:509: anonymous fn/3 in Phoenix.LiveView.Channel.view_handle_event/3
    (telemetry 1.3.0) /Users/taylor/OpenFn/lightning/deps/telemetry/src/telemetry.erl:324: :telemetry.span/3
    (phoenix_live_view 1.0.9) lib/phoenix_live_view/channel.ex:260: Phoenix.LiveView.Channel.handle_info/2
    (stdlib 6.2.2) gen_server.erl:2345: :gen_server.try_handle_info/3
    (stdlib 6.2.2) gen_server.erl:2433: :gen_server.handle_msg/6
    (stdlib 6.2.2) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
Last message: %Phoenix.Socket.Message{topic: "lv:phx-GFQ4wxZixv9Rfj7B", event: "event", payload: %{"event" => "search-selectable-dataclips", "type" => "hook", "value" => %{"job_id" => "17a6ec8a-5812-4dfd-8a14-82861bbd0921", "limit" => 10, "search_text" => "query=funky"}}, ref: "73", join_ref: "62"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

Name a dataclip
2 participants