Skip to content

Commit 60835d1

Browse files
nadjaheitmannMariaAga
authored andcommitted
Fix JS linting error 'no-magic-numbers'
The Foreman linting requires constants to be declared instead of directly assigning numbers to variables. Otherwise, it will through the 'no-magic-numbers' error. Corresponding Foreman core PR: theforeman/foreman#11008 Co-Authored-By: OpenAI Codex
1 parent 16ea7b4 commit 60835d1

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

webpack/global_index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import BulkChangePuppetCAProxy from './src/Extends/Hosts/BulkActions/BulkChangeP
1212
import BulkRemovePuppetProxy from './src/Extends/Hosts/BulkActions/BulkRemovePuppetProxy';
1313
import BulkRemovePuppetCAProxy from './src/Extends/Hosts/BulkActions/BulkRemovePuppetCAProxy';
1414

15+
const GLOBAL_FILL_PRIORITY = 100;
16+
1517
// register reducers
1618
registerReducer('puppet', reducers);
1719
// add fills
@@ -40,35 +42,35 @@ addGlobalFill(
4042
'hosts-index-kebab',
4143
'puppet-hosts-index-kebab',
4244
<HostsIndexActionsBar key="puppet-hosts-index-kebab" />,
43-
100
45+
GLOBAL_FILL_PRIORITY
4446
);
4547

4648
addGlobalFill(
4749
'_all-hosts-modals',
4850
'BulkChangePuppetProxy',
4951
<BulkChangePuppetProxy key="bulk-change-puppet-proxy" />,
50-
100
52+
GLOBAL_FILL_PRIORITY
5153
);
5254

5355
addGlobalFill(
5456
'_all-hosts-modals',
5557
'BulkChangePuppetCAProxy',
5658
<BulkChangePuppetCAProxy key="bulk-change-puppet-ca-proxy" />,
57-
100
59+
GLOBAL_FILL_PRIORITY
5860
);
5961

6062
addGlobalFill(
6163
'_all-hosts-modals',
6264
'BulkRemovePuppetCAProxy',
6365
<BulkRemovePuppetCAProxy key="bulk-remove-puppet-ca-proxy" />,
64-
100
66+
GLOBAL_FILL_PRIORITY
6567
);
6668

6769
addGlobalFill(
6870
'_all-hosts-modals',
6971
'BulkRemovePuppetProxy',
7072
<BulkRemovePuppetProxy key="bulk-remove-puppet-proxy" />,
71-
100
73+
GLOBAL_FILL_PRIORITY
7274
);
7375

7476
registerColumns(puppetHostsIndexColumns);

webpack/src/foreman_class_edit.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import $ from 'jquery';
1818
import { sprintf, translate as __ } from 'foremanReact/common/I18n';
1919

20+
const HIGHLIGHT_DURATION = 5000;
21+
2022
export function filterPuppetClasses(item) {
2123
const term = $(item)
2224
.val()
@@ -59,7 +61,7 @@ export function addPuppetClass(item) {
5961

6062
$('#selected_classes').append(content);
6163

62-
$(`#selected_puppetclass_${id}`).show('highlight', 5000);
64+
$(`#selected_puppetclass_${id}`).show('highlight', HIGHLIGHT_DURATION);
6365
$(`#puppetclass_${id}`)
6466
.addClass('selected-marker')
6567
.hide();
@@ -87,7 +89,7 @@ function addGroupPuppetClass(item) {
8789

8890
$('#selected_classes').append(content);
8991

90-
$(`#selected_puppetclass_${id}`).show('highlight', 5000);
92+
$(`#selected_puppetclass_${id}`).show('highlight', HIGHLIGHT_DURATION);
9193
$(`#puppetclass_${id}`)
9294
.addClass('selected-marker')
9395
.hide();
@@ -136,7 +138,7 @@ export function addConfigGroup(item) {
136138
content.append(
137139
`<input id='config_group_ids' name=${type}[config_group_ids][] type='hidden' value=${id}>`
138140
);
139-
$(`#selected_config_group_${id}`).show('highlight', 5000);
141+
$(`#selected_config_group_${id}`).show('highlight', HIGHLIGHT_DURATION);
140142
$(`#config_group_${id}`)
141143
.addClass('selected-marker')
142144
.hide();
@@ -149,7 +151,7 @@ export function addConfigGroup(item) {
149151
link.text(__(' Remove'));
150152

151153
$('#selected_config_groups').append(content);
152-
$(`#selected_config_group_${id}`).show('highlight', 5000);
154+
$(`#selected_config_group_${id}`).show('highlight', HIGHLIGHT_DURATION);
153155
$(`#config_group_${id}`)
154156
.addClass('selected-marker')
155157
.hide();

0 commit comments

Comments
 (0)