Files
windmill/frontend/src/lib/utils/editInFork.ts
T
wendrul cf7f704a91 add button to edit in workspace fork (#8119)
* Add button to edit in workspace fork

* Remove old fork from script row

* Remove fork button from approw

* fix frontend check
2026-02-26 16:43:30 +00:00

23 lines
622 B
TypeScript

import { base } from '$lib/base'
type ItemType = 'script' | 'flow' | 'app' | 'raw_app'
export function buildForkEditUrl(itemType: ItemType, itemPath: string): string {
let editPath: string
switch (itemType) {
case 'script':
editPath = `${base}/scripts/edit/${itemPath}`
break
case 'flow':
editPath = `${base}/flows/edit/${itemPath}?nodraft=true`
break
case 'app':
editPath = `${base}/apps/edit/${itemPath}?nodraft=true`
break
case 'raw_app':
editPath = `${base}/apps_raw/edit/${itemPath}?nodraft=true`
break
}
return `${base}/user/fork_workspace?rd=${encodeURIComponent(editPath)}`
}