mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-25 19:31:05 +00:00
hide UI things when user not authenticated
This commit is contained in:
parent
1b8a00f5f6
commit
943fafb67e
7 changed files with 59 additions and 69 deletions
|
@ -12,9 +12,9 @@
|
|||
$scope.loading=true;
|
||||
|
||||
// Gets the currently authenticated user
|
||||
users.getCached().then(function (payload) {
|
||||
$scope.user = payload.data;
|
||||
});
|
||||
// users.getCached().then(function (payload) {
|
||||
// $scope.user = payload.data;
|
||||
// });
|
||||
|
||||
// Gets a repository
|
||||
repos.get(fullName).then(function (payload) {
|
||||
|
@ -159,9 +159,9 @@
|
|||
};
|
||||
|
||||
// Gets the currently authenticated user
|
||||
users.getCached().then(function (payload) {
|
||||
$scope.user = payload.data;
|
||||
});
|
||||
// users.getCached().then(function (payload) {
|
||||
// $scope.user = payload.data;
|
||||
// });
|
||||
|
||||
// Gets a repository
|
||||
repos.get(fullName).then(function (payload) {
|
||||
|
|
|
@ -56,7 +56,9 @@
|
|||
templateUrl: '/static/scripts/views/layout.html',
|
||||
controller: function ($scope, $routeParams, repos, users) {
|
||||
users.getCached().then(function (payload) {
|
||||
$scope.user = payload.data;
|
||||
if (payload && payload.data) {
|
||||
$scope.user = payload.data;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<button type="button" ng-click="watch(repo)" ng-if="!repo.starred && user">
|
||||
<i class="material-icons">visibility_off</i>
|
||||
</button>
|
||||
<a href="/{{ repo.full_name }}/edit">
|
||||
<a href="/{{ repo.full_name }}/edit" ng-if="repo.permissions.push">
|
||||
<i class="material-icons">tune</i>
|
||||
</a>
|
||||
</menu>
|
||||
|
|
|
@ -12,6 +12,11 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-if="repo && repo.permissions && repo.permissions.push">
|
||||
<button ng-if="build.status !== 'pending' && build.status !== 'running'" ng-click="restart()" class="button button-restart">Restart</button>
|
||||
<button ng-if="build.status === 'running' && build.jobs.length === 1" ng-click="cancel()" class="button button-cancel">Cancel</button>
|
||||
</div>
|
||||
|
||||
<div ng-class="{'list':true, 'job-list':true, 'matrix-list': build.jobs && build.jobs.length > 1 }">
|
||||
<a ng-repeat="job in build.jobs" ng-href="{{ repo.full_name }}/{{ build.number }}/{{ job.number }}" ng-class="{'active': job.number == step }">
|
||||
<div>
|
||||
|
@ -39,7 +44,7 @@
|
|||
</a>
|
||||
</div>
|
||||
|
||||
<button ng-if="build.status !== 'pending' && build.status !== 'running'" ng-click="restart()" class="button button-restart">Restart</button>
|
||||
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<header>
|
||||
<div class="toolbar" ui-view="toolbar"></div>
|
||||
|
||||
<ul>
|
||||
<ul ng-if="user">
|
||||
<li>
|
||||
<img ng-src="{{ user.avatar }}" />
|
||||
</li>
|
||||
|
@ -19,6 +19,12 @@
|
|||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul ng-if="!user">
|
||||
<li>
|
||||
<a href="/login" class="button button-login">Login</a>
|
||||
</li>
|
||||
</ul>
|
||||
</header>
|
||||
|
||||
<div ui-view="content"></div>
|
||||
|
|
|
@ -527,8 +527,42 @@ menu .button span {
|
|||
color: #8fa1b3;
|
||||
font-size: 13px;
|
||||
text-transform: uppercase;
|
||||
margin-top: 20px;
|
||||
padding: 0px 15px;
|
||||
margin-bottom: 20px;
|
||||
margin-top:-20px;
|
||||
padding: 0px 10px;
|
||||
line-height: 25px;
|
||||
cursor:pointer;
|
||||
}
|
||||
.button-cancel {
|
||||
background: #FFF;
|
||||
border: 1px solid #d08770;
|
||||
color: #d08770;
|
||||
font-size: 13px;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 20px;
|
||||
margin-top:-20px;
|
||||
padding: 0px 10px;
|
||||
line-height: 25px;
|
||||
cursor:pointer;
|
||||
}
|
||||
.button-cancel:hover {
|
||||
background: #d08770;
|
||||
border: 1px solid #d08770;
|
||||
color: #fff;
|
||||
}
|
||||
.button-login {
|
||||
margin-top: 15px;
|
||||
font-size: 13px;
|
||||
text-transform: uppercase;
|
||||
background: #FFF;
|
||||
border: 1px solid #8fa1b3;
|
||||
color: #8fa1b3;
|
||||
line-height: 25px;
|
||||
}
|
||||
.button-login:hover {
|
||||
background: #8fa1b3;
|
||||
border: 1px solid #8fa1b3;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
57
doc/build/caching.md
vendored
57
doc/build/caching.md
vendored
|
@ -1,57 +0,0 @@
|
|||
# Caching
|
||||
Drone allows the caching of directories within the workspace. This can be used to improve the performance of the builds. This document discusses how caching is implemented and provides some general advice for lowering the execution time of builds.
|
||||
|
||||
Remember that cached volumes are retained between builds and those volumes are accessible through plugins. They are also available through the host's file system. Any information that is sensitive should not be contained within the cache.
|
||||
|
||||
## Caching Implementation
|
||||
Drone uses Docker volumes to handle caching. The volumes are mounted within the build container and are available immediately within the container and any plugins running within the environment.
|
||||
|
||||
Given the following configuration.
|
||||
```yaml
|
||||
build:
|
||||
cache:
|
||||
- foo
|
||||
- fizz/buzz
|
||||
```
|
||||
Two volumes will be created with their paths resembling the following, with the path left of the : being the location on the host and to the right being the directory within the container. If a different path is specified in the [clone](clone.md) plugin then the paths on the right will be relative to the value in `path` rather than the default paths specified below.
|
||||
```
|
||||
/tmp/drone/cache/${origin}/${org}/${name}/foo:/drone/src/${origin}/${org}/${name}/foo
|
||||
/tmp/drone/cache/${origin}/${org}/${name}/fizz/buzz:/drone/src/${origin}/${org}/${name}/fizz/buzz
|
||||
```
|
||||
If the drone repository used this caching then the volumes would look like.
|
||||
```
|
||||
/tmp/drone/cache/github.com/drone/drone/foo:/drone/src/github.com/drone/drone/foo
|
||||
/tmp/drone/cache/github.com/drone/drone/fizz/buzz:/drone/src/github.com/drone/drone/fizz/buzz
|
||||
```
|
||||
|
||||
### Sharing the Cache
|
||||
Volumes in Docker are local to the host. When using multiple build machines there will be a copy of the cache on each of these machines. If its desireable to share the cached directories among all the build machines then a distributed file system could be mounted to `/tmp/drone/cache`. Setting up a distrubted file system is beyond the scope of this document but can potentially benifit build times and reduce the disk usage from caching.
|
||||
|
||||
### Deleting the Cache
|
||||
The caching implementation uses the `/tmp/` directory which is typically cleared every boot unless explicitly changed. If the docker host is never rebooted then a cron job could be used to clear the `/tmp/drone/cache/` periodically. The amount of time to wait clear is dependent upon the number of builds being run, the amount of data being cached, and the size of the repositories. Because of this it is recommended to monitor the disk usage and then make a judgement call based on that data.
|
||||
|
||||
## Optimization Strategies
|
||||
The following sections, arranged alphabetically, contain optimization strategies for various programming languages and version control systems using caching.
|
||||
### C/C++
|
||||
_Looking for additional input_
|
||||
### Dart
|
||||
_Looking for additional input_
|
||||
### Git
|
||||
When git is used as the version control system the .git directory is a good candidate for caching. Since the git plugin handles the checkout process the only thing needed is to add the .git directory to the cache section.
|
||||
```yaml
|
||||
build:
|
||||
cache:
|
||||
- .git
|
||||
```
|
||||
### Golang
|
||||
_Looking for additional input_
|
||||
### Java
|
||||
_Looking for additional input_
|
||||
### JavaScript
|
||||
_Looking for additional input_
|
||||
### PHP
|
||||
_Looking for additional input_
|
||||
### Python
|
||||
_Looking for additional input_
|
||||
### Ruby
|
||||
_Looking for additional input_
|
Loading…
Reference in a new issue