From 6056605b8599a7ecf5cb8322668cc29151ce9d0b Mon Sep 17 00:00:00 2001 From: Thomas Durieux Date: Thu, 9 Sep 2021 14:30:34 +0200 Subject: [PATCH] chore: improve anonymization form (#81) --- public/partials/anonymize.htm | 290 +++++++++++++++------------------- public/script/app.js | 39 ++++- 2 files changed, 163 insertions(+), 166 deletions(-) diff --git a/public/partials/anonymize.htm b/public/partials/anonymize.htm index 97bfbf5..773b53f 100644 --- a/public/partials/anonymize.htm +++ b/public/partials/anonymize.htm @@ -17,6 +17,7 @@
Fill the information to anonymize! It will only take 5min.
+

Source

@@ -54,7 +55,7 @@ class="invalid-feedback" ng-show="anonymize.repoUrl.$error.used" > - {{repoUrl}} is already d + {{repoUrl}} is already anonymized
@@ -92,7 +93,7 @@
-
+
+ + Automatically update the anonymized repository with the + latest commit of the repository. The repository is updated + once per hour maximum. +
@@ -128,14 +146,55 @@ class="form-control" id="commit" name="commit" + pattern="[a-fA-Z0-9]{6,}" ng-model="source.commit" required ng-class="{'is-invalid': anonymize.commit.$invalid}" /> The commit to anonymize.The SHA of the commit to anonymize. +
+ The commit SHA is not valid. It should respect this pattern + [a-fA-Z0-9]{6,}. +
+

Conference

+ +
+ + + {{conference_data.name}} + will expire on {{conference_data.endDate | date}}. + +
+ The conference is not activated. +
+ + Use the conference ID that your conference provided you. This + will update automatically the anonymization options based on the + conference preferences. + +
+

Anonymization Options

@@ -187,34 +246,54 @@ Terms are in an invalid format
- +
- Expiration strategy + + Define the expiration strategy for the anonymized + repository. +
+
+ - In which conference the paper will be submitted.After {{options.expirationDate | date}}, the repository will be + removed and the visitor will not be able to see the content of + the repository. - {{conference_data.name}} - will expire on {{conference_data.endDate | date}}.After {{options.expirationDate | date}}, the visitors of the + anonymized repository will be redirected to {{repoUrl}}. - -
- The conference is not activated. -
@@ -229,7 +308,7 @@ aria-expanded="true" aria-controls="collapseOne" > - Rendering options + Advance options
@@ -299,72 +378,29 @@ >Display Notebooks - - - - -
-
-

- -

-
-
-
-
-
- - + + + How the repository will be anonymized. Stream mode + will request the content on the flight. This is the + only option for repositories bigger than + {{site_options.MAX_REPO_SIZE * 1024| humanFileSize}}. + Download will download the repository the repository + on the anonymous.4open.science server, it is faster + and offer more features.
-
- - - How the repository will be anonymized. Stream mode will - request the content on the flight. This is the only - option for repositories bigger than - {{site_options.MAX_REPO_SIZE * 1024| humanFileSize}}. - Download will download the repository the repository on - the anonymous.4open.science server, it is faster and - offer more features. -
-
-
-

- -

-
-
-
-
- - - Define the expiration strategy for the repository - expiration. -
-
- - - After {{options.expirationDate | date}}, the repository - will be removed and the visitor will not be able to see - the content of the repository. - After {{options.expirationDate | date}}, the visitors - of the anonymized repository will be redirected to - {{repoUrl}}. -
-
-
-
{ + if (v) { + $scope.anonymize.commit.$$element[0].disabled = true; + } else { + $scope.anonymize.commit.$$element[0].disabled = false; + } + }) + $scope.$watch("source.branch", async () => { + const selected = $scope.branches.filter( + (f) => f.name == $scope.source.branch + )[0]; + if ($scope.details && $scope.details.hasPage) { + $scope.anonymize.page.$$element[0].disabled = false; + if ($scope.details.pageSource.branch != $scope.source.branch) { + $scope.anonymize.page.$$element[0].disabled = true; + } + } + + if (selected) { + $scope.source.commit = selected.commit; + $scope.readme = selected.readme; + await getReadme(); + anonymize(); + $scope.$apply(); + } + }); + + $scope.$watch("options.mode", (v) => { + if (v == "GitHubStream") { + $scope.options.page = false; + $scope.anonymize.page.$$element[0].disabled = true; + } else { + $scope.anonymize.page.$$element[0].disabled = false; + } + }); + $scope.getBranches = async (force) => { const o = parseGithubUrl($scope.repoUrl); const branches = await $http.get( @@ -1145,6 +1181,7 @@ angular $scope.$watch("conference", async (v) => { getConference(); }); + $scope.$watch("source.branch", async (v) => { const selected = $scope.branches.filter( (f) => f.name == $scope.source.branch @@ -1533,7 +1570,6 @@ angular getPlans(); const start = new Date(); start.setDate(1); - console.log(start); start.setMonth(start.getMonth() + 1); const end = new Date(); end.setMonth(start.getMonth() + 7, 0); @@ -1555,7 +1591,6 @@ angular $scope.plan = null; $scope.$watch("options.plan.planID", () => { - console.log($scope.plans, $scope.options); $scope.plan = $scope.plans.filter( (f) => f.id == $scope.options.plan.planID )[0];