Skip to content
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

feat: new console pages for config, data, database, enum, secret, and typealias #2617

Merged
merged 4 commits into from
Sep 5, 2024

Conversation

deniseli
Copy link
Contributor

@deniseli deniseli commented Sep 4, 2024

Part 1 of #2616

Adds (or significantly adds to) pages for the following decl types:

  • config
  • data
  • database
  • enum
  • secret
  • typealias

Not yet added: FSM, topic, subscription

Adds components for:

  • DeclLink: takes a ref and links to the page for that decl
  • TypeEl: renders an appropriate string for a given Type, with links if appropriate
  • PanelHeader renders the standard decl panel page header (e.g. comments, export badge)

temp

temp

data panel

refac

typealias and some component refactors

lint

lint

database and enum

comments

rm go-runtime files

cleanup

hover class
@deniseli deniseli marked this pull request as ready for review September 4, 2024 21:25
@deniseli deniseli requested a review from alecthomas as a code owner September 4, 2024 21:25
@deniseli deniseli requested review from a team and wesbillman and removed request for a team September 4, 2024 21:25
frontend/console/src/features/modules/decls/DataPanel.tsx Outdated Show resolved Hide resolved
frontend/console/src/features/modules/decls/DeclLink.tsx Outdated Show resolved Hide resolved
Comment on lines +7 to +17
const schema = useSchema()
const decl = useMemo(() => {
const modules = (schema?.data || []) as PullSchemaResponse[]
const module = modules.find((m: PullSchemaResponse) => m.moduleName === moduleName)
if (!module?.schema) {
return
}
return module.schema.decls.find((d) => d.value.value?.name === declName)
}, [moduleName, declName, schema?.data])

const str = moduleName ? `${moduleName}.${declName}` : declName
Copy link
Collaborator

Choose a reason for hiding this comment

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

I've been personally finding that it's easier to make "dumb" components and feed the data into them, vs. having to have useSchema type hooks in the smaller sub components. This also makes them much easier to write storybook stories for since they don't have any real dependencies. Whatcha think?

Copy link
Contributor Author

@deniseli deniseli Sep 5, 2024

Choose a reason for hiding this comment

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

Normally I follow that pattern too, but in this case, DeclLink is used by TypeEl, which in turn is used by most of the decl-type panels. We'd end up having to thread it through all the way, which would make the props for all of those components more complicated just for only DeclLink to actually use the contents. It gets worse from there, because DeclLink is probably going to end up all over the console once we're through, at which point we're basically passing schema down through nearly every single component in the tree. That would almost completely defeat the purpose of the hook pattern to begin with. :/

Copy link
Collaborator

Choose a reason for hiding this comment

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

Awesome! Yeah, definitely seems easier to keep this here then. Thanks for the clarification!

frontend/console/src/features/modules/decls/TypeEl.tsx Outdated Show resolved Hide resolved
frontend/console/src/features/modules/decls/TypeEl.tsx Outdated Show resolved Hide resolved
Copy link
Collaborator

@wesbillman wesbillman left a comment

Choose a reason for hiding this comment

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

Niiiiice! This is awesome

@wesbillman wesbillman added this pull request to the merge queue Sep 5, 2024
Merged via the queue into main with commit 21956b5 Sep 5, 2024
23 checks passed
@wesbillman wesbillman deleted the dli/mini-pages branch September 5, 2024 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants