feat: Prompts Atomic PR of #20243 (#20368)

* feat: Add read-only access support for Prompts

- Backend: Add write_access field to PromptAccessResponse
- Backend: Update /prompts/list to return prompts with write_access
- Frontend: Display Read Only badge in Prompts list
- Frontend: Disable inputs and save button when no write access

* feat: Add read-only visual indicators for Prompts workspace

* fix: Return write_access from getPromptByCommand endpoint

- Backend returns write_access directly in response
- Frontend extracts write_access from getPromptByCommand response
- Remove inefficient getPromptList call in edit page

* fix: Align Read Only badge to right in Prompts.svelte

- Title and command stay on left
- Badge pushed to right by justify-between

* fix: Use PromptAccessResponse in get_prompt_by_command endpoint

fix: Use PromptAccessResponse in get_prompt_by_command endpoint

- Return PromptAccessResponse Pydantic model instead of raw dict
- Properly type the response with response_model
This commit is contained in:
Classic298 authored and GitHub committed 2026-01-05 04:36:13 +04:00
1 parent b55a46ae99
commit 1f059fe730
5 files changed
+85 -45

No files matched your search

+10 -4
View File
@@ -26,6 +26,7 @@
import XMark from '../icons/XMark.svelte';
import GarbageBin from '../icons/GarbageBin.svelte';
import ViewSelector from './common/ViewSelector.svelte';
import Badge from '$lib/components/common/Badge.svelte';
let shiftKey = false;
@@ -327,11 +328,16 @@
href={`/workspace/prompts/edit?command=${encodeURIComponent(prompt.command)}`}
>
<div class=" flex flex-col flex-1 space-x-4 cursor-pointer w-full pl-1">
<div class=" flex-1 flex items-center gap-2 self-start">
<div class=" font-medium line-clamp-1 capitalize">{prompt.title}</div>
<div class=" text-xs overflow-hidden text-ellipsis line-clamp-1 text-gray-500">
{prompt.command}
<div class="flex items-center justify-between w-full">
<div class="flex items-center gap-2">
<div class="font-medium line-clamp-1 capitalize">{prompt.title}</div>
<div class="text-xs overflow-hidden text-ellipsis line-clamp-1 text-gray-500">
{prompt.command}
</div>
</div>
{#if !prompt.write_access}
<Badge type="muted" content={$i18n.t('Read Only')} />
{/if}
</div>
<div class=" text-xs">