@@ -26,7 +26,10 @@ export interface Props {
26
26
const DashboardEmpty = ( { dashboard, canCreate } : Props ) => {
27
27
const styles = useStyles2 ( getStyles ) ;
28
28
const dispatch = useDispatch ( ) ;
29
- const initialDatasource = useSelector ( ( state ) => state . dashboard . initialDatasource ) ;
29
+ const { initialDatasource, isFNDashboard } = useSelector ( ( state ) => ( {
30
+ initialDatasource : state . dashboard . initialDatasource ,
31
+ isFNDashboard : state . fnGlobalState . FNDashboard
32
+ } ) ) ;
30
33
31
34
const onAddVisualization = ( ) => {
32
35
let id ;
@@ -63,14 +66,18 @@ const DashboardEmpty = ({ dashboard, canCreate }: Props) => {
63
66
Start your new dashboard by adding a visualization
64
67
</ Trans >
65
68
</ Text >
66
- < Box marginBottom = { 2 } paddingX = { 4 } >
67
- < Text element = "p" textAlignment = "center" color = "secondary" >
68
- < Trans i18nKey = "dashboard.empty.add-visualization-body" >
69
- Select a data source and then query and visualize your data with charts, stats and tables or create
70
- lists, markdowns and other widgets.
71
- </ Trans >
72
- </ Text >
73
- </ Box >
69
+
70
+ < Box marginBottom = { 2 } paddingX = { 4 } >
71
+ < Text element = "p" textAlignment = "center" color = "secondary" >
72
+ {
73
+ ! isFNDashboard ? < Trans i18nKey = "dashboard.empty.add-visualization-body" >
74
+ Select a data source and then query and visualize your data with charts, stats and tables or create
75
+ lists, markdowns and other widgets.
76
+ </ Trans > : `Visualize CodeRabbit Review metrics using charts, tables and other widgets.`
77
+ }
78
+ </ Text >
79
+ </ Box >
80
+
74
81
< Button
75
82
size = "lg"
76
83
icon = "plus"
@@ -82,83 +89,87 @@ const DashboardEmpty = ({ dashboard, canCreate }: Props) => {
82
89
</ Button >
83
90
</ Stack >
84
91
</ Box >
85
- < Stack direction = { { xs : 'column' , md : 'row' } } wrap = "wrap" gap = { 4 } >
86
- { config . featureToggles . vizAndWidgetSplit && (
92
+ {
93
+ ! isFNDashboard && (
94
+ < Stack direction = { { xs : 'column' , md : 'row' } } wrap = "wrap" gap = { 4 } >
95
+ { config . featureToggles . vizAndWidgetSplit && (
96
+ < Box borderColor = "strong" borderStyle = "dashed" padding = { 3 } flex = { 1 } >
97
+ < Stack direction = "column" alignItems = "center" gap = { 1 } >
98
+ < Text element = "h3" textAlignment = "center" weight = "medium" >
99
+ < Trans i18nKey = "dashboard.empty.add-widget-header" > Add a widget</ Trans >
100
+ </ Text >
101
+ < Box marginBottom = { 2 } >
102
+ < Text element = "p" textAlignment = "center" color = "secondary" >
103
+ < Trans i18nKey = "dashboard.empty.add-widget-body" > Create lists, markdowns and other widgets</ Trans >
104
+ </ Text >
105
+ </ Box >
106
+ < Button
107
+ icon = "plus"
108
+ fill = "outline"
109
+ data-testid = { selectors . pages . AddDashboard . itemButton ( 'Create new widget button' ) }
110
+ onClick = { ( ) => {
111
+ DashboardInteractions . emptyDashboardButtonClicked ( { item : 'add_widget' } ) ;
112
+ locationService . partial ( { addWidget : true } ) ;
113
+ } }
114
+ disabled = { ! canCreate }
115
+ >
116
+ < Trans i18nKey = "dashboard.empty.add-widget-button" > Add widget</ Trans >
117
+ </ Button >
118
+ </ Stack >
119
+ </ Box >
120
+ ) }
87
121
< Box borderColor = "strong" borderStyle = "dashed" padding = { 3 } flex = { 1 } >
88
122
< Stack direction = "column" alignItems = "center" gap = { 1 } >
89
123
< Text element = "h3" textAlignment = "center" weight = "medium" >
90
- < Trans i18nKey = "dashboard.empty.add-widget- header" > Add a widget </ Trans >
124
+ < Trans i18nKey = "dashboard.empty.add-library-panel- header" > Import panel </ Trans >
91
125
</ Text >
92
126
< Box marginBottom = { 2 } >
93
127
< Text element = "p" textAlignment = "center" color = "secondary" >
94
- < Trans i18nKey = "dashboard.empty.add-widget-body" > Create lists, markdowns and other widgets</ Trans >
128
+ < Trans i18nKey = "dashboard.empty.add-library-panel-body" >
129
+ Add visualizations that are shared with other dashboards.
130
+ </ Trans >
95
131
</ Text >
96
132
</ Box >
97
133
< Button
98
134
icon = "plus"
99
135
fill = "outline"
100
- data-testid = { selectors . pages . AddDashboard . itemButton ( 'Create new widget button' ) }
136
+ data-testid = { selectors . pages . AddDashboard . itemButton ( 'Add a panel from the panel library button' ) }
137
+ onClick = { onAddLibraryPanel }
138
+ disabled = { ! canCreate }
139
+ >
140
+ < Trans i18nKey = "dashboard.empty.add-library-panel-button" > Add library panel</ Trans >
141
+ </ Button >
142
+ </ Stack >
143
+ </ Box >
144
+ < Box borderColor = "strong" borderStyle = "dashed" padding = { 3 } flex = { 1 } >
145
+ < Stack direction = "column" alignItems = "center" gap = { 1 } >
146
+ < Text element = "h3" textAlignment = "center" weight = "medium" >
147
+ < Trans i18nKey = "dashboard.empty.import-a-dashboard-header" > Import a dashboard</ Trans >
148
+ </ Text >
149
+ < Box marginBottom = { 2 } >
150
+ < Text element = "p" textAlignment = "center" color = "secondary" >
151
+ < Trans i18nKey = "dashboard.empty.import-a-dashboard-body" >
152
+ Import dashboards from files or < a href = "https://grafana.com/grafana/dashboards/" > grafana.com</ a > .
153
+ </ Trans >
154
+ </ Text >
155
+ </ Box >
156
+ < Button
157
+ icon = "upload"
158
+ fill = "outline"
159
+ data-testid = { selectors . pages . AddDashboard . itemButton ( 'Import dashboard button' ) }
101
160
onClick = { ( ) => {
102
- DashboardInteractions . emptyDashboardButtonClicked ( { item : 'add_widget ' } ) ;
103
- locationService . partial ( { addWidget : true } ) ;
161
+ DashboardInteractions . emptyDashboardButtonClicked ( { item : 'import_dashboard ' } ) ;
162
+ onImportDashboard ( ) ;
104
163
} }
105
164
disabled = { ! canCreate }
106
165
>
107
- < Trans i18nKey = "dashboard.empty.add-widget -button" > Add widget </ Trans >
166
+ < Trans i18nKey = "dashboard.empty.import-dashboard -button" > Import dashboard </ Trans >
108
167
</ Button >
109
168
</ Stack >
110
169
</ Box >
111
- ) }
112
- < Box borderColor = "strong" borderStyle = "dashed" padding = { 3 } flex = { 1 } >
113
- < Stack direction = "column" alignItems = "center" gap = { 1 } >
114
- < Text element = "h3" textAlignment = "center" weight = "medium" >
115
- < Trans i18nKey = "dashboard.empty.add-library-panel-header" > Import panel</ Trans >
116
- </ Text >
117
- < Box marginBottom = { 2 } >
118
- < Text element = "p" textAlignment = "center" color = "secondary" >
119
- < Trans i18nKey = "dashboard.empty.add-library-panel-body" >
120
- Add visualizations that are shared with other dashboards.
121
- </ Trans >
122
- </ Text >
123
- </ Box >
124
- < Button
125
- icon = "plus"
126
- fill = "outline"
127
- data-testid = { selectors . pages . AddDashboard . itemButton ( 'Add a panel from the panel library button' ) }
128
- onClick = { onAddLibraryPanel }
129
- disabled = { ! canCreate }
130
- >
131
- < Trans i18nKey = "dashboard.empty.add-library-panel-button" > Add library panel</ Trans >
132
- </ Button >
133
- </ Stack >
134
- </ Box >
135
- < Box borderColor = "strong" borderStyle = "dashed" padding = { 3 } flex = { 1 } >
136
- < Stack direction = "column" alignItems = "center" gap = { 1 } >
137
- < Text element = "h3" textAlignment = "center" weight = "medium" >
138
- < Trans i18nKey = "dashboard.empty.import-a-dashboard-header" > Import a dashboard</ Trans >
139
- </ Text >
140
- < Box marginBottom = { 2 } >
141
- < Text element = "p" textAlignment = "center" color = "secondary" >
142
- < Trans i18nKey = "dashboard.empty.import-a-dashboard-body" >
143
- Import dashboards from files or < a href = "https://grafana.com/grafana/dashboards/" > grafana.com</ a > .
144
- </ Trans >
145
- </ Text >
146
- </ Box >
147
- < Button
148
- icon = "upload"
149
- fill = "outline"
150
- data-testid = { selectors . pages . AddDashboard . itemButton ( 'Import dashboard button' ) }
151
- onClick = { ( ) => {
152
- DashboardInteractions . emptyDashboardButtonClicked ( { item : 'import_dashboard' } ) ;
153
- onImportDashboard ( ) ;
154
- } }
155
- disabled = { ! canCreate }
156
- >
157
- < Trans i18nKey = "dashboard.empty.import-dashboard-button" > Import dashboard</ Trans >
158
- </ Button >
159
- </ Stack >
160
- </ Box >
161
- </ Stack >
170
+ </ Stack >
171
+ )
172
+ }
162
173
</ Stack >
163
174
</ div >
164
175
</ Stack >
0 commit comments