Skip to content

Commit

Permalink
chore: fix deployment filters
Browse files Browse the repository at this point in the history
  • Loading branch information
amlannandy committed Jan 14, 2025
1 parent 469ea25 commit 935f11d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function DeploymentDetails({
{
id: uuidv4(),
key: {
key: QUERY_KEYS.K8S_NODE_NAME,
key: QUERY_KEYS.K8S_DEPLOYMENT_NAME,
dataType: DataTypes.String,
type: 'resource',
isColumn: false,
Expand All @@ -100,19 +100,19 @@ function DeploymentDetails({
{
id: uuidv4(),
key: {
key: QUERY_KEYS.K8S_CLUSTER_NAME,
key: QUERY_KEYS.K8S_NAMESPACE_NAME,
dataType: DataTypes.String,
type: 'resource',
isColumn: false,
isJSON: false,
id: 'k8s_deployment_name--string--resource--false',
},
op: '=',
value: deployment?.meta.k8s_cluster_name || '',
value: deployment?.meta.k8s_namespace_name || '',
},
],
}),
[deployment?.meta.k8s_deployment_name, deployment?.meta.k8s_cluster_name],
[deployment?.meta.k8s_deployment_name, deployment?.meta.k8s_namespace_name],
);

const initialEventsFilters = useMemo(
Expand Down Expand Up @@ -223,14 +223,15 @@ function DeploymentDetails({
(value: IBuilderQuery['filters']) => {
setLogFilters((prevFilters) => {
const primaryFilters = prevFilters.items.filter((item) =>
[QUERY_KEYS.K8S_NODE_NAME, QUERY_KEYS.K8S_CLUSTER_NAME].includes(
[QUERY_KEYS.K8S_DEPLOYMENT_NAME, QUERY_KEYS.K8S_NAMESPACE_NAME].includes(
item.key?.key ?? '',
),
);
const paginationFilter = value.items.find((item) => item.key?.key === 'id');
const newFilters = value.items.filter(
(item) =>
item.key?.key !== 'id' && item.key?.key !== QUERY_KEYS.K8S_NODE_NAME,
item.key?.key !== 'id' &&
item.key?.key !== QUERY_KEYS.K8S_DEPLOYMENT_NAME,
);

logEvent(
Expand Down Expand Up @@ -258,7 +259,7 @@ function DeploymentDetails({
(value: IBuilderQuery['filters']) => {
setTracesFilters((prevFilters) => {
const primaryFilters = prevFilters.items.filter((item) =>
[QUERY_KEYS.K8S_NODE_NAME, QUERY_KEYS.K8S_CLUSTER_NAME].includes(
[QUERY_KEYS.K8S_DEPLOYMENT_NAME, QUERY_KEYS.K8S_NAMESPACE_NAME].includes(
item.key?.key ?? '',
),
);
Expand All @@ -275,7 +276,7 @@ function DeploymentDetails({
items: [
...primaryFilters,
...value.items.filter(
(item) => item.key?.key !== QUERY_KEYS.K8S_NODE_NAME,
(item) => item.key?.key !== QUERY_KEYS.K8S_DEPLOYMENT_NAME,
),
].filter((item): item is TagFilterItem => item !== undefined),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export default function Events({
id: event.data.id,
key: event.data.id,
resources_string: event.data.resources_string,
attributes_string: event.data.attributes_string,
}),
);

Expand All @@ -179,7 +180,9 @@ export default function Events({
}, [eventsData]);

const handleExpandRow = (record: EventDataType): JSX.Element => (
<EventContents data={record.resources_string} />
<EventContents
data={{ ...record.attributes_string, ...record.resources_string }}
/>
);

const handlePrev = (): void => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function PodLogs({
const newRestFilters = filters.items.filter(
(item) =>
item.key?.key !== 'id' &&
![QUERY_KEYS.K8S_NODE_NAME, QUERY_KEYS.K8S_CLUSTER_NAME].includes(
![QUERY_KEYS.K8S_DEPLOYMENT_NAME, QUERY_KEYS.K8S_NAMESPACE_NAME].includes(
item.key?.key ?? '',
),
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const QUERY_KEYS = {
K8S_OBJECT_KIND: 'k8s.object.kind',
K8S_OBJECT_NAME: 'k8s.object.name',
K8S_NODE_NAME: 'k8s.deployment.name',
K8S_CLUSTER_NAME: 'k8s.cluster.name',
K8S_DEPLOYMENT_NAME: 'k8s.deployment.name',
K8S_NAMESPACE_NAME: 'k8s.namespace.name',
};

0 comments on commit 935f11d

Please sign in to comment.