history_mocks.ts 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. export function versions() {
  2. return [
  3. {
  4. id: 4,
  5. dashboardId: 1,
  6. parentVersion: 3,
  7. restoredFrom: 0,
  8. version: 4,
  9. created: '2017-02-22T17:43:01-08:00',
  10. createdBy: 'admin',
  11. message: '',
  12. },
  13. {
  14. id: 3,
  15. dashboardId: 1,
  16. parentVersion: 1,
  17. restoredFrom: 1,
  18. version: 3,
  19. created: '2017-02-22T17:43:01-08:00',
  20. createdBy: 'admin',
  21. message: '',
  22. },
  23. {
  24. id: 2,
  25. dashboardId: 1,
  26. parentVersion: 0,
  27. restoredFrom: -1,
  28. version: 2,
  29. created: '2017-02-22T17:29:52-08:00',
  30. createdBy: 'admin',
  31. message: '',
  32. },
  33. {
  34. id: 1,
  35. dashboardId: 1,
  36. parentVersion: 0,
  37. restoredFrom: -1,
  38. slug: 'history-dashboard',
  39. version: 1,
  40. created: '2017-02-22T17:06:37-08:00',
  41. createdBy: 'admin',
  42. message: '',
  43. },
  44. ];
  45. }
  46. export function compare(type) {
  47. return type === 'basic' ? '<div></div>' : '<pre><code></code></pre>';
  48. }
  49. export function restore(version, restoredFrom?) {
  50. return {
  51. dashboard: {
  52. meta: {
  53. type: 'db',
  54. canSave: true,
  55. canEdit: true,
  56. canStar: true,
  57. slug: 'history-dashboard',
  58. expires: '0001-01-01T00:00:00Z',
  59. created: '2017-02-21T18:40:45-08:00',
  60. updated: '2017-04-11T21:31:22.59219665-07:00',
  61. updatedBy: 'admin',
  62. createdBy: 'admin',
  63. version: version,
  64. },
  65. dashboard: {
  66. annotations: {
  67. list: [],
  68. },
  69. description: 'A random dashboard for implementing the history list',
  70. editable: true,
  71. gnetId: null,
  72. graphTooltip: 0,
  73. hideControls: false,
  74. id: 1,
  75. links: [],
  76. restoredFrom: restoredFrom,
  77. rows: [
  78. {
  79. collapse: false,
  80. height: '250px',
  81. panels: [
  82. {
  83. aliasColors: {},
  84. bars: false,
  85. datasource: null,
  86. fill: 1,
  87. id: 1,
  88. legend: {
  89. avg: false,
  90. current: false,
  91. max: false,
  92. min: false,
  93. show: true,
  94. total: false,
  95. values: false,
  96. },
  97. lines: true,
  98. linewidth: 1,
  99. nullPointMode: 'null',
  100. percentage: false,
  101. pointradius: 5,
  102. points: false,
  103. renderer: 'flot',
  104. seriesOverrides: [],
  105. span: 12,
  106. stack: false,
  107. steppedLine: false,
  108. targets: [{}],
  109. thresholds: [],
  110. timeFrom: null,
  111. timeShift: null,
  112. title: 'Panel Title',
  113. tooltip: {
  114. shared: true,
  115. sort: 0,
  116. value_type: 'individual',
  117. },
  118. type: 'graph',
  119. xaxis: {
  120. mode: 'time',
  121. name: null,
  122. show: true,
  123. values: [],
  124. },
  125. yaxes: [
  126. {
  127. format: 'short',
  128. label: null,
  129. logBase: 1,
  130. max: null,
  131. min: null,
  132. show: true,
  133. },
  134. {
  135. format: 'short',
  136. label: null,
  137. logBase: 1,
  138. max: null,
  139. min: null,
  140. show: true,
  141. },
  142. ],
  143. },
  144. ],
  145. repeat: null,
  146. repeatIteration: null,
  147. repeatRowId: null,
  148. showTitle: false,
  149. title: 'Dashboard Row',
  150. titleSize: 'h6',
  151. },
  152. ],
  153. schemaVersion: 14,
  154. style: 'dark',
  155. tags: ['development'],
  156. templating: {
  157. list: [],
  158. },
  159. time: {
  160. from: 'now-6h',
  161. to: 'now',
  162. },
  163. timepicker: {
  164. refresh_intervals: ['5s', '10s', '30s', '1m', '5m', '15m', '30m', '1h', '2h', '1d'],
  165. time_options: ['5m', '15m', '1h', '6h', '12h', '24h', '2d', '7d', '30d'],
  166. },
  167. timezone: 'utc',
  168. title: 'History Dashboard',
  169. version: version,
  170. },
  171. },
  172. message: 'Dashboard restored to version ' + version,
  173. version: version,
  174. };
  175. }