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
4f5a1079
Commit
4f5a1079
authored
Feb 22, 2022
by
Savas Vedova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use GlButtonGroup instead of GlSegmentedControl
Changelog: changed EE: true
parent
d9644141
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
16 deletions
+19
-16
ee/app/assets/javascripts/threat_monitoring/components/policy_editor/policy_editor_layout.vue
...itoring/components/policy_editor/policy_editor_layout.vue
+14
-13
ee/spec/frontend/threat_monitoring/components/policy_editor/policy_editor_layout_spec.js
...ing/components/policy_editor/policy_editor_layout_spec.js
+5
-3
No files found.
ee/app/assets/javascripts/threat_monitoring/components/policy_editor/policy_editor_layout.vue
View file @
4f5a1079
<
script
>
import
{
GlButton
,
GlModal
,
GlModalDirective
,
GlSegmentedControl
,
GlTooltipDirective
,
}
from
'
@gitlab/ui
'
;
import
{
GlButtonGroup
,
GlButton
,
GlModal
,
GlModalDirective
,
GlTooltipDirective
}
from
'
@gitlab/ui
'
;
import
{
s__
,
sprintf
}
from
'
~/locale
'
;
import
{
DELETE_MODAL_CONFIG
,
EDITOR_MODES
,
EDITOR_MODE_RULE
,
EDITOR_MODE_YAML
}
from
'
./constants
'
;
...
...
@@ -16,7 +10,7 @@ export default {
components
:
{
GlButton
,
GlModal
,
Gl
SegmentedControl
,
Gl
ButtonGroup
,
PolicyYamlEditor
:
()
=>
import
(
/* webpackChunkName: 'policy_yaml_editor' */
'
../policy_yaml_editor.vue
'
),
},
...
...
@@ -128,11 +122,18 @@ export default {
<section
class=
"gl-mt-6"
>
<div
class=
"gl-mb-5"
>
<div
class=
"gl-border-b-solid gl-border-b-1 gl-border-gray-100 gl-mb-6 gl-pb-6"
>
<gl-segmented-control
:options=
"editorModes"
:checked=
"selectedEditorMode"
@
input=
"updateEditorMode"
/>
<gl-button-group
:vertical=
"false"
>
<gl-button
v-for=
"
{ text, value } in editorModes"
:key="value"
:data-testid="`button-${value}`"
:selected="selectedEditorMode === value"
type="button"
@click="updateEditorMode(value)"
>
{{
text
}}
</gl-button>
</gl-button-group>
</div>
<div
class=
"gl-display-flex gl-sm-flex-direction-column"
>
<section
class=
"gl-w-full gl-mr-7"
>
...
...
ee/spec/frontend/threat_monitoring/components/policy_editor/policy_editor_layout_spec.js
View file @
4f5a1079
import
{
GlModal
,
GlSegmentedControl
}
from
'
@gitlab/ui
'
;
import
{
nextTick
}
from
'
vue
'
;
import
{
GlModal
,
GlButtonGroup
}
from
'
@gitlab/ui
'
;
import
{
EDITOR_MODE_YAML
}
from
'
ee/threat_monitoring/components/policy_editor/constants
'
;
import
PolicyEditorLayout
from
'
ee/threat_monitoring/components/policy_editor/policy_editor_layout.vue
'
;
import
{
shallowMountExtended
}
from
'
helpers/vue_test_utils_helper
'
;
...
...
@@ -26,7 +27,7 @@ describe('PolicyEditorLayout component', () => {
const
findDeletePolicyButton
=
()
=>
wrapper
.
findByTestId
(
'
delete-policy
'
);
const
findDeletePolicyModal
=
()
=>
wrapper
.
findComponent
(
GlModal
);
const
findEditorModeToggle
=
()
=>
wrapper
.
findComponent
(
Gl
SegmentedControl
);
const
findEditorModeToggle
=
()
=>
wrapper
.
findComponent
(
Gl
ButtonGroup
);
const
findYamlModeSection
=
()
=>
wrapper
.
findByTestId
(
'
policy-yaml-editor
'
);
const
findRuleModeSection
=
()
=>
wrapper
.
findByTestId
(
'
rule-editor
'
);
const
findRuleModePreviewSection
=
()
=>
wrapper
.
findByTestId
(
'
rule-editor-preview
'
);
...
...
@@ -67,7 +68,8 @@ describe('PolicyEditorLayout component', () => {
it
(
'
mode changes appropriately when new mode is selected
'
,
async
()
=>
{
expect
(
findRuleModeSection
().
exists
()).
toBe
(
true
);
expect
(
findYamlModeSection
().
exists
()).
toBe
(
false
);
await
findEditorModeToggle
().
vm
.
$emit
(
'
input
'
,
EDITOR_MODE_YAML
);
wrapper
.
findByTestId
(
'
button-yaml
'
).
vm
.
$emit
(
'
click
'
);
await
nextTick
();
expect
(
findRuleModeSection
().
exists
()).
toBe
(
false
);
expect
(
findYamlModeSection
().
exists
()).
toBe
(
true
);
expect
(
wrapper
.
emitted
(
'
update-editor-mode
'
)).
toStrictEqual
([[
EDITOR_MODE_YAML
]]);
...
...
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