-
Notifications
You must be signed in to change notification settings - Fork 9
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
New ViewManager
for persisting named bundles of grid and other component state
#3774
Conversation
svc/JsonBlobService.ts
Outdated
value, | ||
meta, | ||
description | ||
}: { | ||
type: string; | ||
name: string; | ||
acl?: string | PlainObject; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why PlainObject
?
saveDialog({omit: !saveDialogModel}) | ||
); | ||
render({model, ...props}) { | ||
return fragment(defaultMenu({...props}), manageDialog(), saveDialog()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To discuss - either exporting the dialogs, exposing more props for customizing, or making them pluggable (i.e. PersistenceManagerProps
could accept a manageDialogCmp
and saveDialogCmp
that default to our Hoist implementations)
@@ -114,7 +129,8 @@ const objMenu = hoistCmp.factory<PersistenceManagerProps>({ | |||
}), | |||
menuItem({ | |||
icon: Icon.refresh(), | |||
text: 'Reset Defaults', | |||
text: 'Reset Default View', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discuss today - Reset vs Restore. Or maybe there’s a better phrasing entirely?
/** Fn to produce a new, empty object - can be async. */ | ||
newObjectFnAsync?: () => T; | ||
/** Optional flag to force selection of a view. Defaults false*/ | ||
allowEmpty?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this - interested in discussing as a group this afternoon
@@ -229,6 +218,7 @@ export class PersistenceManagerModel<T extends PlainObject = PlainObject> extend | |||
|
|||
this.setPendingValue(value); | |||
await this.onChangeAsync(value); | |||
this._loadedInitially = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be nice if we can leverage the LoadSupport
API to check if we’ve already completed a successful load.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That way we wouldn’t need this update this observable and could just have a getter.
isFavorite: boolean; | ||
} | ||
| { | ||
type: 'divider'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would remove divider
. To me, that’s a view-level concern and not a concern of the model / data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without 'divider' how would we know where to put in the menuDivider? we could add a group
prop to PersistenceViewTree
and have some logic on the component?
// Persistence Provider | ||
// Pass this to models that implement `persistWith` to include their state in the view. | ||
//------------------------ | ||
readonly provider: PersistOptions = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonder if we should make a new PersistenceManagerProvider
class that extends PersistenceProvider
so the API is consistent with DashViewProvider
.
Don't auto save when default view is selected
ViewManager
for persisting named bundles of grid and other component state
Latest process tracked @ #3821 |
Hoist P/R Checklist
Pull request authors: Review and check off the below. Items that do not apply can also be
checked off to indicate they have been considered. If unclear if a step is relevant, please leave
unchecked and note in comments.
develop
branch as of last change.breaking-change
label + CHANGELOG if so.If your change is still a WIP, please use the "Create draft pull request" option in the split
button below to indicate it is not ready yet for a final review.
Remaining TODOs:
Restore view
function when Default view is selected