foreman_templates 7.0.7 → 9.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/api/v2/template_controller.rb +6 -1
  3. data/app/controllers/concerns/foreman/controller/parameters/template_params.rb +22 -2
  4. data/app/controllers/ui_template_syncs_controller.rb +1 -1
  5. data/app/models/setting/template_sync.rb +12 -2
  6. data/app/services/foreman_templates/template_exporter.rb +3 -3
  7. data/app/services/foreman_templates/template_importer.rb +21 -5
  8. data/app/views/template_syncs/index.html.erb +14 -17
  9. data/app/views/ui_template_syncs/template_attrs.json.rabl +1 -1
  10. data/db/migrate/20180627134929_change_lock_setting.rb +5 -0
  11. data/lib/foreman_templates/engine.rb +11 -5
  12. data/lib/foreman_templates/version.rb +1 -1
  13. data/lib/tasks/foreman_templates_tasks.rake +10 -9
  14. data/package.json +15 -21
  15. data/webpack/ForemanTemplates.js +17 -13
  16. data/webpack/__mocks__/foremanReact/Root/Context/ForemanContext.js +2 -0
  17. data/webpack/__mocks__/foremanReact/components/common/forms/ForemanForm.js +2 -0
  18. data/webpack/components/NewTemplateSync/__fixtures__/templateSyncSettings.fixtures.js +4 -4
  19. data/webpack/components/NewTemplateSync/__tests__/__snapshots__/NewTemplateSync.test.js.snap +2 -2
  20. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/NewTemplateSyncForm.js +102 -132
  21. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/NewTemplateSyncFormHelpers.js +43 -0
  22. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/NewTemplateSyncFormSelectors.js +10 -13
  23. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/__tests__/NewTemplateSyncFormSelectors.test.js +1 -19
  24. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/__tests__/__snapshots__/NewTemplateSyncFormSelectors.test.js.snap +7 -36
  25. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/index.js +3 -20
  26. data/webpack/components/NewTemplateSync/components/SyncSettingField.js +5 -11
  27. data/webpack/components/NewTemplateSync/components/SyncSettingFields.js +8 -25
  28. data/webpack/components/NewTemplateSync/components/TextButtonField/index.js +27 -20
  29. data/webpack/components/NewTemplateSync/components/__tests__/SyncSettingField.test.js +2 -1
  30. data/webpack/components/NewTemplateSync/components/__tests__/SyncSettingFields.test.js +1 -0
  31. data/webpack/components/NewTemplateSync/components/__tests__/TextButtonField.test.js +4 -4
  32. data/webpack/components/NewTemplateSync/components/__tests__/__snapshots__/SyncSettingField.test.js.snap +18 -27
  33. data/webpack/components/NewTemplateSync/components/__tests__/__snapshots__/SyncSettingFields.test.js.snap +5 -3
  34. data/webpack/components/NewTemplateSync/components/__tests__/__snapshots__/TextButtonField.test.js.snap +8 -91
  35. data/webpack/components/TemplateSyncResult/__fixtures__/templateSyncResult.fixtures.js +2 -2
  36. data/webpack/components/TemplateSyncResult/__tests__/__snapshots__/TemplateSyncResult.test.js.snap +3 -1
  37. data/webpack/components/TemplateSyncResult/__tests__/__snapshots__/TemplateSyncResultReducer.test.js.snap +3 -1
  38. data/webpack/components/TemplateSyncResult/components/SyncResultList.js +2 -2
  39. data/webpack/components/TemplateSyncResult/components/SyncedTemplate/__snapshots__/helpers.test.js.snap +37 -0
  40. data/webpack/components/TemplateSyncResult/components/SyncedTemplate/helpers.js +21 -11
  41. data/webpack/components/TemplateSyncResult/components/SyncedTemplate/helpers.test.js +21 -0
  42. data/webpack/components/TemplateSyncResult/components/__tests__/__snapshots__/SyncResultList.test.js.snap +8 -6
  43. data/webpack/components/TemplateSyncResult/components/__tests__/__snapshots__/SyncedTemplate.test.js.snap +39 -15
  44. data/webpack/testSetup.js +2 -1
  45. metadata +9 -8
  46. data/webpack/__mocks__/foremanReact/components/common/forms/Form.js +0 -2
  47. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/NewTemplateSyncFormConstants.js +0 -1
  48. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/__tests__/NewTemplateSyncForm.test.js +0 -42
  49. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/__tests__/__snapshots__/NewTemplateSyncForm.test.js.snap +0 -186
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9583ee6b0f88f013c5a26f23dd90a22cf7bdcdeebbb8052c3fdffaf11960fb3d
4
- data.tar.gz: 5b54607bfe06ca7cdd359d371afbb497e343310ae48d29c2f359bb4d43a6a38d
3
+ metadata.gz: 3b520577905d85f390af67f22635c98defb339c3177cfc9b7ecfb8039b3999c2
4
+ data.tar.gz: ae67963f134f9b53fe2f4520c028cd8426474e3aa10dc01733a292bbf1bb8284
5
5
  SHA512:
6
- metadata.gz: d6826d8bdd2c9bbc47d09cfe8a9cfeddb169a6aa65933fd670144921091267d20814b5cf4cf37e93629a81fa2b1b81120ce796dd53194d4740b02b7e10c04720
7
- data.tar.gz: 2e019ce44797e7c28648f8b8913d224441a514fad0e75c977502c1c79c4bab09dbcb4b538a584c28fc8049c60df5ff3c270dfe2de2df97564c5a5af3125ebce5
6
+ metadata.gz: 763f1cd44a8a5a91bad924c0c6eb50950b7cd552b762bc767c188eeae9f78d66ecb9f4f15d81012092683a2fff263c19bf2230e622167ec235557fac64244ea7
7
+ data.tar.gz: e48d8b9ac3b46195afec1d2913a4ad4a6558dc2a7ea2d325e8f6566b7697ca8780e450ced74b7604d709940660dbdd54a438c6590b4c08fd66b7fa3bdd189f88
@@ -3,6 +3,10 @@ module Api
3
3
  class TemplateController < ::Api::V2::BaseController
4
4
  include ::Foreman::Controller::Parameters::TemplateParams
5
5
 
6
+ resource_description do
7
+ resource_id 'templates'
8
+ end
9
+
6
10
  def_param_group :foreman_template_sync_params do
7
11
  param :branch, String, :required => false, :desc => N_("Branch in Git repo.")
8
12
  param :repo, String, :required => false, :desc => N_("Override the default repo from settings.")
@@ -15,7 +19,7 @@ module Api
15
19
  param :prefix, String, :required => false, :desc => N_("The string all imported templates should begin with.")
16
20
  param :associate, Setting::TemplateSync.associate_types.keys, :required => false, :desc => N_("Associate to OS's, Locations & Organizations. Options are: always, new or never.")
17
21
  param :force, :bool, :required => false, :desc => N_("Update templates that are locked")
18
- param :lock, :bool, :required => false, :desc => N_("Lock imported templates")
22
+ param :lock, Setting::TemplateSync.lock_types.keys + ["true", "false", "0", "1"], :required => false, :desc => N_("Lock imported templates")
19
23
  param :verbose, :bool, :required => false, :desc => N_("Show template diff in response")
20
24
  param_group :foreman_template_sync_params
21
25
  param_group :taxonomies, ::Api::V2::BaseController
@@ -29,6 +33,7 @@ module Api
29
33
 
30
34
  api :POST, "/templates/export", N_("Initiate Export")
31
35
  param :metadata_export_mode, Setting::TemplateSync.metadata_export_mode_types.keys, :required => false, :desc => N_("Specify how to handle metadata")
36
+ param :commit_msg, String, :desc => N_("Custom commit message for templates export")
32
37
  param_group :foreman_template_sync_params
33
38
  param_group :taxonomies, ::Api::V2::BaseController
34
39
  def export
@@ -15,7 +15,7 @@ module Foreman
15
15
  end
16
16
 
17
17
  def extra_export_params
18
- [:metadata_export_mode]
18
+ %i(metadata_export_mode commit_msg)
19
19
  end
20
20
 
21
21
  def template_params_filter(extra_params = [])
@@ -34,7 +34,27 @@ module Foreman
34
34
  end
35
35
 
36
36
  def template_import_params
37
- add_taxonomy_params(base_import_params(:none))
37
+ transform_lock_param add_taxonomy_params(base_import_params(:none))
38
+ end
39
+
40
+ def transform_lock_param(params)
41
+ lock = params[:lock]
42
+ return params if lock.nil?
43
+
44
+ if lock == "true" || lock.is_a?(TrueClass) || lock.to_s == "1"
45
+ log_deprecated_param(lock)
46
+ params[:lock] = "lock"
47
+ end
48
+
49
+ if lock == "false" || lock.is_a?(FalseClass) || lock.to_s == "0"
50
+ log_deprecated_param(lock)
51
+ params[:lock] = "unlock"
52
+ end
53
+ params
54
+ end
55
+
56
+ def log_deprecated_param(value)
57
+ Logging.logger('app').warn "Using '#{value}' as a value for lock when syncing templates is deprecated and will be removed in the future."
38
58
  end
39
59
 
40
60
  def template_export_params
@@ -43,6 +43,6 @@ class UiTemplateSyncsController < ApplicationController
43
43
  end
44
44
 
45
45
  def render_errors(messages, severity = 'danger')
46
- render :json => { :error => { :errors => { :base => messages }, :severity => severity } }, :status => :unprocessable_entity
46
+ render :json => { :error => { :errors => { :base => messages }, full_messages: messages, :severity => severity } }, :status => :unprocessable_entity
47
47
  end
48
48
  end
@@ -11,7 +11,7 @@ class Setting
11
11
  end
12
12
 
13
13
  def self.export_stripped_names
14
- %w(metadata_export_mode)
14
+ %w(metadata_export_mode commit_msg)
15
15
  end
16
16
 
17
17
  def self.import_setting_names(except = [])
@@ -38,6 +38,15 @@ class Setting
38
38
  }
39
39
  end
40
40
 
41
+ def self.lock_types
42
+ {
43
+ 'lock' => _('Lock'),
44
+ 'keep_lock_new' => _('Keep, lock new'),
45
+ 'keep' => _('Keep, do not lock new'),
46
+ 'unlock' => _('Unlock')
47
+ }
48
+ end
49
+
41
50
  def self.metadata_export_mode_types
42
51
  {
43
52
  'refresh' => _('Refresh'),
@@ -75,7 +84,8 @@ class Setting
75
84
  self.set('template_sync_branch', N_('Default branch in Git repo'), '', N_('Branch')),
76
85
  self.set('template_sync_metadata_export_mode', N_('Default metadata export mode, refresh re-renders metadata, keep will keep existing metadata, remove exports template without metadata'), 'refresh', N_('Metadata export mode'), nil, { :collection => Proc.new { self.metadata_export_mode_types } }),
77
86
  self.set('template_sync_force', N_('Should importing overwrite locked templates?'), false, N_('Force import')),
78
- self.set('template_sync_lock', N_('Should importing lock templates?'), false, N_('Lock templates')),
87
+ self.set('template_sync_lock', N_('How to handle lock for imported templates?'), 'keep', N_('Lock templates'), nil, { :collection => Proc.new { self.lock_types } }),
88
+ self.set('template_sync_commit_msg', N_('Custom commit message for templates export'), 'Templates export made by a Foreman user', N_('Commit message'))
79
89
  ].compact.each { |s| self.create! s.update(:category => "Setting::TemplateSync") }
80
90
  end
81
91
 
@@ -1,7 +1,7 @@
1
1
  module ForemanTemplates
2
2
  class TemplateExporter < Action
3
3
  def self.setting_overrides
4
- super + %i(metadata_export_mode)
4
+ super + %i(metadata_export_mode commit_msg)
5
5
  end
6
6
 
7
7
  def initialize(args = {})
@@ -42,7 +42,7 @@ module ForemanTemplates
42
42
  new_repo = true
43
43
  end
44
44
  if new_repo || status.added.any? || status.changed.any? || status.deleted.any? || status.untracked.any?
45
- git_repo.commit "Templates export made by Foreman user #{foreman_git_user}"
45
+ git_repo.commit commit_msg
46
46
  git_repo.push 'origin', branch
47
47
  else
48
48
  @warning = 'No change detected, skipping the commit and push'
@@ -94,7 +94,7 @@ module ForemanTemplates
94
94
  def templates_to_dump
95
95
  find_templates.each do |template|
96
96
  if filter.present?
97
- exportable = template.name =~ /#{filter}/i ? !negate : negate
97
+ exportable = /#{filter}/i.match?(template.name) ? !negate : negate
98
98
  result = ExportResult.new(template, exportable)
99
99
  next @result_lines << result.matching_filter unless exportable
100
100
 
@@ -10,7 +10,6 @@ module ForemanTemplates
10
10
  super args
11
11
  @verbose = parse_bool(@verbose)
12
12
  @force = parse_bool(@force)
13
- @lock = parse_bool(@lock)
14
13
  @result_lines = []
15
14
  end
16
15
 
@@ -71,7 +70,7 @@ module ForemanTemplates
71
70
  @result_lines << parse_result.check_for_errors
72
71
  rescue NameError => e
73
72
  @result_lines << parse_result.name_error(e, metadata['model'])
74
- rescue => e
73
+ rescue StandardError => e
75
74
  @result_lines << parse_result.add_exception(e)
76
75
  end
77
76
  end
@@ -79,11 +78,28 @@ module ForemanTemplates
79
78
  end
80
79
 
81
80
  def import_options
82
- { :force => @force,
81
+ lock_predicate = lambda do |template|
82
+ case @lock
83
+ when 'lock'
84
+ return true
85
+ when 'unlock'
86
+ return false
87
+ when 'keep'
88
+ return template.new_record? ? false : template.locked
89
+ when 'keep_lock_new'
90
+ return template.new_record? ? true : template.locked
91
+ else
92
+ raise ::Foreman::Exception.new("Unknown lock option type, expected one of #{::Setting::TemplateSync.lock_types.keys}, got #{@lock}")
93
+ end
94
+ end
95
+
96
+ {
97
+ :force => @force,
83
98
  :associate => @associate,
84
- :lock => @lock,
99
+ :lock => lock_predicate,
85
100
  :organization_params => @taxonomies[:organizations],
86
- :location_params => @taxonomies[:locations] }
101
+ :location_params => @taxonomies[:locations]
102
+ }
87
103
  end
88
104
 
89
105
  def template_model(metadata, parse_result)
@@ -5,20 +5,17 @@
5
5
  <%= webpacked_plugins_css_for :foreman_templates %>
6
6
  <% end %>
7
7
 
8
- <div id="foreman-templates"/>
9
-
10
- <%= mount_react_component('ForemanTemplates',
11
- '#foreman-templates',
12
- { :apiUrls => {
13
- :exportUrl => export_ui_template_syncs_path,
14
- :syncSettingsUrl => sync_settings_ui_template_syncs_path,
15
- :importUrl => import_ui_template_syncs_path
16
- },
17
- :validationData => { :repo => ForemanTemplates::Action.repo_start_with },
18
- :editPaths => edit_paths,
19
- :fileRepoStartWith => ForemanTemplates::Action.file_repo_start_with,
20
- :userPermissions => {
21
- :import => authorized_for(:controller => :ui_template_syncs, :action => :import),
22
- :export => authorized_for(:controller => :ui_template_syncs, :action => :export)
23
- }
24
- }.to_json )%>
8
+ <%= react_component('ForemanTemplates',
9
+ { :apiUrls => {
10
+ :exportUrl => export_ui_template_syncs_path,
11
+ :syncSettingsUrl => sync_settings_ui_template_syncs_path,
12
+ :importUrl => import_ui_template_syncs_path
13
+ },
14
+ :validationData => { :repo => ForemanTemplates::Action.repo_start_with },
15
+ :editPaths => edit_paths,
16
+ :fileRepoStartWith => ForemanTemplates::Action.file_repo_start_with,
17
+ :userPermissions => {
18
+ :import => authorized_for(:controller => :ui_template_syncs, :action => :import),
19
+ :export => authorized_for(:controller => :ui_template_syncs, :action => :export)
20
+ }
21
+ })%>
@@ -11,7 +11,7 @@ node(:class_name) do |template|
11
11
  end
12
12
 
13
13
  node(:humanized_class_name) do |template|
14
- template.class.name.underscore.split('_').map { |part| part.capitalize }.join(' ')
14
+ template.class.name.underscore.split('_').map(&:capitalize).join(' ')
15
15
  end
16
16
 
17
17
  node(:can_edit) do |template|
@@ -0,0 +1,5 @@
1
+ class ChangeLockSetting < ActiveRecord::Migration[5.1]
2
+ def up
3
+ Setting.find_by(:name => 'template_sync_lock')&.destroy
4
+ end
5
+ end
@@ -20,6 +20,12 @@ module ForemanTemplates
20
20
  end
21
21
  end
22
22
 
23
+ initializer "foreman_templates.load_app_instance_data" do |app|
24
+ ForemanTemplates::Engine.paths['db/migrate'].existent.each do |path|
25
+ app.config.paths['db/migrate'] << path
26
+ end
27
+ end
28
+
23
29
  initializer 'foreman_templates.register_plugin', :before => :finisher_hook do
24
30
  Foreman::Plugin.register :foreman_templates do
25
31
  requires_foreman '>= 1.24'
@@ -43,11 +49,11 @@ module ForemanTemplates
43
49
  add_all_permissions_to_default_roles
44
50
 
45
51
  menu :top_menu, :template_sync,
46
- :url_hash => { :controller => :template_syncs, :action => :index },
47
- :caption => N_('Sync Templates'),
48
- :parent => :hosts_menu,
49
- :before => :ptables,
50
- :turbolinks => false
52
+ :url_hash => { :controller => :template_syncs, :action => :index },
53
+ :caption => N_('Sync Templates'),
54
+ :parent => :hosts_menu,
55
+ :before => :ptables,
56
+ :turbolinks => false
51
57
  end
52
58
  end
53
59
 
@@ -1,3 +1,3 @@
1
1
  module ForemanTemplates
2
- VERSION = '7.0.7'.freeze
2
+ VERSION = '9.1.0'.freeze
3
3
  end
@@ -20,14 +20,14 @@ namespace :templates do
20
20
  verbose = ENV['verbose']
21
21
 
22
22
  results = ForemanTemplates::TemplateImporter.new({
23
- verbose: verbose,
24
- repo: ENV['repo'],
25
- branch: ENV['branch'],
26
- prefix: ENV['prefix'],
27
- dirname: ENV['dirname'],
28
- filter: ENV['filter'],
23
+ verbose: verbose,
24
+ repo: ENV['repo'],
25
+ branch: ENV['branch'],
26
+ prefix: ENV['prefix'],
27
+ dirname: ENV['dirname'],
28
+ filter: ENV['filter'],
29
29
  associate: ENV['associate'],
30
- lock: ENV['lock'],
30
+ lock: ENV['lock'],
31
31
  }).import!
32
32
  pp(results[:results].map { |result| result.to_h(verbose) })
33
33
  end
@@ -58,8 +58,8 @@ namespace :templates do
58
58
  # * negate => negate query [false]
59
59
  # * prefix => The string all templates to purge should ( or not ) begin with [Community ]
60
60
  # * verbose => Print extra information during the run [false]
61
- negate: ENV['negate'],
62
- prefix: ENV['prefix'],
61
+ negate: ENV['negate'],
62
+ prefix: ENV['prefix'],
63
63
  verbose: ENV['verbose'],
64
64
  }).purge!
65
65
  end
@@ -89,6 +89,7 @@ namespace :foreman_templates do
89
89
  begin
90
90
  require 'rubocop/rake_task'
91
91
  RuboCop::RakeTask.new(:rubocop_foreman_templates) do |task|
92
+ task.options = ['--config', ForemanTemplates::Engine.root.join('.rubocop.yml').to_s]
92
93
  task.patterns = ["#{ForemanTemplates::Engine.root}/app/**/*.rb",
93
94
  "#{ForemanTemplates::Engine.root}/lib/**/*.rb",
94
95
  "#{ForemanTemplates::Engine.root}/test/**/*.rb"]
data/package.json CHANGED
@@ -20,33 +20,24 @@
20
20
  "url": "https://projects.theforeman.org"
21
21
  },
22
22
  "homepage": "https://github.com/theforeman/foreman_templates",
23
- "dependencies": {
24
- "@theforeman/vendor": "^1.7.0"
23
+ "peerDependencies": {
24
+ "@theforeman/vendor": ">= 3.3.2"
25
25
  },
26
26
  "devDependencies": {
27
- "@theforeman/vendor-dev": "^1.7.0",
28
- "babel-cli": "^6.10.1",
29
- "babel-core": "^6.26.3",
30
- "babel-eslint": "^8.2.1",
31
- "babel-loader": "^7.1.1",
32
- "babel-plugin-transform-class-properties": "^6.24.1",
33
- "babel-plugin-transform-object-assign": "^6.22.0",
34
- "babel-plugin-transform-object-rest-spread": "^6.26.0",
35
- "babel-preset-env": "^1.6.0",
36
- "babel-preset-react": "^6.24.1",
27
+ "@babel/core": "^7.7.0",
28
+ "@theforeman/env": "^3.3.2",
29
+ "@theforeman/builder": "^4.0.2",
30
+ "@theforeman/vendor-dev": "^3.3.2",
31
+ "babel-eslint": "^10.0.0",
32
+ "babel-jest": "^24.9.0",
37
33
  "enzyme": "^3.7.0",
38
34
  "enzyme-adapter-react-16": "^1.7.0",
39
35
  "enzyme-to-json": "^3.3.5",
40
- "eslint": "^4.18.1",
41
- "eslint-config-airbnb": "^16.0.0",
42
- "eslint-plugin-import": "^2.8.0",
43
- "eslint-plugin-jest": "^21.2.0",
44
- "eslint-plugin-jsx-a11y": "^6.0.2",
45
- "eslint-plugin-patternfly-react": "^0.2.1",
46
- "eslint-plugin-react": "^7.4.0",
36
+ "eslint": "^6.8.0",
37
+ "eslint-plugin-patternfly-react": "^0.3.0",
47
38
  "identity-obj-proxy": "^3.0.0",
48
- "jest": "^23.6.0",
49
- "prettier": "^1.16.4",
39
+ "jest": "^24.9.0",
40
+ "prettier": "^1.19.1",
50
41
  "react-redux-test-utils": "^0.1.1"
51
42
  },
52
43
  "jest": {
@@ -56,6 +47,9 @@
56
47
  "node_modules",
57
48
  "webpack"
58
49
  ],
50
+ "transform": {
51
+ "^.+\\.js$": "babel-jest"
52
+ },
59
53
  "setupFiles": [
60
54
  "raf/polyfill",
61
55
  "./webpack/testSetup.js"
@@ -4,26 +4,30 @@ import PropTypes from 'prop-types';
4
4
 
5
5
  import Routes from './Routes';
6
6
 
7
- const ForemanTemplates = ({ data }) => (
7
+ const ForemanTemplates = ({
8
+ apiUrls,
9
+ validationData,
10
+ fileRepoStartWith,
11
+ userPermissions,
12
+ editPaths,
13
+ }) => (
8
14
  <Router>
9
15
  <Routes
10
- apiUrls={data.apiUrls}
11
- validationData={data.validationData}
12
- editPaths={data.editPaths}
13
- fileRepoStartWith={data.fileRepoStartWith}
14
- userPermissions={data.userPermissions}
16
+ apiUrls={apiUrls}
17
+ validationData={validationData}
18
+ editPaths={editPaths}
19
+ fileRepoStartWith={fileRepoStartWith}
20
+ userPermissions={userPermissions}
15
21
  />
16
22
  </Router>
17
23
  );
18
24
 
19
25
  ForemanTemplates.propTypes = {
20
- data: PropTypes.shape({
21
- apiUrls: PropTypes.object,
22
- validationData: PropTypes.object,
23
- editPaths: PropTypes.object,
24
- userPermissions: PropTypes.object,
25
- fileRepoStartWith: PropTypes.array,
26
- }).isRequired,
26
+ apiUrls: PropTypes.object.isRequired,
27
+ validationData: PropTypes.object.isRequired,
28
+ editPaths: PropTypes.object.isRequired,
29
+ userPermissions: PropTypes.object.isRequired,
30
+ fileRepoStartWith: PropTypes.array.isRequired,
27
31
  };
28
32
 
29
33
  export default ForemanTemplates;
@@ -0,0 +1,2 @@
1
+ export const useForemanOrganization = () => {};
2
+ export const useForemanLocation = () => {};
@@ -0,0 +1,2 @@
1
+ const ForemanForm = () => jest.fn();
2
+ export default ForemanForm;
@@ -1,5 +1,7 @@
1
1
  import Immutable from 'seamless-immutable';
2
2
 
3
+ import { transformInitialValues } from '../components/NewTemplateSyncForm/NewTemplateSyncFormSelectors';
4
+
3
5
  export const associateSetting = Immutable({
4
6
  id: 45,
5
7
  value: 'new',
@@ -65,10 +67,8 @@ export const registeredExportSettings = {
65
67
  };
66
68
 
67
69
  export const initialValues = {
68
- initial: importSettings.concat(exportSettings).reduce((memo, item) => {
69
- memo[item.name] = item.value;
70
- return memo;
71
- }, {}),
70
+ import: transformInitialValues(importSettings),
71
+ export: transformInitialValues(exportSettings),
72
72
  };
73
73
 
74
74
  export const stateFactory = obj => ({