Skip to content
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

[App Search] Added the log retention panel to the Settings page #82982

Merged
merged 8 commits into from
Nov 10, 2020

Conversation

JasonStoltz
Copy link
Member

@JasonStoltz JasonStoltz commented Nov 9, 2020

Summary

This PR adds the log retention section to the App Search Settings page.

Options can be enabled, but can not yet be disabled, as they require the next PR, which will add a modal.

In the meantime, you can navigate directly to the stand-alone UI to enable and disable options.

screencapture-localhost-5601-app-enterprise-search-app-search-settings-account-2020-11-09-12_57_36

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@JasonStoltz JasonStoltz requested a review from a team November 9, 2020 17:07
@JasonStoltz JasonStoltz changed the title Added LogRententionPanel [App Search] Added the log retentional panel to the Settings page Nov 9, 2020
@JasonStoltz JasonStoltz added 7.11.0 release_note:skip Skip the PR/issue when compiling release notes labels Nov 9, 2020
@JasonStoltz JasonStoltz changed the title [App Search] Added the log retentional panel to the Settings page [App Search] Added the log retention panel to the Settings page Nov 9, 2020
@JasonStoltz JasonStoltz removed the 7.11.0 label Nov 9, 2020
Copy link
Contributor

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly very minor nit change requests and some rambling from me

}
);

const API_STORED = (minAgeDays: number | null | undefined) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems weird to have null and undefined as a type option here, although I'm not sure we can do anything about it since I assume this is data coming from the server

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's weird, I agree.

logRetentionSettings.retentionPolicy?.isDefault
) {
return renderOrReturnMessage(messages.defaultPolicy);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're getting an uncovered branch line on line 39 - I assume basically Jest wants to know what happens if all our if branches are skipped and it passes through to the very end, which is unlikely to happen in a real world scenario. Probably not really worth covering right now / something to look at later as tech debt. If you'd like me to look at this after your PRs get in today, LMK

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw that as well and couldn't quite figure out what the failure was all about.

determineTooltipContent(API_MESSAGES, true, {
...BASE_SETTINGS,
enabled: false,
disabledAt: 'Thu, 05 Nov 2020 18:57:28 +0000',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a change request, just an aside: using current dates for tests is always somewhat amusing because they end up acting as a time capsule when looking back at code. Like, someone will come in here 5 years from now and be like "oh I guess this code is 5 years old haha". Personally, I like using Jan 1 1970 as a clear way of saying in a test "this is an arbitrary/mock date".

Comment on lines 71 to 87
it('renders API switch off when apiLogRetention is false in LogRetentionLogic ', () => {
setMockValues({
isLogRetentionUpdating: false,
logRetention: mockLogRetention({
api: {
enabled: false,
},
}),
});

const logRetentionPanel = shallow(<LogRetentionPanel />);
expect(
logRetentionPanel.find(`[data-test-subj="LogRetentionPanelAPISwitch"]`).prop('checked')
).toEqual(false);
});

it('renders API switch on when apiLogRetention is true in LogRetentionLogic ', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Not a change request] It might be interesting (later, as tech debt) to combine these two tests into a single test that tests both true/false. Might save on some setup time and combines the tests conceptually. I'd have to DRY out a rerender helper of some kind though.

const logRetentionPanel = shallow(<LogRetentionPanel />);

setMockValues({ ... });
logRetentionPanel.setProps({}); // rerenders/updates component
expect(switchIsChecked).toEqual(false);

setMockValues({ ... });
logRetentionPanel.setProps({}); // rerenders/updates component
expect(switchIsChecked).toEqual(true);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree.

JasonStoltz and others added 4 commits November 9, 2020 15:09
…h/components/settings/log_retention/messaging/determine_tooltip_content.test.ts

Co-authored-by: Constance <constancecchen@users.noreply.github.com>
Co-authored-by: Constance <constancecchen@users.noreply.github.com>
Co-authored-by: Constance <constancecchen@users.noreply.github.com>
@JasonStoltz JasonStoltz requested a review from cee-chen November 9, 2020 20:18
@JasonStoltz
Copy link
Member Author

JasonStoltz commented Nov 9, 2020

@constancecchen I think I got all of the blocking feedback. I especially appreciated the accessibility help!

Copy link
Contributor

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks for the speedy changes!

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
enterpriseSearch 453 460 +7

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
enterpriseSearch 664.0KB 678.8KB +14.8KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@JasonStoltz JasonStoltz merged commit 291c34c into elastic:master Nov 10, 2020
@JasonStoltz JasonStoltz deleted the log-retention-ui branch November 10, 2020 15:26
JasonStoltz added a commit to JasonStoltz/kibana that referenced this pull request Nov 10, 2020
…tic#82982)

* Added LogRententionPanel

* i18n

* fix axe failure

* Update x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/messaging/determine_tooltip_content.test.ts

Co-authored-by: Constance <constancecchen@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Constance <constancecchen@users.noreply.github.com>

* PR Feeback: interpolation

* Apply suggestions from code review

Co-authored-by: Constance <constancecchen@users.noreply.github.com>

Co-authored-by: Constance <constancecchen@users.noreply.github.com>
phillipb added a commit to phillipb/kibana that referenced this pull request Nov 10, 2020
…kibana into bootstrap-node-details-overlay

* 'bootstrap-node-details-overlay' of github.com:phillipb/kibana: (49 commits)
  [Security Solution] Fix DNS Network table query (elastic#82778)
  [Workplace Search] Consolidate groups routes (elastic#83015)
  Adds cloud links to user menu (elastic#82803)
  [Security Solution][Detections] - follow up cleanup on auto refresh rules (elastic#83023)
  [App Search] Added the log retention panel to the Settings page (elastic#82982)
  [Maps] show icon when layer is filtered by time and allow layers to ignore global time range (elastic#83006)
  [DOCS] Consolidates drilldown pages (elastic#82081)
  [Maps] add on-prem EMS config (elastic#82525)
  migrate i18n mixin to KP (elastic#81799)
  [bundle optimization] fix imports of react-use lib (elastic#82847)
  [Discover] Add metric on adding filter (elastic#82961)
  [Lens] Performance refactoring for indexpattern fast lookup and Operation support matrix computation (elastic#82829)
  skip flaky suite (elastic#82804)
  Fix SO query for searching across spaces (elastic#83025)
  renaming built-in alerts to Stack Alerts (elastic#82873)
  [TSVB] Disable using top_hits in pipeline aggregations (elastic#82278)
  [Visualizations] Remove kui usage (elastic#82810)
  [Visualizations] Make the icon buttons labels more descriptive (elastic#82585)
  [Lens] Do not reset formatting when switching between custom ranges and auto histogram (elastic#82694)
  Fix ilm navigation (elastic#81664)
  ...
gmmorris added a commit to gmmorris/kibana that referenced this pull request Nov 10, 2020
…na into alerts/stack-alerts-public

* 'alerts/stack-alerts-public' of github.com:gmmorris/kibana:
  [Security Solution] Fix DNS Network table query (elastic#82778)
  [Workplace Search] Consolidate groups routes (elastic#83015)
  Adds cloud links to user menu (elastic#82803)
  [Security Solution][Detections] - follow up cleanup on auto refresh rules (elastic#83023)
  [App Search] Added the log retention panel to the Settings page (elastic#82982)
  [Maps] show icon when layer is filtered by time and allow layers to ignore global time range (elastic#83006)
  [DOCS] Consolidates drilldown pages (elastic#82081)
  [Maps] add on-prem EMS config (elastic#82525)
  migrate i18n mixin to KP (elastic#81799)
  [bundle optimization] fix imports of react-use lib (elastic#82847)
  [Discover] Add metric on adding filter (elastic#82961)
  [Lens] Performance refactoring for indexpattern fast lookup and Operation support matrix computation (elastic#82829)
  skip flaky suite (elastic#82804)
  Fix SO query for searching across spaces (elastic#83025)
  renaming built-in alerts to Stack Alerts (elastic#82873)
  [TSVB] Disable using top_hits in pipeline aggregations (elastic#82278)
  [Visualizations] Remove kui usage (elastic#82810)
  [Visualizations] Make the icon buttons labels more descriptive (elastic#82585)
  [Lens] Do not reset formatting when switching between custom ranges and auto histogram (elastic#82694)
:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes v7.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants