migrations.test.ts 2.8 KB

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