-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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(dashboards): add overlay to create dashboard from template #13078
feat(dashboards): add overlay to create dashboard from template #13078
Conversation
35b8625
to
6cde9ac
Compare
router, | ||
params: {orgID}, | ||
} = this.props | ||
router.push(`/orgs/${orgID}/dashboards/templates`) |
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.
this route url should have something in it to indicate that its import /orgs/${orgID}/dashboards/import/template
would be my go to.
title={_.get(selectedTemplateSummary, 'meta.name')} | ||
/> | ||
<Panel.Body> | ||
{/* TODO: Add Template description */} |
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.
Please do not leave comments in JSX
ui/src/dashboards/actions/index.ts
Outdated
@@ -1,5 +1,6 @@ | |||
// Libraries | |||
import {Dispatch} from 'redux' | |||
import _ from 'lodash' |
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.
Do we need lodash here? Nothing else added seems to use it.
</ResponsiveGridSizer> | ||
</OrgTemplateFetcher> | ||
{!selectedTemplateSummary && ( | ||
<Panel className="import-template-overlay--empty"> |
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.
Could we extract the empty state? There is a lot going on in this render function.
@@ -117,6 +118,11 @@ class Dashboards extends PureComponent<Props, State> { | |||
router.push(`/organizations/${params.orgID}/dashboards/import`) | |||
} | |||
|
|||
private summonImportFromTemplateOverlay = (): void => { | |||
const {router, params} = this.props | |||
router.push(`/organizations/${params.orgID}/dashboards/templates`) |
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.
Same comment about the route.
<Dropdown.Item id={newOption} key={newOption} value={newOption}> | ||
{newOption} | ||
</Dropdown.Item>, | ||
<Dropdown.Item id={importOption} key={importOption} value={importOption}> | ||
{importOption} | ||
</Dropdown.Item>, | ||
] | ||
|
||
if (!!this.props.onSelectTemplate) { |
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.
seems odd that the existence of a handler is determining whether to render this.
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.
would you recommend a boolean prop instead?
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.
yeah that seems more informative
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.
A few things to fix but otherwise 🍰
44849b1
to
874bc16
Compare
965a598
to
c124273
Compare
c124273
to
d10d216
Compare
Closes #12913
This PR adds an overlay to create a new dashboard from a template.