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
4ac53a1a
Commit
4ac53a1a
authored
Mar 06, 2018
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coerce hasMetrics to a boolean value before instantiating the Vue component
parent
e761e6e1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
9 deletions
+12
-9
app/assets/javascripts/monitoring/components/dashboard.vue
app/assets/javascripts/monitoring/components/dashboard.vue
+4
-4
app/assets/javascripts/monitoring/monitoring_bundle.js
app/assets/javascripts/monitoring/monitoring_bundle.js
+5
-1
ee/app/views/projects/clusters/_health.html.haml
ee/app/views/projects/clusters/_health.html.haml
+1
-2
spec/javascripts/monitoring/dashboard_spec.js
spec/javascripts/monitoring/dashboard_spec.js
+2
-2
No files found.
app/assets/javascripts/monitoring/components/dashboard.vue
View file @
4ac53a1a
...
...
@@ -7,7 +7,6 @@
import
EmptyState
from
'
./empty_state.vue
'
;
import
MonitoringStore
from
'
../stores/monitoring_store
'
;
import
eventHub
from
'
../event_hub
'
;
import
{
convertPermissionToBoolean
}
from
'
../../lib/utils/common_utils
'
;
export
default
{
components
:
{
...
...
@@ -18,8 +17,9 @@
props
:
{
hasMetrics
:
{
type
:
String
,
required
:
true
,
type
:
Boolean
,
required
:
false
,
default
:
true
,
},
showLegend
:
{
type
:
Boolean
,
...
...
@@ -108,7 +108,7 @@
mounted
()
{
this
.
resizeThrottled
=
_
.
throttle
(
this
.
resize
,
600
);
if
(
!
convertPermissionToBoolean
(
this
.
hasMetrics
)
)
{
if
(
!
this
.
hasMetrics
)
{
this
.
state
=
'
gettingStarted
'
;
}
else
{
this
.
getGraphsData
();
...
...
app/assets/javascripts/monitoring/monitoring_bundle.js
View file @
4ac53a1a
import
Vue
from
'
vue
'
;
import
{
convertPermissionToBoolean
}
from
'
~/lib/utils/common_utils
'
;
import
Dashboard
from
'
./components/dashboard.vue
'
;
export
default
()
=>
{
...
...
@@ -10,7 +11,10 @@ export default () => {
el
,
render
(
createElement
)
{
return
createElement
(
Dashboard
,
{
props
:
el
.
dataset
,
props
:
{
...
el
.
dataset
,
hasMetrics
:
convertPermissionToBoolean
(
el
.
dataset
.
hasMetrics
),
},
});
},
});
...
...
ee/app/views/projects/clusters/_health.html.haml
View file @
4ac53a1a
...
...
@@ -11,8 +11,7 @@
"empty-unable-to-connect-svg-path"
:
image_path
(
'illustrations/monitoring/unable_to_connect.svg'
),
"metrics-endpoint"
:
metrics_namespace_project_cluster_path
(
format: :json
),
"project-path"
:
project_path
(
@project
),
"tags-path"
:
project_tags_path
(
@project
),
"has-metrics"
:
"true"
}
}
"tags-path"
:
project_tags_path
(
@project
)
}
}
-
else
.settings-content
...
...
spec/javascripts/monitoring/dashboard_spec.js
View file @
4ac53a1a
...
...
@@ -9,7 +9,7 @@ describe('Dashboard', () => {
let
DashboardComponent
;
let
component
;
const
propsData
=
{
hasMetrics
:
'
false
'
,
hasMetrics
:
false
,
documentationPath
:
'
/path/to/docs
'
,
settingsPath
:
'
/path/to/settings
'
,
clustersPath
:
'
/path/to/clusters
'
,
...
...
@@ -58,7 +58,7 @@ describe('Dashboard', () => {
it
(
'
shows up a loading state
'
,
(
done
)
=>
{
component
=
new
DashboardComponent
({
el
:
document
.
querySelector
(
'
#prometheus-graphs
'
),
propsData
:
{
...
propsData
,
hasMetrics
:
'
true
'
},
propsData
:
{
...
propsData
,
hasMetrics
:
true
},
});
component
.
$mount
();
Vue
.
nextTick
(()
=>
{
...
...
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