Skip to content

Commit

Permalink
[App Search] ILM is always enabled from 8.0 (#117291) (#117669)
Browse files Browse the repository at this point in the history
Co-authored-by: Orhan Toy <[email protected]>
  • Loading branch information
kibanamachine and orhantoy authored Nov 5, 2021
1 parent f842adc commit 064e3b5
Show file tree
Hide file tree
Showing 11 changed files with 2 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

export const DEFAULT_INITIAL_APP_DATA = {
readOnlyMode: false,
ilmEnabled: true,
searchOAuth: {
clientId: 'someUID',
redirectUrl: 'http://localhost:3002/ws/search_callback',
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/enterprise_search/common/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {

export interface InitialAppData {
readOnlyMode?: boolean;
ilmEnabled?: boolean;
searchOAuth?: SearchOAuth;
configuredLimits?: ConfiguredLimits;
access?: ProductAccess;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ describe('AppLogic', () => {
mount({}, DEFAULT_INITIAL_APP_DATA);

expect(AppLogic.values).toEqual({
ilmEnabled: true,
configuredLimits: {
engine: {
maxDocumentByteSize: 102400,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { ConfiguredLimits, Account, Role } from './types';
import { getRoleAbilities } from './utils/role';

interface AppValues {
ilmEnabled: boolean;
configuredLimits: ConfiguredLimits;
account: Account;
myRole: Role;
Expand All @@ -41,7 +40,6 @@ export const AppLogic = kea<MakeLogicType<AppValues, AppActions, Required<Initia
},
],
configuredLimits: [props.configuredLimits.appSearch, {}],
ilmEnabled: [props.ilmEnabled, {}],
}),
selectors: {
myRole: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,6 @@ export const NoLogging: React.FC<Props> = ({ type, disabledAt }) => {
);
};

export const ILMDisabled: React.FC<Props> = ({ type }) => (
<FormattedMessage
id="xpack.enterpriseSearch.appSearch.logRetention.ilmDisabled"
defaultMessage="App Search isn't managing {logsType} log retention."
values={{ logsType: CAPITALIZATION_MAP[type].lowercase }}
/>
);

export const CustomPolicy: React.FC<Props> = ({ type }) => (
<FormattedMessage
id="xpack.enterpriseSearch.appSearch.logRetention.customPolicy"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('LogRetentionMessage', () => {
const analytics = LogRetentionOptions.Analytics;
const api = LogRetentionOptions.API;

const setLogRetention = (logRetention: object, ilmEnabled: boolean = true) => {
const setLogRetention = (logRetention: object) => {
const logRetentionSettings = {
disabledAt: null,
enabled: true,
Expand All @@ -30,7 +30,6 @@ describe('LogRetentionMessage', () => {
};

setMockValues({
ilmEnabled,
logRetention: {
[LogRetentionOptions.API]: logRetentionSettings,
[LogRetentionOptions.Analytics]: logRetentionSettings,
Expand Down Expand Up @@ -155,22 +154,4 @@ describe('LogRetentionMessage', () => {
});
});
});

describe('when ILM is disabled entirely', () => {
describe('an ILM disabled message renders', () => {
beforeEach(() => {
setLogRetention({}, false);
});

it('for analytics', () => {
const wrapper = mountWithIntl(<LogRetentionMessage type={analytics} />);
expect(wrapper.text()).toEqual("App Search isn't managing analytics log retention.");
});

it('for api', () => {
const wrapper = mountWithIntl(<LogRetentionMessage type={api} />);
expect(wrapper.text()).toEqual("App Search isn't managing API log retention.");
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,15 @@ import React from 'react';

import { useValues } from 'kea';

import { AppLogic } from '../../../app_logic';
import { LogRetentionLogic } from '../log_retention_logic';
import { LogRetentionOptions } from '../types';

import { NoLogging, ILMDisabled, CustomPolicy, DefaultPolicy } from './constants';
import { NoLogging, CustomPolicy, DefaultPolicy } from './constants';

interface Props {
type: LogRetentionOptions;
}
export const LogRetentionMessage: React.FC<Props> = ({ type }) => {
const { ilmEnabled } = useValues(AppLogic);

const { logRetention } = useValues(LogRetentionLogic);
if (!logRetention) return null;

Expand All @@ -30,9 +27,6 @@ export const LogRetentionMessage: React.FC<Props> = ({ type }) => {
if (!logRetentionSettings.enabled) {
return <NoLogging type={type} disabledAt={logRetentionSettings.disabledAt} />;
}
if (!ilmEnabled) {
return <ILMDisabled type={type} />;
}
if (!logRetentionSettings.retentionPolicy?.isDefault) {
return <CustomPolicy type={type} />;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ describe('callEnterpriseSearchConfigAPI', () => {
settings: {
external_url: 'http://some.vanity.url/',
read_only_mode: false,
ilm_enabled: true,
is_federated_auth: false,
search_oauth: {
client_id: 'someUID',
Expand Down Expand Up @@ -139,7 +138,6 @@ describe('callEnterpriseSearchConfigAPI', () => {
},
publicUrl: undefined,
readOnlyMode: false,
ilmEnabled: false,
searchOAuth: {
clientId: undefined,
redirectUrl: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ export const callEnterpriseSearchConfigAPI = async ({
},
publicUrl: stripTrailingSlash(data?.settings?.external_url),
readOnlyMode: !!data?.settings?.read_only_mode,
ilmEnabled: !!data?.settings?.ilm_enabled,
searchOAuth: {
clientId: data?.settings?.search_oauth?.client_id,
redirectUrl: data?.settings?.search_oauth?.redirect_url,
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -9744,7 +9744,6 @@
"xpack.enterpriseSearch.appSearch.logRetention.callout.disabledSinceTitle": "{logsTitle}は、{disabledDate}以降に無効にされました。",
"xpack.enterpriseSearch.appSearch.logRetention.callout.disabledTitle": "{logsTitle}は無効です。",
"xpack.enterpriseSearch.appSearch.logRetention.customPolicy": "カスタム{logsType}ログ保持ポリシーがあります。",
"xpack.enterpriseSearch.appSearch.logRetention.ilmDisabled": "App Search は{logsType}ログ保持を管理していません。",
"xpack.enterpriseSearch.appSearch.logRetention.noLogging": "すべてのエンジンの{logsType}ログが無効です。",
"xpack.enterpriseSearch.appSearch.logRetention.noLogging.collected": "前回の{logsType}ログは{disabledAtDate}に収集されました。",
"xpack.enterpriseSearch.appSearch.logRetention.noLogging.notCollected": "収集された{logsType}ログはありません。",
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -9842,7 +9842,6 @@
"xpack.enterpriseSearch.appSearch.logRetention.callout.disabledTitle": "{logsTitle} 已禁用。",
"xpack.enterpriseSearch.appSearch.logRetention.customPolicy": "您有定制 {logsType} 日志保留策略。",
"xpack.enterpriseSearch.appSearch.logRetention.defaultPolicy": "您的 {logsType} 日志将存储至少 {minAgeDays, plural, other {# 天}}。",
"xpack.enterpriseSearch.appSearch.logRetention.ilmDisabled": "App Search 未管理 {logsType} 日志保留。",
"xpack.enterpriseSearch.appSearch.logRetention.noLogging": "所有引擎的 {logsType} 日志记录均已禁用。",
"xpack.enterpriseSearch.appSearch.logRetention.noLogging.collected": "{logsType} 日志的最后收集日期为 {disabledAtDate}。",
"xpack.enterpriseSearch.appSearch.logRetention.noLogging.notCollected": "未收集任何 {logsType} 日志。",
Expand Down

0 comments on commit 064e3b5

Please sign in to comment.