Skip to content

Commit

Permalink
Tidy up event headers
Browse files Browse the repository at this point in the history
- opens up to event header e2e failures again...
  • Loading branch information
richard-cox committed Jan 13, 2025
1 parent 1fe4b89 commit 96e30e2
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 22 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/tests/pages/fleet/advanced/workspaces.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Workspaces', { testIsolation: 'off', tags: ['@fleet', '@adminUser'] },
let initialCount: number;

it('check table headers are available in list and details view', () => {
FleetWorkspaceListPagePo.navTo();
fleetWorkspacesPage.goTo();
fleetWorkspacesPage.waitForPage();
fleetWorkspacesPage.sortableTable().noRowsShouldNotExist();
fleetWorkspacesPage.sortableTable().filter(defaultWorkspace);
Expand Down
23 changes: 20 additions & 3 deletions shell/components/form/ResourceTabs/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import { _VIEW } from '@shell/config/query-params';
import RelatedResources from '@shell/components/RelatedResources';
import { isConditionReadyAndWaiting } from '@shell/plugins/dashboard-store/resource-class';
import { PaginationParamFilter } from '@shell/types/store/pagination.types';
import { MESSAGE, REASON } from '@shell/config/table-headers';
import { STEVE_EVENT_LAST_SEEN, STEVE_EVENT_TYPE, STEVE_NAME_COL, STEVE_NAMESPACE_COL } from '@shell/config/pagination-table-headers';

Check warning on line 17 in shell/components/form/ResourceTabs/index.vue

View workflow job for this annotation

GitHub Actions / lint

'STEVE_NAMESPACE_COL' is defined but never used
import { headerFromSchemaColString } from '@shell/store/type-map.utils';
export default {
Expand Down Expand Up @@ -70,13 +73,25 @@ export default {
data() {
const inStore = this.$store.getters['currentStore'](EVENT);
const eventSchema = this.$store.getters[`${ inStore }/schemaFor`](EVENT); // @TODO be smarter about which resources actually ever have events
return {
eventSchema: this.$store.getters[`${ inStore }/schemaFor`](EVENT), // @TODO be smarter about which resources actually ever have events
eventSchema,
EVENT,
selectedTab: this.defaultTab,
selectedTab: this.defaultTab,
inStore,
showConditions: false,
showConditions: false,
paginationHeaders: [
STEVE_EVENT_LAST_SEEN,
STEVE_EVENT_TYPE,
REASON,
headerFromSchemaColString('Subobject', eventSchema, this.$store.getters, true),
headerFromSchemaColString('Source', eventSchema, this.$store.getters, true),
MESSAGE,
headerFromSchemaColString('First Seen', eventSchema, this.$store.getters, true),
headerFromSchemaColString('Count', eventSchema, this.$store.getters, true),
STEVE_NAME_COL,
]
};
},
Expand Down Expand Up @@ -241,6 +256,8 @@ export default {
:local-filter="filterRowsLocal"
:api-filter="filterRowsApi"
:use-query-params-for-simple-filtering="false"
:headers="eventHeaders"
:paginationHeaders="paginationHeaders"
/>
</Tab>
Expand Down
17 changes: 16 additions & 1 deletion shell/config/pagination-table-headers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import {
STATE, NAME as NAME_COL, NAMESPACE as NAMESPACE_COL, AGE, OBJECT
STATE, NAME as NAME_COL, NAMESPACE as NAMESPACE_COL, AGE, OBJECT,
LAST_SEEN_TIME,

Check warning on line 3 in shell/config/pagination-table-headers.js

View workflow job for this annotation

GitHub Actions / lint

'LAST_SEEN_TIME' is defined but never used
EVENT_LAST_SEEN_TIME,
EVENT_TYPE
} from '@shell/config/table-headers';

// This file contains table headers
Expand Down Expand Up @@ -52,6 +55,18 @@ export const STEVE_EVENT_OBJECT = {
search: 'involvedObject.kind',
};

export const STEVE_EVENT_LAST_SEEN = {
...EVENT_LAST_SEEN_TIME,
value: 'metadata.fields.0',
sort: 'metadata.fields.0',
};

export const STEVE_EVENT_TYPE = {
...EVENT_TYPE,
value: '_type',
sort: '_type',
};

export const STEVE_LIST_GROUPS = [{
tooltipKey: 'resourceTable.groupBy.none',
icon: 'icon-list-flat',
Expand Down
24 changes: 7 additions & 17 deletions shell/config/product/explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ import {
STORAGE_CLASS_PROVISIONER, PERSISTENT_VOLUME_SOURCE,
HPA_REFERENCE, MIN_REPLICA, MAX_REPLICA, CURRENT_REPLICA,
ACCESS_KEY, DESCRIPTION, EXPIRES, EXPIRY_STATE, SUB_TYPE, AGE_NORMAN, SCOPE_NORMAN, PERSISTENT_VOLUME_CLAIM, RECLAIM_POLICY, PV_REASON, WORKLOAD_HEALTH_SCALE, POD_RESTARTS,
DURATION, MESSAGE, REASON, LAST_SEEN_TIME, EVENT_TYPE, OBJECT, ROLE, ROLES, VERSION, INTERNAL_EXTERNAL_IP, KUBE_NODE_OS, CPU, RAM, SECRET_DATA
DURATION, MESSAGE, REASON, EVENT_TYPE, OBJECT, ROLE, ROLES, VERSION, INTERNAL_EXTERNAL_IP, KUBE_NODE_OS, CPU, RAM, SECRET_DATA,
EVENT_LAST_SEEN_TIME
} from '@shell/config/table-headers';

import { DSL } from '@shell/store/type-map';
import {
STEVE_AGE_COL, STEVE_EVENT_OBJECT, STEVE_LIST_GROUPS, STEVE_NAMESPACE_COL, STEVE_NAME_COL, STEVE_STATE_COL
STEVE_AGE_COL, STEVE_EVENT_LAST_SEEN, STEVE_EVENT_OBJECT, STEVE_EVENT_TYPE, STEVE_LIST_GROUPS, STEVE_NAMESPACE_COL, STEVE_NAME_COL, STEVE_STATE_COL
} from '@shell/config/pagination-table-headers';

import { COLUMN_BREAKPOINTS } from '@shell/types/store/type-map';
Expand Down Expand Up @@ -321,23 +322,12 @@ export function init(store) {
]
);

const eventLastSeenTime = {
...LAST_SEEN_TIME,
defaultSort: true,
};

headers(EVENT,
[STATE, eventLastSeenTime, EVENT_TYPE, REASON, OBJECT, 'Subobject', 'Source', MESSAGE, 'First Seen', 'Count', NAME_COL, NAMESPACE_COL],
[STATE, EVENT_LAST_SEEN_TIME, EVENT_TYPE, REASON, OBJECT, 'Subobject', 'Source', MESSAGE, 'First Seen', 'Count', NAME_COL, NAMESPACE_COL],
[
STEVE_STATE_COL, {
...eventLastSeenTime,
value: 'metadata.fields.0',
sort: 'metadata.fields.0',
}, {
...EVENT_TYPE,
value: '_type',
sort: '_type',
},
STEVE_STATE_COL,
STEVE_EVENT_LAST_SEEN,
STEVE_EVENT_TYPE,
REASON,
STEVE_EVENT_OBJECT,
'Subobject',
Expand Down
6 changes: 6 additions & 0 deletions shell/config/table-headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,12 @@ export const LAST_SEEN_TIME = {
sort: 'lastTimestamp:desc',
tooltip: 'tableHeaders.lastSeenTooltip'
};

export const EVENT_LAST_SEEN_TIME = {
...LAST_SEEN_TIME,
defaultSort: true,
};

export const LAST_HEARTBEAT_TIME = {
name: 'lastHeartbeatTime',
labelKey: 'tableHeaders.lastSeen',
Expand Down

0 comments on commit 96e30e2

Please sign in to comment.