-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:elastic/kibana into deangularize/…
…dashboard
- Loading branch information
Showing
135 changed files
with
13,361 additions
and
65,946 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,3 +104,4 @@ pageLoadAssetSize: | |
watcher: 43598 | ||
runtimeFields: 41752 | ||
stackAlerts: 29684 | ||
presentationUtil: 28545 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# presentationUtil | ||
|
||
Utilities and components used by the presentation-related plugins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
export const PLUGIN_ID = 'presentationUtil'; | ||
export const PLUGIN_NAME = 'presentationUtil'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"id": "presentationUtil", | ||
"version": "1.0.0", | ||
"kibanaVersion": "kibana", | ||
"server": false, | ||
"ui": true, | ||
"requiredPlugins": ["dashboard", "savedObjects"], | ||
"optionalPlugins": [] | ||
} |
92 changes: 92 additions & 0 deletions
92
src/plugins/presentation_util/public/components/dashboard_picker.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import React, { useState, useEffect, useCallback } from 'react'; | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
|
||
import { EuiComboBox } from '@elastic/eui'; | ||
import { SavedObjectsClientContract } from '../../../../core/public'; | ||
import { SavedObjectDashboard } from '../../../../plugins/dashboard/public'; | ||
|
||
export interface DashboardPickerProps { | ||
onChange: (dashboard: { name: string; id: string } | null) => void; | ||
isDisabled: boolean; | ||
savedObjectsClient: SavedObjectsClientContract; | ||
} | ||
|
||
interface DashboardOption { | ||
label: string; | ||
value: string; | ||
} | ||
|
||
export function DashboardPicker(props: DashboardPickerProps) { | ||
const [dashboards, setDashboards] = useState<DashboardOption[]>([]); | ||
const [isLoadingDashboards, setIsLoadingDashboards] = useState(true); | ||
const [selectedDashboard, setSelectedDashboard] = useState<DashboardOption | null>(null); | ||
|
||
const { savedObjectsClient, isDisabled, onChange } = props; | ||
|
||
const fetchDashboards = useCallback( | ||
async (query) => { | ||
setIsLoadingDashboards(true); | ||
setDashboards([]); | ||
|
||
const { savedObjects } = await savedObjectsClient.find<SavedObjectDashboard>({ | ||
type: 'dashboard', | ||
search: query ? `${query}*` : '', | ||
searchFields: ['title'], | ||
}); | ||
if (savedObjects) { | ||
setDashboards(savedObjects.map((d) => ({ value: d.id, label: d.attributes.title }))); | ||
} | ||
setIsLoadingDashboards(false); | ||
}, | ||
[savedObjectsClient] | ||
); | ||
|
||
// Initial dashboard load | ||
useEffect(() => { | ||
fetchDashboards(''); | ||
}, [fetchDashboards]); | ||
|
||
return ( | ||
<EuiComboBox | ||
placeholder={i18n.translate('presentationUtil.dashboardPicker.searchDashboardPlaceholder', { | ||
defaultMessage: 'Search dashboards...', | ||
})} | ||
singleSelection={{ asPlainText: true }} | ||
options={dashboards || []} | ||
selectedOptions={!!selectedDashboard ? [selectedDashboard] : undefined} | ||
onChange={(e) => { | ||
if (e.length) { | ||
setSelectedDashboard({ value: e[0].value || '', label: e[0].label }); | ||
onChange({ name: e[0].label, id: e[0].value || '' }); | ||
} else { | ||
setSelectedDashboard(null); | ||
onChange(null); | ||
} | ||
}} | ||
onSearchChange={fetchDashboards} | ||
isDisabled={isDisabled} | ||
isLoading={isLoadingDashboards} | ||
compressed={true} | ||
/> | ||
); | ||
} |
5 changes: 5 additions & 0 deletions
5
src/plugins/presentation_util/public/components/saved_object_save_modal_dashboard.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.savAddDashboard__searchDashboards { | ||
margin-left: $euiSizeL; | ||
margin-top: $euiSizeXS; | ||
width: 300px; | ||
} |
Oops, something went wrong.