Commit 580ae2c5 authored by Mark Florian's avatar Mark Florian

Merge branch '341163-webide-trace-job' into 'master'

Rename job trace to job log in webIDE component

See merge request gitlab-org/gitlab!70788
parents dab58c88 a79f8a13
...@@ -44,18 +44,18 @@ export default { ...@@ -44,18 +44,18 @@ export default {
methods: { methods: {
...mapActions('pipelines', ['fetchJobLogs', 'setDetailJob']), ...mapActions('pipelines', ['fetchJobLogs', 'setDetailJob']),
scrollDown() { scrollDown() {
if (this.$refs.buildTrace) { if (this.$refs.buildJobLog) {
this.$refs.buildTrace.scrollTo(0, this.$refs.buildTrace.scrollHeight); this.$refs.buildJobLog.scrollTo(0, this.$refs.buildJobLog.scrollHeight);
} }
}, },
scrollUp() { scrollUp() {
if (this.$refs.buildTrace) { if (this.$refs.buildJobLog) {
this.$refs.buildTrace.scrollTo(0, 0); this.$refs.buildJobLog.scrollTo(0, 0);
} }
}, },
scrollBuildLog: throttle(function buildLogScrollDebounce() { scrollBuildLog: throttle(function buildLogScrollDebounce() {
const { scrollTop } = this.$refs.buildTrace; const { scrollTop } = this.$refs.buildJobLog;
const { offsetHeight, scrollHeight } = this.$refs.buildTrace; const { offsetHeight, scrollHeight } = this.$refs.buildJobLog;
if (scrollTop + offsetHeight === scrollHeight) { if (scrollTop + offsetHeight === scrollHeight) {
this.scrollPos = scrollPositions.bottom; this.scrollPos = scrollPositions.bottom;
...@@ -97,7 +97,7 @@ export default { ...@@ -97,7 +97,7 @@ export default {
<scroll-button :disabled="isScrolledToBottom" direction="down" @click="scrollDown" /> <scroll-button :disabled="isScrolledToBottom" direction="down" @click="scrollDown" />
</div> </div>
</div> </div>
<pre ref="buildTrace" class="build-trace mb-0 h-100 mr-3" @scroll="scrollBuildLog"> <pre ref="buildJobLog" class="build-trace mb-0 h-100 mr-3" @scroll="scrollBuildLog">
<code <code
v-show="!detailJob.isLoading" v-show="!detailJob.isLoading"
class="bash" class="bash"
......
...@@ -41,7 +41,7 @@ describe('IDE jobs detail view', () => { ...@@ -41,7 +41,7 @@ describe('IDE jobs detail view', () => {
}); });
it('scrolls to bottom', () => { it('scrolls to bottom', () => {
expect(vm.$refs.buildTrace.scrollTo).toHaveBeenCalled(); expect(vm.$refs.buildJobLog.scrollTo).toHaveBeenCalled();
}); });
it('renders job output', () => { it('renders job output', () => {
...@@ -125,15 +125,15 @@ describe('IDE jobs detail view', () => { ...@@ -125,15 +125,15 @@ describe('IDE jobs detail view', () => {
beforeEach(() => { beforeEach(() => {
vm = vm.$mount(); vm = vm.$mount();
jest.spyOn(vm.$refs.buildTrace, 'scrollTo').mockImplementation(); jest.spyOn(vm.$refs.buildJobLog, 'scrollTo').mockImplementation();
}); });
it('scrolls build trace to bottom', () => { it('scrolls build trace to bottom', () => {
jest.spyOn(vm.$refs.buildTrace, 'scrollHeight', 'get').mockReturnValue(1000); jest.spyOn(vm.$refs.buildJobLog, 'scrollHeight', 'get').mockReturnValue(1000);
vm.scrollDown(); vm.scrollDown();
expect(vm.$refs.buildTrace.scrollTo).toHaveBeenCalledWith(0, 1000); expect(vm.$refs.buildJobLog.scrollTo).toHaveBeenCalledWith(0, 1000);
}); });
}); });
...@@ -141,26 +141,26 @@ describe('IDE jobs detail view', () => { ...@@ -141,26 +141,26 @@ describe('IDE jobs detail view', () => {
beforeEach(() => { beforeEach(() => {
vm = vm.$mount(); vm = vm.$mount();
jest.spyOn(vm.$refs.buildTrace, 'scrollTo').mockImplementation(); jest.spyOn(vm.$refs.buildJobLog, 'scrollTo').mockImplementation();
}); });
it('scrolls build trace to top', () => { it('scrolls build trace to top', () => {
vm.scrollUp(); vm.scrollUp();
expect(vm.$refs.buildTrace.scrollTo).toHaveBeenCalledWith(0, 0); expect(vm.$refs.buildJobLog.scrollTo).toHaveBeenCalledWith(0, 0);
}); });
}); });
describe('scrollBuildLog', () => { describe('scrollBuildLog', () => {
beforeEach(() => { beforeEach(() => {
vm = vm.$mount(); vm = vm.$mount();
jest.spyOn(vm.$refs.buildTrace, 'scrollTo').mockImplementation(); jest.spyOn(vm.$refs.buildJobLog, 'scrollTo').mockImplementation();
jest.spyOn(vm.$refs.buildTrace, 'offsetHeight', 'get').mockReturnValue(100); jest.spyOn(vm.$refs.buildJobLog, 'offsetHeight', 'get').mockReturnValue(100);
jest.spyOn(vm.$refs.buildTrace, 'scrollHeight', 'get').mockReturnValue(200); jest.spyOn(vm.$refs.buildJobLog, 'scrollHeight', 'get').mockReturnValue(200);
}); });
it('sets scrollPos to bottom when at the bottom', () => { it('sets scrollPos to bottom when at the bottom', () => {
jest.spyOn(vm.$refs.buildTrace, 'scrollTop', 'get').mockReturnValue(100); jest.spyOn(vm.$refs.buildJobLog, 'scrollTop', 'get').mockReturnValue(100);
vm.scrollBuildLog(); vm.scrollBuildLog();
...@@ -168,7 +168,7 @@ describe('IDE jobs detail view', () => { ...@@ -168,7 +168,7 @@ describe('IDE jobs detail view', () => {
}); });
it('sets scrollPos to top when at the top', () => { it('sets scrollPos to top when at the top', () => {
jest.spyOn(vm.$refs.buildTrace, 'scrollTop', 'get').mockReturnValue(0); jest.spyOn(vm.$refs.buildJobLog, 'scrollTop', 'get').mockReturnValue(0);
vm.scrollPos = 1; vm.scrollPos = 1;
vm.scrollBuildLog(); vm.scrollBuildLog();
...@@ -177,7 +177,7 @@ describe('IDE jobs detail view', () => { ...@@ -177,7 +177,7 @@ describe('IDE jobs detail view', () => {
}); });
it('resets scrollPos when not at top or bottom', () => { it('resets scrollPos when not at top or bottom', () => {
jest.spyOn(vm.$refs.buildTrace, 'scrollTop', 'get').mockReturnValue(10); jest.spyOn(vm.$refs.buildJobLog, 'scrollTop', 'get').mockReturnValue(10);
vm.scrollBuildLog(); vm.scrollBuildLog();
......
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