mockDashboardFormData.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. /* eslint-disable theme-colors/no-literal-colors */
  20. import { JsonObject } from '@superset-ui/core';
  21. export const getDashboardFormData = (overrides: JsonObject = {}) => ({
  22. label_colors: {
  23. Girls: '#FF69B4',
  24. Boys: '#ADD8E6',
  25. girl: '#FF69B4',
  26. boy: '#ADD8E6',
  27. },
  28. shared_label_colors: ['boy', 'girl'],
  29. color_scheme: 'd3Category20b',
  30. extra_filters: [
  31. {
  32. col: '__time_range',
  33. op: '==',
  34. val: 'No filter',
  35. },
  36. {
  37. col: '__time_grain',
  38. op: '==',
  39. val: 'P1D',
  40. },
  41. {
  42. col: '__time_col',
  43. op: '==',
  44. val: 'ds',
  45. },
  46. ],
  47. extra_form_data: {
  48. filters: [
  49. {
  50. col: 'name',
  51. op: 'IN',
  52. val: ['Aaron'],
  53. },
  54. {
  55. col: 'num_boys',
  56. op: '<=',
  57. val: 10000,
  58. },
  59. {
  60. col: {
  61. sqlExpression: 'totally viable sql expression',
  62. expressionType: 'SQL',
  63. label: 'My column',
  64. },
  65. op: 'IN',
  66. val: ['Value1', 'Value2'],
  67. },
  68. ],
  69. granularity_sqla: 'ds',
  70. time_range: 'Last month',
  71. time_grain_sqla: 'PT1S',
  72. },
  73. dashboardId: 2,
  74. ...overrides,
  75. });