contextmenu and deployment

This commit is contained in:
Peter Clement 2024-12-30 09:27:22 +00:00
parent 6e6c25e15e
commit a94adced72
3 changed files with 50 additions and 31 deletions

View File

@ -1,28 +0,0 @@
import { writable } from "svelte/store"
export const INITIAL_CONTEXT_MENU_STATE = {
id: null,
items: [],
position: { x: 0, y: 0 },
visible: false,
}
export function createViewsStore() {
const store = writable({ ...INITIAL_CONTEXT_MENU_STATE })
const open = (id, items, position) => {
store.set({ id, items, position, visible: true })
}
const close = () => {
store.set({ ...INITIAL_CONTEXT_MENU_STATE })
}
return {
subscribe: store.subscribe,
open,
close,
}
}
export const contextMenuStore = createViewsStore()

View File

@ -0,0 +1,46 @@
import { writable } from "svelte/store"
interface Position {
x: number
y: number
}
interface MenuItem {
label: string
icon?: string
action: () => void
}
interface ContextMenuState {
id: string | null
items: MenuItem[]
position: Position
visible: boolean
}
export const INITIAL_CONTEXT_MENU_STATE: ContextMenuState = {
id: null,
items: [],
position: { x: 0, y: 0 },
visible: false,
}
export function createViewsStore() {
const store = writable<ContextMenuState>({ ...INITIAL_CONTEXT_MENU_STATE })
const open = (id: string, items: MenuItem[], position: Position): void => {
store.set({ id, items, position, visible: true })
}
const close = (): void => {
store.set({ ...INITIAL_CONTEXT_MENU_STATE })
}
return {
subscribe: store.subscribe,
open,
close,
}
}
export const contextMenuStore = createViewsStore()

View File

@ -1,11 +1,12 @@
import { writable } from "svelte/store"
import { writable, type Writable } from "svelte/store"
import { API } from "api"
import { notifications } from "@budibase/bbui"
import { DeploymentProgressResponse } from "@budibase/types"
export const createDeploymentStore = () => {
let store = writable([])
let store: Writable<DeploymentProgressResponse[]> = writable([])
const load = async () => {
const load = async (): Promise<void> => {
try {
store.set(await API.getAppDeployments())
} catch (err) {