history_mocks.ts 4.2 KB

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