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
486c87a0
Commit
486c87a0
authored
Dec 16, 2016
by
Bryce Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly show and hide loading state.
parent
669e6717
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
14 deletions
+17
-14
app/assets/javascripts/merge_request_widget/approvals/components/approvals_body.js.es6
...request_widget/approvals/components/approvals_body.js.es6
+6
-10
app/assets/javascripts/merge_request_widget/approvals/stores/approvals_store.js.es6
...ge_request_widget/approvals/stores/approvals_store.js.es6
+3
-2
app/assets/javascripts/merge_request_widget/widget_store.js.es6
...sets/javascripts/merge_request_widget/widget_store.js.es6
+5
-0
app/views/projects/merge_requests/widget/open/_approvals_body.html.haml
...ects/merge_requests/widget/open/_approvals_body.html.haml
+3
-2
No files found.
app/assets/javascripts/merge_request_widget/approvals/components/approvals_body.js.es6
View file @
486c87a0
...
...
@@ -4,12 +4,7 @@
(() => {
Vue.component('approvals-body', {
name: 'approvals-body',
props: ['approvedBy', 'approvalsLeft', 'userCanApprove', 'userHasApproved', 'suggestedApprovers'],
data() {
return {
loaded: false,
};
},
props: ['approvedBy', 'approvalsLeft', 'userCanApprove', 'userHasApproved', 'suggestedApprovers', 'widgetLoading'],
computed: {
approvalsRequiredStringified() {
return this.approvalsLeft === 1 ? 'one more approval' :
...
...
@@ -31,6 +26,9 @@
showApproveButton() {
return this.userCanApprove && !this.userHasApproved;
},
showApprovalsBody() {
return !this.widgetLoading && this.approvalsLeft;
}
},
methods: {
approveMergeRequest() {
...
...
@@ -38,12 +36,10 @@
},
},
beforeCreate() {
gl.ApprovalsStore.initStoreOnce().then(() => {
this.loaded = true;
});
gl.ApprovalsStore.initStoreOnce();
},
template: `
<div v-if='
loaded && approvalsLeft
'>
<div v-if='
showApprovalsBody
'>
<h4> Requires {{ approvalsRequiredStringified }} (from {{ approverNamesStringified }})</h4>
<div v-if='showApproveButton' class='append-bottom-10'>
<button
...
...
app/assets/javascripts/merge_request_widget/approvals/stores/approvals_store.js.es6
View file @
486c87a0
...
...
@@ -20,8 +20,8 @@
};
}
assignToRootStore(data) {
return this.rootStore.assignToData(
'approvals'
, data);
assignToRootStore(data
, key = 'approvals'
) {
return this.rootStore.assignToData(
key
, data);
}
initStoreOnce() {
...
...
@@ -31,6 +31,7 @@
return this.fetch()
.then(() => {
state.loading = false;
this.assignToRootStore(false, 'loading');
})
.catch((err) => {
console.error(`Failed to initialize approvals store: ${err}`);
...
...
app/assets/javascripts/merge_request_widget/widget_store.js.es6
View file @
486c87a0
...
...
@@ -18,9 +18,14 @@
this.data = {};
// init other widget stores here
this.initState();
this.initApprovals();
}
initState() {
this.assignToData('loading', true);
}
initApprovals() {
gl.ApprovalsStore = new gl.ApprovalsStore(this);
this.assignToData('approvals', {});
...
...
app/views/projects/merge_requests/widget/open/_approvals_body.html.haml
View file @
486c87a0
%approvals-body
{
':user-can-approve'
=>
'approvals.user_can_approve'
,
':user-has-approved'
=>
'approvals.user_has_approved'
,
':approved-by'
=>
'approvals.approved_by'
,
':approvals-left'
:'approvals.approvals_left'
,
':suggested-approvers'
=>
'approvals.suggested_approvers'
}
.loading
{
'v-show'
=>
'loading'
}
=
icon
(
'spinner spin'
)
%approvals-body
{
':user-can-approve'
=>
'approvals.user_can_approve'
,
':user-has-approved'
=>
'approvals.user_has_approved'
,
':approved-by'
=>
'approvals.approved_by'
,
':approvals-left'
:'approvals.approvals_left'
,
':suggested-approvers'
=>
'approvals.suggested_approvers'
,
':widget-loading'
=>
'loading'
}
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