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: unified actions selectors #2749

Merged
merged 24 commits into from
Jul 14, 2023
Merged

feat: unified actions selectors #2749

merged 24 commits into from
Jul 14, 2023

Conversation

skokenes
Copy link
Contributor

@skokenes skokenes commented Jul 6, 2023

Checklist

  • Manual verification
  • Unit test coverage
  • E2E test coverage
  • Needs manual QA?

Summary

Issue addressed:

Details:

Steps to Verify

@skokenes skokenes changed the base branch from main to feat/business-model-context July 6, 2023 18:38
Comment on lines +14 to +32
return derived(
[ctx.runtime, ctx.metricsViewName],
([runtime, metricViewName], set) => {
return createRuntimeServiceGetCatalogEntry(
runtime.instanceId,
metricViewName,
{
query: {
select: (data) =>
selector
? selector(data?.entry?.metricsView)
: data?.entry?.metricsView,
queryClient: ctx.queryClient,
},
}
).subscribe(set);
}
);
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we use the v5 reactivity pattern and put the derived store within the createQuery (or createOrvalGeneratedQuery) call?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Really interesting idea that I hadn't considered. Let's discuss as a team, I see pros and cons:

  • pro: will make moving to sq5 easier later
  • cons: will require more code changes as we refactor here. Not clear yet how exactly we want to use sq5 API so we may be guessing at this point

Copy link
Collaborator

Choose a reason for hiding this comment

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

Would we need to make tweaks to orval generator? Does it even allow us to do this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point @AdityaHegde , I don't think we could touch the orval generated query.
What we could do is make our options into these wrapper methods stores, so at least it matches future APIs.
But IMO its overkill for now. We should wait until sq5 is stable before we try to do any migration in that direction, with the exception of the query client thing because we can't get around that.

Copy link
Contributor

Choose a reason for hiding this comment

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

I like this!

@skokenes skokenes mentioned this pull request Jun 27, 2023
5 tasks
(meta) => !!meta?.timeDimension
) as CreateQueryResult<boolean>;

export const getFilterSearchList = (
Copy link
Collaborator

Choose a reason for hiding this comment

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

Great! I was looking to do something similar in my time control refactor (The derived store would only depend on dashboardStore and the new time range data store). Perhaps makes senes to add more such extractions in future PRs.

Base automatically changed from feat/business-model-context to main July 11, 2023 19:31
@skokenes skokenes marked this pull request as ready for review July 12, 2023 19:17
absenceCallback?: () => MetricsExplorerEntity
) => {
const name = get(dashboardStore).name;
updateMetricsExplorerByName(name, callback, absenceCallback);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This redirect to updateMetricsExplorerByName feels unnecessary. Perhaps add a TODO to move the body of updateMetricsExplorerByName here once we refactor everything to use updateDashboard.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I agree, I will leave a TODO here for now.
The reason I didn't outright do it yet is that it requires access to the update method from the MetricsExplorerStore, and that method is currently not publicly exposed outside of the singleton file where MetricsExplorerStore is created.

@skokenes skokenes merged commit a83b0c3 into main Jul 14, 2023
2 checks passed
@skokenes skokenes deleted the feat/unified-actions-selectors branch July 14, 2023 18:14
djbarnwal pushed a commit that referenced this pull request Aug 3, 2023
* feat: init context sharing

* example

* fix: lint issue

* cleanup

* ex refactor wip

* wip refactor

* cleanup

* type

* fix: fork sq

* cleanup

* cleanup

* move value check to enabled prop

* remove business model

* remove business model

* fix merge

* fix: type error

* fix: types

* feat: consolidate action code

* fix: remove unused

* fix: added comment

* fix: optional search results
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.

3 participants