Commit 85047793 authored by Enrique Alcántara's avatar Enrique Alcántara

Merge branch '324100-update-initial-branch-name-contributors-graph' into 'master'

Update default branch in contributors graph

See merge request gitlab-org/gitlab!58876
parents 07ea548d 0e9b5a28
import Vue from 'vue';
import ContributorsGraphs from './components/contributors.vue';
import store from './stores';
import { createStore } from './stores';
export default () => {
const el = document.querySelector('.js-contributors-graph');
if (!el) return null;
const { projectGraphPath, projectBranch, defaultBranch } = el.dataset;
const store = createStore(defaultBranch);
return new Vue({
el,
store,
......@@ -14,8 +17,8 @@ export default () => {
render(createElement) {
return createElement(ContributorsGraphs, {
props: {
endpoint: el.dataset.projectGraphPath,
branch: el.dataset.projectBranch,
endpoint: projectGraphPath,
branch: projectBranch,
},
});
},
......
......@@ -7,12 +7,12 @@ import state from './state';
Vue.use(Vuex);
export const createStore = () =>
export const createStore = (defaultBranch) =>
new Vuex.Store({
actions,
mutations,
getters,
state: state(),
state: state(defaultBranch),
});
export default createStore();
export default createStore;
export default () => ({
export default (branch) => ({
loading: false,
chartData: null,
branch: 'master',
branch,
});
......@@ -5,4 +5,4 @@
= render 'shared/ref_switcher', destination: 'graphs'
= link_to s_('Commits|History'), project_commits_path(@project, current_ref), class: 'btn gl-button btn-default'
.js-contributors-graph{ class: container_class, 'data-project-graph-path': project_graph_path(@project, current_ref, format: :json), 'data-project-branch': current_ref }
.js-contributors-graph{ class: container_class, data: { project_graph_path: project_graph_path(@project, current_ref, format: :json), project_branch: current_ref, default_branch: @project.default_branch } }
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