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
71df6576
Commit
71df6576
authored
Jun 09, 2021
by
David O'Regan
Committed by
Olena Horal-Koretska
Jun 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Depreciate GMA from Logs view in Operations
Changelog: deprecated
parent
6a3f50e4
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
10 additions
and
245 deletions
+10
-245
app/assets/javascripts/logs/components/environment_logs.vue
app/assets/javascripts/logs/components/environment_logs.vue
+2
-23
app/assets/javascripts/logs/constants.js
app/assets/javascripts/logs/constants.js
+0
-1
app/assets/javascripts/logs/stores/actions.js
app/assets/javascripts/logs/stores/actions.js
+2
-30
app/assets/javascripts/logs/stores/getters.js
app/assets/javascripts/logs/stores/getters.js
+3
-10
app/assets/javascripts/logs/stores/mutation_types.js
app/assets/javascripts/logs/stores/mutation_types.js
+0
-3
app/assets/javascripts/logs/stores/mutations.js
app/assets/javascripts/logs/stores/mutations.js
+0
-25
app/assets/javascripts/logs/stores/state.js
app/assets/javascripts/logs/stores/state.js
+0
-10
locale/gitlab.pot
locale/gitlab.pot
+0
-3
spec/features/projects/environments_pod_logs_spec.rb
spec/features/projects/environments_pod_logs_spec.rb
+1
-1
spec/frontend/logs/components/environment_logs_spec.js
spec/frontend/logs/components/environment_logs_spec.js
+1
-2
spec/frontend/logs/mock_data.js
spec/frontend/logs/mock_data.js
+0
-27
spec/frontend/logs/stores/actions_spec.js
spec/frontend/logs/stores/actions_spec.js
+0
-27
spec/frontend/logs/stores/getters_spec.js
spec/frontend/logs/stores/getters_spec.js
+1
-47
spec/frontend/logs/stores/mutations_spec.js
spec/frontend/logs/stores/mutations_spec.js
+0
-36
No files found.
app/assets/javascripts/logs/components/environment_logs.vue
View file @
71df6576
...
...
@@ -5,7 +5,6 @@ import {
GlDropdown
,
GlDropdownSectionHeader
,
GlDropdownItem
,
GlDropdownDivider
,
GlInfiniteScroll
,
}
from
'
@gitlab/ui
'
;
import
{
throttle
}
from
'
lodash
'
;
...
...
@@ -25,7 +24,6 @@ export default {
GlDropdown
,
GlDropdownSectionHeader
,
GlDropdownItem
,
GlDropdownDivider
,
GlInfiniteScroll
,
LogSimpleFilters
,
LogAdvancedFilters
,
...
...
@@ -66,7 +64,7 @@ export default {
};
},
computed
:
{
...
mapState
(
'
environmentLogs
'
,
[
'
environments
'
,
'
timeRange
'
,
'
logs
'
,
'
pods
'
,
'
managedApps
'
]),
...
mapState
(
'
environmentLogs
'
,
[
'
environments
'
,
'
timeRange
'
,
'
logs
'
,
'
pods
'
]),
...
mapGetters
(
'
environmentLogs
'
,
[
'
trace
'
,
'
showAdvancedFilters
'
]),
showLoader
()
{
...
...
@@ -88,15 +86,12 @@ export default {
});
this
.
fetchEnvironments
(
this
.
environmentsPath
);
this
.
fetchManagedApps
(
this
.
clustersPath
);
},
methods
:
{
...
mapActions
(
'
environmentLogs
'
,
[
'
setInitData
'
,
'
showEnvironment
'
,
'
showManagedApp
'
,
'
fetchEnvironments
'
,
'
fetchManagedApps
'
,
'
refreshPodLogs
'
,
'
fetchMoreLogsPrepend
'
,
'
dismissRequestEnvironmentsError
'
,
...
...
@@ -107,9 +102,6 @@ export default {
isCurrentEnvironment
(
envName
)
{
return
envName
===
this
.
environments
.
current
;
},
isCurrentManagedApp
(
appName
)
{
return
appName
===
this
.
managedApps
.
current
;
},
topReached
()
{
if
(
!
this
.
logs
.
isLoading
)
{
this
.
fetchMoreLogsPrepend
();
...
...
@@ -173,7 +165,7 @@ export default {
<div
class=
"flex-grow-0"
>
<gl-dropdown
id=
"environments-dropdown"
:text=
"environments.current
|| managedApps.current
"
:text=
"environments.current"
:disabled=
"environments.isLoading"
class=
"gl-mr-3 gl-mb-3 gl-display-flex gl-md-display-block js-environments-dropdown"
>
...
...
@@ -189,19 +181,6 @@ export default {
>
{{
env
.
name
}}
</gl-dropdown-item>
<gl-dropdown-divider
/>
<gl-dropdown-section-header>
{{
s__
(
'
Environments|Managed apps
'
)
}}
</gl-dropdown-section-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)"
>
{{
app
.
name
}}
</gl-dropdown-item>
</gl-dropdown>
</div>
...
...
app/assets/javascripts/logs/constants.js
View file @
71df6576
...
...
@@ -13,5 +13,4 @@ export const tracking = {
export
const
logExplorerOptions
=
{
environments
:
'
environments
'
,
managedApps
:
'
managedApps
'
,
};
app/assets/javascripts/logs/stores/actions.js
View file @
71df6576
...
...
@@ -25,15 +25,9 @@ const requestUntilData = (url, params) =>
const
requestLogsUntilData
=
({
commit
,
state
})
=>
{
const
params
=
{};
const
type
=
state
.
environments
.
current
?
logExplorerOptions
.
environments
:
logExplorerOptions
.
managedApps
;
const
type
=
logExplorerOptions
.
environments
;
const
selectedObj
=
state
[
type
].
options
.
find
(({
name
})
=>
name
===
state
[
type
].
current
);
const
path
=
type
===
logExplorerOptions
.
environments
?
selectedObj
.
logs_api_path
:
selectedObj
.
gitlab_managed_apps_logs_path
;
const
path
=
selectedObj
.
logs_api_path
;
if
(
state
.
pods
.
current
)
{
params
.
pod_name
=
state
.
pods
.
current
;
...
...
@@ -106,11 +100,6 @@ export const showEnvironment = ({ dispatch, commit }, environmentName) => {
dispatch
(
'
fetchLogs
'
,
tracking
.
ENVIRONMENT_SELECTED
);
};
export
const
showManagedApp
=
({
dispatch
,
commit
},
managedApp
)
=>
{
commit
(
types
.
SET_MANAGED_APP
,
managedApp
);
dispatch
(
'
fetchLogs
'
,
tracking
.
MANAGED_APP_SELECTED
);
};
export
const
refreshPodLogs
=
({
dispatch
,
commit
})
=>
{
commit
(
types
.
REFRESH_POD_LOGS
);
dispatch
(
'
fetchLogs
'
,
tracking
.
REFRESH_POD_LOGS
);
...
...
@@ -135,23 +124,6 @@ export const fetchEnvironments = ({ commit, dispatch }, environmentsPath) => {
});
};
/**
* Fetch managed apps data
* @param {Object} store
* @param {String} clustersPath
*/
export
const
fetchManagedApps
=
({
commit
},
clustersPath
)
=>
{
return
axios
.
get
(
clustersPath
)
.
then
(({
data
})
=>
{
commit
(
types
.
RECEIVE_MANAGED_APPS_DATA_SUCCESS
,
data
.
clusters
);
})
.
catch
(()
=>
{
commit
(
types
.
RECEIVE_MANAGED_APPS_DATA_ERROR
);
});
};
export
const
fetchLogs
=
({
commit
,
state
},
trackingLabel
)
=>
{
commit
(
types
.
REQUEST_LOGS_DATA
);
...
...
app/assets/javascripts/logs/stores/getters.js
View file @
71df6576
...
...
@@ -6,16 +6,9 @@ const mapTrace = ({ timestamp = null, pod = '', message = '' }) =>
export
const
trace
=
(
state
)
=>
state
.
logs
.
lines
.
map
(
mapTrace
).
join
(
'
\n
'
);
export
const
showAdvancedFilters
=
(
state
)
=>
{
if
(
state
.
environments
.
current
)
{
const
environment
=
state
.
environments
.
options
.
find
(
({
name
})
=>
name
===
state
.
environments
.
current
,
);
return
Boolean
(
environment
?.
enable_advanced_logs_querying
);
}
const
managedApp
=
state
.
managedApps
.
options
.
find
(
({
name
})
=>
name
===
state
.
managedApps
.
current
,
const
environment
=
state
.
environments
.
options
.
find
(
({
name
})
=>
name
===
state
.
environments
.
current
,
);
return
Boolean
(
managedApp
?.
enable_advanced_logs_querying
);
return
Boolean
(
environment
?.
enable_advanced_logs_querying
);
};
app/assets/javascripts/logs/stores/mutation_types.js
View file @
71df6576
...
...
@@ -13,9 +13,6 @@ export const RECEIVE_ENVIRONMENTS_DATA_SUCCESS = 'RECEIVE_ENVIRONMENTS_DATA_SUCC
export
const
RECEIVE_ENVIRONMENTS_DATA_ERROR
=
'
RECEIVE_ENVIRONMENTS_DATA_ERROR
'
;
export
const
HIDE_REQUEST_ENVIRONMENTS_ERROR
=
'
HIDE_REQUEST_ENVIRONMENTS_ERROR
'
;
export
const
RECEIVE_MANAGED_APPS_DATA_SUCCESS
=
'
RECEIVE_MANAGED_APPS_DATA_SUCCESS
'
;
export
const
RECEIVE_MANAGED_APPS_DATA_ERROR
=
'
RECEIVE_MANAGED_APPS_DATA_ERROR
'
;
export
const
REQUEST_LOGS_DATA
=
'
REQUEST_LOGS_DATA
'
;
export
const
RECEIVE_LOGS_DATA_SUCCESS
=
'
RECEIVE_LOGS_DATA_SUCCESS
'
;
export
const
RECEIVE_LOGS_DATA_ERROR
=
'
RECEIVE_LOGS_DATA_ERROR
'
;
...
...
app/assets/javascripts/logs/stores/mutations.js
View file @
71df6576
...
...
@@ -32,9 +32,6 @@ export default {
// Clear current pod options
state
.
pods
.
current
=
null
;
state
.
pods
.
options
=
[];
// Clear current managedApps options
state
.
managedApps
.
current
=
null
;
},
[
types
.
REQUEST_ENVIRONMENTS_DATA
](
state
)
{
state
.
environments
.
options
=
[];
...
...
@@ -110,26 +107,4 @@ export default {
[
types
.
RECEIVE_PODS_DATA_ERROR
](
state
)
{
state
.
pods
.
options
=
[];
},
// Managed apps data
[
types
.
RECEIVE_MANAGED_APPS_DATA_SUCCESS
](
state
,
apps
)
{
state
.
managedApps
.
options
=
apps
.
filter
(
({
gitlab_managed_apps_logs_path
})
=>
gitlab_managed_apps_logs_path
,
// eslint-disable-line babel/camelcase
);
state
.
managedApps
.
isLoading
=
false
;
},
[
types
.
RECEIVE_MANAGED_APPS_DATA_ERROR
](
state
)
{
state
.
managedApps
.
options
=
[];
state
.
managedApps
.
isLoading
=
false
;
state
.
managedApps
.
fetchError
=
true
;
},
[
types
.
SET_MANAGED_APP
](
state
,
managedApp
)
{
state
.
managedApps
.
current
=
managedApp
;
// Clear current pod options
state
.
pods
.
current
=
null
;
state
.
pods
.
options
=
[];
// Clear current environment options
state
.
environments
.
current
=
null
;
},
};
app/assets/javascripts/logs/stores/state.js
View file @
71df6576
...
...
@@ -30,16 +30,6 @@ export default () => ({
fetchError
:
false
,
},
/**
* Managed apps list information
*/
managedApps
:
{
options
:
[],
isLoading
:
false
,
current
:
null
,
fetchError
:
false
,
},
/**
* Logs including trace
*/
...
...
locale/gitlab.pot
View file @
71df6576
...
...
@@ -12562,9 +12562,6 @@ msgstr ""
msgid "Environments|Logs from %{start} to %{end}."
msgstr ""
msgid "Environments|Managed apps"
msgstr ""
msgid "Environments|More information"
msgstr ""
...
...
spec/features/projects/environments_pod_logs_spec.rb
View file @
71df6576
...
...
@@ -40,7 +40,7 @@ RSpec.describe 'Environment > Pod Logs', :js, :kubeclient do
dropdown_items
=
find
(
".dropdown-menu"
).
all
(
".dropdown-item"
)
expect
(
dropdown_items
.
first
).
to
have_content
(
environment
.
name
)
expect
(
dropdown_items
.
size
).
to
eq
(
3
)
expect
(
dropdown_items
.
size
).
to
eq
(
2
)
end
end
...
...
spec/frontend/logs/components/environment_logs_spec.js
View file @
71df6576
...
...
@@ -12,7 +12,6 @@ import {
mockTrace
,
mockEnvironmentsEndpoint
,
mockDocumentationPath
,
mockManagedAppsEndpoint
,
}
from
'
../mock_data
'
;
jest
.
mock
(
'
~/lib/utils/scroll_utils
'
);
...
...
@@ -35,7 +34,7 @@ describe('EnvironmentLogs', () => {
environmentName
:
mockEnvName
,
environmentsPath
:
mockEnvironmentsEndpoint
,
clusterApplicationsDocumentationPath
:
mockDocumentationPath
,
clustersPath
:
mockManagedAppsEndpoint
,
clustersPath
:
'
/gitlab-org
'
,
};
const
updateControlBtnsMock
=
jest
.
fn
();
...
...
spec/frontend/logs/mock_data.js
View file @
71df6576
...
...
@@ -7,8 +7,6 @@ export const mockDocumentationPath = '/documentation.md';
export
const
mockLogsEndpoint
=
'
/dummy_logs_path.json
'
;
export
const
mockCursor
=
'
MOCK_CURSOR
'
;
export
const
mockNextCursor
=
'
MOCK_NEXT_CURSOR
'
;
export
const
mockManagedAppName
=
'
kubernetes-cluster-1
'
;
export
const
mockManagedAppsEndpoint
=
`
${
mockProjectPath
}
/clusters.json`
;
const
makeMockEnvironment
=
(
id
,
name
,
advancedQuerying
)
=>
({
id
,
...
...
@@ -25,31 +23,6 @@ export const mockEnvironments = [
makeMockEnvironment
(
102
,
'
review/a-feature
'
,
false
),
];
export
const
mockManagedApps
=
[
{
cluster_type
:
'
project_type
'
,
enabled
:
true
,
environment_scope
:
'
*
'
,
name
:
'
kubernetes-cluster-1
'
,
provider_type
:
'
user
'
,
status
:
'
connected
'
,
path
:
'
/root/autodevops-deploy/-/clusters/15
'
,
gitlab_managed_apps_logs_path
:
'
/root/autodevops-deploy/-/logs?cluster_id=15
'
,
enable_advanced_logs_querying
:
true
,
},
{
cluster_type
:
'
project_type
'
,
enabled
:
true
,
environment_scope
:
'
*
'
,
name
:
'
kubernetes-cluster-2
'
,
provider_type
:
'
user
'
,
status
:
'
connected
'
,
path
:
'
/root/autodevops-deploy/-/clusters/16
'
,
gitlab_managed_apps_logs_path
:
null
,
enable_advanced_logs_querying
:
false
,
},
];
export
const
mockPodName
=
'
production-764c58d697-aaaaa
'
;
export
const
mockPods
=
[
mockPodName
,
...
...
spec/frontend/logs/stores/actions_spec.js
View file @
71df6576
...
...
@@ -11,7 +11,6 @@ import {
fetchEnvironments
,
fetchLogs
,
fetchMoreLogsPrepend
,
fetchManagedApps
,
}
from
'
~/logs/stores/actions
'
;
import
*
as
types
from
'
~/logs/stores/mutation_types
'
;
import
logsPageState
from
'
~/logs/stores/state
'
;
...
...
@@ -31,8 +30,6 @@ import {
mockResponse
,
mockCursor
,
mockNextCursor
,
mockManagedApps
,
mockManagedAppsEndpoint
,
}
from
'
../mock_data
'
;
jest
.
mock
(
'
~/flash
'
);
...
...
@@ -219,30 +216,6 @@ describe('Logs Store actions', () => {
});
});
describe
(
'
fetchManagedApps
'
,
()
=>
{
beforeEach
(()
=>
{
mock
=
new
MockAdapter
(
axios
);
});
it
(
'
should commit RECEIVE_MANAGED_APPS_DATA_SUCCESS mutation on succesful fetch
'
,
()
=>
{
mock
.
onGet
(
mockManagedAppsEndpoint
).
replyOnce
(
200
,
{
clusters
:
mockManagedApps
});
return
testAction
(
fetchManagedApps
,
mockManagedAppsEndpoint
,
state
,
[
{
type
:
types
.
RECEIVE_MANAGED_APPS_DATA_SUCCESS
,
payload
:
mockManagedApps
},
]);
});
it
(
'
should commit RECEIVE_MANAGED_APPS_DATA_ERROR on wrong data
'
,
()
=>
{
mock
.
onGet
(
mockManagedAppsEndpoint
).
replyOnce
(
500
);
return
testAction
(
fetchManagedApps
,
mockManagedAppsEndpoint
,
state
,
[{
type
:
types
.
RECEIVE_MANAGED_APPS_DATA_ERROR
}],
[],
);
});
});
describe
(
'
when the backend responds succesfully
'
,
()
=>
{
let
expectedMutations
;
let
expectedActions
;
...
...
spec/frontend/logs/stores/getters_spec.js
View file @
71df6576
import
{
trace
,
showAdvancedFilters
}
from
'
~/logs/stores/getters
'
;
import
logsPageState
from
'
~/logs/stores/state
'
;
import
{
mockLogsResult
,
mockTrace
,
mockEnvName
,
mockEnvironments
,
mockManagedApps
,
mockManagedAppName
,
}
from
'
../mock_data
'
;
import
{
mockLogsResult
,
mockTrace
,
mockEnvName
,
mockEnvironments
}
from
'
../mock_data
'
;
describe
(
'
Logs Store getters
'
,
()
=>
{
let
state
;
...
...
@@ -79,43 +72,4 @@ describe('Logs Store getters', () => {
});
});
});
describe
(
'
when no managedApps are set
'
,
()
=>
{
beforeEach
(()
=>
{
state
.
environments
.
current
=
null
;
state
.
environments
.
options
=
[];
state
.
managedApps
.
current
=
mockManagedAppName
;
state
.
managedApps
.
options
=
[];
});
it
(
'
returns false
'
,
()
=>
{
expect
(
showAdvancedFilters
(
state
)).
toBe
(
false
);
});
});
describe
(
'
when the managedApp supports filters
'
,
()
=>
{
beforeEach
(()
=>
{
state
.
environments
.
current
=
null
;
state
.
environments
.
options
=
mockEnvironments
;
state
.
managedApps
.
current
=
mockManagedAppName
;
state
.
managedApps
.
options
=
mockManagedApps
;
});
it
(
'
returns true
'
,
()
=>
{
expect
(
showAdvancedFilters
(
state
)).
toBe
(
true
);
});
});
describe
(
'
when the managedApp does not support filters
'
,
()
=>
{
beforeEach
(()
=>
{
state
.
environments
.
current
=
null
;
state
.
environments
.
options
=
mockEnvironments
;
state
.
managedApps
.
options
=
mockManagedApps
;
state
.
managedApps
.
current
=
mockManagedApps
[
1
].
name
;
});
it
(
'
returns false
'
,
()
=>
{
expect
(
showAdvancedFilters
(
state
)).
toBe
(
false
);
});
});
});
spec/frontend/logs/stores/mutations_spec.js
View file @
71df6576
...
...
@@ -11,8 +11,6 @@ import {
mockSearch
,
mockCursor
,
mockNextCursor
,
mockManagedApps
,
mockManagedAppName
,
}
from
'
../mock_data
'
;
describe
(
'
Logs Store Mutations
'
,
()
=>
{
...
...
@@ -32,15 +30,6 @@ describe('Logs Store Mutations', () => {
it
(
'
sets the environment
'
,
()
=>
{
mutations
[
types
.
SET_PROJECT_ENVIRONMENT
](
state
,
mockEnvName
);
expect
(
state
.
environments
.
current
).
toEqual
(
mockEnvName
);
expect
(
state
.
managedApps
.
current
).
toBe
(
null
);
});
});
describe
(
'
SET_MANAGED_APP
'
,
()
=>
{
it
(
'
sets the managed app
'
,
()
=>
{
mutations
[
types
.
SET_MANAGED_APP
](
state
,
mockManagedAppName
);
expect
(
state
.
managedApps
.
current
).
toBe
(
mockManagedAppName
);
expect
(
state
.
environments
.
current
).
toBe
(
null
);
});
});
...
...
@@ -265,29 +254,4 @@ describe('Logs Store Mutations', () => {
);
});
});
describe
(
'
RECEIVE_MANAGED_APPS_DATA_SUCCESS
'
,
()
=>
{
it
(
'
receives managed apps data success
'
,
()
=>
{
expect
(
state
.
managedApps
.
options
).
toEqual
([]);
mutations
[
types
.
RECEIVE_MANAGED_APPS_DATA_SUCCESS
](
state
,
mockManagedApps
);
expect
(
state
.
managedApps
.
options
.
length
).
toEqual
(
1
);
expect
(
state
.
managedApps
.
options
).
toEqual
([
mockManagedApps
[
0
]]);
expect
(
state
.
managedApps
.
isLoading
).
toBe
(
false
);
});
});
describe
(
'
RECEIVE_MANAGED_APPS_DATA_ERROR
'
,
()
=>
{
it
(
'
received managed apps data error
'
,
()
=>
{
mutations
[
types
.
RECEIVE_MANAGED_APPS_DATA_ERROR
](
state
);
expect
(
state
.
managedApps
).
toEqual
({
options
:
[],
isLoading
:
false
,
current
:
null
,
fetchError
:
true
,
});
});
});
});
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