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
b5d72807
Commit
b5d72807
authored
Mar 01, 2017
by
Filipa Lacerda
Committed by
Toon Claes
Apr 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make a new request every 1second after we receive the latest if the cpmpletion is under 100
parent
cecdaaca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
36 deletions
+57
-36
app/assets/javascripts/environments/components/deploy_board_component.js
...scripts/environments/components/deploy_board_component.js
+57
-36
No files found.
app/assets/javascripts/environments/components/deploy_board_component.js
View file @
b5d72807
/* eslint-disable no-new */
/* eslint-disable no-new
, no-undef
*/
/* global Flash */
/**
* Renders a deploy board.
...
...
@@ -67,47 +67,68 @@ export default {
},
created
()
{
this
.
isLoading
=
true
;
this
.
getDeployBoard
();
},
updated
()
{
// While board is not complete we need to request new data from the server.
// Let's make sure we are not making any request at the moment
// and that we only make this request if the latest response was not 204.
if
(
!
this
.
isLoading
&&
!
this
.
hasError
&&
this
.
deployBoardData
.
completion
&&
this
.
deployBoardData
.
completion
<
100
)
{
// let's wait 1s and make the request again
setTimeout
(()
=>
{
this
.
getDeployBoard
();
},
1000
);
}
},
methods
:
{
getDeployBoard
()
{
this
.
isLoading
=
true
;
const
maxNumberOfRequests
=
3
;
const
maxNumberOfRequests
=
3
;
// If the response is 204, we make 3 more requests.
gl
.
utils
.
backOff
((
next
,
stop
)
=>
{
this
.
service
.
getDeployBoard
(
this
.
endpoint
)
.
then
((
resp
)
=>
{
if
(
resp
.
status
===
statusCodes
.
NO_CONTENT
)
{
this
.
backOffRequestCounter
=
this
.
backOffRequestCounter
+=
1
;
// If the response is 204, we make 3 more requests.
gl
.
utils
.
backOff
((
next
,
stop
)
=>
{
this
.
service
.
getDeployBoard
(
this
.
endpoint
)
.
then
((
resp
)
=>
{
if
(
resp
.
status
===
statusCodes
.
NO_CONTENT
)
{
this
.
backOffRequestCounter
=
this
.
backOffRequestCounter
+=
1
;
if
(
this
.
backOffRequestCounter
<
maxNumberOfRequests
)
{
next
();
if
(
this
.
backOffRequestCounter
<
maxNumberOfRequests
)
{
next
();
}
else
{
stop
(
resp
);
}
}
else
{
stop
(
resp
);
}
}
else
{
stop
(
resp
);
}
})
.
catch
(
stop
);
})
.
then
((
resp
)
=>
{
if
(
resp
.
status
===
statusCodes
.
NO_CONTENT
)
{
this
.
hasError
=
true
;
return
resp
;
}
return
resp
.
json
();
})
.
then
((
response
)
=>
{
this
.
store
.
storeDeployBoard
(
this
.
environmentID
,
response
);
return
response
;
})
.
then
(()
=>
{
this
.
isLoading
=
false
;
})
.
catch
(()
=>
{
this
.
isLoading
=
false
;
new
Flash
(
'
An error occurred while fetching the deploy board.
'
,
'
alert
'
);
});
})
.
catch
(
stop
);
})
.
then
((
resp
)
=>
{
if
(
resp
.
status
===
statusCodes
.
NO_CONTENT
)
{
this
.
hasError
=
true
;
return
resp
;
}
return
resp
.
json
();
})
.
then
((
response
)
=>
{
this
.
store
.
storeDeployBoard
(
this
.
environmentID
,
response
);
return
response
;
})
.
then
(()
=>
{
this
.
isLoading
=
false
;
})
.
catch
(()
=>
{
this
.
isLoading
=
false
;
new
Flash
(
'
An error occurred while fetching the deploy board.
'
,
'
alert
'
);
});
},
},
computed
:
{
...
...
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