types.ts 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /*
  2. * <<
  3. * Davinci
  4. * ==
  5. * Copyright (C) 2016 - 2017 EDP
  6. * ==
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. * >>
  19. */
  20. import { IDashboardBase, IDashboardRaw } from 'app/containers/Viz/types'
  21. import { IControl } from 'app/components/Control/types'
  22. import { ControlQueryMode } from 'app/components/Control/constants'
  23. import { RenderType, IPaginationParams } from '../Widget/components/Widget'
  24. import { IFieldSortDescriptor } from '../Widget/components/Config/Sort'
  25. import { TShareVizsType, ISharePanel } from 'app/components/SharePanel/types'
  26. import { IWidgetFormed } from '../Widget/types'
  27. import { IView, IViewQueryResponse } from '../View/types'
  28. import { CancelTokenSource } from 'axios'
  29. import { IDrillDetail } from 'components/DataDrill/types'
  30. export interface IDashboard extends IDashboardBase {
  31. config: IDashboardConfig
  32. }
  33. export interface IDashboardConfig {
  34. filters: IControl[]
  35. linkages: any[]
  36. queryMode: ControlQueryMode
  37. }
  38. export interface IDashboardDetailRaw extends IDashboardRaw {
  39. relations: IDashboardItem[]
  40. views: IView[]
  41. }
  42. export interface IDashboardItem {
  43. id: number
  44. dashboardId: number
  45. widgetId: number
  46. width: number
  47. height: number
  48. x: number
  49. y: number
  50. polling: boolean
  51. frequency: number
  52. config: string
  53. alias?: string
  54. }
  55. export interface IDashboardItemInfo {
  56. datasource: IViewQueryResponse
  57. loading: boolean
  58. queryConditions: IQueryConditions
  59. shareToken: string
  60. passwordShareToken?: string
  61. password?: string
  62. authorizedShareToken: string
  63. shareLoading: boolean
  64. downloadCsvLoading: boolean
  65. interactId: string
  66. rendered: boolean
  67. renderType: RenderType
  68. selectedItems: number[]
  69. errorMessage: string
  70. }
  71. export type QueryVariable = Array<{ name: string; value: string | number }>
  72. export interface IQueryVariableMap {
  73. [key: string]: string | number
  74. }
  75. export interface IQueryConditions {
  76. tempFilters: string[] // @TODO combine widget static filters with local filters
  77. linkageFilters: string[]
  78. globalFilters: string[]
  79. variables: QueryVariable
  80. linkageVariables: QueryVariable
  81. globalVariables: QueryVariable
  82. pagination: IPaginationParams
  83. nativeQuery: boolean
  84. orders?: Array<{ column: string; direction: string }>
  85. drillStatus?: any
  86. drillHistory?: IDrillDetail[]
  87. drillpathSetting?: any
  88. drillpathInstance?: any
  89. drillSetting?: any
  90. }
  91. export interface IDataRequestParams {
  92. groups: string[]
  93. aggregators: Array<{ column: string; func: string }>
  94. filters: string[]
  95. tempFilters: string[]
  96. linkageFilters: string[]
  97. globalFilters: string[]
  98. variables: QueryVariable
  99. linkageVariables: QueryVariable
  100. globalVariables: QueryVariable
  101. orders: Array<{ column: string; direction: string }>
  102. limit: number
  103. cache: boolean
  104. expired: number
  105. flush: boolean
  106. pagination?: IPaginationParams
  107. nativeQuery: boolean
  108. customOrders?: IFieldSortDescriptor[]
  109. drillStatus?: {
  110. filters: any[]
  111. groups: string[]
  112. }
  113. }
  114. export interface IDataRequestBody {
  115. groups: string[]
  116. aggregators: Array<{ column: string; func: string }>
  117. filters: string[]
  118. params?: QueryVariable
  119. orders?: Array<{ column: string; direction: string }>
  120. limit: number
  121. cache: boolean
  122. expired: number
  123. flush: boolean
  124. pageNo: number
  125. pageSize: number
  126. nativeQuery: boolean
  127. }
  128. export interface IDataDownloadStatistic {
  129. id: number
  130. param: IDataRequestBody
  131. itemId: number
  132. widget: IWidgetFormed
  133. }
  134. export interface IDashboardState {
  135. currentDashboard: IDashboard
  136. currentDashboardLoading: boolean
  137. currentDashboardShareToken: string
  138. currentDashboardAuthorizedShareToken: string
  139. currentDashboardPasswordShareToken: string
  140. currentDashboardPasswordSharePassword: string
  141. currentDashboardShareLoading: boolean
  142. sharePanel: IDashboardSharePanelState
  143. currentItems: IDashboardItem[]
  144. currentItemsInfo: {
  145. [itemId: string]: IDashboardItemInfo
  146. }
  147. fullScreenPanelItemId: number
  148. cancelTokenSources: CancelTokenSource[]
  149. }
  150. export interface IDashboardSharePanelState
  151. extends Pick<ISharePanel, 'id' | 'itemId' | 'type' | 'title'> {
  152. visible: boolean
  153. }
  154. export type ILoadData = (
  155. renderType: RenderType,
  156. itemId: number,
  157. queryConditions?: Partial<IQueryConditions>
  158. ) => void
  159. export { IDashboardRaw, TShareVizsType }