foreman_acd 0.9.7 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -19
  3. data/app/controllers/ui_acd_controller.rb +1 -1
  4. data/db/migrate/20210503122809_add_git_url_to_ansible_playbooks.rb +1 -1
  5. data/lib/foreman_acd/engine.rb +4 -10
  6. data/lib/foreman_acd/plugin.rb +1 -1
  7. data/lib/foreman_acd/version.rb +1 -1
  8. data/package.json +5 -3
  9. data/test/controllers/ui_acd_controller_test.rb +1 -1
  10. data/webpack/components/ApplicationDefinition/ApplicationDefinition.js +210 -121
  11. data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +79 -91
  12. data/webpack/components/ApplicationDefinition/ApplicationDefinitionConstants.js +30 -15
  13. data/webpack/components/ApplicationDefinition/ApplicationDefinitionHelper.js +15 -15
  14. data/webpack/components/ApplicationDefinition/ApplicationDefinitionReducer.js +96 -63
  15. data/webpack/components/ApplicationDefinition/ApplicationDefinitionSelectors.js +22 -11
  16. data/webpack/components/ApplicationDefinition/__fixtures__/{applicationDefinitionConfData_1.fixtures.js → applicationDefinitionConfData1.fixtures.js} +77 -105
  17. data/webpack/components/ApplicationDefinition/__fixtures__/applicationDefinitionReducer.fixtures.js +49 -29
  18. data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinition.test.js +4 -4
  19. data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionHelper.test.js +16 -0
  20. data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionReducer.test.js +0 -5
  21. data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionSelectors.test.js +25 -25
  22. data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionReducer.test.js.snap +9 -1
  23. data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionSelectors.test.js.snap +11 -11
  24. data/webpack/components/ApplicationDefinition/components/AnsiblePlaybookSelector.js +30 -25
  25. data/webpack/components/ApplicationDefinition/components/__tests__/AnsiblePlaybookSelector.test.js +3 -3
  26. data/webpack/components/ApplicationDefinition/index.js +0 -1
  27. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImport.js +91 -105
  28. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportActions.js +59 -84
  29. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportConstants.js +12 -6
  30. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportReducer.js +21 -27
  31. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportSelectors.js +14 -7
  32. data/webpack/components/ApplicationDefinitionImport/__fixtures__/{applicationDefinitionImportConfData_1.fixtures.js → applicationDefinitionImportConfData1.fixtures.js} +32 -40
  33. data/webpack/components/ApplicationDefinitionImport/__fixtures__/applicationDefinitionImportReducer.fixtures.js +14 -16
  34. data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImport.test.js +38 -8
  35. data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImportReducer.test.js +0 -2
  36. data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImportSelectors.test.js +9 -9
  37. data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImport.test.js.snap +116 -2
  38. data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImportSelectors.test.js.snap +3 -3
  39. data/webpack/components/ApplicationInstance/ApplicationInstance.js +344 -193
  40. data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +92 -105
  41. data/webpack/components/ApplicationInstance/ApplicationInstanceConstants.js +34 -17
  42. data/webpack/components/ApplicationInstance/ApplicationInstanceHelper.js +4 -7
  43. data/webpack/components/ApplicationInstance/ApplicationInstanceReducer.js +114 -74
  44. data/webpack/components/ApplicationInstance/ApplicationInstanceSelectors.js +18 -9
  45. data/webpack/components/ApplicationInstance/__fixtures__/{applicationInstanceConfData_1.fixtures.js → applicationInstanceConfData1.fixtures.js} +68 -86
  46. data/webpack/components/ApplicationInstance/__fixtures__/applicationInstanceReducer.fixtures.js +24 -32
  47. data/webpack/components/ApplicationInstance/__tests__/ApplicationInstance.test.js +75 -10
  48. data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceReducer.test.js +0 -8
  49. data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceSelectors.test.js +27 -27
  50. data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstance.test.js.snap +606 -2
  51. data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceSelectors.test.js.snap +12 -12
  52. data/webpack/components/ApplicationInstance/components/AppDefinitionSelector.js +32 -25
  53. data/webpack/components/ApplicationInstance/components/Service.js +7 -18
  54. data/webpack/components/ApplicationInstance/components/ServiceCounter.js +25 -18
  55. data/webpack/components/ApplicationInstance/index.js +0 -1
  56. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.js +167 -110
  57. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportActions.js +20 -25
  58. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportConstants.js +10 -5
  59. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js +9 -12
  60. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportSelectors.js +12 -6
  61. data/webpack/components/ApplicationInstanceReport/__fixtures__/{applicationInstanceReportData_1.fixtures.js → applicationInstanceReportData1.fixtures.js} +154 -101
  62. data/webpack/components/ApplicationInstanceReport/__fixtures__/applicationInstanceReportReducer.fixtures.js +3 -10
  63. data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReport.test.js +28 -22
  64. data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReportSelectors.test.js +5 -7
  65. data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReportReducer.test.js.snap +0 -1
  66. data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReportSelectors.test.js.snap +2 -2
  67. data/webpack/components/ApplicationInstanceReport/components/ReportViewer.js +9 -5
  68. data/webpack/components/ApplicationInstanceReport/components/__tests__/ReportViewer.test.js +1 -3
  69. data/webpack/components/ExistingHostSelection/ExistingHostSelection.js +35 -56
  70. data/webpack/components/ExistingHostSelection/ExistingHostSelectionActions.js +21 -28
  71. data/webpack/components/ExistingHostSelection/ExistingHostSelectionConstants.js +6 -3
  72. data/webpack/components/ExistingHostSelection/ExistingHostSelectionReducer.js +16 -19
  73. data/webpack/components/ExistingHostSelection/ExistingHostSelectionSelectors.js +8 -4
  74. data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionConfData1.fixtures.js +187 -0
  75. data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionReducer.fixtures.js +13 -24
  76. data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelection.test.js +3 -2
  77. data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelectionSelectors.test.js +11 -14
  78. data/webpack/components/ExistingHostSelection/__tests__/__snapshots__/ExistingHostSelectionSelectors.test.js.snap +5 -5
  79. data/webpack/components/ExistingHostSelection/components/ServiceSelector.js +31 -25
  80. data/webpack/components/ExistingHostSelection/components/__tests__/ServiceSelector.test.js +3 -9
  81. data/webpack/components/ParameterSelection/ParameterSelection.js +258 -174
  82. data/webpack/components/ParameterSelection/ParameterSelectionActions.js +110 -100
  83. data/webpack/components/ParameterSelection/ParameterSelectionConstants.js +22 -11
  84. data/webpack/components/ParameterSelection/ParameterSelectionHelper.js +13 -11
  85. data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +63 -49
  86. data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +10 -5
  87. data/webpack/components/ParameterSelection/__fixtures__/{parameterSelectionData_1.fixtures.js → parameterSelectionData1.fixtures.js} +67 -104
  88. data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionReducer.fixtures.js +22 -26
  89. data/webpack/components/ParameterSelection/__tests__/ParameterSelection.test.js +50 -36
  90. data/webpack/components/ParameterSelection/__tests__/ParameterSelectionHelper.test.js +76 -0
  91. data/webpack/components/ParameterSelection/__tests__/ParameterSelectionReducer.test.js +0 -2
  92. data/webpack/components/ParameterSelection/__tests__/ParameterSelectionSelectors.test.js +23 -25
  93. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelection.test.js.snap +100 -0
  94. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionReducer.test.js.snap +99 -112
  95. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionSelectors.test.js.snap +18 -19
  96. data/webpack/components/ParameterSelection/index.js +1 -4
  97. data/webpack/components/SyncGitRepo/SyncGitRepo.js +124 -117
  98. data/webpack/components/SyncGitRepo/SyncGitRepoActions.js +64 -74
  99. data/webpack/components/SyncGitRepo/SyncGitRepoReducer.js +17 -17
  100. data/webpack/components/SyncGitRepo/__fixtures__/syncGitRepoConfData1.fixtures.js +7 -0
  101. data/webpack/components/SyncGitRepo/__fixtures__/syncGitRepoReducer.fixtures.js +10 -18
  102. data/webpack/components/SyncGitRepo/__tests__/SyncGitRepo.test.js +80 -6
  103. data/webpack/components/SyncGitRepo/__tests__/SyncGitRepoSelectors.test.js +9 -11
  104. data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepo.test.js.snap +192 -1
  105. data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepoSelectors.test.js.snap +4 -4
  106. data/webpack/components/SyncGitRepo/components/FormTextInput.js +26 -21
  107. data/webpack/components/SyncGitRepo/components/ScmTypeSelector.js +29 -24
  108. data/webpack/components/SyncGitRepo/index.js +2 -5
  109. data/webpack/components/common/AddTableEntry.js +3 -10
  110. data/webpack/components/common/DeleteTableEntry.js +7 -15
  111. data/webpack/components/common/EditTableEntry.js +7 -7
  112. data/webpack/components/common/ExtSelect.js +12 -8
  113. data/webpack/components/common/ExtTextInput.js +12 -7
  114. data/webpack/components/common/LockTableEntry.js +6 -6
  115. data/webpack/components/common/RailsData.js +6 -16
  116. data/webpack/components/common/__tests__/ExtSelect.test.js +2 -2
  117. data/webpack/components/common/__tests__/RailsData.test.js +0 -2
  118. data/webpack/global_test_setup.js +11 -0
  119. data/webpack/helper.js +10 -21
  120. data/webpack/helper.test.js +17 -29
  121. data/webpack/index.js +25 -7
  122. data/webpack/js-yaml.js +1563 -1135
  123. data/webpack/reducer.js +52 -27
  124. metadata +16 -14
  125. data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionConfData_1.fixtures.js +0 -191
  126. data/webpack/components/ParameterSelection/__fixtures__/parameterSelection.fixtures.js +0 -153
  127. data/webpack/components/SyncGitRepo/__fixtures__/syncGitRepoConfData_1.fixtures.js +0 -7
@@ -5,14 +5,14 @@ import SyncGitRepo from '../SyncGitRepo';
5
5
  const noop = () => {};
6
6
 
7
7
  const fixtures = {
8
- 'should render ansible playbook': {
8
+ 'should render empty ansible playbook': {
9
9
  data: {
10
- scmType: "",
11
- path: "",
12
- gitCommit: "",
13
- appDefinitions: "",
14
- gitUrl: "",
10
+ path: '',
11
+ gitCommit: '',
12
+ appDefinitions: [],
13
+ gitUrl: '',
15
14
  scmTypes: {},
15
+ scmType: '',
16
16
  },
17
17
  initSyncGitRepo: noop,
18
18
  loadScmType: noop,
@@ -21,6 +21,80 @@ const fixtures = {
21
21
  loadGitUrl: noop,
22
22
  handleGitRepoSync: noop,
23
23
  },
24
+ 'should render ansible playbook git-form': {
25
+ data: {
26
+ path: '',
27
+ gitCommit: '',
28
+ appDefinitions: [],
29
+ gitUrl: '',
30
+ scmTypes: {},
31
+ scmType: '',
32
+ },
33
+ scmType: 'git',
34
+ initSyncGitRepo: noop,
35
+ loadScmType: noop,
36
+ loadPath: noop,
37
+ loadGitCommit: noop,
38
+ loadGitUrl: noop,
39
+ handleGitRepoSync: noop,
40
+ },
41
+ 'should render ansible playbook directory-form': {
42
+ data: {
43
+ path: '',
44
+ gitCommit: '',
45
+ appDefinitions: [],
46
+ gitUrl: '',
47
+ scmTypes: {},
48
+ scmType: '',
49
+ },
50
+ scmType: 'directory',
51
+ initSyncGitRepo: noop,
52
+ loadScmType: noop,
53
+ loadPath: noop,
54
+ loadGitCommit: noop,
55
+ loadGitUrl: noop,
56
+ handleGitRepoSync: noop,
57
+ },
58
+ 'should render ansible playbook git-form with server-data': {
59
+ data: {
60
+ path: '',
61
+ gitCommit: '',
62
+ appDefinitions: [],
63
+ gitUrl: '',
64
+ scmTypes: { directory: 'directory', git: 'git' },
65
+ scmType: '',
66
+ },
67
+ path: '/ansible/play_hello.yaml',
68
+ gitCommit: 'main',
69
+ gitUrl: 'https://git.example.com/playbooks.git',
70
+ scmType: 'git',
71
+ initSyncGitRepo: noop,
72
+ loadScmType: noop,
73
+ loadPath: noop,
74
+ loadGitCommit: noop,
75
+ loadGitUrl: noop,
76
+ handleGitRepoSync: noop,
77
+ },
78
+ 'should render ansible playbook directory-form with server-data': {
79
+ data: {
80
+ path: '',
81
+ gitCommit: '',
82
+ appDefinitions: [],
83
+ gitUrl: '',
84
+ scmTypes: { directory: 'directory', git: 'git' },
85
+ scmType: 'directory',
86
+ },
87
+ gitUrl: '',
88
+ path: '/ansible/play_hello.yaml',
89
+ gitCommit: '',
90
+ scmType: 'directory',
91
+ initSyncGitRepo: noop,
92
+ loadScmType: noop,
93
+ loadPath: noop,
94
+ loadGitCommit: noop,
95
+ loadGitUrl: noop,
96
+ handleGitRepoSync: noop,
97
+ },
24
98
  };
25
99
 
26
100
  describe('SyncGitRepo', () =>
@@ -7,9 +7,7 @@ import {
7
7
  selectGitUrl,
8
8
  } from '../SyncGitRepoSelectors';
9
9
 
10
- import {
11
- syncGitRepoConfData_1,
12
- } from '../__fixtures__/syncGitRepoConfData_1.fixtures';
10
+ import { syncGitRepoConfData1 } from '../__fixtures__/syncGitRepoConfData1.fixtures';
13
11
 
14
12
  const stateFactory = obj => ({
15
13
  foremanAcd: {
@@ -18,14 +16,14 @@ const stateFactory = obj => ({
18
16
  });
19
17
 
20
18
  const fixtures = {
21
- 'should return scmType from syncGitRepoConfData_1 fixtures': () =>
22
- selectScmType(stateFactory(syncGitRepoConfData_1)),
23
- 'should return path from syncGitRepoConfData_1 fixtures': () =>
24
- selectPath(stateFactory(syncGitRepoConfData_1)),
25
- 'should return gitCommit from syncGitRepoConfData_1 fixtures': () =>
26
- selectGitCommit(stateFactory(syncGitRepoConfData_1)),
27
- 'should return gitUrl from syncGitRepoConfData_1 fixtures': () =>
28
- selectGitUrl(stateFactory(syncGitRepoConfData_1)),
19
+ 'should return scmType from syncGitRepoConfData1 fixtures': () =>
20
+ selectScmType(stateFactory(syncGitRepoConfData1)),
21
+ 'should return path from syncGitRepoConfData1 fixtures': () =>
22
+ selectPath(stateFactory(syncGitRepoConfData1)),
23
+ 'should return gitCommit from syncGitRepoConfData1 fixtures': () =>
24
+ selectGitCommit(stateFactory(syncGitRepoConfData1)),
25
+ 'should return gitUrl from syncGitRepoConfData1 fixtures': () =>
26
+ selectGitUrl(stateFactory(syncGitRepoConfData1)),
29
27
  };
30
28
 
31
29
  describe('SyncGitRepoSelectors', () =>
@@ -1,6 +1,196 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`SyncGitRepo should render ansible playbook 1`] = `
3
+ exports[`SyncGitRepo should render ansible playbook directory-form 1`] = `
4
+ <span>
5
+ <div>
6
+ <ScmTypeSelector
7
+ editable={true}
8
+ hidden={false}
9
+ label="SCM Type *"
10
+ onChange={[Function]}
11
+ options={Object {}}
12
+ selectValue="directory"
13
+ viewText=""
14
+ />
15
+ <FormTextInput
16
+ editable={true}
17
+ hidden={false}
18
+ label="Directory Path *"
19
+ onChange={[Function]}
20
+ parameter="path"
21
+ viewText=""
22
+ />
23
+ <div />
24
+ <div
25
+ className="form-group"
26
+ >
27
+ <div
28
+ className="col-md-2"
29
+ />
30
+ <div
31
+ className="col-md-4"
32
+ >
33
+ <pre>
34
+ Directory path cannot be blank
35
+ </pre>
36
+ </div>
37
+ </div>
38
+ </div>
39
+ </span>
40
+ `;
41
+
42
+ exports[`SyncGitRepo should render ansible playbook directory-form with server-data 1`] = `
43
+ <span>
44
+ <div>
45
+ <ScmTypeSelector
46
+ editable={true}
47
+ hidden={false}
48
+ label="SCM Type *"
49
+ onChange={[Function]}
50
+ options={
51
+ Object {
52
+ "directory": "directory",
53
+ "git": "git",
54
+ }
55
+ }
56
+ selectValue="directory"
57
+ viewText="directory"
58
+ />
59
+ <FormTextInput
60
+ editable={true}
61
+ hidden={false}
62
+ label="Directory Path *"
63
+ onChange={[Function]}
64
+ parameter="path"
65
+ viewText="/ansible/play_hello.yaml"
66
+ />
67
+ <div />
68
+ <div />
69
+ </div>
70
+ </span>
71
+ `;
72
+
73
+ exports[`SyncGitRepo should render ansible playbook git-form 1`] = `
74
+ <span>
75
+ <div>
76
+ <ScmTypeSelector
77
+ editable={true}
78
+ hidden={false}
79
+ label="SCM Type *"
80
+ onChange={[Function]}
81
+ options={Object {}}
82
+ selectValue="git"
83
+ viewText=""
84
+ />
85
+ <FormTextInput
86
+ editable={true}
87
+ hidden={false}
88
+ label="Git Url *"
89
+ onChange={[Function]}
90
+ parameter="git_url"
91
+ viewText=""
92
+ />
93
+ <div />
94
+ <div
95
+ className="form-group"
96
+ >
97
+ <div
98
+ className="col-md-2"
99
+ />
100
+ <div
101
+ className="col-md-4"
102
+ >
103
+ <pre>
104
+ Git URL cannot be blank
105
+ </pre>
106
+ </div>
107
+ </div>
108
+ <FormTextInput
109
+ editable={true}
110
+ hidden={false}
111
+ label="Git Branch/Commit/Tag"
112
+ onChange={[Function]}
113
+ parameter="git_commit"
114
+ viewText=""
115
+ />
116
+ <CommonForm>
117
+ <span
118
+ className="help-block help-inline"
119
+ >
120
+ <Button
121
+ active={false}
122
+ block={false}
123
+ bsClass="btn"
124
+ bsStyle="default"
125
+ disabled={false}
126
+ onClick={[Function]}
127
+ >
128
+ Sync Repository
129
+
130
+ </Button>
131
+ </span>
132
+ </CommonForm>
133
+ </div>
134
+ </span>
135
+ `;
136
+
137
+ exports[`SyncGitRepo should render ansible playbook git-form with server-data 1`] = `
138
+ <span>
139
+ <div>
140
+ <ScmTypeSelector
141
+ editable={true}
142
+ hidden={false}
143
+ label="SCM Type *"
144
+ onChange={[Function]}
145
+ options={
146
+ Object {
147
+ "directory": "directory",
148
+ "git": "git",
149
+ }
150
+ }
151
+ selectValue="git"
152
+ viewText="git"
153
+ />
154
+ <FormTextInput
155
+ editable={true}
156
+ hidden={false}
157
+ label="Git Url *"
158
+ onChange={[Function]}
159
+ parameter="git_url"
160
+ viewText="https://git.example.com/playbooks.git"
161
+ />
162
+ <div />
163
+ <div />
164
+ <FormTextInput
165
+ editable={true}
166
+ hidden={false}
167
+ label="Git Branch/Commit/Tag"
168
+ onChange={[Function]}
169
+ parameter="git_commit"
170
+ viewText="main"
171
+ />
172
+ <CommonForm>
173
+ <span
174
+ className="help-block help-inline"
175
+ >
176
+ <Button
177
+ active={false}
178
+ block={false}
179
+ bsClass="btn"
180
+ bsStyle="default"
181
+ disabled={false}
182
+ onClick={[Function]}
183
+ >
184
+ Sync Repository
185
+
186
+ </Button>
187
+ </span>
188
+ </CommonForm>
189
+ </div>
190
+ </span>
191
+ `;
192
+
193
+ exports[`SyncGitRepo should render empty ansible playbook 1`] = `
4
194
  <span>
5
195
  <div>
6
196
  <ScmTypeSelector
@@ -10,6 +200,7 @@ exports[`SyncGitRepo should render ansible playbook 1`] = `
10
200
  onChange={[Function]}
11
201
  options={Object {}}
12
202
  selectValue=""
203
+ viewText=""
13
204
  />
14
205
  <div />
15
206
  <div
@@ -1,12 +1,12 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`SyncGitRepoSelectors should return gitCommit from syncGitRepoConfData_1 fixtures 1`] = `"master"`;
3
+ exports[`SyncGitRepoSelectors should return gitCommit from syncGitRepoConfData1 fixtures 1`] = `"master"`;
4
4
 
5
- exports[`SyncGitRepoSelectors should return gitUrl from syncGitRepoConfData_1 fixtures 1`] = `"https://github.com/alpha.git"`;
5
+ exports[`SyncGitRepoSelectors should return gitUrl from syncGitRepoConfData1 fixtures 1`] = `"https://github.com/alpha.git"`;
6
6
 
7
- exports[`SyncGitRepoSelectors should return path from syncGitRepoConfData_1 fixtures 1`] = `"https://example.com"`;
7
+ exports[`SyncGitRepoSelectors should return path from syncGitRepoConfData1 fixtures 1`] = `"https://example.com"`;
8
8
 
9
- exports[`SyncGitRepoSelectors should return scmType from syncGitRepoConfData_1 fixtures 1`] = `
9
+ exports[`SyncGitRepoSelectors should return scmType from syncGitRepoConfData1 fixtures 1`] = `
10
10
  Object {
11
11
  "git": "git",
12
12
  }
@@ -1,42 +1,47 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import ExtTextInput from '../../common/ExtTextInput';
4
- import RailsData from '../../common/RailsData'
4
+ import RailsData from '../../common/RailsData';
5
5
 
6
- const FormTextInput= ({
6
+ const FormTextInput = ({
7
7
  label,
8
8
  hidden,
9
9
  editable,
10
10
  viewText,
11
11
  onChange,
12
12
  parameter,
13
- }) =>{
14
- return (
15
- <div >
16
- <div >
17
- <ExtTextInput
18
- label={label}
19
- editable={editable}
20
- viewText={viewText}
21
- onChange={onChange}
22
- />
23
- <RailsData
24
- key='ansible_playbook_form_data'
25
- view='ansible_playbook'
26
- parameter={parameter}
27
- value={viewText}
28
- />
29
- </div>
13
+ }) => (
14
+ <div>
15
+ <div>
16
+ <ExtTextInput
17
+ hidden={false}
18
+ label={label}
19
+ editable={editable}
20
+ viewText={viewText}
21
+ onChange={onChange}
22
+ />
23
+ <RailsData
24
+ key="ansible_playbook_form_data"
25
+ view="ansible_playbook"
26
+ parameter={parameter}
27
+ value={viewText}
28
+ />
30
29
  </div>
31
- );
32
- };
30
+ </div>
31
+ );
33
32
 
34
33
  FormTextInput.propTypes = {
35
34
  label: PropTypes.string.isRequired,
35
+ hidden: PropTypes.bool,
36
36
  editable: PropTypes.bool.isRequired,
37
37
  viewText: PropTypes.string,
38
38
  onChange: PropTypes.func.isRequired,
39
39
  parameter: PropTypes.string,
40
40
  };
41
+ FormTextInput.defaultProps = {
42
+ hidden: false,
43
+ viewText: '',
44
+ parameter: '',
45
+ };
41
46
 
42
47
  export default FormTextInput;
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import ExtSelect from '../../common/ExtSelect';
4
- import RailsData from '../../common/RailsData'
4
+ import RailsData from '../../common/RailsData';
5
5
 
6
- const ScmTypeSelector= ({
6
+ const ScmTypeSelector = ({
7
7
  label,
8
8
  hidden,
9
9
  editable,
@@ -11,37 +11,42 @@ const ScmTypeSelector= ({
11
11
  selectValue,
12
12
  onChange,
13
13
  options,
14
- }) =>{
15
- return (
16
- <div className="form-group">
17
- <label className="col-md-2 control-label">{label}</label>
18
- <div className="col-md-4">
19
- <ExtSelect
20
- hidden={hidden}
21
- editable={editable}
22
- viewText={viewText}
23
- selectValue={selectValue}
24
- onChange={onChange}
25
- options={options}
26
- />
27
- <RailsData
28
- key='ansible_playbook_scm_data'
29
- view='ansible_playbook'
30
- parameter='scm_type'
31
- value={selectValue}
32
- />
33
- </div>
14
+ }) => (
15
+ <div className="form-group">
16
+ <label className="col-md-2 control-label">{label}</label>
17
+ <div className="col-md-4">
18
+ <ExtSelect
19
+ hidden={hidden}
20
+ editable={editable}
21
+ viewText={viewText}
22
+ selectValue={selectValue}
23
+ onChange={onChange}
24
+ options={options}
25
+ />
26
+ <RailsData
27
+ key="ansible_playbook_scm_data"
28
+ view="ansible_playbook"
29
+ parameter="scm_type"
30
+ value={selectValue}
31
+ />
34
32
  </div>
35
- );
36
- };
33
+ </div>
34
+ );
37
35
 
38
36
  ScmTypeSelector.propTypes = {
39
37
  label: PropTypes.string.isRequired,
38
+ hidden: PropTypes.bool,
40
39
  editable: PropTypes.bool.isRequired,
41
40
  viewText: PropTypes.string,
42
41
  selectValue: PropTypes.string,
43
42
  onChange: PropTypes.func.isRequired,
44
43
  options: PropTypes.object,
45
44
  };
45
+ ScmTypeSelector.defaultProps = {
46
+ hidden: false,
47
+ viewText: '',
48
+ selectValue: '',
49
+ options: {},
50
+ };
46
51
 
47
52
  export default ScmTypeSelector;
@@ -16,13 +16,10 @@ const mapStateToProps = state => ({
16
16
  scmType: selectScmType(state),
17
17
  gitCommit: selectGitCommit(state),
18
18
  path: selectPath(state),
19
- gitUrl: selectGitUrl(state)
19
+ gitUrl: selectGitUrl(state),
20
20
  });
21
21
 
22
22
  const mapDispatchToProps = dispatch =>
23
23
  bindActionCreators(SyncGitRepoActions, dispatch);
24
24
 
25
- export default connect(
26
- mapStateToProps,
27
- mapDispatchToProps
28
- )(SyncGitRepo);
25
+ export default connect(mapStateToProps, mapDispatchToProps)(SyncGitRepo);
@@ -1,15 +1,8 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import {
4
- Icon,
5
- Button,
6
- } from 'patternfly-react';
3
+ import { Icon, Button } from 'patternfly-react';
7
4
 
8
- const AddTableEntry = ({
9
- hidden,
10
- disabled,
11
- onAddTableEntry,
12
- }) =>{
5
+ const AddTableEntry = ({ hidden, disabled, onAddTableEntry }) => {
13
6
  if (hidden) {
14
7
  return null;
15
8
  }
@@ -24,7 +17,7 @@ const AddTableEntry = ({
24
17
  AddTableEntry.propTypes = {
25
18
  hidden: PropTypes.bool.isRequired,
26
19
  disabled: PropTypes.bool.isRequired,
27
- onAddTableEntry: PropTypes.func.isRequired
20
+ onAddTableEntry: PropTypes.func.isRequired,
28
21
  };
29
22
 
30
23
  export default AddTableEntry;
@@ -1,10 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import {
4
- Icon,
5
- Button,
6
- MessageDialog,
7
- } from 'patternfly-react';
3
+ import { Icon, Button, MessageDialog } from 'patternfly-react';
8
4
  import { translate as __ } from 'foremanReact/common/I18n';
9
5
 
10
6
  const DeleteTableEntry = ({
@@ -12,14 +8,14 @@ const DeleteTableEntry = ({
12
8
  disabled,
13
9
  onDeleteTableEntry,
14
10
  additionalData,
15
- }) =>{
11
+ }) => {
12
+ const [showModal, setShowModal] = useState(false);
13
+ const toggleModal = () => setShowModal(!showModal);
14
+
16
15
  if (hidden) {
17
16
  return null;
18
17
  }
19
18
 
20
- const [showModal, setShowModal] = useState(false);
21
- const toggleModal = () => setShowModal(!showModal);
22
-
23
19
  return (
24
20
  <span>
25
21
  <MessageDialog
@@ -32,12 +28,8 @@ const DeleteTableEntry = ({
32
28
  title={__('Confirm action')}
33
29
  primaryContent={__('Are you sure you wish to delete this item?')}
34
30
  />
35
- <Button
36
- bsStyle="default"
37
- disabled={disabled}
38
- onClick={toggleModal}
39
- >
40
- <Icon type="pf" name="delete" title={__("Delete entry")} />
31
+ <Button bsStyle="default" disabled={disabled} onClick={toggleModal}>
32
+ <Icon type="pf" name="delete" title={__('Delete entry')} />
41
33
  </Button>
42
34
  </span>
43
35
  );
@@ -1,9 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import {
4
- Icon,
5
- Button,
6
- } from 'patternfly-react';
3
+ import { Icon, Button } from 'patternfly-react';
7
4
  import { translate as __ } from 'foremanReact/common/I18n';
8
5
 
9
6
  const EditTableEntry = ({
@@ -12,12 +9,12 @@ const EditTableEntry = ({
12
9
  handleLocking,
13
10
  onEditTableEntry,
14
11
  additionalData,
15
- }) =>{
12
+ }) => {
16
13
  if (hidden) {
17
14
  return null;
18
15
  }
19
16
 
20
- let title = 'edit this entry'
17
+ let title = 'edit this entry';
21
18
 
22
19
  if (handleLocking === true) {
23
20
  if (additionalData.rowData.locked === true) {
@@ -31,7 +28,7 @@ const EditTableEntry = ({
31
28
  <Button
32
29
  bsStyle="default"
33
30
  disabled={disabled}
34
- onClick={() => onEditTableEntry(additionalData) }
31
+ onClick={() => onEditTableEntry(additionalData)}
35
32
  >
36
33
  <Icon type="pf" name="edit" title={__(title)} />
37
34
  </Button>
@@ -46,5 +43,8 @@ EditTableEntry.propTypes = {
46
43
  onEditTableEntry: PropTypes.func.isRequired,
47
44
  additionalData: PropTypes.object.isRequired,
48
45
  };
46
+ EditTableEntry.defaultProps = {
47
+ hidden: false,
48
+ };
49
49
 
50
50
  export default EditTableEntry;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import Select from 'foremanReact/components/common/forms/Select';
4
4
 
5
- const ExtSelect= ({
5
+ const ExtSelect = ({
6
6
  hidden,
7
7
  editable,
8
8
  viewText,
@@ -10,22 +10,20 @@ const ExtSelect= ({
10
10
  onChange,
11
11
  options,
12
12
  additionalData,
13
- }) =>{
13
+ }) => {
14
14
  if (hidden) {
15
15
  return null;
16
16
  }
17
17
 
18
18
  if (!editable) {
19
- return (
20
- <div>{viewText}</div>
21
- );
19
+ return <div>{viewText}</div>;
22
20
  }
23
21
 
24
22
  return (
25
23
  <Select
26
- value={selectValue}
27
- onChange={e => onChange(e.target.value, additionalData) }
28
- options={options}
24
+ value={selectValue}
25
+ onChange={e => onChange(e.target.value, additionalData)}
26
+ options={options}
29
27
  />
30
28
  );
31
29
  };
@@ -39,5 +37,11 @@ ExtSelect.propTypes = {
39
37
  options: PropTypes.object,
40
38
  additionalData: PropTypes.object,
41
39
  };
40
+ ExtSelect.defaultProps = {
41
+ viewText: '',
42
+ selectValue: '',
43
+ options: {},
44
+ additionalData: {},
45
+ };
42
46
 
43
47
  export default ExtSelect;