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
65a79751
Commit
65a79751
authored
Jun 09, 2021
by
Jannik Lehmann
Committed by
Enrique Alcántara
Jun 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Config History Link to Secure Config Page
parent
25423897
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
2 deletions
+61
-2
app/assets/javascripts/security_configuration/components/redesigned_app.vue
...ipts/security_configuration/components/redesigned_app.vue
+25
-1
app/assets/javascripts/security_configuration/index.js
app/assets/javascripts/security_configuration/index.js
+10
-1
spec/frontend/security_configuration/components/redesigned_app_spec.js
.../security_configuration/components/redesigned_app_spec.js
+26
-0
No files found.
app/assets/javascripts/security_configuration/components/redesigned_app.vue
View file @
65a79751
...
@@ -35,13 +35,27 @@ export default {
...
@@ -35,13 +35,27 @@ export default {
type
:
Array
,
type
:
Array
,
required
:
true
,
required
:
true
,
},
},
gitlabCiPresent
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
,
},
gitlabCiHistoryPath
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
latestPipelinePath
:
{
latestPipelinePath
:
{
type
:
String
,
type
:
String
,
required
:
false
,
required
:
false
,
default
:
''
,
default
:
''
,
},
},
},
},
computed
:
{
canViewCiHistory
()
{
return
Boolean
(
this
.
gitlabCiPresent
&&
this
.
gitlabCiHistoryPath
);
},
},
};
};
</
script
>
</
script
>
...
@@ -66,6 +80,11 @@ export default {
...
@@ -66,6 +80,11 @@ export default {
</
template
>
</
template
>
</gl-sprintf>
</gl-sprintf>
</p>
</p>
<p
v-if=
"canViewCiHistory"
>
<gl-link
data-testid=
"security-view-history-link"
:href=
"gitlabCiHistoryPath"
>
{{
$options.i18n.configurationHistory
}}
</gl-link>
</p>
</template>
</template>
<
template
#features
>
<
template
#features
>
...
@@ -92,6 +111,11 @@ export default {
...
@@ -92,6 +111,11 @@ export default {
</
template
>
</
template
>
</gl-sprintf>
</gl-sprintf>
</p>
</p>
<p
v-if=
"canViewCiHistory"
>
<gl-link
data-testid=
"compliance-view-history-link"
:href=
"gitlabCiHistoryPath"
>
{{
$options.i18n.configurationHistory
}}
</gl-link>
</p>
</template>
</template>
<
template
#features
>
<
template
#features
>
<feature-card
<feature-card
...
...
app/assets/javascripts/security_configuration/index.js
View file @
65a79751
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
import
{
parseBooleanDataAttributes
}
from
'
~/lib/utils/dom_utils
'
;
import
SecurityConfigurationApp
from
'
./components/app.vue
'
;
import
SecurityConfigurationApp
from
'
./components/app.vue
'
;
import
{
securityFeatures
,
complianceFeatures
}
from
'
./components/constants
'
;
import
{
securityFeatures
,
complianceFeatures
}
from
'
./components/constants
'
;
import
RedesignedSecurityConfigurationApp
from
'
./components/redesigned_app.vue
'
;
import
RedesignedSecurityConfigurationApp
from
'
./components/redesigned_app.vue
'
;
...
@@ -17,7 +18,13 @@ export const initStaticSecurityConfiguration = (el) => {
...
@@ -17,7 +18,13 @@ export const initStaticSecurityConfiguration = (el) => {
defaultClient
:
createDefaultClient
(),
defaultClient
:
createDefaultClient
(),
});
});
const
{
projectPath
,
upgradePath
,
features
,
latestPipelinePath
}
=
el
.
dataset
;
const
{
projectPath
,
upgradePath
,
features
,
latestPipelinePath
,
gitlabCiHistoryPath
,
}
=
el
.
dataset
;
if
(
gon
.
features
.
securityConfigurationRedesign
)
{
if
(
gon
.
features
.
securityConfigurationRedesign
)
{
const
{
augmentedSecurityFeatures
,
augmentedComplianceFeatures
}
=
augmentFeatures
(
const
{
augmentedSecurityFeatures
,
augmentedComplianceFeatures
}
=
augmentFeatures
(
...
@@ -39,6 +46,8 @@ export const initStaticSecurityConfiguration = (el) => {
...
@@ -39,6 +46,8 @@ export const initStaticSecurityConfiguration = (el) => {
augmentedComplianceFeatures
,
augmentedComplianceFeatures
,
augmentedSecurityFeatures
,
augmentedSecurityFeatures
,
latestPipelinePath
,
latestPipelinePath
,
gitlabCiHistoryPath
,
...
parseBooleanDataAttributes
(
el
,
[
'
gitlabCiPresent
'
]),
},
},
});
});
},
},
...
...
spec/frontend/security_configuration/components/redesigned_app_spec.js
View file @
65a79751
...
@@ -36,6 +36,8 @@ describe('redesigned App component', () => {
...
@@ -36,6 +36,8 @@ describe('redesigned App component', () => {
const
findTabs
=
()
=>
wrapper
.
findAllComponents
(
GlTab
);
const
findTabs
=
()
=>
wrapper
.
findAllComponents
(
GlTab
);
const
findByTestId
=
(
id
)
=>
wrapper
.
findByTestId
(
id
);
const
findByTestId
=
(
id
)
=>
wrapper
.
findByTestId
(
id
);
const
findFeatureCards
=
()
=>
wrapper
.
findAllComponents
(
FeatureCard
);
const
findFeatureCards
=
()
=>
wrapper
.
findAllComponents
(
FeatureCard
);
const
findComplianceViewHistoryLink
=
()
=>
findByTestId
(
'
compliance-view-history-link
'
);
const
findSecurityViewHistoryLink
=
()
=>
findByTestId
(
'
security-view-history-link
'
);
const
securityFeaturesMock
=
[
const
securityFeaturesMock
=
[
{
{
...
@@ -103,6 +105,11 @@ describe('redesigned App component', () => {
...
@@ -103,6 +105,11 @@ describe('redesigned App component', () => {
it
(
'
should not show latest pipeline link when latestPipelinePath is not defined
'
,
()
=>
{
it
(
'
should not show latest pipeline link when latestPipelinePath is not defined
'
,
()
=>
{
expect
(
findByTestId
(
'
latest-pipeline-info
'
).
exists
()).
toBe
(
false
);
expect
(
findByTestId
(
'
latest-pipeline-info
'
).
exists
()).
toBe
(
false
);
});
});
it
(
'
should not show configuration History Link when gitlabCiPresent & gitlabCiHistoryPath are not defined
'
,
()
=>
{
expect
(
findComplianceViewHistoryLink
().
exists
()).
toBe
(
false
);
expect
(
findSecurityViewHistoryLink
().
exists
()).
toBe
(
false
);
});
});
});
describe
(
'
when given latestPipelinePath props
'
,
()
=>
{
describe
(
'
when given latestPipelinePath props
'
,
()
=>
{
...
@@ -134,4 +141,23 @@ describe('redesigned App component', () => {
...
@@ -134,4 +141,23 @@ describe('redesigned App component', () => {
expect
(
latestPipelineInfoCompliance
.
find
(
'
a
'
).
attributes
(
'
href
'
)).
toBe
(
'
test/path
'
);
expect
(
latestPipelineInfoCompliance
.
find
(
'
a
'
).
attributes
(
'
href
'
)).
toBe
(
'
test/path
'
);
});
});
});
});
describe
(
'
given gitlabCiPresent & gitlabCiHistoryPath props
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
({
augmentedSecurityFeatures
:
securityFeaturesMock
,
augmentedComplianceFeatures
:
complianceFeaturesMock
,
gitlabCiPresent
:
true
,
gitlabCiHistoryPath
:
'
test/historyPath
'
,
});
});
it
(
'
should show configuration History Link
'
,
()
=>
{
expect
(
findComplianceViewHistoryLink
().
exists
()).
toBe
(
true
);
expect
(
findSecurityViewHistoryLink
().
exists
()).
toBe
(
true
);
expect
(
findComplianceViewHistoryLink
().
attributes
(
'
href
'
)).
toBe
(
'
test/historyPath
'
);
expect
(
findSecurityViewHistoryLink
().
attributes
(
'
href
'
)).
toBe
(
'
test/historyPath
'
);
});
});
});
});
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