feat: admin to remove repo cache

This commit is contained in:
tdurieux
2023-02-07 13:27:06 +01:00
parent 3eee62d6ad
commit 73f7582fd2
6 changed files with 162 additions and 10 deletions
+74
View File
@@ -148,5 +148,79 @@
There is no job to display.
</li>
</ul>
<h1>Remove Cache</h1>
<ul class="p-0 m-0 w-100">
<li
class="col-12 d-flex px-0 py-3 border-bottom color-border-secondary"
ng-repeat="job in removeCaches as filteredRemoveCache"
>
<div class="w-100">
<div class="">
<h3>
<a target="__blank" ng-href="/r/{{job.id}}" ng-bind="job.id"></a>
<span class="badge" ng-bind="job.progress.status | title"></span>
</h3>
</div>
<div class="color-text-secondary mb-1">
<span ng-if="job.timestamp">
Created on:
<span ng-bind="job.timestamp | humanTime"></span>
</span>
<span ng-if="job.finishedOn">
Finished on:
<span ng-bind="job.finishedOn | humanTime"></span>
</span>
<span ng-if="job.processedOn">
Processed on:
<span ng-bind="job.processedOn | humanTime"></span>
</span>
</div>
<div>
<pre
ng-repeat="stack in job.stacktrace track by $index"
><code ng-bind="stack"></code></pre>
</div>
</div>
<div class="d-flex">
<div class="dropdown">
<button
class="btn black_border dropdown-toggle btn-sm"
type="button"
id="dropdownMenuButton"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false"
>
Actions
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a
class="dropdown-item"
href="#"
ng-click="removeJob('remove', job)"
>
<i class="fas fa-trash-alt"></i> Remove
</a>
<a
class="dropdown-item"
href="#"
ng-click="retryJob('remove', job)"
>
<i class="fas fa-sync"></i> Retry
</a>
<a class="dropdown-item" href="/anonymize/{{job.id}}">
<i class="far fa-edit" aria-hidden="true"></i> Edit
</a>
</div>
</div>
</div>
</li>
<li
class="col-12 d-flex px-0 py-3 border-bottom color-border-secondary"
ng-if="filteredRemoveCache.length == 0"
>
There is no job to display.
</li>
</ul>
</div>
</div>
+3
View File
@@ -313,6 +313,9 @@
Actions
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#" ng-click="removeCache(repo)">
<i class="fas fa-trash-alt"></i> Remove Cache
</a>
<a class="dropdown-item" href="/anonymize/{{repo.repoId}}">
<i class="far fa-edit" aria-hidden="true"></i> Edit
</a>
+12 -1
View File
@@ -29,6 +29,16 @@ angular
preparing: true,
};
$scope.removeCache = (repo) => {
$http.delete("/api/admin/repos/" + repo.repoId).then(
(res) => {
$scope.$apply();
},
(err) => {
console.error(err);
}
);
};
function getRepositories() {
$http.get("/api/admin/repos", { params: $scope.query }).then(
(res) => {
@@ -138,7 +148,7 @@ angular
return false;
};
function getUserRepositories(username) {
$http.get("/api/admin/users/" + username + "/repos", {}).then(
(res) => {
@@ -247,6 +257,7 @@ angular
(res) => {
$scope.downloadJobs = res.data.downloadQueue;
$scope.removeJobs = res.data.removeQueue;
$scope.removeCaches = res.data.cacheQueue;
},
(err) => {
console.error(err);