Skip to content

Commit 3063bf7

Browse files
committed
Avoid CCS-incompatible index name resolution
1 parent 40ff82d commit 3063bf7

File tree

5 files changed

+10
-17
lines changed

5 files changed

+10
-17
lines changed

x-pack/plugins/infra/common/http_api/log_sources/get_log_source_status.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export type LogIndexField = rt.TypeOf<typeof logIndexFieldRT>;
4242

4343
const logSourceStatusRT = rt.strict({
4444
logIndexFields: rt.array(logIndexFieldRT),
45-
logIndexNames: rt.array(rt.string),
45+
logIndicesExist: rt.boolean,
4646
});
4747

4848
export type LogSourceStatus = rt.TypeOf<typeof logSourceStatusRT>;

x-pack/plugins/infra/public/containers/logs/log_source/log_source.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,6 @@ export const useLogSource = ({
7878
[sourceId, fetch]
7979
);
8080

81-
/* eslint-disable-next-line react-hooks/exhaustive-deps */
82-
const logIndicesExist = useMemo(() => (sourceStatus?.logIndexNames?.length ?? 0) > 0, [
83-
sourceStatus,
84-
]);
85-
8681
const derivedIndexPattern = useMemo(
8782
() => ({
8883
fields: sourceStatus?.logIndexFields ?? [],
@@ -160,7 +155,6 @@ export const useLogSource = ({
160155
loadSourceFailureMessage,
161156
loadSourceConfiguration,
162157
loadSourceStatus,
163-
logIndicesExist,
164158
sourceConfiguration,
165159
sourceId,
166160
sourceStatus,

x-pack/plugins/infra/public/pages/logs/stream/page_content.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ export const StreamPageContent: React.FunctionComponent = () => {
1818
isUninitialized,
1919
loadSource,
2020
loadSourceFailureMessage,
21-
logIndicesExist,
21+
sourceStatus,
2222
} = useLogSourceContext();
2323

2424
if (isLoading || isUninitialized) {
2525
return <SourceLoadingPage />;
2626
} else if (hasFailedLoadingSource) {
2727
return <SourceErrorPage errorMessage={loadSourceFailureMessage ?? ''} retry={loadSource} />;
28-
} else if (logIndicesExist) {
28+
} else if (sourceStatus?.logIndicesExist) {
2929
return <LogsPageLogsContent />;
3030
} else {
3131
return <LogsPageNoIndicesContent />;

x-pack/plugins/infra/public/pages/logs/stream/page_providers.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ const LogHighlightsStateProvider: React.FC = ({ children }) => {
104104
};
105105

106106
export const LogsPageProviders: React.FunctionComponent = ({ children }) => {
107-
const { logIndicesExist } = useLogSourceContext();
107+
const { sourceStatus } = useLogSourceContext();
108108

109109
// The providers assume the source is loaded, so short-circuit them otherwise
110-
if (!logIndicesExist) {
110+
if (!sourceStatus?.logIndicesExist) {
111111
return <>{children}</>;
112112
}
113113

x-pack/plugins/infra/server/routes/log_sources/status.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,16 @@ export const initLogSourceStatusRoutes = ({
3131
const { sourceId } = request.params;
3232

3333
try {
34-
const logIndexNames = await sourceStatus.getLogIndexNames(requestContext, sourceId);
35-
const logIndexFields =
36-
logIndexNames.length > 0
37-
? await fields.getFields(requestContext, sourceId, InfraIndexType.LOGS)
38-
: [];
34+
const logIndicesExist = await sourceStatus.hasLogIndices(requestContext, sourceId);
35+
const logIndexFields = logIndicesExist
36+
? await fields.getFields(requestContext, sourceId, InfraIndexType.LOGS)
37+
: [];
3938

4039
return response.ok({
4140
body: getLogSourceStatusSuccessResponsePayloadRT.encode({
4241
data: {
42+
logIndicesExist,
4343
logIndexFields,
44-
logIndexNames,
4544
},
4645
}),
4746
});

0 commit comments

Comments
 (0)