Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
cb2d4b9e
Commit
cb2d4b9e
authored
Sep 08, 2020
by
Jose Vargas
Committed by
Jose Vargas
Oct 26, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove ajax_variable_list javascript file
This removes unused files and stubs from rspec files
parent
7e35adeb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1 addition
and
136 deletions
+1
-136
app/assets/javascripts/ci_variable_list/ajax_variable_list.js
...assets/javascripts/ci_variable_list/ajax_variable_list.js
+0
-128
changelogs/unreleased/jivanvl-remove-ci-variables-table-feature-flag.yml
...leased/jivanvl-remove-ci-variables-table-feature-flag.yml
+1
-1
locale/gitlab.pot
locale/gitlab.pot
+0
-6
spec/features/projects/settings/registry_settings_spec.rb
spec/features/projects/settings/registry_settings_spec.rb
+0
-1
No files found.
app/assets/javascripts/ci_variable_list/ajax_variable_list.js
deleted
100644 → 0
View file @
7e35adeb
import
{
escape
}
from
'
lodash
'
;
import
axios
from
'
../lib/utils/axios_utils
'
;
import
{
s__
}
from
'
../locale
'
;
import
{
deprecatedCreateFlash
as
Flash
}
from
'
../flash
'
;
import
{
parseBoolean
}
from
'
../lib/utils/common_utils
'
;
import
statusCodes
from
'
../lib/utils/http_status
'
;
import
VariableList
from
'
./ci_variable_list
'
;
function
generateErrorBoxContent
(
errors
)
{
const
errorList
=
[].
concat
(
errors
).
map
(
errorString
=>
`
<li>
${
escape
(
errorString
)}
</li>
`
,
);
return
`
<p>
${
s__
(
'
CiVariable|Validation failed
'
)}
</p>
<ul>
${
errorList
.
join
(
''
)}
</ul>
`
;
}
// Used for the variable list on CI/CD projects/groups settings page
export
default
class
AjaxVariableList
{
constructor
({
container
,
saveButton
,
errorBox
,
formField
=
'
variables
'
,
saveEndpoint
,
maskableRegex
,
})
{
this
.
container
=
container
;
this
.
saveButton
=
saveButton
;
this
.
errorBox
=
errorBox
;
this
.
saveEndpoint
=
saveEndpoint
;
this
.
maskableRegex
=
maskableRegex
;
this
.
variableList
=
new
VariableList
({
container
:
this
.
container
,
formField
,
maskableRegex
,
});
this
.
bindEvents
();
this
.
variableList
.
init
();
}
bindEvents
()
{
this
.
saveButton
.
addEventListener
(
'
click
'
,
this
.
onSaveClicked
.
bind
(
this
));
}
onSaveClicked
()
{
const
loadingIcon
=
this
.
saveButton
.
querySelector
(
'
.js-ci-variables-save-loading-icon
'
);
loadingIcon
.
classList
.
toggle
(
'
hide
'
,
false
);
this
.
errorBox
.
classList
.
toggle
(
'
hide
'
,
true
);
// We use this to prevent a user from changing a key before we have a chance
// to match it up in `updateRowsWithPersistedVariables`
this
.
variableList
.
toggleEnableRow
(
false
);
return
axios
.
patch
(
this
.
saveEndpoint
,
{
variables_attributes
:
this
.
variableList
.
getAllData
(),
},
{
// We want to be able to process the `res.data` from a 400 error response
// and print the validation messages such as duplicate variable keys
validateStatus
:
status
=>
(
status
>=
statusCodes
.
OK
&&
status
<
statusCodes
.
MULTIPLE_CHOICES
)
||
status
===
statusCodes
.
BAD_REQUEST
,
},
)
.
then
(
res
=>
{
loadingIcon
.
classList
.
toggle
(
'
hide
'
,
true
);
this
.
variableList
.
toggleEnableRow
(
true
);
if
(
res
.
status
===
statusCodes
.
OK
&&
res
.
data
)
{
this
.
updateRowsWithPersistedVariables
(
res
.
data
.
variables
);
this
.
variableList
.
hideValues
();
}
else
if
(
res
.
status
===
statusCodes
.
BAD_REQUEST
)
{
// Validation failed
this
.
errorBox
.
innerHTML
=
generateErrorBoxContent
(
res
.
data
);
this
.
errorBox
.
classList
.
toggle
(
'
hide
'
,
false
);
}
})
.
catch
(()
=>
{
loadingIcon
.
classList
.
toggle
(
'
hide
'
,
true
);
this
.
variableList
.
toggleEnableRow
(
true
);
Flash
(
s__
(
'
CiVariable|Error occurred while saving variables
'
));
});
}
updateRowsWithPersistedVariables
(
persistedVariables
=
[])
{
const
persistedVariableMap
=
[].
concat
(
persistedVariables
).
reduce
(
(
variableMap
,
variable
)
=>
({
...
variableMap
,
[
variable
.
key
]:
variable
,
}),
{},
);
this
.
container
.
querySelectorAll
(
'
.js-row
'
).
forEach
(
row
=>
{
// If we submitted a row that was destroyed, remove it so we don't try
// to destroy it again which would cause a BE error
const
destroyInput
=
row
.
querySelector
(
'
.js-ci-variable-input-destroy
'
);
if
(
parseBoolean
(
destroyInput
.
value
))
{
row
.
remove
();
// Update the ID input so any future edits and `_destroy` will apply on the BE
}
else
{
const
key
=
row
.
querySelector
(
'
.js-ci-variable-input-key
'
).
value
;
const
persistedVariable
=
persistedVariableMap
[
key
];
if
(
persistedVariable
)
{
// eslint-disable-next-line no-param-reassign
row
.
querySelector
(
'
.js-ci-variable-input-id
'
).
value
=
persistedVariable
.
id
;
row
.
setAttribute
(
'
data-is-persisted
'
,
'
true
'
);
}
}
});
}
}
changelogs/unreleased/jivanvl-remove-ci-variables-table-feature-flag.yml
View file @
cb2d4b9e
---
title
:
Remove new_
ci_variables_list
feature flag
title
:
Remove new_
variables_ui
feature flag
merge_request
:
41412
author
:
type
:
other
locale/gitlab.pot
View file @
cb2d4b9e
...
...
@@ -5318,9 +5318,6 @@ msgstr ""
msgid "CiVariable|Create wildcard"
msgstr ""
msgid "CiVariable|Error occurred while saving variables"
msgstr ""
msgid "CiVariable|Masked"
msgstr ""
...
...
@@ -5339,9 +5336,6 @@ msgstr ""
msgid "CiVariable|Toggle protected"
msgstr ""
msgid "CiVariable|Validation failed"
msgstr ""
msgid "Classification Label (optional)"
msgstr ""
...
...
spec/features/projects/settings/registry_settings_spec.rb
View file @
cb2d4b9e
...
...
@@ -18,7 +18,6 @@ RSpec.describe 'Project > Settings > CI/CD > Container registry tag expiration p
sign_in
(
user
)
stub_container_registry_config
(
enabled:
container_registry_enabled
)
stub_feature_flags
(
new_variables_ui:
false
)
end
context
'as owner'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment