mockExploreFormData.ts 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. import { JsonObject, VizType } from '@superset-ui/core';
  20. export const getExploreFormData = (overrides: JsonObject = {}) => ({
  21. adhoc_filters: [
  22. {
  23. clause: 'WHERE' as const,
  24. expressionType: 'SIMPLE' as const,
  25. operator: 'IN' as const,
  26. subject: 'gender',
  27. comparator: ['boys'],
  28. filterOptionName: '123',
  29. },
  30. {
  31. clause: 'WHERE' as const,
  32. expressionType: 'SQL' as const,
  33. operator: null,
  34. subject: null,
  35. comparator: null,
  36. sqlExpression: "name = 'John'",
  37. filterOptionName: '456',
  38. },
  39. {
  40. clause: 'WHERE' as const,
  41. expressionType: 'SQL' as const,
  42. operator: null,
  43. subject: null,
  44. comparator: null,
  45. sqlExpression: "city = 'Warsaw'",
  46. filterOptionName: '567',
  47. },
  48. {
  49. clause: 'WHERE' as const,
  50. expressionType: 'SIMPLE' as const,
  51. operator: 'TEMPORAL_RANGE' as const,
  52. subject: 'ds',
  53. comparator: 'No filter',
  54. filterOptionName: '678',
  55. },
  56. ],
  57. adhoc_filters_b: [
  58. {
  59. clause: 'WHERE' as const,
  60. expressionType: 'SQL' as const,
  61. operator: null,
  62. subject: null,
  63. comparator: null,
  64. sqlExpression: "country = 'Poland'",
  65. filterOptionName: '789',
  66. },
  67. ],
  68. applied_time_extras: {},
  69. color_scheme: 'supersetColors',
  70. datasource: '2__table',
  71. granularity_sqla: 'ds',
  72. groupby: ['gender'],
  73. metric: {
  74. aggregate: 'SUM',
  75. column: {
  76. column_name: 'num',
  77. type: 'BIGINT',
  78. },
  79. expressionType: 'SIMPLE',
  80. label: 'Births',
  81. },
  82. slice_id: 46,
  83. time_range: '100 years ago : now',
  84. viz_type: VizType.Pie,
  85. ...overrides,
  86. });