types.ts 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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 { SqlTypes } from 'app/globalConstants'
  21. import { SourceProperty } from './components/types'
  22. export { SourceResetConnectionProperties } from './components/types'
  23. export type SourceType = 'csv' | 'jdbc'
  24. export interface ISourceSimple {
  25. id: number
  26. name: string
  27. }
  28. export interface ISourceBase extends ISourceSimple {
  29. type: SourceType
  30. description: string
  31. projectId: number
  32. }
  33. export interface ISourceRaw extends ISourceBase {
  34. config: string
  35. }
  36. export interface ISource extends ISourceBase {
  37. config: {
  38. username: string
  39. password: string
  40. url: string
  41. properties: SourceProperty[]
  42. ext?: boolean
  43. version?: string
  44. }
  45. }
  46. export interface ISourceFormValues extends ISourceBase {
  47. datasourceInfo: string[]
  48. config: {
  49. username: string
  50. password: string
  51. url: string
  52. properties: SourceProperty[]
  53. }
  54. }
  55. export type IDatabase = string
  56. export interface ITable {
  57. name: string
  58. type: 'TABLE' | 'VIEW'
  59. }
  60. export interface IColumn {
  61. name: string
  62. type: SqlTypes
  63. }
  64. export interface ISourceDatabases {
  65. databases: IDatabase[]
  66. sourceId: number
  67. }
  68. export interface IMapSourceDatabases {
  69. [sourceId: number]: IDatabase[]
  70. }
  71. export interface IDatabaseTables {
  72. tables: ITable[]
  73. dbName: IDatabase
  74. sourceId: number
  75. }
  76. export interface IMapDatabaseTables {
  77. [mapKey: string]: IDatabaseTables
  78. }
  79. export interface ITableColumns {
  80. columns: IColumn[]
  81. primaryKeys: string[]
  82. tableName: string
  83. sourceId: number
  84. dbName: string
  85. }
  86. export interface IMapTableColumns {
  87. [mapKey: string]: ITableColumns
  88. }
  89. export interface ISchema {
  90. mapDatabases: IMapSourceDatabases
  91. mapTables: IMapDatabaseTables
  92. mapColumns: IMapTableColumns
  93. }
  94. export interface ICSVMetaInfo {
  95. sourceId: number
  96. tableName: string
  97. mode: number
  98. primaryKeys: string
  99. indexKeys: string
  100. file: File
  101. }
  102. export interface ISourceState {
  103. sources: ISourceBase[]
  104. listLoading: boolean
  105. formLoading: boolean
  106. testLoading: boolean
  107. resetLoading: boolean
  108. datasourcesInfo: IDatasourceInfo[]
  109. }
  110. export interface IDatasourceInfo {
  111. name: string
  112. prefix: string
  113. versions: string[]
  114. }