Skip to content

Commit

Permalink
update overview events widget
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanHoladay committed Nov 7, 2024
1 parent 369bd9a commit fe8f37d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
4 changes: 2 additions & 2 deletions ui/src/lib/components/k8s/DataTable/component.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@
{:else if $rows.length === 0}
<tr class="!pointer-events-none !border-b-0">
<td colspan="9">
<div class="w-full flex flex-col justify-center items-center content-center">
{#each rows.noResourcesMSG as resource}
<div class="flex flex-col items-center">
{#each rows.noResourcesMsg as resource}
<div class={`w-96 text-center ${resource.style}`}>
{resource.msg}
</div>
Expand Down
8 changes: 6 additions & 2 deletions ui/src/lib/components/k8s/Event/EventsOverviewWidget.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,12 @@
<span>No matching entries found</span>
</div>
{:else if $rows.length === 0}
<div class="!pointer-events-none !border-b-0 flex h-12 justify-center items-center">
<span>No resources found</span>
<div class="!pointer-events-none !border-b-0 mt-6 flex flex-col items-center">
{#each rows.noResourcesMsg as resource}
<div class={`w-96 text-center ${resource.style}`}>
{resource.msg}
</div>
{/each}
</div>
{:else}
{#each $rows as row}
Expand Down
22 changes: 12 additions & 10 deletions ui/src/lib/features/k8s/events/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,21 @@ export function createStore(): ResourceStoreInterface<Resource, Row> {

const store = new ResourceStore<Resource, Row>(url, transform, 'age', false)

const noResourcesMsg = [
{
msg: 'No active events to display',
style: 'text-sm font-bold dark:text-white',
},
{
msg: 'Cluster events from the last hour will appear here. An empty log often indicates healthy cluster performance.',
style: 'text-sm font-normal text-gray-400',
},
]

return {
...store,
start: store.start.bind(store),
sortByKey: store.sortByKey.bind(store),
noResourcesMSG: [
{
msg: 'No active events to display',
style: 'text-sm font-bold dark:text-white',
},
{
msg: 'Cluster events from the last hour will appear here. An empty log often indicates healthy cluster performance.',
style: '',
},
],
noResourcesMsg,
}
}
2 changes: 1 addition & 1 deletion ui/src/lib/features/k8s/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class ResourceStore<T extends KubernetesObject, U extends CommonRow> impl
// The URL for the EventSource
public url = ''
// The message to display when there are no resources
public noResourcesMSG = [{ msg: 'No resources found', style: '' }]
public noResourcesMsg = [{ msg: 'No resources found', style: '' }]

/**
* Create a new ResourceStore instance
Expand Down
2 changes: 1 addition & 1 deletion ui/src/lib/features/k8s/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export interface ResourceStoreInterface<T extends KubernetesObject, U extends Co
// The url for the EventSource
url: string
// The message to display when there are no resources
noResourcesMSG: { msg: string; style: string }[]
noResourcesMsg: { msg: string; style: string }[]
}

// Define specific status types for each resource
Expand Down

0 comments on commit fe8f37d

Please sign in to comment.