|
5 | 5 | // file, You can obtain one at https://mozilla.org/MPL/2.0/. |
6 | 6 |
|
7 | 7 | import * as React from 'react'; |
8 | | -import { useNavigate } from 'react-router-dom'; |
| 8 | +import { Link, useNavigate } from 'react-router-dom'; |
9 | 9 | import { IMetric } from '../models/metric'; |
10 | 10 | import { saveMetric } from '../api/saveMetric'; |
11 | | -import { maxTagsSize } from '../../common/settings'; |
| 11 | +import { maxTagsSize } from '@/common/settings'; |
12 | 12 | import { getDefaultTag } from '../storages/MetricFormValues/reducer'; |
| 13 | +import { useMetricMeta } from '@/hooks/useMetricMeta'; |
13 | 14 |
|
14 | 15 | export function CreatePage(props: { yAxisSize: number }) { |
15 | 16 | const { yAxisSize } = props; |
@@ -64,7 +65,9 @@ export function EditFormCreate() { |
64 | 65 | <span className="visually-hidden">Loading...</span> |
65 | 66 | </div> |
66 | 67 | ) : error ? ( |
67 | | - <span className="text-danger">{error}</span> |
| 68 | + <span className="text-danger"> |
| 69 | + {error} <MetricInfo metricName={name} /> |
| 70 | + </span> |
68 | 71 | ) : success ? ( |
69 | 72 | <span className="text-success">{success}</span> |
70 | 73 | ) : null} |
@@ -122,3 +125,18 @@ function useSubmitCreate(name: string) { |
122 | 125 | success, |
123 | 126 | }; |
124 | 127 | } |
| 128 | + |
| 129 | +type MetricInfoProps = { metricName: string }; |
| 130 | + |
| 131 | +function MetricInfo({ metricName }: MetricInfoProps) { |
| 132 | + const meta = useMetricMeta(metricName, true); |
| 133 | + if (!meta) { |
| 134 | + return null; |
| 135 | + } |
| 136 | + return ( |
| 137 | + <span> |
| 138 | + {meta.disable && <span>and disabled. </span>} |
| 139 | + <Link to={`/admin/edit/${metricName}`}>Edit</Link> <Link to={`/view?s=${metricName}`}>View</Link> |
| 140 | + </span> |
| 141 | + ); |
| 142 | +} |
0 commit comments