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
0520e228
Commit
0520e228
authored
Oct 28, 2019
by
Miguel Rincon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make changes from reviews
- Remove empty function file - Simplify getter - Add spec for getters
parent
cd02d195
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
11 deletions
+43
-11
ee/app/assets/javascripts/logs/logs_bundle.js
ee/app/assets/javascripts/logs/logs_bundle.js
+0
-1
ee/app/assets/javascripts/logs/stores/actions.js
ee/app/assets/javascripts/logs/stores/actions.js
+1
-2
ee/app/assets/javascripts/logs/stores/getters.js
ee/app/assets/javascripts/logs/stores/getters.js
+1
-6
ee/app/assets/javascripts/pages/projects/environments/logs/index.js
...ets/javascripts/pages/projects/environments/logs/index.js
+1
-2
ee/spec/frontend/logs/stores/getters_spec.js
ee/spec/frontend/logs/stores/getters_spec.js
+40
-0
No files found.
ee/app/assets/javascripts/logs/logs_bundle.js
deleted
100644 → 0
View file @
cd02d195
export
default
()
=>
{};
ee/app/assets/javascripts/logs/stores/actions.js
View file @
0520e228
...
...
@@ -47,8 +47,7 @@ export const fetchLogs = ({ commit, state }, podName) => {
commit
(
types
.
REQUEST_PODS_DATA
);
commit
(
types
.
REQUEST_LOGS_DATA
);
return
requestUntilData
(
state
.
logs
.
endpoint
,
{
pod_name
:
podName
})
.
then
(
res
=>
res
.
data
)
.
then
(
data
=>
{
.
then
(({
data
})
=>
{
const
{
pods
,
logs
}
=
data
;
// Set first pod as default, if none is set
...
...
ee/app/assets/javascripts/logs/stores/getters.js
View file @
0520e228
export
const
trace
=
state
=>
{
if
(
state
.
logs
.
lines
)
{
return
state
.
logs
.
lines
.
join
(
'
\n
'
);
}
return
''
;
};
export
const
trace
=
state
=>
state
.
logs
.
lines
.
join
(
'
\n
'
);
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export
default
()
=>
{};
ee/app/assets/javascripts/pages/projects/environments/logs/index.js
View file @
0520e228
import
logsBundle
from
'
ee/logs/logs_bundle
'
;
import
KubernetesLogs
from
'
../../../../kubernetes_logs
'
;
if
(
gon
.
features
.
environmentLogsUseVueUi
)
{
document
.
addEventListener
(
'
DOMContentLoaded
'
,
logsBundle
);
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{}
);
}
else
{
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
const
kubernetesLogContainer
=
document
.
querySelector
(
'
.js-kubernetes-logs
'
);
...
...
ee/spec/frontend/logs/stores/getters_spec.js
0 → 100644
View file @
0520e228
import
*
as
getters
from
'
ee/logs/stores/getters
'
;
import
logsPageState
from
'
ee/logs/stores/state
'
;
import
{
mockLines
}
from
'
../mock_data
'
;
describe
(
'
Logs Store getters
'
,
()
=>
{
let
state
;
beforeEach
(()
=>
{
state
=
logsPageState
();
});
describe
(
'
trace
'
,
()
=>
{
describe
(
'
when state is initialized
'
,
()
=>
{
it
(
'
returns an empty string
'
,
()
=>
{
expect
(
getters
.
trace
(
state
)).
toEqual
(
''
);
});
});
describe
(
'
when state logs are empty
'
,
()
=>
{
beforeEach
(()
=>
{
state
.
logs
.
lines
=
[];
});
it
(
'
returns an empty string
'
,
()
=>
{
expect
(
getters
.
trace
(
state
)).
toEqual
(
''
);
});
});
describe
(
'
when state logs are set
'
,
()
=>
{
beforeEach
(()
=>
{
state
.
logs
.
lines
=
mockLines
;
});
it
(
'
returns an empty string
'
,
()
=>
{
expect
(
getters
.
trace
(
state
)).
toEqual
(
mockLines
.
join
(
'
\n
'
));
});
});
});
});
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