Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c8cb7f8d
Commit
c8cb7f8d
authored
Dec 14, 2016
by
Bryce Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly cloak loading states.
parent
4723b2ea
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
19 deletions
+28
-19
app/assets/javascripts/merge_request_widget/approvals/components/approvals_body.js.es6
...request_widget/approvals/components/approvals_body.js.es6
+16
-11
app/assets/javascripts/merge_request_widget/approvals/components/approvals_footer.js.es6
...quest_widget/approvals/components/approvals_footer.js.es6
+9
-3
app/assets/javascripts/merge_request_widget/approvals/stores/approvals_store.js.es6
...ge_request_widget/approvals/stores/approvals_store.js.es6
+3
-5
No files found.
app/assets/javascripts/merge_request_widget/approvals/components/approvals_body.js.es6
View file @
c8cb7f8d
...
@@ -5,6 +5,11 @@
...
@@ -5,6 +5,11 @@
Vue.component('approvals-body', {
Vue.component('approvals-body', {
name: 'approvals-body',
name: 'approvals-body',
props: ['approvedBy', 'approvalsLeft', 'userCanApprove', 'userHasApproved', 'suggestedApprovers'],
props: ['approvedBy', 'approvalsLeft', 'userCanApprove', 'userHasApproved', 'suggestedApprovers'],
data() {
return {
loaded: false,
};
},
computed: {
computed: {
approvalsRequiredStringified() {
approvalsRequiredStringified() {
return this.approvalsLeft === 1 ? 'one more approval' :
return this.approvalsLeft === 1 ? 'one more approval' :
...
@@ -33,19 +38,19 @@
...
@@ -33,19 +38,19 @@
},
},
},
},
beforeCreate() {
beforeCreate() {
return gl.ApprovalsStore.initStoreOnce();
gl.ApprovalsStore.initStoreOnce().then(() => {
this.loaded = true;
});
},
},
template: `
template: `
<div>
<div v-if='loaded'>
<div>
<h4> Requires {{ approvalsRequiredStringified }} (from {{ approverNamesStringified }})</h4>
<h4> Requires {{ approvalsRequiredStringified }} (from {{ approverNamesStringified }})</h4>
<div v-if='showApproveButton' class='append-bottom-10'>
<div v-if='showApproveButton' class='append-bottom-10'>
<button
<button
@click='approveMergeRequest'
@click='approveMergeRequest'
class='btn btn-primary approve-btn'>
class='btn btn-primary approve-btn'>
Approve Merge Request
Approve Merge Request
</button>
</button>
</div>
</div>
</div>
</div>
</div>
`,
`,
...
...
app/assets/javascripts/merge_request_widget/approvals/components/approvals_footer.js.es6
View file @
c8cb7f8d
...
@@ -2,10 +2,14 @@
...
@@ -2,10 +2,14 @@
//= require vue_common_component/link_to_member_avatar
//= require vue_common_component/link_to_member_avatar
(() => {
(() => {
Vue.component('approvals-footer', {
Vue.component('approvals-footer', {
name: 'approvals-footer',
name: 'approvals-footer',
props: ['userCanApprove', 'userHasApproved', 'approvedBy', 'approvalsLeft', 'pendingAvatarSvg', 'checkmarkSvg'],
props: ['userCanApprove', 'userHasApproved', 'approvedBy', 'approvalsLeft', 'pendingAvatarSvg', 'checkmarkSvg'],
data() {
return {
loaded: false,
};
},
computed: {
computed: {
hasApprovers() {
hasApprovers() {
return this.approvedBy && this.approvedBy.length;
return this.approvedBy && this.approvedBy.length;
...
@@ -20,10 +24,12 @@
...
@@ -20,10 +24,12 @@
},
},
},
},
beforeCreate() {
beforeCreate() {
return gl.ApprovalsStore.initStoreOnce();
gl.ApprovalsStore.initStoreOnce().then(() => {
this.loaded = true;
});
},
},
template: `
template: `
<div v-if='hasApprovers' class='mr-widget-footer approved-by-users approvals-footer clearfix'>
<div v-if='hasApprovers
&& loaded
' class='mr-widget-footer approved-by-users approvals-footer clearfix'>
<span class='approvers-prefix'> Approved by </span>
<span class='approvers-prefix'> Approved by </span>
<span v-for='approver in approvedBy'>
<span v-for='approver in approvedBy'>
<link-to-member-avatar
<link-to-member-avatar
...
...
app/assets/javascripts/merge_request_widget/approvals/stores/approvals_store.js.es6
View file @
c8cb7f8d
...
@@ -17,7 +17,6 @@
...
@@ -17,7 +17,6 @@
this.api = new gl.ApprovalsApi(rootStore.dataset.endpoint);
this.api = new gl.ApprovalsApi(rootStore.dataset.endpoint);
this.state = {
this.state = {
loading: false,
loading: false,
loaded: false,
};
};
}
}
...
@@ -27,18 +26,17 @@
...
@@ -27,18 +26,17 @@
initStoreOnce() {
initStoreOnce() {
const state = this.state;
const state = this.state;
if (
state.loading || state.loaded
) {
if (
!state.loading
) {
state.loading = true;
state.loading = true;
this.fetch()
return
this.fetch()
.then(() => {
.then(() => {
state.loading = false;
state.loading = false;
state.loaded = true;
})
})
.catch((err) => {
.catch((err) => {
console.error(`Failed to initialize approvals store: ${err}`);
console.error(`Failed to initialize approvals store: ${err}`);
});
});
}
}
return
this.fetch
();
return
Promise.resolve
();
}
}
fetch() {
fetch() {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment