-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(25263): Relocate subscriptions to the workspace * refactor(25263): refactor the inward/outward icons * feat(25263): add right side panel for devices * feat(25263): add types for the subscription manager * feat(25263): add navigate for the adapter toolbar * feat(25263): add config panel for subscriptions * feat(25263): add RJSF wrapper * feat(25263): add management of the subscription properties from the J… * feat(25263): add expand/collapse button on the panel * feat(25263): add form * feat(25263): add mock outward subscription JSONSchema * refactor(25263): add support for `create` and `multiple` options in t… * feat(25263): add right side panel for devices * chore(25263): a bit of cleaning * feat(25263): add type for the outward subscriptions * fix(25263): add submit handling * fix(25263): fix bug with creatable options * fix(25263): fix type * fix(25263): fix layout * feat(25263): add a custom field for deprecated/hidden feature in a RJ… * fix(25263): fix type * test(25263): add tests * test(25263): add tests * fix(25263): fix type * chore(25263): rename component * test(25263): add tests * refactor(25263): refactor the subscription manager * test(25263): add tests * refactor(25263): refactor the expand button * test(25263): add tests * refactor(25263): refactor error handling * fix(25263): fix props * fix(25263): fix error message * test(25263): add tests * chore(25263): a bit of cleaning * fix(25263): fix condition * refactor(25263): fix extraction * test(25263): remove deprecated only * refactor(25263): improve literals * chore(25263): a bit of cleaning
- Loading branch information
Showing
33 changed files
with
1,039 additions
and
27 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
25 changes: 25 additions & 0 deletions
25
hivemq-edge/src/frontend/src/components/Chakra/DrawerExpandButton.spec.cy.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,25 @@ | ||
import DrawerExpandButton from '@/components/Chakra/DrawerExpandButton.tsx' | ||
|
||
describe('DrawerExpandButton', () => { | ||
beforeEach(() => { | ||
cy.viewport(400, 150) | ||
}) | ||
|
||
it('should render expanded properly', () => { | ||
cy.mountWithProviders(<DrawerExpandButton isExpanded={true} toggle={cy.stub().as('toggle')} />) | ||
cy.get('button').should('have.attr', 'data-expanded', 'true') | ||
|
||
cy.get('@toggle').should('not.have.been.called') | ||
cy.get('button').click() | ||
cy.get('@toggle').should('have.been.called') | ||
}) | ||
|
||
it('should render shrunk properly', () => { | ||
cy.mountWithProviders(<DrawerExpandButton isExpanded={false} toggle={cy.stub().as('toggle')} />) | ||
cy.get('button').should('have.attr', 'data-expanded', 'false') | ||
|
||
cy.get('@toggle').should('not.have.been.called') | ||
cy.get('button').click() | ||
cy.get('@toggle').should('have.been.called') | ||
}) | ||
}) |
35 changes: 35 additions & 0 deletions
35
hivemq-edge/src/frontend/src/components/Chakra/DrawerExpandButton.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,35 @@ | ||
import { FC } from 'react' | ||
import { IconButton, IconButtonProps } from '@chakra-ui/react' | ||
import { LuExpand, LuShrink } from 'react-icons/lu' | ||
import { useTranslation } from 'react-i18next' | ||
|
||
interface DrawerExpandButtonProps extends Omit<IconButtonProps, 'aria-label'> { | ||
isExpanded: boolean | ||
toggle: () => void | ||
} | ||
|
||
const DrawerExpandButton: FC<DrawerExpandButtonProps> = ({ isExpanded, toggle, ...props }) => { | ||
const { t } = useTranslation('components') | ||
return ( | ||
<IconButton | ||
{...props} | ||
variant="ghost" | ||
colorScheme="gray" | ||
onClick={toggle} | ||
data-expanded={isExpanded} | ||
icon={isExpanded ? <LuShrink /> : <LuExpand />} | ||
style={{ | ||
position: 'absolute', | ||
top: 'var(--chakra-space-2)', | ||
right: 0, | ||
width: '32px', | ||
height: '32px', | ||
transform: 'translate(-48px, 0)', | ||
minWidth: 'inherit', | ||
}} | ||
aria-label={isExpanded ? t('DrawerExpandButton.aria-label.shrink') : t('DrawerExpandButton.aria-label.expand')} | ||
/> | ||
) | ||
} | ||
|
||
export default DrawerExpandButton |
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
29 changes: 29 additions & 0 deletions
29
hivemq-edge/src/frontend/src/components/react-icons/hm/HmInput.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,29 @@ | ||
import { GenIcon, IconBaseProps } from 'react-icons' | ||
|
||
export const HmInput = (props: IconBaseProps) => | ||
GenIcon({ | ||
tag: 'svg', | ||
attr: { viewBox: '0 0 22 18' }, | ||
child: [ | ||
{ | ||
tag: 'g', | ||
attr: { transform: 'matrix(1, 0, 0, 1, -290.7229919433594, -240.23300170898438)' }, | ||
child: [ | ||
{ | ||
tag: 'path', | ||
attr: { | ||
d: 'M 310.729 240.233 L 292.729 240.233 C 291.629 240.233 290.729 241.133 290.729 242.233 L 290.723 246.308 L 292.729 246.223 L 292.729 242.213 L 310.729 242.213 L 310.729 256.243 L 292.729 256.243 L 292.729 252.223 L 290.729 252.223 L 290.729 256.233 C 290.729 257.333 291.629 258.213 292.729 258.213 L 310.729 258.213 C 311.829 258.213 312.729 257.333 312.729 256.233 L 312.729 242.233 C 312.729 241.128 311.834 240.233 310.729 240.233 Z', | ||
}, | ||
child: [], | ||
}, | ||
{ | ||
tag: 'path', | ||
attr: { | ||
d: 'M 299.328 254.314 L 304.328 249.314 L 299.328 244.314 L 297.918 245.724 L 300.498 248.314 L 291.328 248.314 L 291.328 250.314 L 300.498 250.314 L 297.918 252.904 L 299.328 254.314 Z', | ||
}, | ||
child: [], | ||
}, | ||
], | ||
}, | ||
], | ||
})(props) |
29 changes: 29 additions & 0 deletions
29
hivemq-edge/src/frontend/src/components/react-icons/hm/HmOutput.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,29 @@ | ||
import { GenIcon, IconBaseProps } from 'react-icons' | ||
|
||
export const HmOutput = (props: IconBaseProps) => | ||
GenIcon({ | ||
tag: 'svg', | ||
attr: { viewBox: '0 0 22 18' }, | ||
child: [ | ||
{ | ||
tag: 'g', | ||
attr: { transform: 'matrix(1, 0, 0, 1, -290.7560119628906, -260.54998779296875)' }, | ||
child: [ | ||
{ | ||
tag: 'path', | ||
attr: { | ||
d: 'M 310.144 276.55 L 293.179 276.55 L 293.179 262.55 L 310.144 262.55 L 310.144 264.55 L 312.567 264.55 L 312.567 262.55 C 312.567 261.445 311.483 260.55 310.144 260.55 L 293.179 260.55 C 291.846 260.55 290.756 261.45 290.756 262.55 L 290.756 276.55 C 290.756 277.65 291.846 278.55 293.179 278.55 L 310.144 278.55 C 311.483 278.55 312.567 277.654 312.567 276.55 L 312.567 274.55 L 310.144 274.55 L 310.144 276.55 Z', | ||
}, | ||
child: [], | ||
}, | ||
{ | ||
tag: 'path', | ||
attr: { | ||
d: 'M 307.452 274.633 L 312.452 269.633 L 307.452 264.633 L 306.042 266.043 L 308.622 268.633 L 299.452 268.633 L 299.452 270.633 L 308.622 270.633 L 306.042 273.223 L 307.452 274.633 Z', | ||
}, | ||
child: [], | ||
}, | ||
], | ||
}, | ||
], | ||
})(props) |
4 changes: 4 additions & 0 deletions
4
hivemq-edge/src/frontend/src/components/react-icons/hm/index.ts
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,4 @@ | ||
import { HmInput } from '@/components/react-icons/hm/HmInput.tsx' | ||
import { HmOutput } from '@/components/react-icons/hm/HmOutput.tsx' | ||
|
||
export { HmInput, HmOutput } |
27 changes: 27 additions & 0 deletions
27
hivemq-edge/src/frontend/src/components/rjsf/Fields/InternalNotice.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,27 @@ | ||
import { FC } from 'react' | ||
import { FieldProps, getUiOptions, labelValue } from '@rjsf/utils' | ||
import { RJSFSchema } from '@rjsf/utils/src/types.ts' | ||
import { getChakra } from '@rjsf/chakra-ui/lib/utils' | ||
import { Alert, AlertDescription, AlertIcon, AlertStatus, FormControl, FormLabel } from '@chakra-ui/react' | ||
import { AdapterContext } from '@/modules/ProtocolAdapters/types.ts' | ||
|
||
export const InternalNotice: FC<FieldProps<unknown, RJSFSchema, AdapterContext>> = (props) => { | ||
const chakraProps = getChakra({ uiSchema: props.uiSchema }) | ||
const { message, status } = getUiOptions(props.uiSchema) | ||
|
||
return ( | ||
<FormControl {...chakraProps}> | ||
{labelValue( | ||
<FormLabel htmlFor={props.id} id={`${props.id}-label`}> | ||
{props.label} | ||
</FormLabel>, | ||
props.hideLabel || !props.label | ||
)} | ||
|
||
<Alert status={(status as AlertStatus) || 'info'}> | ||
<AlertIcon /> | ||
{message && <AlertDescription maxWidth="sm">{message as string}</AlertDescription>} | ||
</Alert> | ||
</FormControl> | ||
) | ||
} |
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
Oops, something went wrong.