16
16
@clear-search-input =" clearFilter"
17
17
@click:row =" (row: any) => rowClick(row as EntityRow)"
18
18
@sort =" resetPagination"
19
+ @state =" handleStateChange"
19
20
>
20
21
<!-- Filter -->
21
22
<template #toolbar-filter >
30
31
:disabled =" !useActionOutside"
31
32
to =" #kong-ui-app-page-header-action-button"
32
33
>
33
- <PermissionsWrapper :auth-function =" () => canCreate()" >
34
- <!-- Hide Create button if table is empty -->
34
+ <div class =" button-row" >
35
35
<KButton
36
- appearance =" primary"
37
- data-testid =" toolbar-add-gateway-service"
38
- :size =" useActionOutside ? 'medium' : 'large'"
39
- :to =" config.createRoute"
36
+ v-if =" !showEmptyState && config.app === 'konnect'"
37
+ appearance =" secondary"
38
+ class =" open-learning-hub"
39
+ data-testid =" gateway-services-learn-more-button"
40
+ icon
41
+ @click =" $emit('click:learn-more')"
40
42
>
41
- <AddIcon />
42
- {{ t('gateway_services.list.toolbar_actions.new_gateway_service') }}
43
+ <BookIcon decorative />
43
44
</KButton >
44
- </PermissionsWrapper >
45
+ <PermissionsWrapper :auth-function =" () => canCreate()" >
46
+ <!-- Hide Create button if table is empty -->
47
+ <KButton
48
+ appearance =" primary"
49
+ data-testid =" toolbar-add-gateway-service"
50
+ :size =" useActionOutside ? 'medium' : 'large'"
51
+ :to =" config.createRoute"
52
+ >
53
+ <AddIcon />
54
+ {{ t('gateway_services.list.toolbar_actions.new_gateway_service') }}
55
+ </KButton >
56
+ </PermissionsWrapper >
57
+ </div >
45
58
</Teleport >
46
59
</template >
47
60
61
+ <template
62
+ v-if =" enableV2EmptyStates && config .app === ' konnect' "
63
+ #empty-state
64
+ >
65
+ <EntityEmptyState
66
+ :action-button-text =" t('gateway_services.empty_state_v2.create')"
67
+ appearance =" secondary"
68
+ :can-create =" () => canCreate()"
69
+ :description =" t('gateway_services.empty_state_v2.description')"
70
+ :learn-more =" config.app === 'konnect'"
71
+ :title =" t('gateway_services.empty_state_v2.title')"
72
+ @click:create =" handleCreate"
73
+ @click:learn-more =" $emit('click:learn-more')"
74
+ >
75
+ <template #image >
76
+ <div class =" empty-state-icon-gateway" >
77
+ <ServicesIcon
78
+ :color =" KUI_COLOR_TEXT_DECORATIVE_AQUA"
79
+ :size =" KUI_ICON_SIZE_50"
80
+ />
81
+ </div >
82
+ </template >
83
+ </EntityEmptyState >
84
+ </template >
85
+
48
86
<!-- Column Formatting -->
49
87
<template #name =" { rowValue } " >
50
88
<b >{{ rowValue ?? '-' }}</b >
160
198
import type { PropType } from ' vue'
161
199
import { computed , ref , watch , onBeforeMount } from ' vue'
162
200
import { useRouter } from ' vue-router'
163
- import { AddIcon } from ' @kong/icons'
201
+ import { AddIcon , BookIcon , ServicesIcon } from ' @kong/icons'
164
202
import composables from ' ../composables'
165
203
import endpoints from ' ../gateway-services-endpoints'
166
204
import type { AxiosError } from ' axios'
@@ -184,17 +222,21 @@ import {
184
222
EntityFilter ,
185
223
EntityToggleModal ,
186
224
EntityTypes ,
225
+ EntityEmptyState ,
187
226
FetcherStatus ,
188
227
PermissionsWrapper ,
189
228
useAxios ,
229
+ useTableState ,
190
230
useFetcher ,
191
231
useDeleteUrlBuilder ,
192
232
TableTags ,
193
233
} from ' @kong-ui-public/entities-shared'
234
+ import { KUI_ICON_SIZE_50 , KUI_COLOR_TEXT_DECORATIVE_AQUA } from ' @kong/design-tokens'
194
235
import ' @kong-ui-public/entities-shared/dist/style.css'
195
236
196
237
const emit = defineEmits <{
197
238
(e : ' error' , error : AxiosError ): void ,
239
+ (e : ' click:learn-more' ): void ,
198
240
(e : ' copy:success' , payload : CopyEventPayload ): void ,
199
241
(e : ' copy:error' , payload : CopyEventPayload ): void ,
200
242
(e : ' delete:success' , gatewayService : EntityRow ): void ,
@@ -253,12 +295,22 @@ const props = defineProps({
253
295
type: Boolean ,
254
296
default: false ,
255
297
},
298
+ /**
299
+ * Enables the new empty state design, this prop can be removed when
300
+ * the khcp-14756-empty-states-m2 FF is removed.
301
+ */
302
+ enableV2EmptyStates: {
303
+ type: Boolean ,
304
+ default: false ,
305
+ },
256
306
})
257
307
258
308
const { i18n : { t, formatUnixTimeStamp } } = composables .useI18n ()
259
309
const router = useRouter ()
260
310
261
311
const { axiosInstance } = useAxios (props .config ?.axiosRequestConfig )
312
+ const { hideTableToolbar : showEmptyState, handleStateChange } = useTableState (() => filterQuery .value )
313
+
262
314
263
315
/**
264
316
* Table Headers
@@ -551,6 +603,12 @@ const deleteRow = async (): Promise<void> => {
551
603
isDeletePending .value = false
552
604
}
553
605
}
606
+ /**
607
+ * Add Gateway Service
608
+ */
609
+ const handleCreate = (): void => {
610
+ router .push (props .config .createRoute )
611
+ }
554
612
555
613
/**
556
614
* Watchers
@@ -579,6 +637,12 @@ onBeforeMount(async () => {
579
637
</script >
580
638
581
639
<style lang="scss" scoped>
640
+ .button-row {
641
+ align-items : center ;
642
+ display : flex ;
643
+ gap : $kui-space-50 ;
644
+ }
645
+
582
646
.kong-ui-entities-gateway-services-list {
583
647
width : 100% ;
584
648
0 commit comments