testData.ts 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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 { VizType } from '@superset-ui/core';
  20. export const basicFormData = {
  21. datasource: '1__table',
  22. viz_type: VizType.PivotTable,
  23. granularity_sqla: 'ts',
  24. groupbyColumns: ['location'],
  25. groupbyRows: ['program_language'],
  26. metrics: [
  27. {
  28. expressionType: 'SIMPLE',
  29. column: {
  30. id: 1,
  31. column_name: 'count',
  32. description: null,
  33. expression: null,
  34. groupby: true,
  35. is_dttm: false,
  36. python_date_format: null,
  37. type: 'BIGINT',
  38. type_generic: 0,
  39. },
  40. aggregate: 'SUM',
  41. sqlExpression: null,
  42. isNew: false,
  43. hasCustomLabel: true,
  44. label: 'Count',
  45. },
  46. {
  47. expressionType: 'SIMPLE',
  48. column: {
  49. id: 2,
  50. column_name: 'ts',
  51. description: null,
  52. expression: "DATE_PARSE(ds || ' ' || hr, '%Y-%m-%d %H')",
  53. groupby: true,
  54. is_dttm: true,
  55. type: 'TIMESTAMP',
  56. type_generic: 2,
  57. python_date_format: null,
  58. },
  59. aggregate: 'MAX',
  60. sqlExpression: null,
  61. isNew: false,
  62. hasCustomLabel: true,
  63. label: 'Most Recent Data',
  64. },
  65. ],
  66. metricsLayout: 'COLUMNS',
  67. order_desc: true,
  68. aggregateFunction: 'Sum',
  69. valueFormat: '~g',
  70. date_format: 'smart_date',
  71. rowOrder: 'key_a_to_z',
  72. colOrder: 'key_a_to_z',
  73. };
  74. export const basicData = {
  75. cache_key: 'f2cd2a37b6977e3619ce6c07d0027972',
  76. cached_dttm: '2022-07-27T17:42:39',
  77. cache_timeout: 129600,
  78. applied_template_filters: [],
  79. annotation_data: {},
  80. error: null,
  81. is_cached: true,
  82. query: 'SELECT \nFROM\nWHERE',
  83. status: 'success',
  84. stacktrace: null,
  85. rowcount: 5,
  86. from_dttm: 1658426268000,
  87. to_dttm: 1659031068000,
  88. colnames: ['location', 'program_language', 'Count', 'Most Recent Data'],
  89. indexnames: [0, 1, 2, 3, 4],
  90. coltypes: [1, 1, 0, 1],
  91. data: [
  92. {
  93. location: 'AMEA',
  94. program_language: 'JavaScript',
  95. Count: 134,
  96. 'Most Recent Data': '2022-07-25 13:00:00.000',
  97. },
  98. {
  99. location: 'ASIA',
  100. program_language: 'python',
  101. Count: 19,
  102. 'Most Recent Data': '2022-07-25 16:00:00.000',
  103. },
  104. {
  105. location: 'ASIA',
  106. program_language: 'Java',
  107. Count: 7,
  108. 'Most Recent Data': '2022-07-25 15:00:00.000',
  109. },
  110. {
  111. location: 'ASIA',
  112. program_language: 'C++',
  113. Count: 1,
  114. 'Most Recent Data': '2022-07-25 02:00:00.000',
  115. },
  116. {
  117. location: 'ASIA',
  118. program_language: 'PHP',
  119. Count: 1,
  120. 'Most Recent Data': '2022-07-24 00:00:00.000',
  121. },
  122. ],
  123. result_format: 'json',
  124. applied_filters: [],
  125. rejected_filters: [],
  126. };