fix repo update

This commit is contained in:
tdurieux
2021-04-21 22:58:18 +02:00
parent a32945bf67
commit fbc7952d62
2 changed files with 50 additions and 39 deletions
+1 -3
View File
@@ -113,7 +113,7 @@
{{$index + 1}} {{$index + 1}}
</th> </th>
<td class="align-middle"> <td class="align-middle">
<a href="/r/{{repo.repoId}}" target="__self" <a href="/r/{{repo.repoId}}"
>{{repo.repoId}}</a >{{repo.repoId}}</a
> >
</td> </td>
@@ -185,7 +185,6 @@
<a <a
class="dropdown-item" class="dropdown-item"
href="/anonymize/{{repo.repoId}}" href="/anonymize/{{repo.repoId}}"
target="_self"
> >
<i class="fa fa-edit" aria-hidden="true"></i> Edit <i class="fa fa-edit" aria-hidden="true"></i> Edit
</a> </a>
@@ -218,7 +217,6 @@
<a <a
class="dropdown-item" class="dropdown-item"
href="/r/{{repo.repoId}}/" href="/r/{{repo.repoId}}/"
target="_self"
> >
<i class="fa fa-eye" aria-hidden="true"></i> View Repo <i class="fa fa-eye" aria-hidden="true"></i> View Repo
</a> </a>
+48 -35
View File
@@ -591,13 +591,15 @@ angular
link: true, link: true,
mode: "download", mode: "download",
}; };
$scope.options.expirationDate.setDate(90); $scope.options.expirationDate.setDate(
$scope.options.expirationDate.getDate() + 90
);
$scope.anonymize_readme = ""; $scope.anonymize_readme = "";
$scope.readme = ""; $scope.readme = "";
$scope.html_readme = ""; $scope.html_readme = "";
$scope.isUpdate = false; $scope.isUpdate = false;
function getDefault() { function getDefault(cb) {
$http.get("/api/user/default").then((res) => { $http.get("/api/user/default").then((res) => {
const data = res.data; const data = res.data;
if (data.terms) { if (data.terms) {
@@ -607,44 +609,55 @@ angular
$scope.options.expirationDate = new Date( $scope.options.expirationDate = new Date(
$scope.options.expirationDate $scope.options.expirationDate
); );
$scope.options.expirationDate.setDate(
$scope.options.expirationDate.getDate() + 90
);
if (cb) cb();
}); });
} }
getDefault(); getDefault(() => {
if ($routeParams.repoId && $routeParams.repoId != "") {
$scope.isUpdate = true;
$scope.repoId = $routeParams.repoId;
$http.get("/api/repo/" + $scope.repoId).then(
async (res) => {
$scope.repoUrl = "https://github.com/" + res.data.fullName;
if ($routeParams.repoId && $routeParams.repoId != "") { $scope.terms = res.data.terms.join("\n");
$scope.isUpdate = true; $scope.branch = res.data.branch;
$scope.repoId = $routeParams.repoId; $scope.options = res.data.options;
$http.get("/api/repo/" + $scope.repoId).then( $scope.conference = res.data.conference;
async (res) => { if (res.data.options.expirationDate) {
$scope.repoUrl = "https://github.com/" + res.data.fullName; $scope.options.expirationDate = new Date(
res.data.options.expirationDate
);
} else {
$scope.options.expirationDate = new Date();
$scope.options.expirationDate.setDate(
$scope.options.expirationDate.getDate() + 90
);
}
$scope.terms = res.data.terms.join("\n"); $scope.details = (await $http.get(
$scope.branch = res.data.branch; `/api/repo/${res.data.fullName}/`
$scope.options = res.data.options; )).data;
$scope.conference = res.data.conference;
$scope.options.expirationDate = new Date(
res.data.options.expirationDate
);
$scope.details = (await $http.get( await getReadme();
`/api/repo/${res.data.fullName}/` await $scope.getBranches();
)).data; anonymize();
$scope.$apply();
await getReadme(); },
await $scope.getBranches(); (err) => {
anonymize(); $location.url("/404");
$scope.$apply(); }
}, );
(err) => { $scope.$watch("anonymize", () => {
$location.url("/404"); $scope.anonymize.repoId.$$element[0].disabled = true;
} $scope.anonymize.repoUrl.$$element[0].disabled = true;
); $scope.anonymize.repositories.$$element[0].disabled = true;
$scope.$watch("anonymize", () => { });
$scope.anonymize.repoId.$$element[0].disabled = true; }
$scope.anonymize.repoUrl.$$element[0].disabled = true; });
$scope.anonymize.repositories.$$element[0].disabled = true;
});
}
$scope.repositories = []; $scope.repositories = [];