diff --git a/frontend/console/src/features/modules/decls/RightPanelHeader.tsx b/frontend/console/src/features/modules/decls/RightPanelHeader.tsx index 90f58cad6..951a06024 100644 --- a/frontend/console/src/features/modules/decls/RightPanelHeader.tsx +++ b/frontend/console/src/features/modules/decls/RightPanelHeader.tsx @@ -1,7 +1,7 @@ export const RightPanelHeader = ({ Icon, title }: { Icon?: React.ElementType; title?: string }) => { return (
- {Icon && } + {Icon && } {title &&
{title}
}
) diff --git a/frontend/console/src/features/modules/decls/database/DatabasePanel.tsx b/frontend/console/src/features/modules/decls/database/DatabasePanel.tsx index ec48c3113..a3d7c23ae 100644 --- a/frontend/console/src/features/modules/decls/database/DatabasePanel.tsx +++ b/frontend/console/src/features/modules/decls/database/DatabasePanel.tsx @@ -1,16 +1,35 @@ +import { ResizablePanels } from '../../../../components/ResizablePanels' import type { Database } from '../../../../protos/xyz/block/ftl/v1/console/console_pb' +import { declIcon } from '../../module.utils' import { Schema } from '../../schema/Schema' +import { DeclDefaultPanels } from '../DeclDefaultPanels' import { PanelHeader } from '../PanelHeader' -import { References } from '../References' +import { RightPanelHeader } from '../RightPanelHeader' +import { databasePanels } from './DatabaseRightPanels' export const DatabasePanel = ({ value, schema, moduleName, declName }: { value: Database; schema: string; moduleName: string; declName: string }) => { + const decl = value.database + if (!decl) { + return + } + return ( -
- -
- -
- +
+ +
+ +
+ +
+
+
+ } + rightPanelHeader={} + rightPanelPanels={[...databasePanels(value), ...DeclDefaultPanels(schema, value.references)]} + storageKeyPrefix='databasePanel' + />
) } diff --git a/frontend/console/src/features/modules/decls/database/DatabaseRightPanels.tsx b/frontend/console/src/features/modules/decls/database/DatabaseRightPanels.tsx new file mode 100644 index 000000000..c4cb27264 --- /dev/null +++ b/frontend/console/src/features/modules/decls/database/DatabaseRightPanels.tsx @@ -0,0 +1,16 @@ +import { RightPanelAttribute } from '../../../../components/RightPanelAttribute' +import type { Database } from '../../../../protos/xyz/block/ftl/v1/console/console_pb' +import type { ExpandablePanelProps } from '../../../console/ExpandablePanel' + +export const databasePanels = (database: Database) => { + return [ + { + title: 'Details', + expanded: true, + children: [ + , + , + ], + }, + ] as ExpandablePanelProps[] +} diff --git a/frontend/console/src/features/modules/decls/enum/EnumPanel.tsx b/frontend/console/src/features/modules/decls/enum/EnumPanel.tsx index e3c242667..c0ec9919c 100644 --- a/frontend/console/src/features/modules/decls/enum/EnumPanel.tsx +++ b/frontend/console/src/features/modules/decls/enum/EnumPanel.tsx @@ -1,8 +1,11 @@ +import { ResizablePanels } from '../../../../components/ResizablePanels' import type { Enum } from '../../../../protos/xyz/block/ftl/v1/console/console_pb' +import { declIcon } from '../../module.utils' import { Schema } from '../../schema/Schema' +import { DeclDefaultPanels } from '../DeclDefaultPanels' import { PanelHeader } from '../PanelHeader' -import { References } from '../References' -import { enumType } from './enum.utils' +import { RightPanelHeader } from '../RightPanelHeader' +import { enumPanels } from './EnumRightPanels' export const EnumPanel = ({ value, schema, moduleName, declName }: { value: Enum; schema: string; moduleName: string; declName: string }) => { if (!value || !schema) { @@ -13,12 +16,22 @@ export const EnumPanel = ({ value, schema, moduleName, declName }: { value: Enum return } return ( -
- -
- -
- +
+ +
+ +
+ +
+
+
+ } + rightPanelHeader={} + rightPanelPanels={[...enumPanels(value), ...DeclDefaultPanels(schema, value.references)]} + storageKeyPrefix='enumPanel' + />
) } diff --git a/frontend/console/src/features/modules/decls/enum/EnumRightPanels.tsx b/frontend/console/src/features/modules/decls/enum/EnumRightPanels.tsx new file mode 100644 index 000000000..41b1bd9a2 --- /dev/null +++ b/frontend/console/src/features/modules/decls/enum/EnumRightPanels.tsx @@ -0,0 +1,16 @@ +import { RightPanelAttribute } from '../../../../components/RightPanelAttribute' +import type { Enum } from '../../../../protos/xyz/block/ftl/v1/console/console_pb' +import type { ExpandablePanelProps } from '../../../console/ExpandablePanel' + +export const enumPanels = (enumDecl: Enum) => { + return [ + { + title: 'Details', + expanded: true, + children: [ + , + , + ], + }, + ] as ExpandablePanelProps[] +} diff --git a/frontend/console/src/features/modules/decls/secret/SecretPanel.tsx b/frontend/console/src/features/modules/decls/secret/SecretPanel.tsx index 008aff4a0..f13d811d8 100644 --- a/frontend/console/src/features/modules/decls/secret/SecretPanel.tsx +++ b/frontend/console/src/features/modules/decls/secret/SecretPanel.tsx @@ -1,5 +1,5 @@ -import { Button } from '@headlessui/react' import { useContext, useEffect, useState } from 'react' +import { Button } from '../../../../components/Button' import { CodeEditor } from '../../../../components/CodeEditor' import { ResizablePanels } from '../../../../components/ResizablePanels' import { useClient } from '../../../../hooks/use-client' @@ -24,10 +24,20 @@ export const SecretPanel = ({ value, schema, moduleName, declName }: { value: Se const handleGetSecret = () => { setIsLoading(true) - client.getSecret({ module: moduleName, name: declName }).then((resp) => { - setSecretValue(new TextDecoder().decode(resp.value)) - setIsLoading(false) - }) + client + .getSecret({ module: moduleName, name: declName }) + .then((resp) => { + setSecretValue(new TextDecoder().decode(resp.value)) + setIsLoading(false) + }) + .catch((error) => { + setIsLoading(false) + notification?.showNotification({ + title: 'Failed to get secret', + message: error.message, + type: NotificationType.Error, + }) + }) } const handleSetSecret = () => { diff --git a/frontend/console/src/features/modules/decls/subscription/SubscriptionPanel.tsx b/frontend/console/src/features/modules/decls/subscription/SubscriptionPanel.tsx index c817dc5ba..08f8ef483 100644 --- a/frontend/console/src/features/modules/decls/subscription/SubscriptionPanel.tsx +++ b/frontend/console/src/features/modules/decls/subscription/SubscriptionPanel.tsx @@ -23,7 +23,7 @@ export const SubscriptionPanel = ({ value, schema, moduleName, declName }: { val mainContent={
- +
diff --git a/frontend/console/src/features/modules/decls/subscription/SubscriptionRightPanels.tsx b/frontend/console/src/features/modules/decls/subscription/SubscriptionRightPanels.tsx index aecab63d7..6a90e676f 100644 --- a/frontend/console/src/features/modules/decls/subscription/SubscriptionRightPanels.tsx +++ b/frontend/console/src/features/modules/decls/subscription/SubscriptionRightPanels.tsx @@ -7,7 +7,10 @@ export const subscriptionPanels = (subscription: Subscription) => { { title: 'Details', expanded: true, - children: [], + children: [ + , + , + ], }, ] as ExpandablePanelProps[] } diff --git a/frontend/console/src/features/modules/decls/topic/TopicPanel.tsx b/frontend/console/src/features/modules/decls/topic/TopicPanel.tsx index 01307c5c6..fc0ba1480 100644 --- a/frontend/console/src/features/modules/decls/topic/TopicPanel.tsx +++ b/frontend/console/src/features/modules/decls/topic/TopicPanel.tsx @@ -23,7 +23,7 @@ export const TopicPanel = ({ value, schema, moduleName, declName }: { value: Top mainContent={
- +
diff --git a/frontend/console/src/features/modules/decls/topic/TopicRightPanels.tsx b/frontend/console/src/features/modules/decls/topic/TopicRightPanels.tsx index 8e486086e..9d8105fa0 100644 --- a/frontend/console/src/features/modules/decls/topic/TopicRightPanels.tsx +++ b/frontend/console/src/features/modules/decls/topic/TopicRightPanels.tsx @@ -7,7 +7,10 @@ export const topicPanels = (topic: Topic) => { { title: 'Details', expanded: true, - children: [], + children: [ + , + , + ], }, ] as ExpandablePanelProps[] } diff --git a/frontend/console/src/features/modules/decls/typealias/TypeAliasPanel.tsx b/frontend/console/src/features/modules/decls/typealias/TypeAliasPanel.tsx index e04e6e34c..deffc12a9 100644 --- a/frontend/console/src/features/modules/decls/typealias/TypeAliasPanel.tsx +++ b/frontend/console/src/features/modules/decls/typealias/TypeAliasPanel.tsx @@ -1,19 +1,39 @@ +import { ResizablePanels } from '../../../../components/ResizablePanels' import type { TypeAlias } from '../../../../protos/xyz/block/ftl/v1/console/console_pb' +import { declIcon } from '../../module.utils' import { Schema } from '../../schema/Schema' +import { DeclDefaultPanels } from '../DeclDefaultPanels' import { PanelHeader } from '../PanelHeader' -import { References } from '../References' +import { RightPanelHeader } from '../RightPanelHeader' +import { typeAliasPanels } from './TypeAliasRightPanels' export const TypeAliasPanel = ({ value, schema, moduleName, declName }: { value: TypeAlias; schema: string; moduleName: string; declName: string }) => { if (!value || !schema) { return } + + const decl = value.typealias + if (!decl) { + return + } + return ( -
- -
- -
- +
+ +
+ +
+ +
+
+
+ } + rightPanelHeader={} + rightPanelPanels={[...typeAliasPanels(value), ...DeclDefaultPanels(schema, value.references)]} + storageKeyPrefix='typeAliasPanel' + />
) } diff --git a/frontend/console/src/features/modules/decls/typealias/TypeAliasRightPanels.tsx b/frontend/console/src/features/modules/decls/typealias/TypeAliasRightPanels.tsx new file mode 100644 index 000000000..f1507624d --- /dev/null +++ b/frontend/console/src/features/modules/decls/typealias/TypeAliasRightPanels.tsx @@ -0,0 +1,16 @@ +import { RightPanelAttribute } from '../../../../components/RightPanelAttribute' +import type { TypeAlias } from '../../../../protos/xyz/block/ftl/v1/console/console_pb' +import type { ExpandablePanelProps } from '../../../console/ExpandablePanel' + +export const typeAliasPanels = (typeAlias: TypeAlias) => { + return [ + { + title: 'Details', + expanded: true, + children: [ + , + , + ], + }, + ] as ExpandablePanelProps[] +}