Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
b9120c77
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
b9120c77
编写于
3月 20, 2017
作者:
J
Jose Ivan Vargas Lopez
提交者:
Alfredo Sumaran
3月 20, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Removed d3.js from the main application.js bundle
上级
5bdab11f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
32 addition
and
21 deletion
+32
-21
app/assets/javascripts/dispatcher.js
app/assets/javascripts/dispatcher.js
+0
-3
app/assets/javascripts/monitoring/monitoring_bundle.js
app/assets/javascripts/monitoring/monitoring_bundle.js
+6
-0
app/assets/javascripts/monitoring/prometheus_graph.js
app/assets/javascripts/monitoring/prometheus_graph.js
+17
-17
app/views/projects/environments/metrics.html.haml
app/views/projects/environments/metrics.html.haml
+3
-0
changelogs/unreleased/fix-prometheus-including-d3-main-bundle.yml
...gs/unreleased/fix-prometheus-including-d3-main-bundle.yml
+4
-0
config/webpack.config.js
config/webpack.config.js
+2
-1
未找到文件。
app/assets/javascripts/dispatcher.js
浏览文件 @
b9120c77
import
PrometheusGraph
from
'
./monitoring/prometheus_graph
'
;
// TODO: Maybe Make this a bundle
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-arrow-callback, wrap-iife, no-shadow, consistent-return, one-var, one-var-declaration-per-line, camelcase, default-case, no-new, quotes, no-duplicate-case, no-case-declarations, no-fallthrough, max-len */
/* global UsernameValidator */
/* global ActiveTabMemoizer */
...
...
@@ -329,8 +328,6 @@ const UserCallout = require('./user_callout');
case
'
ci:lints:show
'
:
new
gl
.
CILintEditor
();
break
;
case
'
projects:environments:metrics
'
:
new
PrometheusGraph
();
case
'
users:show
'
:
new
UserCallout
();
break
;
...
...
app/assets/javascripts/monitoring/monitoring_bundle.js
0 → 100644
浏览文件 @
b9120c77
import
PrometheusGraph
from
'
./prometheus_graph
'
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
function
onLoad
()
{
document
.
removeEventListener
(
'
DOMContentLoaded
'
,
onLoad
,
false
);
return
new
PrometheusGraph
();
},
false
);
app/assets/javascripts/monitoring/prometheus_graph.js
浏览文件 @
b9120c77
...
...
@@ -2,10 +2,9 @@
/* global Flash */
import
d3
from
'
d3
'
;
import
_
from
'
underscore
'
;
import
statusCodes
from
'
~/lib/utils/http_status
'
;
import
'
~
/lib/utils/common_utils
'
;
import
'
~
/flash
'
;
import
'
..
/lib/utils/common_utils
'
;
import
'
..
/flash
'
;
const
prometheusGraphsContainer
=
'
.prometheus-graph
'
;
const
metricsEndpoint
=
'
metrics.json
'
;
...
...
@@ -31,22 +30,21 @@ class PrometheusGraph {
}
createGraph
()
{
const
self
=
this
;
_
.
each
(
this
.
data
,
(
value
,
key
)
=>
{
if
(
value
.
length
>
0
&&
(
key
===
'
cpu_values
'
||
key
===
'
memory_values
'
)
)
{
self
.
plotValues
(
value
,
key
);
Object
.
keys
(
this
.
data
).
forEach
((
key
)
=>
{
const
value
=
this
.
data
[
key
];
if
(
value
.
length
>
0
)
{
this
.
plotValues
(
value
,
key
);
}
});
}
init
()
{
const
self
=
this
;
this
.
getData
().
then
((
metricsResponse
)
=>
{
if
(
metricsResponse
===
{}
)
{
if
(
Object
.
keys
(
metricsResponse
).
length
===
0
)
{
new
Flash
(
'
Empty metrics
'
,
'
alert
'
);
}
else
{
self
.
transformData
(
metricsResponse
);
self
.
createGraph
();
this
.
transformData
(
metricsResponse
);
this
.
createGraph
();
}
});
}
...
...
@@ -321,12 +319,14 @@ class PrometheusGraph {
transformData
(
metricsResponse
)
{
const
metricTypes
=
{};
_
.
each
(
metricsResponse
.
metrics
,
(
value
,
key
)
=>
{
const
metricValues
=
value
[
0
].
values
;
metricTypes
[
key
]
=
_
.
map
(
metricValues
,
metric
=>
({
time
:
new
Date
(
metric
[
0
]
*
1000
),
value
:
metric
[
1
],
}));
Object
.
keys
(
metricsResponse
.
metrics
).
forEach
((
key
)
=>
{
if
(
key
===
'
cpu_values
'
||
key
===
'
memory_values
'
)
{
const
metricValues
=
(
metricsResponse
.
metrics
[
key
])[
0
];
metricTypes
[
key
]
=
metricValues
.
values
.
map
(
metric
=>
({
time
:
new
Date
(
metric
[
0
]
*
1000
),
value
:
metric
[
1
],
}));
}
});
this
.
data
=
metricTypes
;
}
...
...
app/views/projects/environments/metrics.html.haml
浏览文件 @
b9120c77
-
@no_container
=
true
-
page_title
"Metrics for environment"
,
@environment
.
name
-
content_for
:page_specific_javascripts
do
=
page_specific_javascript_bundle_tag
(
'common_d3'
)
=
page_specific_javascript_bundle_tag
(
'monitoring'
)
=
render
"projects/pipelines/head"
%div
{
class:
container_class
}
...
...
changelogs/unreleased/fix-prometheus-including-d3-main-bundle.yml
0 → 100644
浏览文件 @
b9120c77
---
title
:
Removed d3 from the main application.js bundle
merge_request
:
10062
author
:
config/webpack.config.js
浏览文件 @
b9120c77
...
...
@@ -35,6 +35,7 @@ var config = {
issuable
:
'
./issuable/issuable_bundle.js
'
,
merge_conflicts
:
'
./merge_conflicts/merge_conflicts_bundle.js
'
,
merge_request_widget
:
'
./merge_request_widget/ci_bundle.js
'
,
monitoring
:
'
./monitoring/monitoring_bundle.js
'
,
network
:
'
./network/network_bundle.js
'
,
profile
:
'
./profile/profile_bundle.js
'
,
protected_branches
:
'
./protected_branches/protected_branches_bundle.js
'
,
...
...
@@ -120,7 +121,7 @@ var config = {
// create cacheable common library bundle for all d3 chunks
new
webpack
.
optimize
.
CommonsChunkPlugin
({
name
:
'
common_d3
'
,
chunks
:
[
'
graphs
'
,
'
users
'
],
chunks
:
[
'
graphs
'
,
'
users
'
,
'
monitoring
'
],
}),
// create cacheable common library bundles
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录