Commit ba729a82 authored by Tim Zallmann's avatar Tim Zallmann

Merge branch 'ee-ch-gitlab-ui-progress-bar' into 'master'

Replace issues time tracking progress bar with gitlab-ui's progress bar (EE)

See merge request gitlab-org/gitlab-ee!6666
parents 6644041e b1ab5c2e
import Vue from 'vue';
import progressBar from '@gitlab-org/gitlab-ui/dist/base/progress_bar';
Vue.component('gl-progress-bar', progressBar);
......@@ -3,4 +3,5 @@ import './polyfills';
import './jquery';
import './bootstrap';
import './vue';
import './gitlab_ui';
import '../lib/utils/axios_utils';
......@@ -42,11 +42,14 @@ export default {
return this.timeEstimate - this.timeSpent;
},
timeRemainingPercent() {
return `${Math.floor((this.timeSpent / this.timeEstimate) * 100)}%`;
return Math.floor((this.timeSpent / this.timeEstimate) * 100);
},
timeRemainingStatusClass() {
return this.timeEstimate >= this.timeSpent ? 'within_estimate' : 'over_estimate';
},
progressBarVariant() {
return this.timeRemainingPercent > 100 ? 'danger' : 'primary';
},
},
};
</script>
......@@ -59,16 +62,10 @@ export default {
:class="timeRemainingStatusClass"
class="compare-meter"
>
<div
:aria-valuenow="timeRemainingPercent"
class="meter-container"
>
<div
:style="{ width: timeRemainingPercent }"
class="meter-fill"
>
</div>
</div>
<gl-progress-bar
:value="timeRemainingPercent"
:variant="progressBarVariant"
/>
<div class="compare-display-container">
<div class="compare-display float-left">
<span class="compare-label">
......
......@@ -374,11 +374,14 @@ img.emoji {
margin-right: 10px;
}
.alert,
.progress {
.alert {
margin-bottom: $gl-padding;
}
.progress {
height: 4px;
}
.project-item-select-holder {
display: inline-block;
position: relative;
......
......@@ -848,17 +848,7 @@
}
.compare-meter {
&.within_estimate {
.meter-fill {
background: $gl-primary;
}
}
&.over_estimate {
.meter-fill {
background: $red-500;
}
.time-remaining,
.compare-value.spent {
color: $red-500;
......
......@@ -540,3 +540,9 @@
:why: https://github.com/xtuc/webassemblyjs/blob/master/LICENSE
:versions: []
:when: 2018-06-08 05:30:56.764116000 Z
- - :approve
- "@gitlab-org/gitlab-ui"
- :who: Clement Ho
:why: Our own library
:versions: []
:when: 2018-07-17 21:02:54.529227000 Z
......@@ -19,6 +19,7 @@
},
"dependencies": {
"@gitlab-org/gitlab-svgs": "^1.26.0",
"@gitlab-org/gitlab-ui": "1.0.5",
"autosize": "^4.0.0",
"axios": "^0.17.1",
"babel-core": "^6.26.3",
......
import $ from 'jquery';
import Vue from 'vue';
import TimeTracker from '~/sidebar/components/time_tracking/time_tracker.vue';
......@@ -94,21 +93,14 @@ describe('Issuable Time Tracker', () => {
describe('Remaining meter', () => {
it('should display the remaining meter with the correct width', done => {
Vue.nextTick(() => {
const meterWidth = vm.$el.querySelector('.time-tracking-comparison-pane .meter-fill')
.style.width;
const correctWidth = '5%';
expect(meterWidth).toBe(correctWidth);
expect(vm.$el.querySelector('.time-tracking-comparison-pane .progress[value="5"]')).not.toBeNull();
done();
});
});
it('should display the remaining meter with the correct background color when within estimate', done => {
Vue.nextTick(() => {
const styledMeter = $(vm.$el).find(
'.time-tracking-comparison-pane .within_estimate .meter-fill',
);
expect(styledMeter.length).toBe(1);
expect(vm.$el.querySelector('.time-tracking-comparison-pane .progress[variant="primary"]')).not.toBeNull();
done();
});
});
......@@ -117,10 +109,7 @@ describe('Issuable Time Tracker', () => {
vm.time_estimate = 100000;
vm.time_spent = 20000000;
Vue.nextTick(() => {
const styledMeter = $(vm.$el).find(
'.time-tracking-comparison-pane .over_estimate .meter-fill',
);
expect(styledMeter.length).toBe(1);
expect(vm.$el.querySelector('.time-tracking-comparison-pane .progress[variant="danger"]')).not.toBeNull();
done();
});
});
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment