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
329521e1
Commit
329521e1
authored
Oct 19, 2020
by
Marvin Karegyeya
Committed by
Phil Hughes
Oct 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace GlDeprecatedDropdown with GlDropdown in app/assets/javascripts/logs
parent
efc7239c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
74 deletions
+59
-74
app/assets/javascripts/logs/components/environment_logs.vue
app/assets/javascripts/logs/components/environment_logs.vue
+26
-36
app/assets/javascripts/logs/components/log_simple_filters.vue
...assets/javascripts/logs/components/log_simple_filters.vue
+16
-26
changelogs/unreleased/Replace-GlDeprecatedDropdown-with-GlDropdown-in-app-assets-javascripts-lo.yml
...Dropdown-with-GlDropdown-in-app-assets-javascripts-lo.yml
+5
-0
spec/frontend/logs/components/environment_logs_spec.js
spec/frontend/logs/components/environment_logs_spec.js
+8
-8
spec/frontend/logs/components/log_simple_filters_spec.js
spec/frontend/logs/components/log_simple_filters_spec.js
+4
-4
No files found.
app/assets/javascripts/logs/components/environment_logs.vue
View file @
329521e1
...
...
@@ -3,12 +3,11 @@ import { throttle } from 'lodash';
import
{
mapActions
,
mapState
,
mapGetters
}
from
'
vuex
'
;
import
{
GlSprintf
,
GlIcon
,
GlAlert
,
GlD
eprecatedD
ropdown
,
GlD
eprecatedDropdow
nHeader
,
GlD
eprecatedD
ropdownItem
,
GlD
eprecatedD
ropdownDivider
,
GlDropdown
,
GlD
ropdownSectio
nHeader
,
GlDropdownItem
,
GlDropdownDivider
,
GlInfiniteScroll
,
}
from
'
@gitlab/ui
'
;
...
...
@@ -23,12 +22,11 @@ import { formatDate } from '../utils';
export
default
{
components
:
{
GlSprintf
,
GlIcon
,
GlAlert
,
GlD
eprecatedD
ropdown
,
GlD
eprecatedDropdow
nHeader
,
GlD
eprecatedD
ropdownItem
,
GlD
eprecatedD
ropdownDivider
,
GlDropdown
,
GlD
ropdownSectio
nHeader
,
GlDropdownItem
,
GlDropdownDivider
,
GlInfiniteScroll
,
LogSimpleFilters
,
LogAdvancedFilters
,
...
...
@@ -174,46 +172,38 @@ export default {
<div
class=
"top-bar d-md-flex border bg-secondary-50 pt-2 pr-1 pb-0 pl-2"
>
<div
class=
"flex-grow-0"
>
<gl-d
eprecated-d
ropdown
<gl-dropdown
id=
"environments-dropdown"
:text=
"environments.current || managedApps.current"
:disabled=
"environments.isLoading"
class=
"
mb-2 gl-h-32 pr-2 d-flex d
-md-block js-environments-dropdown"
class=
"
gl-mr-3 gl-mb-3 gl-display-flex gl-display
-md-block js-environments-dropdown"
>
<gl-d
eprecated-dropdown-header
class=
"gl-text-center"
>
<gl-d
ropdown-section-header
>
{{
s__
(
'
Environments|Environments
'
)
}}
</gl-d
eprecated-dropdow
n-header>
<gl-d
eprecated-d
ropdown-item
</gl-d
ropdown-sectio
n-header>
<gl-dropdown-item
v-for=
"env in environments.options"
:key=
"env.id"
:is-check-item=
"true"
:is-checked=
"isCurrentEnvironment(env.name)"
@
click=
"showEnvironment(env.name)"
>
<div
class=
"d-flex"
>
<gl-icon
:class=
"
{ invisible: !isCurrentEnvironment(env.name) }"
name="status_success_borderless"
/>
<div
class=
"gl-flex-grow-1"
>
{{
env
.
name
}}
</div>
</div>
</gl-deprecated-dropdown-item>
<gl-deprecated-dropdown-divider
/>
<gl-deprecated-dropdown-header
class=
"gl-text-center"
>
{{
env
.
name
}}
</gl-dropdown-item>
<gl-dropdown-divider
/>
<gl-dropdown-section-header>
{{
s__
(
'
Environments|Managed apps
'
)
}}
</gl-d
eprecated-dropdow
n-header>
<gl-d
eprecated-d
ropdown-item
</gl-d
ropdown-sectio
n-header>
<gl-dropdown-item
v-for=
"app in managedApps.options"
:key=
"app.id"
:is-check-item=
"true"
:is-checked=
"isCurrentManagedApp(app.name)"
@
click=
"showManagedApp(app.name)"
>
<div
class=
"gl-display-flex"
>
<gl-icon
:class=
"
{ invisible: !isCurrentManagedApp(app.name) }"
name="status_success_borderless"
/>
<div
class=
"gl-flex-grow-1"
>
{{
app
.
name
}}
</div>
</div>
</gl-deprecated-dropdown-item>
</gl-deprecated-dropdown>
{{
app
.
name
}}
</gl-dropdown-item>
</gl-dropdown>
</div>
<log-advanced-filters
...
...
app/assets/javascripts/logs/components/log_simple_filters.vue
View file @
329521e1
<
script
>
import
{
mapActions
,
mapState
}
from
'
vuex
'
;
import
{
GlIcon
,
GlDeprecatedDropdown
,
GlDeprecatedDropdownHeader
,
GlDeprecatedDropdownItem
,
}
from
'
@gitlab/ui
'
;
import
{
GlDropdown
,
GlDropdownSectionHeader
,
GlDropdownItem
}
from
'
@gitlab/ui
'
;
import
{
s__
}
from
'
~/locale
'
;
export
default
{
components
:
{
GlIcon
,
GlDeprecatedDropdown
,
GlDeprecatedDropdownHeader
,
GlDeprecatedDropdownItem
,
GlDropdown
,
GlDropdownSectionHeader
,
GlDropdownItem
,
},
props
:
{
disabled
:
{
...
...
@@ -44,35 +38,31 @@ export default {
</
script
>
<
template
>
<div>
<gl-d
eprecated-d
ropdown
<gl-dropdown
ref=
"podsDropdown"
:text=
"podDropdownText"
:disabled=
"disabled"
class=
"
mb-2 gl-h-32 pr-2 d-flex d-md-block flex-grow-0
qa-pods-dropdown"
class=
"
gl-mr-3 gl-mb-3 gl-display-flex gl-display-md-block
qa-pods-dropdown"
>
<gl-d
eprecated-dropdown-header
class=
"text-center"
>
<gl-d
ropdown-section-header
>
{{
s__
(
'
Environments|Select pod
'
)
}}
</gl-d
eprecated-dropdow
n-header>
</gl-d
ropdown-sectio
n-header>
<gl-d
eprecated-d
ropdown-item
v-if=
"!pods.options.length"
disabled
>
<gl-dropdown-item
v-if=
"!pods.options.length"
disabled
>
<span
ref=
"noPodsMsg"
class=
"text-muted"
>
{{
s__
(
'
Environments|No pods to display
'
)
}}
</span>
</gl-d
eprecated-d
ropdown-item>
<gl-d
eprecated-d
ropdown-item
</gl-dropdown-item>
<gl-dropdown-item
v-for=
"podName in pods.options"
:key=
"podName"
:is-check-item=
"true"
:is-checked=
"isCurrentPod(podName)"
class=
"text-nowrap"
@
click=
"showPodLogs(podName)"
>
<div
class=
"d-flex"
>
<gl-icon
:class=
"
{ invisible: !isCurrentPod(podName) }"
name="status_success_borderless"
/>
<div
class=
"flex-grow-1"
>
{{
podName
}}
</div>
</div>
</gl-deprecated-dropdown-item>
</gl-deprecated-dropdown>
{{
podName
}}
</gl-dropdown-item>
</gl-dropdown>
</div>
</
template
>
changelogs/unreleased/Replace-GlDeprecatedDropdown-with-GlDropdown-in-app-assets-javascripts-lo.yml
0 → 100644
View file @
329521e1
---
title
:
Replace-GlDeprecatedDropdown-with-GlDropdown-in-app/assets/javascripts/logs
merge_request
:
41421
author
:
nuwe1
type
:
other
spec/frontend/logs/components/environment_logs_spec.js
View file @
329521e1
import
{
GlSprintf
,
Gl
Icon
,
GlDeprecatedDropdown
,
GlDeprecated
DropdownItem
}
from
'
@gitlab/ui
'
;
import
{
GlSprintf
,
Gl
Dropdown
,
Gl
DropdownItem
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
EnvironmentLogs
from
'
~/logs/components/environment_logs.vue
'
;
...
...
@@ -121,7 +121,7 @@ describe('EnvironmentLogs', () => {
it
(
'
displays UI elements
'
,
()
=>
{
initWrapper
();
expect
(
findEnvironmentsDropdown
().
is
(
GlD
eprecatedD
ropdown
)).
toBe
(
true
);
expect
(
findEnvironmentsDropdown
().
is
(
GlDropdown
)).
toBe
(
true
);
expect
(
findSimpleFilters
().
exists
()).
toBe
(
true
);
expect
(
findLogControlButtons
().
exists
()).
toBe
(
true
);
...
...
@@ -164,7 +164,7 @@ describe('EnvironmentLogs', () => {
it
(
'
displays a disabled environments dropdown
'
,
()
=>
{
expect
(
findEnvironmentsDropdown
().
attributes
(
'
disabled
'
)).
toBe
(
'
true
'
);
expect
(
findEnvironmentsDropdown
().
findAll
(
GlD
eprecatedD
ropdownItem
).
length
).
toBe
(
0
);
expect
(
findEnvironmentsDropdown
().
findAll
(
GlDropdownItem
).
length
).
toBe
(
0
);
});
it
(
'
does not update buttons state
'
,
()
=>
{
...
...
@@ -241,7 +241,7 @@ describe('EnvironmentLogs', () => {
});
it
(
'
populates environments dropdown
'
,
()
=>
{
const
items
=
findEnvironmentsDropdown
().
findAll
(
GlD
eprecatedD
ropdownItem
);
const
items
=
findEnvironmentsDropdown
().
findAll
(
GlDropdownItem
);
expect
(
findEnvironmentsDropdown
().
props
(
'
text
'
)).
toBe
(
mockEnvName
);
expect
(
items
.
length
).
toBe
(
mockEnvironments
.
length
);
mockEnvironments
.
forEach
((
env
,
i
)
=>
{
...
...
@@ -251,14 +251,14 @@ describe('EnvironmentLogs', () => {
});
it
(
'
dropdown has one environment selected
'
,
()
=>
{
const
items
=
findEnvironmentsDropdown
().
findAll
(
GlD
eprecatedD
ropdownItem
);
const
items
=
findEnvironmentsDropdown
().
findAll
(
GlDropdownItem
);
mockEnvironments
.
forEach
((
env
,
i
)
=>
{
const
item
=
items
.
at
(
i
);
if
(
item
.
text
()
!==
mockEnvName
)
{
expect
(
item
.
find
(
Gl
Icon
).
classes
(
'
invisible
'
)).
toBe
(
true
);
expect
(
item
.
find
(
Gl
DropdownItem
).
attributes
(
'
ischecked
'
)).
toBeFalsy
(
);
}
else
{
expect
(
item
.
find
(
Gl
Icon
).
classes
(
'
invisible
'
)).
toBe
(
false
);
expect
(
item
.
find
(
Gl
DropdownItem
).
attributes
(
'
ischecked
'
)).
toBeTruthy
(
);
}
});
});
...
...
@@ -286,7 +286,7 @@ describe('EnvironmentLogs', () => {
describe
(
'
when user clicks
'
,
()
=>
{
it
(
'
environment name, trace is refreshed
'
,
()
=>
{
const
items
=
findEnvironmentsDropdown
().
findAll
(
GlD
eprecatedD
ropdownItem
);
const
items
=
findEnvironmentsDropdown
().
findAll
(
GlDropdownItem
);
const
index
=
1
;
// any env
expect
(
dispatch
).
not
.
toHaveBeenCalledWith
(
`
${
module
}
/showEnvironment`
,
expect
.
anything
());
...
...
spec/frontend/logs/components/log_simple_filters_spec.js
View file @
329521e1
import
{
Gl
Icon
,
GlDeprecated
DropdownItem
}
from
'
@gitlab/ui
'
;
import
{
GlDropdownItem
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
createStore
}
from
'
~/logs/stores
'
;
import
{
mockPods
,
mockPodName
}
from
'
../mock_data
'
;
...
...
@@ -17,7 +17,7 @@ describe('LogSimpleFilters', () => {
const
findPodsNoPodsText
=
()
=>
wrapper
.
find
({
ref
:
'
noPodsMsg
'
});
const
findPodsDropdownItems
=
()
=>
findPodsDropdown
()
.
findAll
(
GlD
eprecatedD
ropdownItem
)
.
findAll
(
GlDropdownItem
)
.
filter
(
item
=>
!
(
'
disabled
'
in
item
.
attributes
()));
const
mockPodsLoading
=
()
=>
{
...
...
@@ -114,9 +114,9 @@ describe('LogSimpleFilters', () => {
mockPods
.
forEach
((
pod
,
i
)
=>
{
const
item
=
items
.
at
(
i
);
if
(
item
.
text
()
!==
mockPodName
)
{
expect
(
item
.
find
(
Gl
Icon
).
classes
(
'
invisible
'
)).
toBe
(
true
);
expect
(
item
.
find
(
Gl
DropdownItem
).
attributes
(
'
ischecked
'
)).
toBeFalsy
(
);
}
else
{
expect
(
item
.
find
(
Gl
Icon
).
classes
(
'
invisible
'
)).
toBe
(
false
);
expect
(
item
.
find
(
Gl
DropdownItem
).
attributes
(
'
ischecked
'
)).
toBeTruthy
(
);
}
});
});
...
...
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