config.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*
  2. Copyright (C) 2017 Cloudbase Solutions SRL
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Affero General Public License as
  5. published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Affero General Public License for more details.
  11. You should have received a copy of the GNU Affero General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. // @flow
  15. export const coriolisUrl = (window.env && window.env.CORIOLIS_URL) || '/'
  16. export const servicesUrl = {
  17. identity: `${coriolisUrl}identity/auth/tokens`,
  18. projects: `${coriolisUrl}identity/auth/projects`,
  19. users: `${coriolisUrl}identity/users`,
  20. endpoints: `${coriolisUrl}coriolis/endpoints`,
  21. coriolis: `${coriolisUrl}coriolis`,
  22. migrations: `${coriolisUrl}coriolis/migrations`,
  23. barbican: `${coriolisUrl}barbican`,
  24. openId: `${coriolisUrl}identity/OS-FEDERATION/identity_providers/google/protocols/openid/auth`,
  25. }
  26. export const userDomain = 'default'
  27. // Whether to use Barbican secrets when creating a new endpoint
  28. export const useSecret = true
  29. // Shows the 'Use Current User/Project/Domain for Authentification' switch
  30. // when creating a new openstack endpoint
  31. export const showOpenstackCurrentUserSwitch = false
  32. export const navigationMenu = [
  33. { label: 'Replicas', value: 'replicas' },
  34. { label: 'Migrations', value: 'migrations' },
  35. { label: 'Cloud Endpoints', value: 'endpoints' },
  36. // Optional pages
  37. { label: 'Planning', value: 'planning', disabled: true },
  38. // User management pages
  39. { label: 'Projects', value: 'projects', disabled: true, requiresAdmin: true },
  40. { label: 'Users', value: 'users', disabled: true, requiresAdmin: true },
  41. ]
  42. export const requestPollTimeout = 5000
  43. // https://github.com/cloudbase/coriolis/blob/master/coriolis/constants.py
  44. // PROVIDER_TYPE_IMPORT = 1 // migration target schema
  45. // PROVIDER_TYPE_EXPORT = 2 // migration source schema
  46. // PROVIDER_TYPE_REPLICA_IMPORT = 4 // replica target schema
  47. // PROVIDER_TYPE_REPLICA_EXPORT = 8 // replica source schema
  48. export const providerTypes = {
  49. TARGET_MIGRATION: 1,
  50. SOURCE_MIGRATION: 2,
  51. TARGET_REPLICA: 4,
  52. SOURCE_REPLICA: 8,
  53. CONNECTION: 16,
  54. }
  55. export const loginButtons = [
  56. // {
  57. // name: 'Google',
  58. // id: 'google',
  59. // url: '',
  60. // },
  61. ]
  62. export const env = {
  63. name: process.env.NODE_ENV || 'development',
  64. isDev: process.env.NODE_ENV !== 'production',
  65. isBrowser: typeof window !== 'undefined',
  66. }
  67. export const executionOptions = [
  68. {
  69. name: 'shutdown_instances',
  70. type: 'strict-boolean',
  71. defaultValue: false,
  72. },
  73. ]
  74. export const storageProviders = ['openstack', 'azure']
  75. export const sourceOptionsProviders = ['aws']
  76. export const wizardConfig = {
  77. pages: [
  78. { id: 'type', title: 'New', breadcrumb: 'Type' },
  79. { id: 'source', title: 'Select your source cloud', breadcrumb: 'Source Cloud' },
  80. {
  81. id: 'source-options',
  82. title: 'Source options',
  83. breadcrumb: 'Source Options',
  84. sourceFilter: (p: string) => sourceOptionsProviders.find(s => s === p),
  85. },
  86. { id: 'vms', title: 'Select instances', breadcrumb: 'Select VMs' },
  87. { id: 'target', title: 'Select your target cloud', breadcrumb: 'Target Cloud' },
  88. { id: 'dest-options', title: 'Target options', breadcrumb: 'Target Options' },
  89. { id: 'networks', title: 'Networks', breadcrumb: 'Networks' },
  90. {
  91. id: 'storage',
  92. title: 'Storage Mapping',
  93. breadcrumb: 'Storage',
  94. targetFilter: (p: string) => storageProviders.find(s => s === p),
  95. },
  96. { id: 'schedule', title: 'Schedule', breadcrumb: 'Schedule', excludeFrom: 'migration' },
  97. { id: 'summary', title: 'Summary', breadcrumb: 'Summary' },
  98. ],
  99. }
  100. // - Specifies the `limit` for each provider when listing all its VMs for pagination.
  101. // - If the provider is not in this list, the 'default' value will be used.
  102. // - If the `default` value is lower than the number of instances that fit into a page, the latter number will be used.
  103. // - `Infinity` value means no `limit` will be used, i.e. all VMs will be listed.
  104. export const instancesListBackgroundLoading = { default: 10, ovm: Infinity }
  105. // A list of providers for which `destination-options` API call(s) will be made in the Wizard
  106. // If the item is just a string with the provider name, only one API call will be made
  107. // If the item has `envRequiredFields`, an additional API call will be made once the specified fields are filled
  108. export const providersWithExtraOptions = [
  109. 'openstack',
  110. 'oracle_vm',
  111. {
  112. name: 'azure',
  113. envRequiredFields: ['location', 'resource_group'],
  114. },
  115. {
  116. name: 'oci',
  117. envRequiredFields: ['compartment', 'availability_domain'],
  118. },
  119. ]
  120. export const basename = process.env.PUBLIC_PATH