Skip to content

Commit da137b8

Browse files
#604 little design improvemnt
1 parent 13093b8 commit da137b8

File tree

5 files changed

+57
-3
lines changed

5 files changed

+57
-3
lines changed

src/core/integrations/integrations/integrations-create/containers/type-step/TypeStep.vue

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ const integrationCards = ref<TypeCard[]>([]);
105105
const loadingCards = ref(false);
106106
const cardLoadError = ref(false);
107107
const selectedCardCache = ref<TypeCard | null>(null);
108+
const totalIntegrationCards = ref<number | null>(null);
109+
const hasLoadedFirstPage = ref(false);
108110
let wizardActionsObserver: IntersectionObserver | null = null;
111+
let activeFetchRequestId = 0;
109112
110113
const getCardFilter = (category: IntegrationCategory) => {
111114
return t(`integrations.create.wizard.step1.filters.${category}`);
@@ -298,8 +301,12 @@ const buildCardFromNode = (node: PublicIntegrationTypeNode): TypeCard => ({
298301
});
299302
300303
const fetchIntegrationCards = async () => {
304+
const requestId = ++activeFetchRequestId;
301305
loadingCards.value = true;
302306
cardLoadError.value = false;
307+
integrationCards.value = [];
308+
totalIntegrationCards.value = null;
309+
hasLoadedFirstPage.value = false;
303310
304311
try {
305312
const filter: Record<string, any> = {
@@ -332,21 +339,34 @@ const fetchIntegrationCards = async () => {
332339
fetchPolicy: 'network-only',
333340
});
334341
342+
if (requestId !== activeFetchRequestId) {
343+
return;
344+
}
345+
335346
const connection = data?.publicIntegrationTypes;
336347
const currentEdges = connection?.edges || [];
337348
338349
edges.push(...currentEdges);
350+
integrationCards.value = edges.map((edge) => buildCardFromNode(edge.node));
351+
totalIntegrationCards.value = connection?.totalCount ?? edges.length;
352+
hasLoadedFirstPage.value = true;
339353
hasNextPage = Boolean(connection?.pageInfo?.hasNextPage);
340354
after = connection?.pageInfo?.endCursor || null;
341355
}
342-
343-
integrationCards.value = edges.map((edge) => buildCardFromNode(edge.node));
344356
} catch (error) {
357+
if (requestId !== activeFetchRequestId) {
358+
return;
359+
}
360+
345361
integrationCards.value = [];
362+
totalIntegrationCards.value = null;
363+
hasLoadedFirstPage.value = true;
346364
cardLoadError.value = true;
347365
console.error('Failed to load public integration types', error);
348366
} finally {
349-
loadingCards.value = false;
367+
if (requestId === activeFetchRequestId) {
368+
loadingCards.value = false;
369+
}
350370
}
351371
};
352372
@@ -364,6 +384,8 @@ const scheduleCardFetch = () => {
364384
365385
const visibleCards = computed(() => integrationCards.value);
366386
const filteredCount = computed(() => visibleCards.value.length);
387+
const showInlineLoadingState = computed(() => loadingCards.value && hasLoadedFirstPage.value && visibleCards.value.length > 0);
388+
const loadingProgressTotal = computed(() => totalIntegrationCards.value ?? filteredCount.value);
367389
const selectedCard = computed(() => {
368390
const currentCard = integrationCards.value.find((card) => card.value === selectedType.value) || null;
369391
if (currentCard) {
@@ -508,6 +530,7 @@ onBeforeUnmount(() => {
508530
<SearchInput
509531
v-model="searchTerm"
510532
:placeholder="t('integrations.create.wizard.step1.searchPlaceholder')"
533+
:loading="loadingCards"
511534
/>
512535

513536
<div class="flex flex-col gap-3 rounded-2xl border border-slate-200 bg-white/90 px-4 py-3 shadow-sm sm:flex-row sm:items-center">
@@ -593,6 +616,21 @@ onBeforeUnmount(() => {
593616
</div>
594617

595618
<div v-else class="space-y-10">
619+
<div
620+
v-if="showInlineLoadingState"
621+
class="flex items-center gap-3 rounded-2xl border border-slate-200 bg-white/90 px-4 py-3 text-sm text-slate-600 shadow-sm"
622+
>
623+
<Icon name="circle-notch" size="sm" spin class="text-primary" />
624+
<div class="min-w-0">
625+
<p class="font-medium text-slate-800">
626+
{{ t('integrations.create.wizard.step1.loadingMore.title') }}
627+
</p>
628+
<p class="text-xs text-slate-500">
629+
{{ t('integrations.create.wizard.step1.loadingMore.description', { loaded: filteredCount, total: loadingProgressTotal }) }}
630+
</p>
631+
</div>
632+
</div>
633+
596634
<section
597635
v-for="section in visibleSections"
598636
:key="section.key"

src/locale/de.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,6 +1249,10 @@
12491249
"title": "",
12501250
"description": ""
12511251
},
1252+
"loadingMore": {
1253+
"title": "",
1254+
"description": ""
1255+
},
12521256
"selection": {
12531257
"title": "",
12541258
"description": "",

src/locale/en.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4732,6 +4732,10 @@
47324732
"title": "No integrations match this filter",
47334733
"description": "Try another search term or expand the active filters to surface more integration types."
47344734
},
4735+
"loadingMore": {
4736+
"title": "Loading more integrations",
4737+
"description": "{loaded} of {total} integration types loaded."
4738+
},
47354739
"selection": {
47364740
"title": "Selected Integration",
47374741
"description": "{integration} is selected. Continue to the next step to configure the connection details and sync setup.",

src/locale/fr.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,6 +1246,10 @@
12461246
"title": "",
12471247
"description": ""
12481248
},
1249+
"loadingMore": {
1250+
"title": "",
1251+
"description": ""
1252+
},
12491253
"selection": {
12501254
"title": "",
12511255
"description": "",

src/locale/nl.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3987,6 +3987,10 @@
39873987
"title": "",
39883988
"description": ""
39893989
},
3990+
"loadingMore": {
3991+
"title": "",
3992+
"description": ""
3993+
},
39903994
"selection": {
39913995
"title": "",
39923996
"description": "",

0 commit comments

Comments
 (0)