-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Feat: Workpad Templates #23966
Merged
Merged
Feat: Workpad Templates #23966
Changes from 16 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
736073a
Added workpad manager which contains workpad_loader and workpad_templ…
cqliu1 d85cc74
Fixed term filter in workpad_templates
cqliu1 389cc05
design changes
ryankeairns d6d5681
Removed console logs
cqliu1 4288492
case insensitive template search
cqliu1 36db1b9
Case insensitive tag order in popover
cqliu1 1797076
Merge branch 'master' into feat/workpad-templates
cqliu1 8d526c8
Merge branch 'master' into feat/workpad-templates
cqliu1 9b4e6f1
added descriptions and tags to sample data workpads
cqliu1 520f742
refine list of initial templates
ryankeairns 2159cc8
Merge branch 'master' into feat/workpad-templates
cqliu1 6aec3b1
remove sample data templates, make buttons bigger
ryankeairns 227ce5d
Merge branch 'master' into feat/workpad-templates
cqliu1 69ccf9a
Merge branch 'master' into feat/workpad-templates
cqliu1 a262458
Merge branch 'master' into feat/workpad-templates
cqliu1 e820fd5
Merge branch 'master' into feat/workpad-templates
cqliu1 499bbab
Merge branch 'master' into feat/workpad-templates
cqliu1 2b3bacb
Merge branch 'master' into feat/workpad-templates
cqliu1 b8d49d8
Merge branch 'master' into feat/workpad-templates
cqliu1 61626ee
Added template and tag registries
cqliu1 54ce70d
Merge branch 'master' into feat/workpad-templates
cqliu1 e0d452d
Fixed workpad loader resizing issue on home page
cqliu1 8bddc57
Merge branch 'master' into feat/workpad-templates
cqliu1 282eb42
Merge branch 'master' into feat/workpad-templates
cqliu1 fe2b098
Merge branch 'master' into feat/workpad-templates
cqliu1 c8796c9
Moved tags to ui folder
cqliu1 5c9f6a6
Fixed template class
cqliu1 6f0e0ce
Fixed properties in templates to match workpad
cqliu1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
14 changes: 14 additions & 0 deletions
14
x-pack/plugins/canvas/public/components/workpad_loader/workpad_loader.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,14 @@ | ||
.canvasWorkpad__upload--compressed { | ||
|
||
&.euiFilePicker--compressed.euiFilePicker { | ||
|
||
.euiFilePicker__prompt { | ||
height: $euiSizeXXL; | ||
padding: $euiSizeM; | ||
padding-left: $euiSizeXXL; | ||
} | ||
.euiFilePicker__icon { | ||
top: $euiSizeM; | ||
} | ||
} | ||
} |
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
7 changes: 7 additions & 0 deletions
7
x-pack/plugins/canvas/public/components/workpad_manager/index.js
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,7 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export { WorkpadManager } from './workpad_manager'; |
75 changes: 75 additions & 0 deletions
75
x-pack/plugins/canvas/public/components/workpad_manager/workpad_manager.js
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,75 @@ | ||
/* | ||
* 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, { Fragment } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { | ||
EuiTabbedContent, | ||
EuiModalHeader, | ||
EuiModalHeaderTitle, | ||
EuiModalBody, | ||
EuiSpacer, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiBetaBadge, | ||
EuiLink, | ||
} from '@elastic/eui'; | ||
import { WorkpadLoader } from '../workpad_loader'; | ||
import { WorkpadTemplates } from '../workpad_templates'; | ||
|
||
export const WorkpadManager = ({ onClose }) => { | ||
const tabs = [ | ||
{ | ||
id: 'workpadLoader', | ||
name: 'My Workpads', | ||
content: ( | ||
<Fragment> | ||
<EuiSpacer /> | ||
<WorkpadLoader onClose={onClose} /> | ||
</Fragment> | ||
), | ||
}, | ||
{ | ||
id: 'workpadTemplates', | ||
name: 'Templates', | ||
content: ( | ||
<Fragment> | ||
<EuiSpacer /> | ||
<WorkpadTemplates onClose={onClose} /> | ||
</Fragment> | ||
), | ||
}, | ||
]; | ||
return ( | ||
<Fragment> | ||
<EuiModalHeader className="canvasHomeApp__modalHeader"> | ||
<EuiFlexGroup alignItems="center" gutterSize="s"> | ||
<EuiFlexItem grow={false}> | ||
<EuiModalHeaderTitle>Canvas workpads</EuiModalHeaderTitle> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<EuiBetaBadge | ||
label="Beta" | ||
tooltipContent="Canvas is still in beta. Please help us improve by reporting issues or bugs in the Kibana repo." | ||
/> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<EuiLink href="https://canvas.elastic.co" target="_blank"> | ||
Docs | ||
</EuiLink> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiModalHeader> | ||
<EuiModalBody> | ||
<EuiTabbedContent tabs={tabs} initialSelectedTab={tabs[0]} /> | ||
</EuiModalBody> | ||
</Fragment> | ||
); | ||
}; | ||
|
||
WorkpadManager.propTypes = { | ||
onClose: PropTypes.func, | ||
}; |
28 changes: 28 additions & 0 deletions
28
x-pack/plugins/canvas/public/components/workpad_templates/index.js
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,28 @@ | ||
/* | ||
* 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 PropTypes from 'prop-types'; | ||
import { compose, getContext, withHandlers } from 'recompose'; | ||
import * as workpadService from '../../lib/workpad_service'; | ||
import { notify } from '../../lib/notify'; | ||
import { getId } from '../../lib/get_id'; | ||
import { WorkpadTemplates as Component } from './workpad_templates'; | ||
|
||
export const WorkpadTemplates = compose( | ||
getContext({ | ||
router: PropTypes.object, | ||
}), | ||
withHandlers({ | ||
// Clone workpad given an id | ||
cloneWorkpad: props => workpad => { | ||
workpad.id = getId('workpad'); | ||
return workpadService | ||
.create(workpad) | ||
.then(() => props.router.navigateTo('loadWorkpad', { id: workpad.id, page: 1 })) | ||
.catch(err => notify.error(err, { title: `Couldn't clone workpad template` })); | ||
}, | ||
}) | ||
)(Component); |
10 changes: 10 additions & 0 deletions
10
x-pack/plugins/canvas/public/components/workpad_templates/templates/index.js
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,10 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
const themeDark = require('./theme_dark.json'); | ||
const themeLight = require('./theme_light.json'); | ||
|
||
export const templates = [themeDark, themeLight]; | ||
2 changes: 2 additions & 0 deletions
2
x-pack/plugins/canvas/public/components/workpad_templates/templates/theme_dark.json
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
x-pack/plugins/canvas/public/components/workpad_templates/templates/theme_light.json
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this business a registry like we have for elements, functions, etc. That'll set us up for templates as plugins right quick.