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

[Workplace Search] Migrate DisplaySettings tree #84283

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const ENT_SEARCH_LICENSE_MANAGEMENT = `${ENT_SEARCH_DOCS_PREFIX}/license-

export const PERSONAL_PATH = '/p';

export const ROLE_MAPPINGS_PATH = '/role-mappings';
export const ROLE_MAPPINGS_PATH = '/role_mappings';
export const ROLE_MAPPING_PATH = `${ROLE_MAPPINGS_PATH}/:roleId`;
export const ROLE_MAPPING_NEW_PATH = `${ROLE_MAPPINGS_PATH}/new`;

Expand All @@ -63,18 +63,18 @@ export const PERSONAL_SOURCES_PATH = `${PERSONAL_PATH}${SOURCES_PATH}`;
export const SOURCE_ADDED_PATH = `${SOURCES_PATH}/added`;
export const ADD_SOURCE_PATH = `${SOURCES_PATH}/add`;
export const ADD_BOX_PATH = `${SOURCES_PATH}/add/box`;
export const ADD_CONFLUENCE_PATH = `${SOURCES_PATH}/add/confluence-cloud`;
export const ADD_CONFLUENCE_SERVER_PATH = `${SOURCES_PATH}/add/confluence-server`;
export const ADD_CONFLUENCE_PATH = `${SOURCES_PATH}/add/confluence_cloud`;
export const ADD_CONFLUENCE_SERVER_PATH = `${SOURCES_PATH}/add/confluence_server`;
export const ADD_DROPBOX_PATH = `${SOURCES_PATH}/add/dropbox`;
export const ADD_GITHUB_ENTERPRISE_PATH = `${SOURCES_PATH}/add/github-enterprise-server`;
export const ADD_GITHUB_ENTERPRISE_PATH = `${SOURCES_PATH}/add/github_enterprise_server`;
export const ADD_GITHUB_PATH = `${SOURCES_PATH}/add/github`;
export const ADD_GMAIL_PATH = `${SOURCES_PATH}/add/gmail`;
export const ADD_GOOGLE_DRIVE_PATH = `${SOURCES_PATH}/add/google-drive`;
export const ADD_JIRA_PATH = `${SOURCES_PATH}/add/jira-cloud`;
export const ADD_JIRA_SERVER_PATH = `${SOURCES_PATH}/add/jira-server`;
export const ADD_GOOGLE_DRIVE_PATH = `${SOURCES_PATH}/add/google_drive`;
export const ADD_JIRA_PATH = `${SOURCES_PATH}/add/jira_cloud`;
export const ADD_JIRA_SERVER_PATH = `${SOURCES_PATH}/add/jira_server`;
export const ADD_ONEDRIVE_PATH = `${SOURCES_PATH}/add/onedrive`;
export const ADD_SALESFORCE_PATH = `${SOURCES_PATH}/add/salesforce`;
export const ADD_SALESFORCE_SANDBOX_PATH = `${SOURCES_PATH}/add/salesforce-sandbox`;
export const ADD_SALESFORCE_SANDBOX_PATH = `${SOURCES_PATH}/add/salesforce_sandbox`;
export const ADD_SERVICENOW_PATH = `${SOURCES_PATH}/add/servicenow`;
export const ADD_SHAREPOINT_PATH = `${SOURCES_PATH}/add/sharepoint`;
export const ADD_SLACK_PATH = `${SOURCES_PATH}/add/slack`;
Expand All @@ -86,30 +86,30 @@ export const PERSONAL_SETTINGS_PATH = `${PERSONAL_PATH}/settings`;
export const SOURCE_DETAILS_PATH = `${SOURCES_PATH}/:sourceId`;
export const SOURCE_CONTENT_PATH = `${SOURCES_PATH}/:sourceId/content`;
export const SOURCE_SCHEMAS_PATH = `${SOURCES_PATH}/:sourceId/schemas`;
export const SOURCE_DISPLAY_SETTINGS_PATH = `${SOURCES_PATH}/:sourceId/display-settings`;
export const SOURCE_DISPLAY_SETTINGS_PATH = `${SOURCES_PATH}/:sourceId/display_settings`;
export const SOURCE_SETTINGS_PATH = `${SOURCES_PATH}/:sourceId/settings`;
export const REINDEX_JOB_PATH = `${SOURCES_PATH}/:sourceId/schema-errors/:activeReindexJobId`;
export const REINDEX_JOB_PATH = `${SOURCES_PATH}/:sourceId/schema_errors/:activeReindexJobId`;

export const DISPLAY_SETTINGS_SEARCH_RESULT_PATH = `${SOURCE_DISPLAY_SETTINGS_PATH}/`;
export const DISPLAY_SETTINGS_RESULT_DETAIL_PATH = `${SOURCE_DISPLAY_SETTINGS_PATH}/result-detail`;
export const DISPLAY_SETTINGS_RESULT_DETAIL_PATH = `${SOURCE_DISPLAY_SETTINGS_PATH}/result_detail`;

export const ORG_SETTINGS_PATH = '/settings';
export const ORG_SETTINGS_CUSTOMIZE_PATH = `${ORG_SETTINGS_PATH}/customize`;
export const ORG_SETTINGS_CONNECTORS_PATH = `${ORG_SETTINGS_PATH}/connectors`;
export const ORG_SETTINGS_OAUTH_APPLICATION_PATH = `${ORG_SETTINGS_PATH}/oauth`;
export const EDIT_BOX_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/box/edit`;
export const EDIT_CONFLUENCE_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/confluence-cloud/edit`;
export const EDIT_CONFLUENCE_SERVER_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/confluence-server/edit`;
export const EDIT_CONFLUENCE_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/confluence_cloud/edit`;
export const EDIT_CONFLUENCE_SERVER_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/confluence_server/edit`;
export const EDIT_DROPBOX_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/dropbox/edit`;
export const EDIT_GITHUB_ENTERPRISE_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/github-enterprise-server/edit`;
export const EDIT_GITHUB_ENTERPRISE_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/github_enterprise_server/edit`;
export const EDIT_GITHUB_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/github/edit`;
export const EDIT_GMAIL_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/gmail/edit`;
export const EDIT_GOOGLE_DRIVE_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/google-drive/edit`;
export const EDIT_JIRA_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/jira-cloud/edit`;
export const EDIT_JIRA_SERVER_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/jira-server/edit`;
export const EDIT_GOOGLE_DRIVE_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/google_drive/edit`;
export const EDIT_JIRA_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/jira_cloud/edit`;
export const EDIT_JIRA_SERVER_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/jira_server/edit`;
export const EDIT_ONEDRIVE_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/onedrive/edit`;
export const EDIT_SALESFORCE_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/salesforce/edit`;
export const EDIT_SALESFORCE_SANDBOX_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/salesforce-sandbox/edit`;
export const EDIT_SALESFORCE_SANDBOX_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/salesforce_sandbox/edit`;
export const EDIT_SERVICENOW_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/servicenow/edit`;
export const EDIT_SHAREPOINT_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/sharepoint/edit`;
export const EDIT_SLACK_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/slack/edit`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,26 @@ export interface CustomSource {
name: string;
id: string;
}

export interface Result {
[key: string]: string;
}

export interface OptionValue {
value: string;
text: string;
}

export interface DetailField {
fieldName: string;
label: string;
}

export interface SearchResultConfig {
titleField: string | null;
subtitleField: string | null;
descriptionField: string | null;
urlField: string | null;
color: string;
detailFields: DetailField[];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import React from 'react';

const BLACK_RGB = '#000';

interface CustomSourceIconProps {
color?: string;
}

export const CustomSourceIcon: React.FC<CustomSourceIconProps> = ({ color = BLACK_RGB }) => (
<svg
className="euiIcon euiIcon--medium"
width="52"
height="52"
viewBox="0 0 52 52"
fill="none"
xmlns="http://www.w3.org/2000/svg"
style={{ fill: color }}
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M18 34H20.222C21.988 31.744 23 28.935 23 26C23 23.065 21.988 20.256 20.222 18H18C13.582 18 10 21.582 10 26C10 30.418 13.582 34 18 34Z"
/>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M18 12.158C20.355 10.794 23.082 10 26 10C34.837 10 42 17.163 42 26C42 34.837 34.837 42 26 42C23.082 42 20.355 41.206 18 39.842C20.4228 38.4381 22.4459 36.4202 23.8515 34H23.848C25.1274 31.7962 25.898 29.2625 25.9906 26.5526C25.9936 26.4634 25.996 26.374 25.9975 26.2843C25.9992 26.1898 26 26.095 26 26C26 25.8613 25.9982 25.723 25.9947 25.5851C25.9937 25.5449 25.9925 25.5047 25.9912 25.4646C25.9013 22.7482 25.1301 20.2085 23.848 18H23.8515C22.4459 15.5798 20.4228 13.5619 18 12.158Z"
/>
</svg>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

// --------------------------------------------------
// Custom Source display settings
// --------------------------------------------------

@mixin source_name {
font-size: .6875em;
text-transform: uppercase;
font-weight: 600;
letter-spacing: 0.06em;
}

@mixin example_result_box_shadow {
box-shadow:
0 1px 3px rgba(black, 0.1),
0 0 20px $euiColorLightestShade;
}

// Wrapper
.custom-source-display-settings {
font-size: 16px;
}

// Example result content
.example-result-content {
& > * {
line-height: 1.5em;
}

&__title {
font-size: 1em;
font-weight: 600;
color: $euiColorPrimary;

.example-result-detail-card & {
font-size: 20px;
}
}

&__subtitle,
&__description {
font-size: .875;
}

&__subtitle {
color: $euiColorDarkestShade;
}

&__description {
padding: .1rem 0 .125rem .35rem;
border-left: 3px solid $euiColorLightShade;
color: $euiColorDarkShade;
line-height: 1.8;
word-break: break-word;

@supports (display: -webkit-box) {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
text-overflow: ellipsis;
}
}

&__url {
.example-result-detail-card & {
color: $euiColorDarkShade;
}
}
}

.example-result-content-placeholder {
color: $euiColorMediumShade;
}

// Example standout result
.example-standout-result {
border-radius: 4px;
overflow: hidden;
@include example_result_box_shadow;

&__header,
&__content {
padding-left: 1em;
padding-right: 1em;
}

&__content {
padding-top: 1em;
padding-bottom: 1em;
}

&__source-name {
line-height: 34px;
@include source_name;
}
}

// Example result group
.example-result-group {
&__header {
padding: 0 .5em;
border-radius: 4px;
display: inline-flex;
align-items: center;

.euiIcon {
margin-right: .25rem;
}
}

&__source-name {
line-height: 1.75em;
@include source_name;
}

&__content {
display: flex;
align-items: stretch;
padding: .75em 0;
}

&__border {
width: 4px;
border-radius: 2px;
flex-shrink: 0;
margin-left: .875rem;
}

&__results {
flex: 1;
max-width: 100%;
}
}

.example-grouped-result {
padding: 1em;
}

.example-result-field-hover {
background: lighten($euiColorVis1_behindText, 30%);
position: relative;

&:before,
&:after {
content: '';
position: absolute;
height: 100%;
width: 4px;
background: lighten($euiColorVis1_behindText, 30%);
}

&:before {
right: 100%;
border-radius: 2px 0 0 2px;
}

&:after {
left: 100%;
border-radius: 0 2px 2px 0;
}

.example-result-content-placeholder {
color: $euiColorFullShade;
}
}

.example-result-detail-card {
@include example_result_box_shadow;

&__header {
position: relative;
padding: 1.25em 1em 0;
}

&__border {
height: 4px;
position: absolute;
top: 0;
right: 0;
left: 0;
}

&__source-name {
margin-bottom: 1em;
font-weight: 500;
}

&__field {
padding: 1em;

& + & {
border-top: 1px solid $euiColorLightShade;
}
}
}

.visible-fields-container {
background: $euiColorLightestShade;
border-color: transparent;
}
Loading