Skip to content
1 change: 1 addition & 0 deletions frontend/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2671,6 +2671,7 @@
"doraAttributes": "DORA Attributes",
"doraAssessment": "DORA Assessment",
"moreOnTerminologiesHelpText": "Hint: more options can be defined through terminologies",
"selectPlaceholder": "Select...",
"ebiosRmSyncModalTitle": "Risk Assessment Options",
"ebiosRmSyncModalBody": "A risk assessment already exists for this EBIOS RM study: \"{name}\"\n\nWould you like to:",
"ebiosRmSyncExisting": "Sync Existing",
Expand Down
1 change: 1 addition & 0 deletions frontend/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2671,6 +2671,7 @@
"webhookSecret": "Secret webhook",
"webhookSecretAlreadySetHelpText": "Le secret webhook est déjà défini.",
"webhookUrl": "URL webhook",
"selectPlaceholder": "Sélectionner...",
"ebiosRmSyncModalTitle": "Options d'analyse de risque",
"ebiosRmSyncModalBody": "Une analyse de risque existe déjà pour cette étude EBIOS RM : \"{name}\"\n\nQue souhaitez-vous faire :",
"ebiosRmSyncExisting": "Synchroniser l'existante",
Expand Down
12 changes: 11 additions & 1 deletion frontend/src/lib/components/Forms/AutocompleteSelect.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
disabled?: boolean;
hidden?: boolean;
translateOptions?: boolean;
placeholder?: string | null;
options?: Option[];
optionsEndpoint?: string;
optionsDetailedUrlParameters?: [string, string][];
Expand Down Expand Up @@ -88,6 +89,7 @@
disabled = false,
hidden = false,
translateOptions = true,
placeholder = m.selectPlaceholder(),
options = [],
optionsEndpoint = '',
optionsDetailedUrlParameters = [],
Expand Down Expand Up @@ -371,7 +373,7 @@
cachedOptions = selected;
});

run(() => {
$effect(() => {
// Only update value after options are loaded
if (!isInternalUpdate && optionsLoaded && !arraysEqual(selectedValues, $value)) {
isInternalUpdate = true;
Expand Down Expand Up @@ -457,6 +459,8 @@
duplicates={false}
key={JSON.stringify}
filterFunc={fastFilter}
{placeholder}
--sms-placeholder-color="#9ca3af"
>
{#snippet option({ option })}
{#if optionSnippet}
Expand Down Expand Up @@ -552,3 +556,9 @@
<p class="text-sm text-gray-500 whitespace-pre-line">{helpText}</p>
{/if}
</div>

<style>
.control :global(input::placeholder) {
font-style: italic;
}
</style>
6 changes: 4 additions & 2 deletions frontend/src/lib/components/ModelTable/ModelTable.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@
const rows = handler.getRows();
let invalidateTable = $state(false);

// Hide search field when table is empty to avoid user confusion
let showSearch = $derived(search && $rows.length > 0);

$tableHandlers[baseEndpoint] = handler;

handler.onChange((state: State) =>
Expand All @@ -249,7 +252,6 @@
featureFlags: page.data?.featureflags
})
);

onMount(() => {
if (orderBy) {
orderBy.direction === 'asc'
Expand Down Expand Up @@ -472,7 +474,7 @@
{/snippet}
</Popover>
{/if}
{#if search}
{#if showSearch}
<Search {handler} />
{/if}
{#if pagination && rowsPerPage}
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/lib/components/ModelTable/Search.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,10 @@
bind:value
oninput={search}
/>

<style>
#search-input::placeholder {
font-style: italic;
color: #9ca3af;
}
</style>
Loading