shared.helper.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. // ***********************************************
  20. // Constants for visualization tests
  21. // ***********************************************
  22. export const FORM_DATA_DEFAULTS = {
  23. datasource: '3__table',
  24. time_grain_sqla: null,
  25. x_axis: 'ds',
  26. adhoc_filters: [
  27. {
  28. clause: 'WHERE',
  29. subject: 'ds',
  30. operator: 'TEMPORAL_RANGE',
  31. comparator: '100 years ago : now',
  32. expressionType: 'SIMPLE',
  33. },
  34. ],
  35. groupby: [],
  36. limit: null,
  37. timeseries_limit_metric: null,
  38. order_desc: false,
  39. contributionMode: null,
  40. };
  41. export const HEALTH_POP_FORM_DATA_DEFAULTS = {
  42. datasource: '2__table',
  43. granularity_sqla: 'ds',
  44. time_grain_sqla: 'P1D',
  45. time_range: '1960-01-01 : 2014-01-02',
  46. };
  47. export const NUM_METRIC = {
  48. expressionType: 'SIMPLE',
  49. column: {
  50. id: 336,
  51. column_name: 'num',
  52. verbose_name: null,
  53. description: null,
  54. expression: '',
  55. filterable: false,
  56. groupby: false,
  57. is_dttm: false,
  58. type: 'BIGINT',
  59. database_expression: null,
  60. python_date_format: null,
  61. optionName: '_col_num',
  62. },
  63. aggregate: 'SUM',
  64. sqlExpression: null,
  65. hasCustomLabel: false,
  66. label: 'Sum(num)',
  67. optionName: 'metric_1de0s4viy5d_ly7y8k6ghvk',
  68. };
  69. export const MAX_DS = {
  70. aggregate: 'MAX',
  71. column: {
  72. column_name: 'ds',
  73. description: null,
  74. expression: null,
  75. filterable: true,
  76. groupby: true,
  77. id: 333,
  78. is_dttm: true,
  79. optionName: '_col_ds',
  80. python_date_format: null,
  81. type: 'TIMESTAMP WITHOUT TIME ZONE',
  82. verbose_name: null,
  83. },
  84. expressionType: 'SIMPLE',
  85. hasCustomLabel: false,
  86. isNew: false,
  87. label: 'MAX(ds)',
  88. optionName: 'metric_pbib7j9m15a_js80vs9vca',
  89. sqlExpression: null,
  90. };
  91. export const MAX_STATE = {
  92. expressionType: 'SQL',
  93. sqlExpression: 'MAX(UPPER(state))',
  94. column: null,
  95. aggregate: null,
  96. isNew: false,
  97. hasCustomLabel: false,
  98. label: 'MAX(UPPER(state))',
  99. optionName: 'metric_kvval50pvbo_hewj3pzacb',
  100. };
  101. export const SIMPLE_FILTER = {
  102. expressionType: 'SIMPLE',
  103. subject: 'name',
  104. operator: 'IN',
  105. comparator: ['Aaron', 'Amy', 'Andrea'],
  106. clause: 'WHERE',
  107. sqlExpression: null,
  108. filterOptionName: 'filter_4y6teao56zs_ebjsvwy48c',
  109. };