Page MenuHomePhabricator

Preserve folded YAML sections in the config editor
Needs ReviewPublic

Authored by bengotow on Fri, Oct 4, 10:55 PM.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

This diff stores the currently collapsed / folded segments of YAML into local storage and restores them. Folding is saved per-pipeline, so collapsing the "solids" section of one pipeline in the config editor won't collapse it for other pipelines, but will collapse it in all the tabs of the current one. To make it fairly robust, the collapsed state refers to YAML paths (eg: "resources.config.db_info") not line numbers.

Test Plan

Run tests

Diff Detail

Repository
R1 dagster
Branch
bengotow/-cm-states
Lint
Lint OK
Unit
No Unit Test Coverage

Event Timeline

bengotow created this revision.Fri, Oct 4, 10:55 PM

how does this work with multiple tabs open?

js_modules/dagit/src/configeditor/ConfigEditor.tsx
88–192

scaredbaby

this feels very complex for the utility it buys

92–94

make sure to test changes on a long document.

this feels off to keep in as a comment - is this a note to yourself for this diff?

max added a subscriber: max.Mon, Oct 7, 8:25 PM

What happens when two pipelines in different repositories share the same name?

Hey folks! re: complexity I sort of agree - I could move this to a separate file / plugin type of thing, but it's definitely less straightforward than I'd hoped. We could switch to just storing line numbers that are folded instead of YAML paths, but I think being able to move between tabs and have your folding preserved is kind of nice, and with just indexes we might apply the folding incorrectly and not know. (eg: "fold line 12" might result in something being incorrectly folded if the YAML had changed.)

Re: same pipeline in different repos, the two pipelines with the same name would share folding state. Not sure if that's worth fixing. I'd debating just making the whole app use a single folded state but I imagined folks would be interested in different chunks for different pipelines.

Re: multiple tabs, the last tab in which you folded/unfold part of the document "wins" and determines the folding state on reload / new page.

Anyway—just let me know about this one! I'm totally fine abandoning if we think the code surface area just isn't worth it.

js_modules/dagit/src/configeditor/ConfigEditor.tsx
92–94

Ahh I just left this for future-me. Basically if you edit this function you need to use a YAML document that is more than 40 lines long or it might appear to be working fine when it's really not.