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

Add page parameters to navigation actions #1876

Merged
merged 33 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7bb9ca0
Add page parameters to navigation actions
apedroferreira Apr 12, 2023
b1f0489
Non-working bindings for actions + fix circular dependency hell
apedroferreira Apr 12, 2023
c351057
where did this even come from
apedroferreira Apr 12, 2023
99bb4a3
Fix types
apedroferreira Apr 12, 2023
d8c8c0b
Working page parameter bindings
apedroferreira Apr 13, 2023
2007d59
Fix and add test
apedroferreira Apr 13, 2023
005f5d1
Merge remote-tracking branch 'origin/master' into add-navigation-page…
apedroferreira Apr 13, 2023
31d818a
Merge remote-tracking branch 'origin/master' into add-navigation-page…
apedroferreira Apr 14, 2023
2d7dcdc
Merge remote-tracking branch 'origin/master' into add-navigation-page…
apedroferreira Apr 20, 2023
07c2cee
Merge remote-tracking branch 'origin/master' into add-navigation-page…
apedroferreira Apr 21, 2023
4d738a0
Fixes for rebase + new page file structure
apedroferreira Apr 21, 2023
30c2075
hehe
apedroferreira Apr 21, 2023
8bcf041
Remove unneeded fixture things
apedroferreira Apr 21, 2023
13bcc23
Fix page name
apedroferreira Apr 21, 2023
d28474c
Merge remote-tracking branch 'origin/master' into add-navigation-page…
apedroferreira Apr 21, 2023
e6d0e88
Improve test for navigation overall + see if CI passes
apedroferreira Apr 21, 2023
80a4dfe
Better test
apedroferreira Apr 21, 2023
8e4fec1
Attempt to get CI to pass again
apedroferreira Apr 21, 2023
1fcd96e
Remove check to try to debug issue in CI
apedroferreira Apr 21, 2023
1e44bbb
Revert "Remove check to try to debug issue in CI"
apedroferreira Apr 21, 2023
e68d8e0
Merge remote-tracking branch 'origin/master' into add-navigation-page…
apedroferreira Apr 24, 2023
c1fe290
Another attempt to make CI pass
apedroferreira Apr 24, 2023
4185ed8
Try again
apedroferreira Apr 24, 2023
f8d176d
Try using different method
apedroferreira Apr 24, 2023
e2ce209
Merge remote-tracking branch 'origin/master' into add-navigation-page…
apedroferreira Apr 26, 2023
e057975
Use $ref instead of $$ref everywhere (mystery solved?)
apedroferreira Apr 26, 2023
c246b3d
Forgot this one
apedroferreira Apr 27, 2023
55cd8ba
Refactor with ignored cycle to see what changed
apedroferreira Apr 27, 2023
ef1980a
Revert some more changes
apedroferreira Apr 27, 2023
4e1c55c
fix lint
apedroferreira Apr 27, 2023
6ff80f1
Merge remote-tracking branch 'origin/master' into add-navigation-page…
apedroferreira Apr 27, 2023
3d255de
Document navigation actions
apedroferreira Apr 28, 2023
558648b
Allow navigating to same page
apedroferreira Apr 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/toolpad-app/src/server/localMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ function mergeThemeIntoAppDom(dom: appDom.AppDom, themeFile: Theme): appDom.AppD
}

function toBindable<V>(value: V | { $$jsExpression: string }): BindableAttrValue<V> {
console.log('fuck');
Copy link
Member

Choose a reason for hiding this comment

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

😂

if (value && typeof value === 'object' && typeof (value as any).$$jsExpression === 'string') {
return { type: 'jsExpression', value: (value as any).$$jsExpression };
}
Expand All @@ -410,7 +411,10 @@ function toBindableProp<V>(value: V | { $$jsExpression: string }): BindableAttrV
if (typeof (value as any).$$jsExpressionAction === 'string') {
return { type: 'jsExpressionAction', value: (value as any).$$jsExpressionAction };
}
if (typeof (value as any).$$navigationAction === 'string') {
if (
typeof (value as any).$$navigationAction === 'string' ||
typeof (value as any).$$navigationAction === 'object'
) {
const action = value as any as NavigationAction;
return {
type: 'navigationAction',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Box, Typography, TextField, MenuItem } from '@mui/material';
import * as React from 'react';
import { BindableAttrValue, NavigationAction, NodeId } from '@mui/toolpad-core';
import { mapValues } from '@mui/toolpad-utils/collections';
import { WithControlledProp } from '../../../utils/types';
import { useDom } from '../../AppState';
import * as appDom from '../../../appDom';
import { usePageEditorState } from '../PageEditor/PageEditorProvider';
import { mapValues } from '../../../utils/collections';
import BindableEditor from '../PageEditor/BindableEditor';
import { useBindingEditorContext } from '.';
import { useEvaluateLiveBinding } from '../useEvaluateLiveBinding';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
BindableAttrValue,
PropValueType,
} from '@mui/toolpad-core';
import { createProvidedContext } from '@mui/toolpad-core/utils/react';
import { createProvidedContext } from '@mui/toolpad-utils/react';
import { JsExpressionEditor } from '../PageEditor/JsExpressionEditor';
import JsonView from '../../../components/JsonView';
import useLatest from '../../../utils/useLatest';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import QueryPreview from '../QueryPreview';
import { usePrivateQuery } from '../context';
import BindableEditor from '../../toolpad/AppEditor/PageEditor/BindableEditor';
import { getDefaultControl } from '../../toolpad/propertyControls';
import { errorFrom } from '../../utils/errors';
import { PropBindingEditorDialog } from '../../toolpad/AppEditor/BindingEditor/PropBindingEditorDialog';

const EMPTY_PARAMS: BindableAttrEntries = [];
Expand Down
109 changes: 0 additions & 109 deletions test/integration/bindings/fixture-navigation/toolpad.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.generated
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: v1
kind: page
spec:
id: ld03upm
title: page
content:
- component: PageRow
name: pageRow
children:
- component: Button
name: button
props:
onClick:
$$navigationAction:
page: au03sef
parameters:
abc: zyx
def:
$$jsExpression: |
button.content
content: test
display: shell
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: page
spec:
id: au03sef
title: page2
parameters:
- name: abc
value: "123"
- name: def
value: "456"
display: shell
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: theme
spec:
palette.mode: light
palette.primary.main: purple
palette.secondary.main: indigo