mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-28 03:00:29 -04:00
Feature/api (#82)
* my test changes for branch protection * feat(api): introduced 'deploy as an API' button and updated workflows db to include status of deployment * feat(api): added 'trigger' column for logs table to indicate source of workflow run, persist logs from API executions, removed session validation in favor of API key * fix(bug): cleanup old reference to JSX element in favor of ReactElement * feat(api): added persistent notification for one-click deployment with copy boxes for url, keys, & ex curl * fix(ui/notifications): cleaned up deploy with one-click button ui
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { create } from 'zustand'
|
||||
import { devtools } from 'zustand/middleware'
|
||||
import { Notification, NotificationStore, NotificationType } from './types'
|
||||
import { Notification, NotificationOptions, NotificationStore, NotificationType } from './types'
|
||||
|
||||
const STORAGE_KEY = 'workflow-notifications'
|
||||
// Maximum number of notifications to keep across all workflows
|
||||
@@ -24,7 +24,7 @@ export const useNotificationStore = create<NotificationStore>()(
|
||||
(set, get) => ({
|
||||
notifications: loadPersistedNotifications(),
|
||||
|
||||
addNotification: (type, message, workflowId) => {
|
||||
addNotification: (type, message, workflowId, options: NotificationOptions = {}) => {
|
||||
// Only create notifications on the client side
|
||||
if (typeof window === 'undefined') return
|
||||
|
||||
@@ -32,9 +32,10 @@ export const useNotificationStore = create<NotificationStore>()(
|
||||
id: crypto.randomUUID(),
|
||||
type,
|
||||
message,
|
||||
timestamp: Date.now(), // Simplified timestamp handling
|
||||
timestamp: Date.now(),
|
||||
isVisible: true,
|
||||
workflowId,
|
||||
options,
|
||||
}
|
||||
|
||||
set((state) => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export type NotificationType = 'error' | 'console'
|
||||
export type NotificationType = 'error' | 'console' | 'api'
|
||||
|
||||
export interface Notification {
|
||||
id: string
|
||||
@@ -7,11 +7,28 @@ export interface Notification {
|
||||
timestamp: number
|
||||
isVisible: boolean
|
||||
workflowId: string | null
|
||||
options?: NotificationOptions
|
||||
}
|
||||
|
||||
export interface NotificationSection {
|
||||
label: string
|
||||
content: string
|
||||
}
|
||||
|
||||
export interface NotificationOptions {
|
||||
copyableContent?: string
|
||||
isPersistent?: boolean
|
||||
sections?: NotificationSection[]
|
||||
}
|
||||
|
||||
export interface NotificationStore {
|
||||
notifications: Notification[]
|
||||
addNotification: (type: NotificationType, message: string, workflowId: string | null) => void
|
||||
addNotification: (
|
||||
type: NotificationType,
|
||||
message: string,
|
||||
workflowId: string | null,
|
||||
options?: NotificationOptions
|
||||
) => void
|
||||
hideNotification: (id: string) => void
|
||||
showNotification: (id: string) => void
|
||||
removeNotification: (id: string) => void
|
||||
|
||||
Reference in New Issue
Block a user