Skip to content

Commit

Permalink
Added fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
moredure committed Apr 5, 2018
1 parent ffd4018 commit a540f29
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/components/builds/build-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ import moment from 'moment';
export default {
created() {
this.connection.on(`builds:${this.id}:update`, this.update.bind(this));
this.updateBuildStatusFn = this.update.bind(this);
this.connection.on(`builds:${this.id}:update`, this.updateBuildStatusFn);
},
destroyed() {
this.connection.off(`builds:${this.id}:update`);
this.connection.off(`builds:${this.id}:update`, this.updateBuildStatusFn);
},
computed: {
...mapGetters('socket', ['connection']),
Expand Down
10 changes: 6 additions & 4 deletions src/components/builds/build-page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ export default {
});
this.updateBuildEvent = `builds:${id}:update`;
this.newLogEvent = `logs:${id}:new`;
this.connection.on(this.newLogEvent, this.log.bind(this));
this.connection.on(this.updateBuildEvent, this.update.bind(this));
this.newLogEventFn = this.log.bind(this);
this.updateBuildEventFn = this.update.bind(this);
this.connection.on(this.newLogEvent, this.newLogEventFn);
this.connection.on(this.updateBuildEvent, this.updateBuildEventFn);
},
destroyed() {
this.connection.off(this.newLogEvent);
this.connection.off(this.updateBuildEvent);
this.connection.off(this.newLogEvent, this.newLogEventFn);
this.connection.off(this.updateBuildEvent, this.updateBuildEventFn);
},
computed: {
...mapGetters('socket', [
Expand Down
5 changes: 3 additions & 2 deletions src/components/builds/builds-page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ export default {
const projectId = this.$route.params.project_id;
this.source = this.prefetch(projectId);
this.newBuildEvent = `builds:${projectId}:new`;
this.connection.on(this.newBuildEvent, this.add.bind(this));
this.newBuildEventFn = this.add.bind(this);
this.connection.on(this.newBuildEvent, this.newBuildEventFn);
},
destroyed() {
this.connection.off(this.newBuildEvent);
this.connection.off(this.newBuildEvent, this.newBuildEventFn);
},
computed: {
...mapState('builds', [
Expand Down
3 changes: 1 addition & 2 deletions src/store/modules/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import HTTP from '@/api';

const initialState = {
build: null,
status: 'created',
isLoading: false,
isError: false,
error: null,
Expand Down Expand Up @@ -32,7 +31,7 @@ const mutations = {
state.error = error;
},
[UPDATE_BUILD](state, payload) {
state.status = payload.status;
state.build.status = payload.status;
},
};

Expand Down

0 comments on commit a540f29

Please sign in to comment.