diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-03-07 09:27:02 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-03-07 09:27:02 +0000 |
commit | 56814482d66edd49fc8eeb26896e6cfe788b984e (patch) | |
tree | 808214fb4d5bccab1afd52e79ade6ead8aec14dd | |
parent | 24f1ee5e9b1f4d9bc8cff581419b091756da8deb (diff) | |
parent | 2742fe6fd4f0a65bbd7f4d698ea009d6a6db63e7 (diff) | |
download | gitlab-ce-56814482d66edd49fc8eeb26896e6cfe788b984e.tar.gz |
Merge branch '28019-make-builds-show-faster' into 'master'
Performance improvement on Projects::BuildsController#show.html
Closes #28019
See merge request !9149
-rw-r--r-- | app/helpers/builds_helper.rb | 2 | ||||
-rw-r--r-- | app/views/projects/builds/show.html.haml | 1 | ||||
-rw-r--r-- | changelogs/unreleased/28019-make-builds-show-faster.yml | 4 | ||||
-rw-r--r-- | spec/javascripts/build_spec.js | 10 |
4 files changed, 7 insertions, 10 deletions
diff --git a/app/helpers/builds_helper.rb b/app/helpers/builds_helper.rb index 5ac3e66bb1f..2fcb7a59fc3 100644 --- a/app/helpers/builds_helper.rb +++ b/app/helpers/builds_helper.rb @@ -12,7 +12,7 @@ module BuildsHelper build_url: namespace_project_build_url(@project.namespace, @project, @build, :json), build_status: @build.status, build_stage: @build.stage, - log_state: @build.trace_with_state[:state].to_s + log_state: '' } end diff --git a/app/views/projects/builds/show.html.haml b/app/views/projects/builds/show.html.haml index 228dad528ab..307010edb58 100644 --- a/app/views/projects/builds/show.html.haml +++ b/app/views/projects/builds/show.html.haml @@ -1,6 +1,5 @@ - @no_container = true - page_title "#{@build.name} (##{@build.id})", "Jobs" -- trace_with_state = @build.trace_with_state = render "projects/pipelines/head", build_subnav: true %div{ class: container_class } diff --git a/changelogs/unreleased/28019-make-builds-show-faster.yml b/changelogs/unreleased/28019-make-builds-show-faster.yml new file mode 100644 index 00000000000..bbfea0e4c88 --- /dev/null +++ b/changelogs/unreleased/28019-make-builds-show-faster.yml @@ -0,0 +1,4 @@ +--- +title: Avoid calling Build#trace_with_state for performance +merge_request: 9149 +author: Takuya Noguchi diff --git a/spec/javascripts/build_spec.js b/spec/javascripts/build_spec.js index 0bd50588f5a..fe7f3d2e9c4 100644 --- a/spec/javascripts/build_spec.js +++ b/spec/javascripts/build_spec.js @@ -9,12 +9,6 @@ require('vendor/jquery.nicescroll'); describe('Build', () => { const BUILD_URL = `${gl.TEST_HOST}/frontend-fixtures/builds-project/builds/1`; - // see spec/factories/ci/builds.rb - const BUILD_TRACE = 'BUILD TRACE'; - // see lib/ci/ansi2html.rb - const INITIAL_BUILD_TRACE_STATE = window.btoa(JSON.stringify({ - offset: BUILD_TRACE.length, n_open_tags: 0, fg_color: null, bg_color: null, style_mask: 0, - })); preloadFixtures('builds/build-with-artifacts.html.raw'); @@ -42,7 +36,7 @@ describe('Build', () => { expect(this.build.buildUrl).toBe(`${BUILD_URL}.json`); expect(this.build.buildStatus).toBe('success'); expect(this.build.buildStage).toBe('test'); - expect(this.build.state).toBe(INITIAL_BUILD_TRACE_STATE); + expect(this.build.state).toBe(''); }); it('only shows the jobs matching the current stage', () => { @@ -108,7 +102,7 @@ describe('Build', () => { expect($.ajax.calls.count()).toBe(2); let [{ url, dataType, success, context }] = $.ajax.calls.argsFor(1); expect(url).toBe( - `${BUILD_URL}/trace.json?state=${encodeURIComponent(INITIAL_BUILD_TRACE_STATE)}`, + `${BUILD_URL}/trace.json?state=`, ); expect(dataType).toBe('json'); expect(success).toEqual(jasmine.any(Function)); |