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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
f632ae68
Commit
f632ae68
authored
Jan 15, 2018
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
StackedProgressBar Component
parent
74f2f9b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
127 additions
and
0 deletions
+127
-0
app/assets/javascripts/vue_shared/components/stacked_progress_bar.vue
...avascripts/vue_shared/components/stacked_progress_bar.vue
+127
-0
No files found.
app/assets/javascripts/vue_shared/components/stacked_progress_bar.vue
0 → 100644
View file @
f632ae68
<
script
>
import
tooltip
from
'
~/vue_shared/directives/tooltip
'
;
export
default
{
directives
:
{
tooltip
,
},
props
:
{
cssClass
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
successLabel
:
{
type
:
String
,
required
:
true
,
},
failureLabel
:
{
type
:
String
,
required
:
true
,
},
neutralLabel
:
{
type
:
String
,
required
:
true
,
},
successCount
:
{
type
:
Number
,
required
:
true
,
},
failureCount
:
{
type
:
Number
,
required
:
true
,
},
totalCount
:
{
type
:
Number
,
required
:
true
,
},
},
computed
:
{
neutralCount
()
{
return
this
.
totalCount
-
this
.
successCount
-
this
.
failureCount
;
},
successPercent
()
{
return
this
.
getPercent
(
this
.
successCount
);
},
successBarStyle
()
{
return
this
.
barStyle
(
this
.
successPercent
);
},
successTooltip
()
{
return
this
.
getTooltip
(
this
.
successLabel
,
this
.
successCount
);
},
failurePercent
()
{
return
this
.
getPercent
(
this
.
failureCount
);
},
failureBarStyle
()
{
return
this
.
barStyle
(
this
.
failurePercent
);
},
failureTooltip
()
{
return
this
.
getTooltip
(
this
.
failureLabel
,
this
.
failureCount
);
},
neutralPercent
()
{
return
this
.
getPercent
(
this
.
neutralCount
);
},
neutralBarStyle
()
{
return
this
.
barStyle
(
this
.
neutralPercent
);
},
neutralTooltip
()
{
return
this
.
getTooltip
(
this
.
neutralLabel
,
this
.
neutralCount
);
},
},
methods
:
{
getPercent
(
count
)
{
return
Math
.
ceil
((
count
/
this
.
totalCount
)
*
100
);
},
barStyle
(
percent
)
{
return
`width:
${
percent
}
%;`
;
},
getTooltip
(
label
,
count
)
{
return
`
${
label
}
:
${
count
}
`
;
},
},
};
</
script
>
<
template
>
<div
class=
"stacked-progress-bar"
:class=
"cssClass"
>
<span
v-if=
"!totalCount"
class=
"status-unavailable"
>
{{
__
(
"
Not available
"
)
}}
</span>
<span
v-tooltip
v-if=
"successPercent"
class=
"status-green"
data-placement=
"bottom"
:title=
"successTooltip"
:style=
"successBarStyle"
>
{{
successPercent
}}
%
</span>
<span
v-tooltip
v-if=
"neutralPercent"
class=
"status-neutral"
data-placement=
"bottom"
:title=
"neutralTooltip"
:style=
"neutralBarStyle"
>
{{
neutralPercent
}}
%
</span>
<span
v-tooltip
v-if=
"failurePercent"
class=
"status-red"
data-placement=
"bottom"
:title=
"failureTooltip"
:style=
"failureBarStyle"
>
{{
failurePercent
}}
%
</span>
</div>
</
template
>
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