Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
d303b5ba
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,发现更多精彩内容 >>
提交
d303b5ba
编写于
4月 06, 2018
作者:
J
Jose Ivan Vargas
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added specs for rendered output, changed the background for stable tracks
上级
89c8bd4e
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
73 addition
and
14 deletion
+73
-14
app/assets/javascripts/monitoring/components/graph/axis.vue
app/assets/javascripts/monitoring/components/graph/axis.vue
+6
-1
app/assets/javascripts/monitoring/components/graph/legend.vue
...assets/javascripts/monitoring/components/graph/legend.vue
+11
-1
app/assets/javascripts/monitoring/components/graph/track_line.vue
...ts/javascripts/monitoring/components/graph/track_line.vue
+5
-5
app/assets/stylesheets/framework/variables.scss
app/assets/stylesheets/framework/variables.scss
+5
-0
app/assets/stylesheets/pages/environments.scss
app/assets/stylesheets/pages/environments.scss
+9
-0
spec/javascripts/monitoring/graph/track_info_spec.js
spec/javascripts/monitoring/graph/track_info_spec.js
+13
-0
spec/javascripts/monitoring/graph/track_line_spec.js
spec/javascripts/monitoring/graph/track_line_spec.js
+24
-7
未找到文件。
app/assets/javascripts/monitoring/components/graph/axis.vue
浏览文件 @
d303b5ba
<
script
>
import
{
convertToSentenceCase
}
from
'
~/lib/utils/text_utility
'
;
import
{
s__
}
from
'
~/locale
'
;
export
default
{
props
:
{
...
...
@@ -74,6 +75,10 @@ export default {
yAxisLabelSentenceCase
()
{
return
`
${
convertToSentenceCase
(
this
.
yAxisLabel
)}
(
${
this
.
unitOfDisplay
}
)`
;
},
timeString
()
{
return
s__
(
'
PrometheusDashboard|Time
'
);
},
},
mounted
()
{
this
.
$nextTick
(()
=>
{
...
...
@@ -131,7 +136,7 @@ export default {
:y=
"yPosition"
dy=
".35em"
>
Time
{{
timeString
}}
</text>
</g>
</
template
>
app/assets/javascripts/monitoring/components/graph/legend.vue
浏览文件 @
d303b5ba
...
...
@@ -17,6 +17,13 @@ export default {
required
:
true
,
},
},
methods
:
{
isStable
(
track
)
{
return
{
'
prometheus-table-row-highlight
'
:
track
.
trackName
!==
'
Canary
'
&&
track
.
renderCanary
,
};
},
},
};
</
script
>
<
template
>
...
...
@@ -26,6 +33,7 @@ export default {
v-for=
"(series, index) in timeSeries"
:key=
"index"
v-if=
"series.shouldRenderLegend"
:class=
"isStable(series)"
>
<td>
<strong
v-if=
"series.renderCanary"
>
{{
series
.
trackName
}}
</strong>
...
...
@@ -53,7 +61,9 @@ export default {
:track=
"track"
:key=
"`track-line-$
{trackIndex}`"/>
<td
:key=
"`track-info-$
{trackIndex}`">
<track-info
:track=
"track"
/>
<track-info
class=
"legend-metric-title"
:track=
"track"
/>
</td>
</
template
>
</tr>
...
...
app/assets/javascripts/monitoring/components/graph/track_line.vue
浏览文件 @
d303b5ba
...
...
@@ -7,10 +7,10 @@ export default {
required
:
true
,
},
},
methods
:
{
st
rokeDashArray
(
type
)
{
if
(
t
yp
e
===
'
dashed
'
)
return
'
6, 3
'
;
if
(
t
yp
e
===
'
dotted
'
)
return
'
3, 3
'
;
computed
:
{
st
ylizedLine
(
)
{
if
(
t
his
.
track
.
lineStyl
e
===
'
dashed
'
)
return
'
6, 3
'
;
if
(
t
his
.
track
.
lineStyl
e
===
'
dotted
'
)
return
'
3, 3
'
;
return
null
;
},
},
...
...
@@ -22,7 +22,7 @@ export default {
width=
"15"
height=
"6"
>
<line
:stroke-dasharray=
"st
rokeDashArray(track.lineStyle)
"
:stroke-dasharray=
"st
ylizedLine
"
:stroke=
"track.lineColor"
stroke-width=
"4"
:x1=
"0"
...
...
app/assets/stylesheets/framework/variables.scss
浏览文件 @
d303b5ba
...
...
@@ -767,3 +767,8 @@ $border-color-settings: #e1e1e1;
Modals
*/
$modal-body-height
:
134px
;
/*
Prometheus
*/
$prometheus-table-row-highlight-color
:
$theme-gray-100
;
app/assets/stylesheets/pages/environments.scss
浏览文件 @
d303b5ba
...
...
@@ -321,6 +321,11 @@
vertical-align
:
top
;
}
}
.legend-metric-title
{
font-size
:
12px
;
vertical-align
:
middle
;
}
}
.prometheus-svg-container
{
...
...
@@ -409,3 +414,7 @@
}
}
}
.prometheus-table-row-highlight
{
background-color
:
$prometheus-table-row-highlight-color
;
}
spec/javascripts/monitoring/graph/track_info_spec.js
浏览文件 @
d303b5ba
...
...
@@ -28,4 +28,17 @@ describe('TrackInfo component', () => {
expect
(
vm
.
summaryMetrics
).
toEqual
(
'
Avg: 0.000 · Max: 0.000
'
);
});
});
describe
(
'
Rendered output
'
,
()
=>
{
beforeEach
(()
=>
{
vm
=
mountComponent
(
Component
,
{
track
:
timeSeries
[
0
]
});
});
it
(
'
contains metric tag and the summary metrics
'
,
()
=>
{
const
metricTag
=
vm
.
$el
.
querySelector
(
'
strong
'
);
expect
(
metricTag
.
textContent
.
trim
()).
toEqual
(
vm
.
track
.
metricTag
);
expect
(
vm
.
$el
.
textContent
).
toContain
(
'
Avg: 0.000 · Max: 0.000
'
);
});
});
});
spec/javascripts/monitoring/graph/track_line_spec.js
浏览文件 @
d303b5ba
...
...
@@ -20,16 +20,33 @@ describe('TrackLine component', () => {
});
describe
(
'
Computed props
'
,
()
=>
{
beforeEach
(()
=>
{
vm
=
mountComponent
(
Component
,
{
track
:
timeSeries
[
0
]
});
it
(
'
stylizedLine for dashed lineStyles
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
track
:
{
...
timeSeries
[
0
],
lineStyle
:
'
dashed
'
}
});
expect
(
vm
.
stylizedLine
).
toEqual
(
'
6, 3
'
);
});
it
(
'
stylizedLine for dotted lineStyles
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
track
:
{
...
timeSeries
[
0
],
lineStyle
:
'
dotted
'
}
});
expect
(
vm
.
stylizedLine
).
toEqual
(
'
3, 3
'
);
});
});
describe
(
'
Rendered output
'
,
()
=>
{
it
(
'
has an svg with a line
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
track
:
{
...
timeSeries
[
0
]
}
});
const
svgEl
=
vm
.
$el
.
querySelector
(
'
svg
'
);
const
lineEl
=
vm
.
$el
.
querySelector
(
'
svg line
'
);
it
(
'
strokeDashArray
'
,
()
=>
{
const
dashedArray
=
vm
.
strokeDashArray
(
'
dashed
'
);
const
dottedArray
=
vm
.
strokeDashArray
(
'
dotted
'
);
expect
(
svgEl
.
getAttribute
(
'
width
'
)).
toEqual
(
'
15
'
);
expect
(
svgEl
.
getAttribute
(
'
height
'
)).
toEqual
(
'
6
'
);
expect
(
dashedArray
).
toEqual
(
'
6, 3
'
);
expect
(
dottedArray
).
toEqual
(
'
3, 3
'
);
expect
(
lineEl
.
getAttribute
(
'
stroke-width
'
)).
toEqual
(
'
4
'
);
expect
(
lineEl
.
getAttribute
(
'
x1
'
)).
toEqual
(
'
0
'
);
expect
(
lineEl
.
getAttribute
(
'
x2
'
)).
toEqual
(
'
15
'
);
expect
(
lineEl
.
getAttribute
(
'
y1
'
)).
toEqual
(
'
2
'
);
expect
(
lineEl
.
getAttribute
(
'
y2
'
)).
toEqual
(
'
2
'
);
});
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录