Skip to content

Commit

Permalink
Support for Testing ViewManager Revert Button (#738)
Browse files Browse the repository at this point in the history
  • Loading branch information
lbwexler authored Nov 19, 2024
1 parent bc993a1 commit 90ddc3c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export class ViewManagerTestModel extends HoistModel {
{name: 'enableAutoSave', displayName: 'AutoSave', initialValue: true},
{name: 'enableFavorites', displayName: 'Faves', initialValue: true},
{name: 'showSaveButton', initialValue: 'whenDirty'},
{name: 'showRevertButton', initialValue: 'never'},
{
name: 'showPrivateViewsInSubMenu',
displayName: 'Show private views in sub-menu',
Expand Down
10 changes: 10 additions & 0 deletions client-app/src/admin/tests/viewmanager/ViewManagerTestPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ const modelConFigForm = hoistCmp.factory<ViewManagerTestModel>({
enableFilter: false
})
}),
formField({
field: 'showRevertButton',
item: select({
options: ['always', 'never', 'whenDirty'],
enableFilter: false
})
}),
hbox(
formField({
field: 'showPrivateViewsInSubMenu',
Expand Down Expand Up @@ -175,6 +182,7 @@ const persistablesPanel = hoistCmp.factory<ViewManagerTestModel>({

const {
showSaveButton,
showRevertButton,
showPrivateViewsInSubMenu,
showSharedViewsInSubMenu,
customMenuButtonProps
Expand All @@ -190,6 +198,7 @@ const persistablesPanel = hoistCmp.factory<ViewManagerTestModel>({
tbar: [
viewManager({
showSaveButton,
showRevertButton,
showPrivateViewsInSubMenu,
showSharedViewsInSubMenu,
menuButtonProps
Expand Down Expand Up @@ -293,6 +302,7 @@ const persistablesPanel = hoistCmp.factory<ViewManagerTestModel>({
const persistedComp = hoistCmp.factory({
model: uses(ViewManagerTestModel),
render({title, icon, persistPath, children, model, minHeight}) {
if (!persistPath) return null;
const {value, pendingValue} = model.viewManagerModel,
compVal = get(value, persistPath),
compPendingVal = get(pendingValue, persistPath),
Expand Down

0 comments on commit 90ddc3c

Please sign in to comment.