-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1130 from merico-dev/1129-aggregation-by-a-custom…
…-function 1129 aggregation by a custom function
- Loading branch information
Showing
16 changed files
with
143 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
dashboard/src/components/widgets/modal-function-editor/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Box, Button, Group, Modal } from '@mantine/core'; | ||
import { useDisclosure } from '@mantine/hooks'; | ||
import { forwardRef } from 'react'; | ||
import { InlineFunctionInput } from '../inline-function-input'; | ||
import { AnyObject } from '~/types'; | ||
|
||
interface Props { | ||
value: TFunctionString; | ||
onChange: (v: TFunctionString) => void; | ||
defaultValue: TFunctionString; | ||
label: string; | ||
triggerLabel?: string; | ||
triggerButtonProps?: AnyObject; | ||
} | ||
|
||
export const ModalFunctionEditor = forwardRef( | ||
({ value, onChange, label, triggerLabel = 'Edit', triggerButtonProps = {}, defaultValue }: Props, _ref: any) => { | ||
const [opened, { open, close }] = useDisclosure(false); | ||
|
||
return ( | ||
<> | ||
<Modal opened={opened} onClose={close} title="Authentication" withinPortal zIndex={320} size="900px"> | ||
<Box h={600}> | ||
<InlineFunctionInput value={value} onChange={onChange} defaultValue={defaultValue} label={label} /> | ||
</Box> | ||
</Modal> | ||
|
||
<Button onClick={open} {...triggerButtonProps}> | ||
{triggerLabel} | ||
</Button> | ||
</> | ||
); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import _ from 'lodash'; | ||
import { AnyObject } from '..'; | ||
|
||
function printChanges(a: any, b: any) { | ||
if (_.isEqual(a, b)) { | ||
return; | ||
} | ||
if (Array.isArray(a) && Array.isArray(b)) { | ||
a.forEach((_a, i) => { | ||
printChanges(_a, b[i]); | ||
}); | ||
return; | ||
} | ||
console.log(a, b); | ||
} | ||
|
||
export function printJSONChanges(a: AnyObject, b: AnyObject) { | ||
Object.keys(a).forEach((k) => { | ||
printChanges(a[k], b[k]); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@devtable/root", | ||
"version": "10.18.1", | ||
"version": "10.19.0", | ||
"private": true, | ||
"workspaces": [ | ||
"api", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters