forked from opensearch-project/dashboards-flow-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin_card.tsx
85 lines (80 loc) · 2.39 KB
/
plugin_card.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import React from 'react';
import {
EuiSmallButton,
EuiFlexGroup,
EuiFlexItem,
EuiIcon,
EuiTitle,
} from '@elastic/eui';
import { i18n } from '@osd/i18n';
import { PLUGIN_ID, PLUGIN_NAME } from '../../../common';
import { ContentManagementPluginStart } from '../../../../../src/plugins/content_management/public';
import { CoreStart } from '../../../../../src/core/public';
import pluginIcon from './icon.svg';
const HEADER_TEXT = 'Design and test your search solutions with ease';
const DESCRIPTION_TEXT = `${PLUGIN_NAME} is a visual editor for creating search AI flows to power advanced search and generative AI solutions.`;
export const registerPluginCard = (
contentManagement: ContentManagementPluginStart,
core: CoreStart
) => {
const icon = (
<EuiIcon size="original" aria-label={HEADER_TEXT} type={pluginIcon} />
);
const footer = (
<EuiFlexGroup justifyContent="flexEnd">
<EuiFlexItem grow={false}>
<EuiSmallButton
onClick={() => {
core.application.navigateToApp(PLUGIN_ID);
}}
>
{i18n.translate('flowFrameworkDashboards.opensearchFlowCard.footer', {
defaultMessage: 'Try OpenSearch Flow',
})}
</EuiSmallButton>
</EuiFlexItem>
</EuiFlexGroup>
);
contentManagement.registerContentProvider({
id: 'opensearch_flow_card',
getContent: () => ({
id: 'opensearch_flow',
kind: 'card',
order: 20,
getTitle: () => {
return (
<EuiFlexGroup direction="row" gutterSize="xs">
<EuiFlexItem grow={false}>
<EuiTitle size="s">
<h3>
{i18n.translate(
'flowFrameworkDashboards.opensearchFlowCard.title',
{
defaultMessage: HEADER_TEXT,
}
)}
</h3>
</EuiTitle>
</EuiFlexItem>
</EuiFlexGroup>
);
},
description: i18n.translate(
'flowFrameworkDashboards.opensearchFlowCard.description',
{
defaultMessage: DESCRIPTION_TEXT,
}
),
getIcon: () => icon,
cardProps: {
children: footer,
layout: 'horizontal',
},
}),
getTargetArea: () => 'search_overview/config_evaluate_search',
});
};