-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Tech Debt] Reorder Rules page #152897
[Tech Debt] Reorder Rules page #152897
Conversation
78a1847
to
bc4a886
Compare
bc4a886
to
e47ab7c
Compare
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
@@ -394,7 +394,7 @@ export const RulesList = ({ | |||
if (lastRunOutcomeFilter) { | |||
updateFilters({ filter: 'ruleLastRunOutcomes', value: lastRunOutcomeFilter }); | |||
} | |||
}, [lastResponseFilter]); | |||
}, [lastRunOutcomeFilter]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't ESLint have caught this? It seems the exhaustive-deps rule is not kicking in here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, looks like we have a legacy file wide /* eslint-disable react-hooks/exhaustive-deps */
at the top of the file.
I will create an issue to remove it
'ruleExecutionStatus', | ||
'ruleExecutionState', | ||
]} | ||
onLastRunOutcomeFilterChange={handleLastRunOutcomeFilterChange} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the lastResponse
filter in the Rules List UI didn't update the URL in the previous implementation. Now updated so it does
|
||
function WrappedRulesPage() { | ||
return ( | ||
<Provider value={rulesPageStateContainer}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced state container with a simpler pattern that offers the same functionality
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What pattern did you use instead and where is the implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tagged you in 2 comments.
@@ -24691,18 +24691,7 @@ | |||
"xpack.observability.rules.addRuleButtonLabel": "Créer une règle", | |||
"xpack.observability.rules.deleteSelectedIdsConfirmModal.cancelButtonLabel": "Annuler", | |||
"xpack.observability.rules.docsLinkText": "Documentation", | |||
"xpack.observability.rules.loadError": "Impossible de charger les règles", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these translations were exported from translations.ts but never imported anywhere
} | ||
|
||
const transitions: RulesPageStateTransitions = { | ||
setLastResponse: (state) => (lastResponse) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this code seems to be referencing a previous implementation of this table that is not used in the current page.
I suspect the RuleList component used to live inside Observability, but has been moved to TriggersActionUi. In that process this implementation was not properly cleaned up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
triggers actions UI changes LGTM!
@@ -394,7 +394,7 @@ export const RulesList = ({ | |||
if (lastRunOutcomeFilter) { | |||
updateFilters({ filter: 'ruleLastRunOutcomes', value: lastRunOutcomeFilter }); | |||
} | |||
}, [lastResponseFilter]); | |||
}, [lastRunOutcomeFilter]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, looks like we have a legacy file wide /* eslint-disable react-hooks/exhaustive-deps */
at the top of the file.
I will create an issue to remove it
const urlStateStorage = createKbnUrlStateStorage({ | ||
history, | ||
useHash: false, | ||
useHashQuery: false, | ||
}); | ||
|
||
const { status, lastResponse } = urlStateStorage.get<{ | ||
status: RuleStatus[]; | ||
lastResponse: string[]; | ||
}>('_a') || { status: [], lastResponse: [] }; | ||
|
||
const [stateStatus, setStatus] = useState<RuleStatus[]>(status); | ||
const [stateLastResponse, setLastResponse] = useState<string[]>(lastResponse); | ||
const [stateRefresh, setRefresh] = useState(new Date()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maryam-saeidi new code as replacement of state container (part 1) (line 45-58)
const handleStatusFilterChange = (newStatus: RuleStatus[]) => { | ||
setStatus(newStatus); | ||
urlStateStorage.set('_a', { status: newStatus, lastResponse }); | ||
return { lastResponse: stateLastResponse || [], status: newStatus }; | ||
}; | ||
|
||
const handleLastRunOutcomeFilterChange = (newLastResponse: string[]) => { | ||
setRefresh(new Date()); | ||
setLastResponse(newLastResponse); | ||
urlStateStorage.set('_a', { status, lastResponse: newLastResponse }); | ||
return { lastResponse: newLastResponse, status: stateStatus || [] }; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maryam-saeidi and part 2 (line 76-87)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and works as expected locally 👍🏻
…loy-my-kibana-oblt * upstream/main: (727 commits) Upgrade caniuse-lite db (elastic#153318) [Security Solution] expanded flyout - right section - json tab implementation (elastic#152935) chore(slo): Make APM indicator's index required (elastic#153311) skip failing test suite (elastic#136688) [Security Solution] Fix security-solution storybook package codeowners (elastic#153307) [EUI] Add `scrollLock` workaround CSS to Kibana's `body` (elastic#153227) [Cloud Security] Show coming soon deployments of vulnerability management (elastic#153249) [Cloud Security] fixed onboarding link directs to cspm integration (elastic#153268) [Response Ops][Alerting] Reusable functions for FAAD resource installation (elastic#152849) remove geohash_grid aggregation support (elastic#152952) [Tech Debt] Reorder Rules page (elastic#152897) [Saved Object Finder] Add help text & left button (elastic#152742) [Transform] Replace SavedObjectsFinder component (elastic#153128) Make pipeline creation endpoint accept a full pipeline definition (elastic#153133) [Fleet] Displaying policy changes in Agent activity (elastic#153237) skip flaky suite (elastic#152852) [Security Solution][Endpoint] Add tests to cover RBAC entries in the Role Kibana Privileges flyout (elastic#153068) [Security Solution][Endpoint] Additional tests for Response Console History Log page (covers TestRail manual tests) (elastic#153042) [Monitoring] Display node roles in Nodes table (elastic#152127) Rename getEditAlertFlyout to getEditRuleFlyout (elastic#153243) ...
Resolves #152790
Summary
This PR updates the Rules Page to follow the newly agreed upon structure for the Observability app.
This PR is part of a larger effort to have all pages in the Observability app follow the same structure so they are more consistent with each other. More details in the epic: #152783
It also cleans up dead and unused components where found.
All design and functionality should be exactly the same as before.