diff --git a/frontend/src/lib/components/apps/components/display/AppAlert.svelte b/frontend/src/lib/components/apps/components/display/AppAlert.svelte new file mode 100644 index 0000000000..53bd288671 --- /dev/null +++ b/frontend/src/lib/components/apps/components/display/AppAlert.svelte @@ -0,0 +1,80 @@ + + +{#each Object.keys(components['alertcomponent'].initialData.configuration) as key (key)} + +{/each} + +{#each Object.keys(css ?? {}) as key (key)} + +{/each} + + + +{#if render} + +
+ + {resolvedConfig.description} + +
+
+{/if} diff --git a/frontend/src/lib/components/apps/editor/component/Component.svelte b/frontend/src/lib/components/apps/editor/component/Component.svelte index c02f7e8a0d..6fad139446 100644 --- a/frontend/src/lib/components/apps/editor/component/Component.svelte +++ b/frontend/src/lib/components/apps/editor/component/Component.svelte @@ -69,6 +69,7 @@ import AppAgCharts from '../../components/display/charts/AppAgCharts.svelte' import AppDbExplorer from '../../components/display/dbtable/AppDbExplorer.svelte' import AppS3FileInput from '../../components/inputs/AppS3FileInput.svelte' + import AppAlert from '../../components/display/AppAlert.svelte' import AppDateSliderInput from '../../components/inputs/AppDateSliderInput.svelte' export let component: AppComponent @@ -756,6 +757,14 @@ {componentContainerHeight} {render} /> + {:else if component.type === 'alertcomponent'} + {/if} diff --git a/frontend/src/lib/components/apps/editor/component/components.ts b/frontend/src/lib/components/apps/editor/component/components.ts index ff6a048eee..391242f053 100644 --- a/frontend/src/lib/components/apps/editor/component/components.ts +++ b/frontend/src/lib/components/apps/editor/component/components.ts @@ -45,7 +45,8 @@ import { Menu, Network, Database, - UploadCloud + UploadCloud, + AlertTriangle } from 'lucide-svelte' import type { Aligned, @@ -204,6 +205,8 @@ export type DecisionTreeComponent = BaseComponent<'decisiontreecomponent'> & { nodes: DecisionTreeNode[] } +export type AlertComponent = BaseComponent<'alertcomponent'> + export type TypedComponent = | DBExplorerComponent | DisplayComponent @@ -271,6 +274,7 @@ export type TypedComponent = | S3FileInputComponent | AgChartsComponent | AgChartsComponentEe + | AlertComponent | DateSliderComponent export type AppComponent = BaseAppComponent & TypedComponent @@ -3244,6 +3248,75 @@ This is a paragraph. }, componentInput: undefined } + }, + alertcomponent: { + name: 'Alert', + icon: AlertTriangle, + documentationLink: `${documentationBaseUrl}/alert`, + dims: '2:1-4:5' as AppComponentDimensions, + customCss: { + container: { class: '', style: '' }, + background: { class: '', style: '' }, + icon: { class: '', style: '' }, + title: { class: '', style: '' }, + description: { class: '', style: '' } + }, + initialData: { + verticalAlignment: 'center', + componentInput: undefined, + configuration: { + type: { + fieldType: 'select', + type: 'static', + selectOptions: [ + { value: 'info', label: 'Info' }, + { value: 'success', label: 'Success' }, + { value: 'warning', label: 'Warning' }, + { value: 'error', label: 'Error' } + ], + value: 'info' + }, + title: { + type: 'static', + value: 'Title', + fieldType: 'text' + }, + description: { + type: 'static', + value: 'Description', + fieldType: 'text' + }, + notRounded: { + type: 'static', + value: false, + fieldType: 'boolean' + }, + tooltip: { + type: 'static', + value: '', + fieldType: 'text' + }, + size: { + type: 'static', + value: 'sm', + fieldType: 'select', + selectOptions: [ + { value: 'xs', label: 'Extra Small' }, + { value: 'sm', label: 'Small' } + ] + }, + collapsible: { + type: 'static', + value: false, + fieldType: 'boolean' + }, + initiallyCollapsed: { + type: 'static', + value: false, + fieldType: 'boolean' + } + } + } } } as const diff --git a/frontend/src/lib/components/apps/editor/component/sets.ts b/frontend/src/lib/components/apps/editor/component/sets.ts index 2ea1b235c7..2800257481 100644 --- a/frontend/src/lib/components/apps/editor/component/sets.ts +++ b/frontend/src/lib/components/apps/editor/component/sets.ts @@ -68,7 +68,8 @@ const display: ComponentSet = { 'jobidlogcomponent', 'jobidflowstatuscomponent', 'statcomponent', - 'menucomponent' + 'menucomponent', + 'alertcomponent' ] } as const diff --git a/frontend/src/lib/components/apps/editor/componentsPanel/quickStyleProperties.ts b/frontend/src/lib/components/apps/editor/componentsPanel/quickStyleProperties.ts index dfd9b1bd58..80c6d8ba67 100644 --- a/frontend/src/lib/components/apps/editor/componentsPanel/quickStyleProperties.ts +++ b/frontend/src/lib/components/apps/editor/componentsPanel/quickStyleProperties.ts @@ -767,5 +767,12 @@ export const quickStyleProperties: Record< decisiontreecomponent: { container: containerDefaultProps }, - dbexplorercomponent: {} + dbexplorercomponent: {}, + alertcomponent: { + container: containerDefaultProps, + background: containerDefaultProps, + icon: containerDefaultProps, + title: containerDefaultProps, + description: containerDefaultProps + } } diff --git a/frontend/src/lib/components/common/alert/Alert.svelte b/frontend/src/lib/components/common/alert/Alert.svelte index 8b7c3a60ad..e6a9ee875f 100644 --- a/frontend/src/lib/components/common/alert/Alert.svelte +++ b/frontend/src/lib/components/common/alert/Alert.svelte @@ -1,5 +1,4 @@
- +
{title} {#if tooltip != '' || documentationLink} @@ -104,10 +121,12 @@ {#if $$slots.default && !isCollapsed}
@@ -116,10 +135,12 @@ {#if $$slots.default && !collapsible}