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
aba15718
Commit
aba15718
authored
Mar 23, 2020
by
zmartins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add restriction for updating nginx-ingress
WAF settings will be read-only if there is a new version available
parent
b7f09891
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
4 deletions
+40
-4
app/assets/javascripts/clusters/components/ingress_modsecurity_settings.vue
...ipts/clusters/components/ingress_modsecurity_settings.vue
+8
-4
app/assets/javascripts/clusters/stores/clusters_store.js
app/assets/javascripts/clusters/stores/clusters_store.js
+2
-0
changelogs/unreleased/add_restriction_for_ingress_update.yml
changelogs/unreleased/add_restriction_for_ingress_update.yml
+5
-0
spec/frontend/clusters/components/ingress_modsecurity_settings_spec.js
.../clusters/components/ingress_modsecurity_settings_spec.js
+25
-0
No files found.
app/assets/javascripts/clusters/components/ingress_modsecurity_settings.vue
View file @
aba15718
...
...
@@ -93,7 +93,10 @@ export default {
return
[
UPDATING
].
includes
(
this
.
ingress
.
status
);
},
saveButtonDisabled
()
{
return
[
UNINSTALLING
,
UPDATING
,
INSTALLING
].
includes
(
this
.
ingress
.
status
);
return
(
[
UNINSTALLING
,
UPDATING
,
INSTALLING
].
includes
(
this
.
ingress
.
status
)
||
this
.
ingress
.
updateAvailable
);
},
saveButtonLabel
()
{
return
this
.
saving
?
__
(
'
Saving
'
)
:
__
(
'
Save changes
'
);
...
...
@@ -105,13 +108,14 @@ export default {
* neither getting installed nor updated.
*/
showButtons
()
{
return
(
this
.
saving
||
(
this
.
hasValueChanged
&&
[
INSTALLED
,
UPDATED
].
includes
(
this
.
ingress
.
status
))
);
return
this
.
saving
||
this
.
valuesChangedByUser
;
},
modSecurityModeName
()
{
return
this
.
modes
[
this
.
ingress
.
modsecurity_mode
].
name
;
},
valuesChangedByUser
()
{
return
this
.
hasValueChanged
&&
[
INSTALLED
,
UPDATED
].
includes
(
this
.
ingress
.
status
);
},
},
methods
:
{
updateApplication
()
{
...
...
app/assets/javascripts/clusters/stores/clusters_store.js
View file @
aba15718
...
...
@@ -59,6 +59,7 @@ export default class ClusterStore {
isEditingModSecurityEnabled
:
false
,
isEditingModSecurityMode
:
false
,
updateFailed
:
false
,
updateAvailable
:
false
,
},
cert_manager
:
{
...
applicationInitialState
,
...
...
@@ -213,6 +214,7 @@ export default class ClusterStore {
if
(
appId
===
INGRESS
)
{
this
.
state
.
applications
.
ingress
.
externalIp
=
serverAppEntry
.
external_ip
;
this
.
state
.
applications
.
ingress
.
externalHostname
=
serverAppEntry
.
external_hostname
;
this
.
state
.
applications
.
ingress
.
updateAvailable
=
updateAvailable
;
if
(
!
this
.
state
.
applications
.
ingress
.
isEditingModSecurityEnabled
)
{
this
.
state
.
applications
.
ingress
.
modsecurity_enabled
=
serverAppEntry
.
modsecurity_enabled
;
}
...
...
changelogs/unreleased/add_restriction_for_ingress_update.yml
0 → 100644
View file @
aba15718
---
title
:
WAF settings will be read-only if there is a new version of ingress available
merge_request
:
27845
author
:
type
:
changed
spec/frontend/clusters/components/ingress_modsecurity_settings_spec.js
View file @
aba15718
...
...
@@ -14,6 +14,7 @@ describe('IngressModsecuritySettings', () => {
status
:
'
installable
'
,
installed
:
false
,
modsecurity_mode
:
'
logging
'
,
updateAvailable
:
false
,
};
const
createComponent
=
(
props
=
defaultProps
)
=>
{
...
...
@@ -61,6 +62,11 @@ describe('IngressModsecuritySettings', () => {
expect
(
findCancelButton
().
exists
()).
toBe
(
true
);
});
it
(
'
enables related toggle and buttons
'
,
()
=>
{
expect
(
findSaveButton
().
attributes
().
disabled
).
toBeUndefined
();
expect
(
findCancelButton
().
attributes
().
disabled
).
toBeUndefined
();
});
describe
(
'
with dropdown changed by the user
'
,
()
=>
{
beforeEach
(()
=>
{
findModSecurityDropdown
().
vm
.
$children
[
1
].
$emit
(
'
click
'
);
...
...
@@ -105,6 +111,25 @@ describe('IngressModsecuritySettings', () => {
expect
(
findCancelButton
().
exists
()).
toBe
(
false
);
});
});
describe
(
'
with a new version available
'
,
()
=>
{
beforeEach
(()
=>
{
wrapper
.
setProps
({
ingress
:
{
...
defaultProps
,
installed
:
true
,
status
:
'
installed
'
,
modsecurity_enabled
:
true
,
updateAvailable
:
true
,
},
});
});
it
(
'
disables related toggle and buttons
'
,
()
=>
{
expect
(
findSaveButton
().
attributes
().
disabled
).
toBe
(
'
true
'
);
expect
(
findCancelButton
().
attributes
().
disabled
).
toBe
(
'
true
'
);
});
});
});
it
(
'
triggers set event to be propagated with the current modsecurity value
'
,
()
=>
{
...
...
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