use workspace_id of the script itself

This commit is contained in:
Ruben Fiszel
2022-11-30 12:28:28 +01:00
parent 4f1e97959d
commit ca6abb0ffc
3 changed files with 29 additions and 6 deletions
+8 -2
View File
@@ -26,7 +26,7 @@
export let starred: boolean
export let shareModal: ShareModal
const { summary, path, extra_perms, canWrite } = flow
const { summary, path, extra_perms, canWrite, workspace_id } = flow
async function archiveFlow(path: string): Promise<void> {
try {
@@ -58,7 +58,13 @@
<div class="flex flex-row justify-between w-full grow gap-2 items-start">
<div class="text-gray-700 text-xs flex flex-row flex-wrap gap-x-1 items-center"
>{path}
<Star kind="flow" {path} {starred} on:starred={() => dispatch('change')} />
<Star
workspace_id={workspace_id ?? $workspaceStore ?? ''}
kind="flow"
{path}
{starred}
on:starred={() => dispatch('change')}
/>
<SharedBadge {canWrite} extraPerms={extra_perms} />
</div>
<div class="flex flex-row-reverse place gap-x-2 pt-4">
+18 -2
View File
@@ -26,7 +26,17 @@
export let marked: string | undefined
export let starred: boolean
export let shareModal: ShareModal
let { summary, path, hash, language, extra_perms, canWrite, lock_error_logs, kind } = script
let {
summary,
path,
hash,
language,
extra_perms,
canWrite,
lock_error_logs,
kind,
workspace_id
} = script
const dispatch = createEventDispatcher()
async function archiveScript(path: string): Promise<void> {
@@ -53,7 +63,13 @@
<div class="flex flex-row justify-between w-full grow gap-2 items-start">
<div class="text-gray-700 text-xs flex flex-row flex-wrap gap-x-1 items-center">
{path}
<Star kind="script" {path} {starred} on:starred={() => dispatch('change')} />
<Star
kind="script"
{path}
{starred}
workspace_id={workspace_id ?? $workspaceStore ?? ''}
on:starred={() => dispatch('change')}
/>
<SharedBadge {canWrite} extraPerms={extra_perms} />
<div><LanguageIcon height={16} lang={language} /></div>
{#if kind != 'script'}
+3 -2
View File
@@ -10,18 +10,19 @@
export let path: string
export let kind: 'flow' | 'app' | 'script'
export let starred = false
export let workspace_id: string
async function onClick() {
if (starred) {
await FavoriteService.unstar({
workspace: $workspaceStore!,
workspace: workspace_id,
requestBody: { path, favorite_kind: kind }
})
sendUserToast('Unstarred')
$starStore = $starStore + 1
} else {
await FavoriteService.star({
workspace: $workspaceStore!,
workspace: workspace_id,
requestBody: { path, favorite_kind: kind }
})
sendUserToast('Marked as favorite, it will appear first')