mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-01-29 22:40:22 +00:00
embedded task and status in build struct
This commit is contained in:
@@ -27,7 +27,6 @@
|
||||
|
||||
<script src="/static/scripts/services/repos.js"></script>
|
||||
<script src="/static/scripts/services/builds.js"></script>
|
||||
<script src="/static/scripts/services/tasks.js"></script>
|
||||
<script src="/static/scripts/services/users.js"></script>
|
||||
<script src="/static/scripts/services/logs.js"></script>
|
||||
<script src="/static/scripts/services/tokens.js"></script>
|
||||
@@ -37,4 +36,4 @@
|
||||
<script src="/static/scripts/filters/time.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -3,18 +3,18 @@
|
||||
/**
|
||||
* BuildsCtrl responsible for rendering the repo's
|
||||
* recent build history.
|
||||
*/
|
||||
*/
|
||||
function BuildsCtrl($scope, $routeParams, builds, repos, users) {
|
||||
|
||||
var owner = $routeParams.owner;
|
||||
var name = $routeParams.name;
|
||||
var fullName = owner+'/'+name;
|
||||
|
||||
// Gets the currently authenticated user
|
||||
// Gets the currently authenticated user
|
||||
users.getCached().then(function(payload){
|
||||
$scope.user = payload.data;
|
||||
});
|
||||
|
||||
|
||||
// Gets a repository
|
||||
repos.get(fullName).then(function(payload){
|
||||
$scope.repo = payload.data;
|
||||
@@ -44,8 +44,8 @@
|
||||
|
||||
/**
|
||||
* BuildCtrl responsible for rendering a build.
|
||||
*/
|
||||
function BuildCtrl($scope, $routeParams, logs, tasks, builds, repos, users) {
|
||||
*/
|
||||
function BuildCtrl($scope, $routeParams, logs, builds, repos, users) {
|
||||
|
||||
var step = parseInt($routeParams.step) || 1;
|
||||
var number = $routeParams.number;
|
||||
@@ -53,11 +53,11 @@
|
||||
var name = $routeParams.name;
|
||||
var fullName = owner+'/'+name;
|
||||
|
||||
// Gets the currently authenticated user
|
||||
// Gets the currently authenticated user
|
||||
users.getCached().then(function(payload){
|
||||
$scope.user = payload.data;
|
||||
});
|
||||
|
||||
|
||||
// Gets a repository
|
||||
repos.get(fullName).then(function(payload){
|
||||
$scope.repo = payload.data;
|
||||
@@ -68,23 +68,12 @@
|
||||
// Gets the build
|
||||
builds.get(fullName, number).then(function(payload){
|
||||
$scope.build = payload.data;
|
||||
$scope.task = payload.data.tasks[step];
|
||||
}).catch(function(err){
|
||||
$scope.error = err;
|
||||
});
|
||||
|
||||
// Gets a list of build steps
|
||||
tasks.list(fullName, number).then(function(payload){
|
||||
$scope.tasks = payload.data || [];
|
||||
$scope.tasks.forEach(function(task) {
|
||||
if (task.number === step) {
|
||||
$scope.task = task;
|
||||
}
|
||||
});
|
||||
}).catch(function(err){
|
||||
$scope.error = err;
|
||||
});
|
||||
|
||||
if (step) {
|
||||
if (step) { // TODO only if build is step.state == 'running'
|
||||
// Gets a list of build steps
|
||||
logs.get(fullName, number, step).then(function(payload){
|
||||
$scope.logs = payload.data;
|
||||
@@ -98,4 +87,4 @@
|
||||
.module('drone')
|
||||
.controller('BuildCtrl', BuildCtrl)
|
||||
.controller('BuildsCtrl', BuildsCtrl);
|
||||
})();
|
||||
})();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* @param {number} Number of the task.
|
||||
*/
|
||||
this.get = function(repoName, number, step) {
|
||||
return $http.get('/api/repos/'+repoName+'/builds/'+number+'/tasks/'+step+'/log');
|
||||
return $http.get('/api/repos/'+repoName+'/logs/'+number+'/'+step);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
|
||||
/**
|
||||
* The TaskService provides access to build
|
||||
* task data using REST API calls.
|
||||
*/
|
||||
function TaskService($http, $window) {
|
||||
|
||||
/**
|
||||
* Gets a list of builds.
|
||||
*
|
||||
* @param {string} Name of the repository.
|
||||
* @param {number} Number of the build.
|
||||
*/
|
||||
this.list = function(repoName, number) {
|
||||
return $http.get('/api/repos/'+repoName+'/builds/'+number+'/tasks');
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets a task.
|
||||
*
|
||||
* @param {string} Name of the repository.
|
||||
* @param {number} Number of the build.
|
||||
* @param {number} Number of the task.
|
||||
*/
|
||||
this.get = function(repoName, number, step) {
|
||||
return $http.get('/api/repos/'+repoName+'/builds/'+number+'/tasks/'+step);
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets a task.
|
||||
*
|
||||
* @param {string} Name of the repository.
|
||||
* @param {number} Number of the build.
|
||||
* @param {number} Number of the task.
|
||||
*/
|
||||
this.get = function(repoName, number, step) {
|
||||
return $http.get('/api/repos/'+repoName+'/builds/'+number+'/tasks/'+step);
|
||||
};
|
||||
}
|
||||
|
||||
angular
|
||||
.module('drone')
|
||||
.service('tasks', TaskService);
|
||||
})();
|
||||
@@ -67,7 +67,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="task in tasks">
|
||||
<tr ng-repeat="task in build.tasks">
|
||||
<td><a ng-href="{{ repo.full_name }}/{{ build.number }}/{{ task.number }}">{{ task.number }}</a></td>
|
||||
<td>{{ task.state }}</td>
|
||||
<td>{{ task.started_at | fromNow }}</td>
|
||||
|
||||
Reference in New Issue
Block a user