mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Import:Enhance clarity through improved copy and streamlined links (#74383)
Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
This commit is contained in:
@@ -21,6 +21,8 @@ import {
|
|||||||
DropzoneFile,
|
DropzoneFile,
|
||||||
FileDropzoneDefaultChildren,
|
FileDropzoneDefaultChildren,
|
||||||
LinkButton,
|
LinkButton,
|
||||||
|
TextLink,
|
||||||
|
Label,
|
||||||
} from '@grafana/ui';
|
} from '@grafana/ui';
|
||||||
import appEvents from 'app/core/app_events';
|
import appEvents from 'app/core/app_events';
|
||||||
import { Page } from 'app/core/components/Page/Page';
|
import { Page } from 'app/core/components/Page/Page';
|
||||||
@@ -41,6 +43,13 @@ type DashboardImportPageRouteSearchParams = {
|
|||||||
type OwnProps = Themeable2 & GrafanaRouteComponentProps<{}, DashboardImportPageRouteSearchParams>;
|
type OwnProps = Themeable2 & GrafanaRouteComponentProps<{}, DashboardImportPageRouteSearchParams>;
|
||||||
|
|
||||||
const IMPORT_STARTED_EVENT_NAME = 'dashboard_import_loaded';
|
const IMPORT_STARTED_EVENT_NAME = 'dashboard_import_loaded';
|
||||||
|
const JSON_PLACEHOLDER = `{
|
||||||
|
"title": "Example - Repeating Dictionary variables",
|
||||||
|
"uid": "_0HnEoN4z",
|
||||||
|
"panels": [...]
|
||||||
|
...
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
const mapStateToProps = (state: StoreState) => ({
|
const mapStateToProps = (state: StoreState) => ({
|
||||||
loadingState: state.importDashboard.state,
|
loadingState: state.importDashboard.state,
|
||||||
@@ -136,7 +145,16 @@ class UnthemedDashboardImport extends PureComponent<Props> {
|
|||||||
<Form onSubmit={this.getGcomDashboard} defaultValues={{ gcomDashboard: '' }}>
|
<Form onSubmit={this.getGcomDashboard} defaultValues={{ gcomDashboard: '' }}>
|
||||||
{({ register, errors }) => (
|
{({ register, errors }) => (
|
||||||
<Field
|
<Field
|
||||||
label="Import via grafana.com"
|
label={
|
||||||
|
<Label className={styles.labelWithLink} htmlFor="url-input">
|
||||||
|
<span>
|
||||||
|
Find and import dashboards for common applications at{' '}
|
||||||
|
<TextLink variant="bodySmall" href="https://grafana.com/grafana/dashboards/" external>
|
||||||
|
grafana.com/dashboards
|
||||||
|
</TextLink>
|
||||||
|
</span>
|
||||||
|
</Label>
|
||||||
|
}
|
||||||
invalid={!!errors.gcomDashboard}
|
invalid={!!errors.gcomDashboard}
|
||||||
error={errors.gcomDashboard && errors.gcomDashboard.message}
|
error={errors.gcomDashboard && errors.gcomDashboard.message}
|
||||||
>
|
>
|
||||||
@@ -159,7 +177,7 @@ class UnthemedDashboardImport extends PureComponent<Props> {
|
|||||||
{({ register, errors }) => (
|
{({ register, errors }) => (
|
||||||
<>
|
<>
|
||||||
<Field
|
<Field
|
||||||
label="Import via panel json"
|
label="Import via dashboard JSON model"
|
||||||
invalid={!!errors.dashboardJson}
|
invalid={!!errors.dashboardJson}
|
||||||
error={errors.dashboardJson && errors.dashboardJson.message}
|
error={errors.dashboardJson && errors.dashboardJson.message}
|
||||||
>
|
>
|
||||||
@@ -171,6 +189,7 @@ class UnthemedDashboardImport extends PureComponent<Props> {
|
|||||||
data-testid={selectors.components.DashboardImportPage.textarea}
|
data-testid={selectors.components.DashboardImportPage.textarea}
|
||||||
id="dashboard-json-textarea"
|
id="dashboard-json-textarea"
|
||||||
rows={10}
|
rows={10}
|
||||||
|
placeholder={JSON_PLACEHOLDER}
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
<HorizontalGroup>
|
<HorizontalGroup>
|
||||||
@@ -226,5 +245,11 @@ const importStyles = stylesFactory((theme: GrafanaTheme2) => {
|
|||||||
margin-bottom: ${theme.spacing(4)};
|
margin-bottom: ${theme.spacing(4)};
|
||||||
max-width: 600px;
|
max-width: 600px;
|
||||||
`,
|
`,
|
||||||
|
labelWithLink: css`
|
||||||
|
max-width: 100%;
|
||||||
|
`,
|
||||||
|
linkWithinLabel: css`
|
||||||
|
font-size: inherit;
|
||||||
|
`,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user