1import { PanelModel } from 'app/features/dashboard/state';
2import { timelinePanelChangedHandler } from './migrations';
3
4describe('Timeline Migrations', () => {
5  it('from discrete panel', () => {
6    const panel = {} as PanelModel;
7    panel.options = timelinePanelChangedHandler(panel, 'natel-discrete-panel', { angular: discreteInV8 });
8    expect(panel).toMatchSnapshot();
9  });
10});
11
12const discreteInV8 = {
13  id: 23763571993,
14  gridPos: {
15    h: 8,
16    w: 12,
17    x: 0,
18    y: 0,
19  },
20  type: 'natel-discrete-panel',
21  title: 'Panel Title',
22  backgroundColor: 'rgba(128,128,128,0.1)',
23  colorMaps: [
24    {
25      $$hashKey: 'object:365',
26      color: '#7EB26D',
27      text: '1',
28    },
29    {
30      $$hashKey: 'object:366',
31      color: '#EAB839',
32      text: '20',
33    },
34    {
35      $$hashKey: 'object:367',
36      color: '#6ED0E0',
37      text: '90',
38    },
39    {
40      $$hashKey: 'object:368',
41      color: '#EF843C',
42      text: '30',
43    },
44    {
45      $$hashKey: 'object:369',
46      color: '#E24D42',
47      text: '5',
48    },
49  ],
50  crosshairColor: '#8F070C',
51  display: 'timeline',
52  extendLastValue: true,
53  highlightOnMouseover: true,
54  legendSortBy: '-ms',
55  lineColor: 'rgba(0,0,0,0.1)',
56  metricNameColor: '#000000',
57  rangeMaps: [
58    {
59      $$hashKey: 'object:267',
60      from: '1',
61      text: 'AAA',
62      to: '3',
63    },
64    {
65      from: '4',
66      to: '5',
67      text: 'BBB',
68      $$hashKey: 'object:544',
69    },
70  ],
71  rowHeight: 50,
72  showLegend: true,
73  showLegendNames: true,
74  showLegendPercent: true,
75  showLegendValues: true,
76  showTimeAxis: true,
77  targets: [
78    {
79      refId: 'A',
80      scenarioId: 'csv_metric_values',
81      stringInput: '1,20,90,30,5,0',
82    },
83    {
84      scenarioId: 'csv_metric_values',
85      refId: 'B',
86      stringInput: '1,20,30,5,0',
87      hide: false,
88    },
89  ],
90  textSize: 24,
91  textSizeTime: 12,
92  timeOptions: [
93    {
94      name: 'Years',
95      value: 'years',
96    },
97    {
98      name: 'Months',
99      value: 'months',
100    },
101    {
102      name: 'Weeks',
103      value: 'weeks',
104    },
105    {
106      name: 'Days',
107      value: 'days',
108    },
109    {
110      name: 'Hours',
111      value: 'hours',
112    },
113    {
114      name: 'Minutes',
115      value: 'minutes',
116    },
117    {
118      name: 'Seconds',
119      value: 'seconds',
120    },
121    {
122      name: 'Milliseconds',
123      value: 'milliseconds',
124    },
125  ],
126  timePrecision: {
127    name: 'Minutes',
128    value: 'minutes',
129  },
130  timeTextColor: '#d8d9da',
131  units: 'currencyGBP',
132  valueMaps: [
133    {
134      $$hashKey: 'object:265',
135      op: '=',
136      text: 'ONE',
137      value: '111',
138    },
139    {
140      value: '222',
141      op: '=',
142      text: 'TWO',
143      $$hashKey: 'object:546',
144    },
145  ],
146  valueTextColor: '#000000',
147  writeLastValue: true,
148  expandFromQueryS: 0,
149  use12HourClock: false,
150  useTimePrecision: false,
151  writeAllValues: false,
152  writeMetricNames: false,
153  datasource: null,
154};
155