[Enterprise Search] Reintroduce content plugin for next release (#134026)

* Reintroduce content plugin for next release

Adds simple tabs on the overview tab

* Updated comments to be accurate as suggested on review

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Efe Gürkan YALAMAN 2022-06-13 16:00:49 +02:00 committed by GitHub
parent 4e5f930233
commit 90e46180fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 287 additions and 4 deletions

View file

@ -134,6 +134,7 @@ export const applicationUsageSchema = {
apm: commonSchema,
canvas: commonSchema,
enterpriseSearch: commonSchema,
enterpriseSearchContent: commonSchema,
elasticsearch: commonSchema,
appSearch: commonSchema,
workplaceSearch: commonSchema,

View file

@ -2223,6 +2223,137 @@
}
}
},
"enterpriseSearchContent": {
"properties": {
"appId": {
"type": "keyword",
"_meta": {
"description": "The application being tracked"
}
},
"viewId": {
"type": "keyword",
"_meta": {
"description": "Always `main`"
}
},
"clicks_total": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application since we started counting them"
}
},
"clicks_7_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application over the last 7 days"
}
},
"clicks_30_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application over the last 30 days"
}
},
"clicks_90_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application over the last 90 days"
}
},
"minutes_on_screen_total": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen since we started counting them."
}
},
"minutes_on_screen_7_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen over the last 7 days"
}
},
"minutes_on_screen_30_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen over the last 30 days"
}
},
"minutes_on_screen_90_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen over the last 90 days"
}
},
"views": {
"type": "array",
"items": {
"properties": {
"appId": {
"type": "keyword",
"_meta": {
"description": "The application being tracked"
}
},
"viewId": {
"type": "keyword",
"_meta": {
"description": "The application view being tracked"
}
},
"clicks_total": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application sub view since we started counting them"
}
},
"clicks_7_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the active application sub view over the last 7 days"
}
},
"clicks_30_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the active application sub view over the last 30 days"
}
},
"clicks_90_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the active application sub view over the last 90 days"
}
},
"minutes_on_screen_total": {
"type": "float",
"_meta": {
"description": "Minutes the application sub view is active and on-screen since we started counting them."
}
},
"minutes_on_screen_7_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen active application sub view over the last 7 days"
}
},
"minutes_on_screen_30_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen active application sub view over the last 30 days"
}
},
"minutes_on_screen_90_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen active application sub view over the last 90 days"
}
}
}
}
}
}
},
"elasticsearch": {
"properties": {
"appId": {

View file

@ -5,18 +5,93 @@
* 2.0.
*/
import React from 'react';
import React, { useState } from 'react';
import {
EuiCodeBlock,
EuiText,
EuiFlexGroup,
EuiButton,
EuiButtonIcon,
EuiFlexItem,
EuiPanel,
EuiTabs,
EuiTab,
EuiSpacer,
} from '@elastic/eui';
import { getEnterpriseSearchUrl } from '../../../shared/enterprise_search_url/external_url';
import { EnterpriseSearchContentPageTemplate } from '../layout/page_template';
import { DOCUMENTS_API_JSON_EXAMPLE } from '../new_index/constants';
import { TotalStats } from './total_stats';
export const SearchIndexOverview: React.FC = () => {
const [tabIndex, setSelectedTabIndex] = useState(0);
const searchIndexApiUrl = getEnterpriseSearchUrl('/api/ent/v1/search_indices/');
const apiKey = 'Create an API Key';
return (
<EnterpriseSearchContentPageTemplate
pageChrome={[]}
pageViewTelemetry="Overview"
isLoading={false}
pageHeader={{ pageTitle: 'my-cool-index-name' }}
>
<>Overview</>
<EuiTabs bottomBorder expand size="xl">
<EuiTab isSelected={tabIndex === 0} onClick={() => setSelectedTabIndex(0)}>
Overview
</EuiTab>
<EuiTab isSelected={tabIndex === 1} onClick={() => setSelectedTabIndex(1)}>
Document explorer
</EuiTab>
<EuiTab isSelected={tabIndex === 2} onClick={() => setSelectedTabIndex(2)}>
Index mappings
</EuiTab>
<EuiTab isSelected={tabIndex === 3} onClick={() => setSelectedTabIndex(3)}>
Configuration
</EuiTab>
</EuiTabs>
<EuiSpacer size="l" />
<TotalStats />
<EuiFlexGroup>
<EuiFlexItem>
<EuiPanel>
<EuiFlexGroup direction="column">
<EuiFlexItem>
<EuiFlexGroup justifyContent="spaceBetween" alignItems="center">
<EuiFlexItem>
<EuiText>
<h2>Indexing by API</h2>
</EuiText>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiFlexGroup justifyContent="flexEnd" alignItems="center">
<EuiFlexItem>
<EuiButtonIcon iconType="iInCircle" />
</EuiFlexItem>
<EuiFlexItem>
<EuiButton>Generate an API key</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem>
<EuiCodeBlock language="bash" fontSize="m" isCopyable>
{`\
curl -X POST '${searchIndexApiUrl}${name}/document' \\
-H 'Content-Type: application/json' \\
-H 'Authorization: Bearer ${apiKey}' \\
-d '${JSON.stringify(DOCUMENTS_API_JSON_EXAMPLE, null, 2)}'
`}
</EuiCodeBlock>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPanel>
</EuiFlexItem>
</EuiFlexGroup>
</EnterpriseSearchContentPageTemplate>
);
};

View file

@ -0,0 +1,46 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React, { useState } from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiStat } from '@elastic/eui';
export const TotalStats: React.FC = () => {
const [{ lastUpdated, documentCount, indexHealth, ingestionType }] = useState({
lastUpdated: 'Just now',
documentCount: 0,
indexHealth: 'Healthy',
ingestionType: 'API',
});
return (
<EuiFlexGroup direction="row">
<EuiFlexItem>
<EuiPanel color="success" hasShadow={false} paddingSize="l">
<EuiStat description="Ingestion type" title={ingestionType} />
</EuiPanel>
</EuiFlexItem>
<EuiFlexItem>
<EuiPanel color="subdued" hasShadow={false} paddingSize="l">
<EuiStat description="Document count" title={documentCount} />
</EuiPanel>
</EuiFlexItem>
<EuiFlexItem>
<EuiPanel color="subdued" hasShadow={false} paddingSize="l">
<EuiStat description="Index health" title={indexHealth} />
</EuiPanel>
</EuiFlexItem>
<EuiFlexItem>
<EuiPanel color="subdued" hasShadow={false} paddingSize="l">
<EuiStat description="Last Updated" title={lastUpdated} />
</EuiPanel>
</EuiFlexItem>
</EuiFlexGroup>
);
};

View file

@ -24,6 +24,7 @@ import { SecurityPluginSetup, SecurityPluginStart } from '@kbn/security-plugin/p
import {
APP_SEARCH_PLUGIN,
ELASTICSEARCH_PLUGIN,
ENTERPRISE_SEARCH_CONTENT_PLUGIN,
ENTERPRISE_SEARCH_OVERVIEW_PLUGIN,
WORKPLACE_SEARCH_PLUGIN,
} from '../common/constants';
@ -89,6 +90,29 @@ export class EnterpriseSearchPlugin implements Plugin {
},
});
core.application.register({
id: ENTERPRISE_SEARCH_CONTENT_PLUGIN.ID,
title: ENTERPRISE_SEARCH_CONTENT_PLUGIN.NAV_TITLE,
euiIconType: ENTERPRISE_SEARCH_CONTENT_PLUGIN.LOGO,
appRoute: ENTERPRISE_SEARCH_CONTENT_PLUGIN.URL,
category: DEFAULT_APP_CATEGORIES.enterpriseSearch,
mount: async (params: AppMountParameters) => {
const kibanaDeps = await this.getKibanaDeps(core, params, cloud);
const { chrome, http } = kibanaDeps.core;
chrome.docTitle.change(ENTERPRISE_SEARCH_CONTENT_PLUGIN.NAME);
await this.getInitialData(http);
const pluginData = this.getPluginData();
const { renderApp } = await import('./applications');
const { EnterpriseSearchContent } = await import(
'./applications/enterprise_search_content'
);
return renderApp(EnterpriseSearchContent, kibanaDeps, pluginData);
},
});
core.application.register({
id: ELASTICSEARCH_PLUGIN.ID,
title: ELASTICSEARCH_PLUGIN.NAME,

View file

@ -24,6 +24,7 @@ import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server';
import {
ENTERPRISE_SEARCH_OVERVIEW_PLUGIN,
ENTERPRISE_SEARCH_CONTENT_PLUGIN,
ELASTICSEARCH_PLUGIN,
APP_SEARCH_PLUGIN,
WORKPLACE_SEARCH_PLUGIN,
@ -92,6 +93,7 @@ export class EnterpriseSearchPlugin implements Plugin {
const log = this.logger;
const PLUGIN_IDS = [
ENTERPRISE_SEARCH_OVERVIEW_PLUGIN.ID,
ENTERPRISE_SEARCH_CONTENT_PLUGIN.ID,
ELASTICSEARCH_PLUGIN.ID,
APP_SEARCH_PLUGIN.ID,
WORKPLACE_SEARCH_PLUGIN.ID,

View file

@ -63,6 +63,7 @@ export default function catalogueTests({ getService }: FtrProviderContext) {
const exceptions = [
'monitoring',
'enterpriseSearch',
'enterpriseSearchContent',
'elasticsearch',
'appSearch',
'workplaceSearch',

View file

@ -53,6 +53,7 @@ export default function navLinksTests({ getService }: FtrProviderContext) {
navLinksBuilder.except(
'monitoring',
'enterpriseSearch',
'enterpriseSearchContent',
'appSearch',
'workplaceSearch'
)

View file

@ -25,8 +25,9 @@ export default function catalogueTests({ getService }: FtrProviderContext) {
];
const uiCapabilitiesExceptions = [
// enterprise_search plugin is loaded but disabled because security isn't enabled in ES. That means the following 4 capabilities are disabled
// enterprise_search plugin is loaded but disabled because security isn't enabled in ES. That means the following capabilities are disabled
'enterpriseSearch',
'enterpriseSearchContent',
'elasticsearch',
'appSearch',
'workplaceSearch',

View file

@ -17,8 +17,9 @@ export default function navLinksTests({ getService }: FtrProviderContext) {
const featuresService: FeaturesService = getService('features');
const uiCapabilitiesExceptions = [
// enterprise_search plugin is loaded but disabled because security isn't enabled in ES. That means the following 4 capabilities are disabled
// enterprise_search plugin is loaded but disabled because security isn't enabled in ES. That means the following capabilities are disabled
'enterpriseSearch',
'enterpriseSearchContent',
'appSearch',
'workplaceSearch',
];