mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-07-05 05:08:07 +02:00
feat: add basic admin dashboard (#90)
This commit is contained in:
@@ -74,6 +74,7 @@
|
|||||||
<!-- Anonymous GitHub scripts -->
|
<!-- Anonymous GitHub scripts -->
|
||||||
<script src="/script/utils.js"></script>
|
<script src="/script/utils.js"></script>
|
||||||
<script src="/script/ng-pdfviewer.min.js"></script>
|
<script src="/script/ng-pdfviewer.min.js"></script>
|
||||||
|
<script src="/script/admin.js"></script>
|
||||||
<script src="/script/app.js"></script>
|
<script src="/script/app.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body keypress-events class="d-flex flex-column">
|
<body keypress-events class="d-flex flex-column">
|
||||||
|
|||||||
@@ -0,0 +1,290 @@
|
|||||||
|
<div class="container page">
|
||||||
|
<div class="row">
|
||||||
|
<div class="border-bottom color-border-secondary py-3 w-100">
|
||||||
|
<div class="d-flex flex-items-start w-100">
|
||||||
|
<form class="w-100" aria-label="Conferences" accept-charset="UTF-8">
|
||||||
|
<div class="d-flex flex-column flex-lg-row flex-auto">
|
||||||
|
<div class="mb-1 mb-md-0 mr-md-3">
|
||||||
|
<input
|
||||||
|
type="search"
|
||||||
|
id="search"
|
||||||
|
class="form-control"
|
||||||
|
aria-label="Find a conference…"
|
||||||
|
placeholder="Find a conference…"
|
||||||
|
autocomplete="off"
|
||||||
|
ng-model="query.search"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-1 mb-md-0 mr-md-3 col-2 input-group">
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
id="page"
|
||||||
|
class="form-control"
|
||||||
|
autocomplete="off"
|
||||||
|
ng-model="query.page"
|
||||||
|
min="1"
|
||||||
|
max="{{totalPage}}"
|
||||||
|
/>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<span class="input-group-text">/{{totalPage}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-flex flex-wrap">
|
||||||
|
<div class="dropdown mt-1 mt-lg-0 mr-1">
|
||||||
|
<button
|
||||||
|
class="btn btn-secondary dropdown-toggle"
|
||||||
|
type="button"
|
||||||
|
id="dropdownSort"
|
||||||
|
data-toggle="dropdown"
|
||||||
|
aria-haspopup="true"
|
||||||
|
aria-expanded="false"
|
||||||
|
>
|
||||||
|
Sort
|
||||||
|
</button>
|
||||||
|
<div class="dropdown-menu" aria-labelledby="dropdownSort">
|
||||||
|
<h6 class="dropdown-header">Select order</h6>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="radio"
|
||||||
|
name="sort"
|
||||||
|
id="sortFullName"
|
||||||
|
value="source.conferenceName"
|
||||||
|
ng-model="query.sort"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="sortFullName">
|
||||||
|
Conference
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="radio"
|
||||||
|
name="sort"
|
||||||
|
id="sortAnonymizeDate"
|
||||||
|
value="anonymizeDate"
|
||||||
|
ng-model="query.sort"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="sortAnonymizeDate">
|
||||||
|
Anonymize Date
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="radio"
|
||||||
|
name="sort"
|
||||||
|
id="sortStatus"
|
||||||
|
value="status"
|
||||||
|
ng-model="query.sort"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="sortStatus">
|
||||||
|
Status
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="radio"
|
||||||
|
name="sort"
|
||||||
|
id="sortLastView"
|
||||||
|
value="lastView"
|
||||||
|
ng-model="query.sort"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="sortLastView">
|
||||||
|
Last View
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="radio"
|
||||||
|
name="sort"
|
||||||
|
id="sortPageView"
|
||||||
|
value="pageView"
|
||||||
|
ng-model="query.sort"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="sortPageView">
|
||||||
|
Page View
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="dropdown mt-1 mt-lg-0 mr-1">
|
||||||
|
<button
|
||||||
|
class="btn btn-secondary dropdown-toggle"
|
||||||
|
type="button"
|
||||||
|
id="dropdownStatus"
|
||||||
|
data-toggle="dropdown"
|
||||||
|
aria-haspopup="true"
|
||||||
|
aria-expanded="false"
|
||||||
|
>
|
||||||
|
Status
|
||||||
|
</button>
|
||||||
|
<div class="dropdown-menu" aria-labelledby="dropdownStatus">
|
||||||
|
<h6 class="dropdown-header">Select status</h6>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
name="sort"
|
||||||
|
id="statusReady"
|
||||||
|
value="ready"
|
||||||
|
ng-model="query.ready"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="statusReady">
|
||||||
|
Ready
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
name="sort"
|
||||||
|
id="statusExpired"
|
||||||
|
value="expired"
|
||||||
|
ng-model="query.expired"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="statusExpired">
|
||||||
|
Expired
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
name="sort"
|
||||||
|
id="statusExpired"
|
||||||
|
value="expired"
|
||||||
|
ng-model="query.preparing"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="statusExpired">
|
||||||
|
Preparing
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
name="sort"
|
||||||
|
id="statusRemoved"
|
||||||
|
value="removed"
|
||||||
|
ng-model="query.removed"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="statusRemoved">
|
||||||
|
Removed
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
name="sort"
|
||||||
|
id="statusRemoved"
|
||||||
|
value="removed"
|
||||||
|
ng-model="query.error"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="statusRemoved">
|
||||||
|
Error
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<ul class="p-0 m-0 w-100">
|
||||||
|
<li
|
||||||
|
class="col-12 d-flex px-0 py-3 border-bottom color-border-secondary"
|
||||||
|
ng-class="{'expired': conference.status == 'expired','removed': conference.status == 'removed','error': conference.status == 'error' }"
|
||||||
|
ng-repeat="conference in conferences| filter:conferenceFiler| orderBy:orderBy as filteredConferences"
|
||||||
|
>
|
||||||
|
<div class="w-100">
|
||||||
|
<div class="">
|
||||||
|
<h3>
|
||||||
|
<a
|
||||||
|
ng-href="/conference/{{conference.conferenceID}}"
|
||||||
|
ng-bind="conference.name"
|
||||||
|
></a>
|
||||||
|
<span
|
||||||
|
class="badge"
|
||||||
|
ng-class="{'badge-warning': conference.status == 'removed' || conference.status == 'expired', 'badge-success': conference.status == 'ready', 'badge-danger': ''}"
|
||||||
|
ng-bind="conference.status | title"
|
||||||
|
></span>
|
||||||
|
</h3>
|
||||||
|
<span class="color-text-secondary mb-1 ng-binding">
|
||||||
|
Conference ID: '{{conference.conferenceID}}'
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="color-text-secondary mt-2">
|
||||||
|
<span
|
||||||
|
class="ml-0 mr-3"
|
||||||
|
title="# conference: {{conference.nbConference || 0 | number}}"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
data-placement="bottom"
|
||||||
|
>
|
||||||
|
<i class="fas fa-table"></i>
|
||||||
|
{{::conference.repositories.length || 0 | number}}</span
|
||||||
|
>
|
||||||
|
<span class="ml-0 mr-3">
|
||||||
|
<i class="fas fa-euro-sign"></i>
|
||||||
|
Total: {{conference.price || 0 | number}} €
|
||||||
|
</span>
|
||||||
|
<span class="ml-0 mr-3">
|
||||||
|
<i class="fas fa-calendar-alt"></i>
|
||||||
|
From {{conference.startDate | date}} to {{conference.endDate |
|
||||||
|
date}}</span
|
||||||
|
>
|
||||||
|
</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="/conference/{{conference.conferenceID}}/edit"
|
||||||
|
>
|
||||||
|
<i class="far fa-edit" aria-hidden="true"></i> Edit
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
class="dropdown-item"
|
||||||
|
href="#"
|
||||||
|
ng-show="conference.status != 'removed'"
|
||||||
|
ng-click="removeConference(conference)"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash-alt"></i> Remove
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
class="dropdown-item"
|
||||||
|
href="/conference/{{conference.conferenceID}}/"
|
||||||
|
>
|
||||||
|
<i class="fa fa-eye" aria-hidden="true"></i> View conference
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li
|
||||||
|
class="col-12 d-flex px-0 py-3 border-bottom color-border-secondary"
|
||||||
|
ng-if="filteredConferences.length == 0"
|
||||||
|
>
|
||||||
|
There is no conference to display.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
<div class="container page">
|
||||||
|
<div class="row">
|
||||||
|
<h1>Download jobs</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 downloadJobs as filteredDownloadJobs"
|
||||||
|
>
|
||||||
|
<div class="w-100">
|
||||||
|
{{job}}
|
||||||
|
</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-show="job.status != 'removed'"
|
||||||
|
ng-click="removeJob(job)"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash-alt"></i> Remove
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li
|
||||||
|
class="col-12 d-flex px-0 py-3 border-bottom color-border-secondary"
|
||||||
|
ng-if="filteredDownloadJobs.length == 0"
|
||||||
|
>
|
||||||
|
There is no job to display.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<h1>Remove jobs</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 removeJobs as filteredRemoveJobs"
|
||||||
|
>
|
||||||
|
<div class="w-100">
|
||||||
|
{{job}}
|
||||||
|
</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-show="job.status != 'removed'"
|
||||||
|
ng-click="removeJob(job)"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash-alt"></i> Remove
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li
|
||||||
|
class="col-12 d-flex px-0 py-3 border-bottom color-border-secondary"
|
||||||
|
ng-if="filteredRemoveJobs.length == 0"
|
||||||
|
>
|
||||||
|
There is no job to display.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,367 @@
|
|||||||
|
<div class="container page">
|
||||||
|
<div class="row">
|
||||||
|
<div class="border-bottom color-border-secondary py-3 w-100">
|
||||||
|
<div class="d-flex flex-items-start w-100">
|
||||||
|
<form class="w-100" aria-label="Repositories" accept-charset="UTF-8">
|
||||||
|
<div class="d-flex flex-column flex-lg-row flex-auto">
|
||||||
|
<div class="mb-1 mb-md-0 mr-md-3">
|
||||||
|
<input
|
||||||
|
type="search"
|
||||||
|
id="search"
|
||||||
|
class="form-control"
|
||||||
|
aria-label="Find a repository…"
|
||||||
|
placeholder="Find a repository…"
|
||||||
|
autocomplete="off"
|
||||||
|
ng-model="query.search"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-1 mb-md-0 mr-md-3 col-2 input-group">
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
id="page"
|
||||||
|
class="form-control"
|
||||||
|
autocomplete="off"
|
||||||
|
ng-model="query.page"
|
||||||
|
min="1"
|
||||||
|
max="{{totalPage}}"
|
||||||
|
/>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<span class="input-group-text">/{{totalPage}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-flex flex-wrap">
|
||||||
|
<div class="dropdown mt-1 mt-lg-0 mr-1">
|
||||||
|
<button
|
||||||
|
class="btn btn-secondary dropdown-toggle"
|
||||||
|
type="button"
|
||||||
|
id="dropdownSort"
|
||||||
|
data-toggle="dropdown"
|
||||||
|
aria-haspopup="true"
|
||||||
|
aria-expanded="false"
|
||||||
|
>
|
||||||
|
Sort
|
||||||
|
</button>
|
||||||
|
<div class="dropdown-menu" aria-labelledby="dropdownSort">
|
||||||
|
<h6 class="dropdown-header">Select order</h6>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="radio"
|
||||||
|
name="sort"
|
||||||
|
id="sortFullName"
|
||||||
|
value="source.repositoryName"
|
||||||
|
ng-model="query.sort"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="sortFullName">
|
||||||
|
Repository
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="radio"
|
||||||
|
name="sort"
|
||||||
|
id="sortAnonymizeDate"
|
||||||
|
value="anonymizeDate"
|
||||||
|
ng-model="query.sort"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="sortAnonymizeDate">
|
||||||
|
Anonymize Date
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="radio"
|
||||||
|
name="sort"
|
||||||
|
id="sortStatus"
|
||||||
|
value="status"
|
||||||
|
ng-model="query.sort"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="sortStatus">
|
||||||
|
Status
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="radio"
|
||||||
|
name="sort"
|
||||||
|
id="sortLastView"
|
||||||
|
value="lastView"
|
||||||
|
ng-model="query.sort"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="sortLastView">
|
||||||
|
Last View
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="radio"
|
||||||
|
name="sort"
|
||||||
|
id="sortPageView"
|
||||||
|
value="pageView"
|
||||||
|
ng-model="query.sort"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="sortPageView">
|
||||||
|
Page View
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="dropdown mt-1 mt-lg-0 mr-1">
|
||||||
|
<button
|
||||||
|
class="btn btn-secondary dropdown-toggle"
|
||||||
|
type="button"
|
||||||
|
id="dropdownStatus"
|
||||||
|
data-toggle="dropdown"
|
||||||
|
aria-haspopup="true"
|
||||||
|
aria-expanded="false"
|
||||||
|
>
|
||||||
|
Status
|
||||||
|
</button>
|
||||||
|
<div class="dropdown-menu" aria-labelledby="dropdownStatus">
|
||||||
|
<h6 class="dropdown-header">Select status</h6>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
name="sort"
|
||||||
|
id="statusReady"
|
||||||
|
value="ready"
|
||||||
|
ng-model="query.ready"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="statusReady">
|
||||||
|
Ready
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
name="sort"
|
||||||
|
id="statusExpired"
|
||||||
|
value="expired"
|
||||||
|
ng-model="query.expired"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="statusExpired">
|
||||||
|
Expired
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
name="sort"
|
||||||
|
id="statusExpired"
|
||||||
|
value="expired"
|
||||||
|
ng-model="query.preparing"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="statusExpired">
|
||||||
|
Preparing
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
name="sort"
|
||||||
|
id="statusRemoved"
|
||||||
|
value="removed"
|
||||||
|
ng-model="query.removed"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="statusRemoved">
|
||||||
|
Removed
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
name="sort"
|
||||||
|
id="statusRemoved"
|
||||||
|
value="removed"
|
||||||
|
ng-model="query.error"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="statusRemoved">
|
||||||
|
Error
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<ul class="p-0 m-0 w-100">
|
||||||
|
<li
|
||||||
|
class="col-12 d-flex px-0 py-3 border-bottom color-border-secondary"
|
||||||
|
ng-class="{'expired': repo.status == 'expired','removed': repo.status == 'removed','error': repo.status == 'error' }"
|
||||||
|
ng-repeat="repo in repositories| filter:repoFiler| orderBy:orderBy as filteredRepositories"
|
||||||
|
>
|
||||||
|
<div class="w-100">
|
||||||
|
<div class="">
|
||||||
|
<h3>
|
||||||
|
<a
|
||||||
|
target="__blank"
|
||||||
|
ng-href="/r/{{repo.repoId}}"
|
||||||
|
ng-bind="repo.repoId"
|
||||||
|
></a>
|
||||||
|
<span
|
||||||
|
class="badge"
|
||||||
|
ng-class="{'badge-warning': repo.status == 'removed' || repo.status == 'expired' || repo.status == 'removing' || repo.status == 'expiring', 'badge-info': repo.status == 'preparing' || repo.status == 'download', 'badge-success': repo.status == 'ready', 'badge-danger': repo.status == 'error'}"
|
||||||
|
><span ng-bind="repo.status | title"></span>
|
||||||
|
<span
|
||||||
|
ng-if="repo.status == 'error'"
|
||||||
|
ng-bind="': ' + repo.statusMessage"
|
||||||
|
></span
|
||||||
|
></span>
|
||||||
|
</h3>
|
||||||
|
<span class="color-text-secondary mb-1">
|
||||||
|
<span class="repository">
|
||||||
|
<i class="fab fa-github" aria-hidden="true"></i>
|
||||||
|
<a
|
||||||
|
href="https://github.com/{{repo.source.repositoryName}}/"
|
||||||
|
class="fullName"
|
||||||
|
ng-bind="repo.source.repositoryName"
|
||||||
|
></a>
|
||||||
|
</span>
|
||||||
|
<span class="branch" ng-if="repo.options.update">
|
||||||
|
<i class="fas fa-code-branch" aria-hidden="true"></i>
|
||||||
|
<a
|
||||||
|
href="https://github.com/{{repo.source.fullName}}/tree/{{repo.source.branch}}"
|
||||||
|
class="branch"
|
||||||
|
ng-bind="repo.source.branch"
|
||||||
|
></a>
|
||||||
|
</span>
|
||||||
|
<span class="commit" ng-if="!repo.options.update">
|
||||||
|
@<a
|
||||||
|
href="https://github.com/{{repo.source.fullName}}/tree/{{repo.source.commit}}"
|
||||||
|
class="commit"
|
||||||
|
ng-bind="repo.source.commit.substring(0, 8)"
|
||||||
|
></a>
|
||||||
|
</span>
|
||||||
|
anonymized {{repo.anonymizeDate | humanTime}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="color-text-secondary mt-2">
|
||||||
|
<span class="ml-0 mr-3" ng-if="::repo.conference">
|
||||||
|
<i class="fas fa-chalkboard-teacher"></i>
|
||||||
|
{{repo.conference}}
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="ml-0 mr-3"
|
||||||
|
class="terms"
|
||||||
|
title="Terms: {{::repo.options.terms.join(', ')}}"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
data-placement="bottom"
|
||||||
|
>
|
||||||
|
<i class="fas fa-shield-alt"></i>
|
||||||
|
{{::repo.options.terms.length | number}}
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="ml-0 mr-3"
|
||||||
|
title="Size: {{::repo.size.storage | humanFileSize}}"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
data-placement="bottom"
|
||||||
|
>
|
||||||
|
<i class="fas fa-database"></i> {{::repo.size.storage |
|
||||||
|
humanFileSize}}</span
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="ml-0 mr-3"
|
||||||
|
title="View: {{::repo.pageView || 0 | number}}"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
data-placement="bottom"
|
||||||
|
>
|
||||||
|
<i class="far fa-eye" aria-hidden="true"></i>
|
||||||
|
{{::repo.pageView || 0 | number}}
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="ml-0 mr-3"
|
||||||
|
title="Last view: {{::repo.lastView | date}}"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
data-placement="bottom"
|
||||||
|
>
|
||||||
|
<i class="far fa-calendar-alt" aria-hidden="true"></i>
|
||||||
|
Last view: {{::repo.lastView | humanTime}}</span
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="ml-0 mr-3"
|
||||||
|
ng-if="repo.options.expirationMode!='never' && repo.status == 'ready'"
|
||||||
|
>
|
||||||
|
<i class="far fa-clock" aria-hidden="true"></i>
|
||||||
|
Expire: {{repo.options.expirationDate | humanTime}}</span
|
||||||
|
>
|
||||||
|
</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="/anonymize/{{repo.repoId}}">
|
||||||
|
<i class="far fa-edit" aria-hidden="true"></i> Edit
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
class="dropdown-item"
|
||||||
|
href="#"
|
||||||
|
ng-show="repo.status == 'ready' || repo.status == 'error'"
|
||||||
|
ng-click="updateRepository(repo)"
|
||||||
|
>
|
||||||
|
<i class="fas fa-sync"></i> Force update
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
class="dropdown-item"
|
||||||
|
href="#"
|
||||||
|
ng-show="repo.status == 'removed'"
|
||||||
|
ng-click="updateRepository(repo)"
|
||||||
|
>
|
||||||
|
<i class="fas fa-check-circle"></i>
|
||||||
|
Enable
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
class="dropdown-item"
|
||||||
|
href="#"
|
||||||
|
ng-show="repo.status == 'ready'"
|
||||||
|
ng-click="removeRepository(repo)"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash-alt"></i> Remove
|
||||||
|
</a>
|
||||||
|
<a class="dropdown-item" href="/r/{{repo.repoId}}/">
|
||||||
|
<i class="fa fa-eye" aria-hidden="true"></i> View Repo
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
class="dropdown-item"
|
||||||
|
href="/w/{{repo.repoId}}/"
|
||||||
|
target="_self"
|
||||||
|
ng-if="repo.options.page && repo.status == 'ready'"
|
||||||
|
>
|
||||||
|
<i class="fas fa-globe"></i> View Page
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li
|
||||||
|
class="col-12 d-flex px-0 py-3 border-bottom color-border-secondary"
|
||||||
|
ng-if="filteredRepositories.length == 0"
|
||||||
|
>
|
||||||
|
There is no repository to display.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,213 @@
|
|||||||
|
<div class="container page">
|
||||||
|
<div class="row">
|
||||||
|
<div class="border-bottom color-border-secondary py-3 w-100">
|
||||||
|
<div class="d-flex flex-items-start w-100">
|
||||||
|
<form class="w-100" aria-label="Users" accept-charset="UTF-8">
|
||||||
|
<div class="d-flex flex-column flex-lg-row flex-auto">
|
||||||
|
<div class="mb-1 mb-md-0 mr-md-3">
|
||||||
|
<input
|
||||||
|
type="search"
|
||||||
|
id="search"
|
||||||
|
class="form-control"
|
||||||
|
aria-label="Find a user…"
|
||||||
|
placeholder="Find a user…"
|
||||||
|
autocomplete="off"
|
||||||
|
ng-model="query.search"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-1 mb-md-0 mr-md-3 col-2 input-group">
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
id="page"
|
||||||
|
class="form-control"
|
||||||
|
autocomplete="off"
|
||||||
|
ng-model="query.page"
|
||||||
|
min="1"
|
||||||
|
max="{{totalPage}}"
|
||||||
|
/>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<span class="input-group-text">/{{totalPage}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-flex flex-wrap">
|
||||||
|
<div class="dropdown mt-1 mt-lg-0 mr-1">
|
||||||
|
<button
|
||||||
|
class="btn btn-secondary dropdown-toggle"
|
||||||
|
type="button"
|
||||||
|
id="dropdownSort"
|
||||||
|
data-toggle="dropdown"
|
||||||
|
aria-haspopup="true"
|
||||||
|
aria-expanded="false"
|
||||||
|
>
|
||||||
|
Sort
|
||||||
|
</button>
|
||||||
|
<div class="dropdown-menu" aria-labelledby="dropdownSort">
|
||||||
|
<h6 class="dropdown-header">Select order</h6>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="radio"
|
||||||
|
name="sort"
|
||||||
|
id="username"
|
||||||
|
value="username"
|
||||||
|
ng-model="query.sort"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="username">
|
||||||
|
Username
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="dropdown mt-1 mt-lg-0 mr-1">
|
||||||
|
<button
|
||||||
|
class="btn btn-secondary dropdown-toggle"
|
||||||
|
type="button"
|
||||||
|
id="dropdownStatus"
|
||||||
|
data-toggle="dropdown"
|
||||||
|
aria-haspopup="true"
|
||||||
|
aria-expanded="false"
|
||||||
|
>
|
||||||
|
Status
|
||||||
|
</button>
|
||||||
|
<div class="dropdown-menu" aria-labelledby="dropdownStatus">
|
||||||
|
<h6 class="dropdown-header">Select status</h6>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
name="sort"
|
||||||
|
id="statusReady"
|
||||||
|
value="ready"
|
||||||
|
ng-model="query.ready"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="statusReady">
|
||||||
|
Active
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
name="sort"
|
||||||
|
id="statusExpired"
|
||||||
|
value="expired"
|
||||||
|
ng-model="query.expired"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="statusExpired">
|
||||||
|
Expired
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
name="sort"
|
||||||
|
id="statusExpired"
|
||||||
|
value="expired"
|
||||||
|
ng-model="query.preparing"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="statusExpired">
|
||||||
|
Preparing
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
name="sort"
|
||||||
|
id="statusRemoved"
|
||||||
|
value="removed"
|
||||||
|
ng-model="query.removed"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="statusRemoved">
|
||||||
|
Removed
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check dropdown-item">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
name="sort"
|
||||||
|
id="statusRemoved"
|
||||||
|
value="removed"
|
||||||
|
ng-model="query.error"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="statusRemoved">
|
||||||
|
Error
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<ul class="p-0 m-0 w-100">
|
||||||
|
<li
|
||||||
|
class="col-12 d-flex px-0 py-3 border-bottom color-border-secondary"
|
||||||
|
ng-class="{'expired': user.status == 'expired','removed': user.status == 'removed','error': user.status == 'error' }"
|
||||||
|
ng-repeat="user in users| filter:userFiler| orderBy:orderBy as filteredUsers"
|
||||||
|
>
|
||||||
|
<div class="w-100">
|
||||||
|
<div class="">
|
||||||
|
<h3>
|
||||||
|
{{user.username}}
|
||||||
|
<span
|
||||||
|
class="badge"
|
||||||
|
ng-class="{'badge-warning': user.status == 'removed' || user.status == 'expired' || user.status == 'removing' || user.status == 'expiring', 'badge-info': user.status == 'preparing' || user.status == 'download', 'badge-success': user.status == 'active', 'badge-danger': user.status == 'error'}"
|
||||||
|
><span ng-bind="user.status | title"></span>
|
||||||
|
</span>
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="color-text-secondary mt-2"></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="/admin/user/{{user._id}}">
|
||||||
|
<i class="far fa-edit" aria-hidden="true"></i> Edit
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
class="dropdown-item"
|
||||||
|
href="#"
|
||||||
|
ng-show="user.status == 'ready' || user.status == 'error'"
|
||||||
|
ng-click="banUser(user)"
|
||||||
|
>
|
||||||
|
<i class="fas fa-sync"></i> Ban
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
class="dropdown-item"
|
||||||
|
href="#"
|
||||||
|
ng-show="user.status == 'removed'"
|
||||||
|
ng-click="activateUser(user)"
|
||||||
|
>
|
||||||
|
<i class="fas fa-check-circle"></i>
|
||||||
|
Activate
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li
|
||||||
|
class="col-12 d-flex px-0 py-3 border-bottom color-border-secondary"
|
||||||
|
ng-if="filteredUsers.length == 0"
|
||||||
|
>
|
||||||
|
There is no user to display.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -47,6 +47,29 @@
|
|||||||
>Anonymize</a
|
>Anonymize</a
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item dropdown" ng-if="user">
|
||||||
|
<a
|
||||||
|
class="nav-link dropdown-toggle"
|
||||||
|
href="#"
|
||||||
|
id="navbarDropdownMenuLink"
|
||||||
|
role="button"
|
||||||
|
data-toggle="dropdown"
|
||||||
|
aria-haspopup="true"
|
||||||
|
aria-expanded="false"
|
||||||
|
ng-if="user.isAdmin"
|
||||||
|
>
|
||||||
|
Admin
|
||||||
|
</a>
|
||||||
|
<div
|
||||||
|
class="dropdown-menu"
|
||||||
|
aria-labelledby="navbarDropdownMenuLink"
|
||||||
|
>
|
||||||
|
<a class="dropdown-item" href="/admin/">Repositories</a>
|
||||||
|
<a class="dropdown-item" href="/admin/users">Users</a>
|
||||||
|
<a class="dropdown-item" href="/admin/conferences">Conferences</a>
|
||||||
|
<a class="dropdown-item" href="/admin/queues">Queues</a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="navbar-nav">
|
<ul class="navbar-nav">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
|
|||||||
@@ -0,0 +1,206 @@
|
|||||||
|
angular
|
||||||
|
.module("admin", [])
|
||||||
|
.controller("repositoriesAdminController", [
|
||||||
|
"$scope",
|
||||||
|
"$http",
|
||||||
|
"$location",
|
||||||
|
function ($scope, $http, $location) {
|
||||||
|
$scope.$watch("user.status", () => {
|
||||||
|
if ($scope.user == null) {
|
||||||
|
$location.url("/");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if ($scope.user == null) {
|
||||||
|
$location.url("/");
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.repositories = [];
|
||||||
|
$scope.total = -1;
|
||||||
|
$scope.totalPage = 0;
|
||||||
|
$scope.query = {
|
||||||
|
page: 1,
|
||||||
|
limit: 25,
|
||||||
|
sort: "source.repositoryName",
|
||||||
|
search: "",
|
||||||
|
ready: true,
|
||||||
|
expired: true,
|
||||||
|
removed: true,
|
||||||
|
error: true,
|
||||||
|
preparing: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
function getRepositories() {
|
||||||
|
$http.get("/api/admin/repos", { params: $scope.query }).then(
|
||||||
|
(res) => {
|
||||||
|
$scope.total = res.data.total;
|
||||||
|
$scope.totalPage = Math.ceil(res.data.total / $scope.query.limit);
|
||||||
|
$scope.repositories = res.data.results;
|
||||||
|
$scope.$apply();
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
getRepositories();
|
||||||
|
|
||||||
|
let timeClear = null;
|
||||||
|
$scope.$watch(
|
||||||
|
"query",
|
||||||
|
() => {
|
||||||
|
clearTimeout(timeClear);
|
||||||
|
timeClear = setTimeout(getRepositories, 500);
|
||||||
|
},
|
||||||
|
true
|
||||||
|
);
|
||||||
|
},
|
||||||
|
])
|
||||||
|
.controller("usersAdminController", [
|
||||||
|
"$scope",
|
||||||
|
"$http",
|
||||||
|
"$location",
|
||||||
|
function ($scope, $http, $location) {
|
||||||
|
$scope.$watch("user.status", () => {
|
||||||
|
if ($scope.user == null) {
|
||||||
|
$location.url("/");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if ($scope.user == null) {
|
||||||
|
$location.url("/");
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.users = [];
|
||||||
|
$scope.total = -1;
|
||||||
|
$scope.totalPage = 0;
|
||||||
|
$scope.query = {
|
||||||
|
page: 1,
|
||||||
|
limit: 25,
|
||||||
|
sort: "username",
|
||||||
|
search: "",
|
||||||
|
};
|
||||||
|
|
||||||
|
function getUsers() {
|
||||||
|
$http.get("/api/admin/users", { params: $scope.query }).then(
|
||||||
|
(res) => {
|
||||||
|
$scope.total = res.data.total;
|
||||||
|
$scope.totalPage = Math.ceil(res.data.total / $scope.query.limit);
|
||||||
|
$scope.users = res.data.results;
|
||||||
|
$scope.$apply();
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
getUsers();
|
||||||
|
|
||||||
|
let timeClear = null;
|
||||||
|
$scope.$watch(
|
||||||
|
"query",
|
||||||
|
() => {
|
||||||
|
clearTimeout(timeClear);
|
||||||
|
timeClear = setTimeout(getUsers, 500);
|
||||||
|
},
|
||||||
|
true
|
||||||
|
);
|
||||||
|
},
|
||||||
|
])
|
||||||
|
.controller("conferencesAdminController", [
|
||||||
|
"$scope",
|
||||||
|
"$http",
|
||||||
|
"$location",
|
||||||
|
function ($scope, $http, $location) {
|
||||||
|
$scope.$watch("user.status", () => {
|
||||||
|
if ($scope.user == null) {
|
||||||
|
$location.url("/");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if ($scope.user == null) {
|
||||||
|
$location.url("/");
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.conferences = [];
|
||||||
|
$scope.total = -1;
|
||||||
|
$scope.totalPage = 0;
|
||||||
|
$scope.query = {
|
||||||
|
page: 1,
|
||||||
|
limit: 25,
|
||||||
|
sort: "name",
|
||||||
|
search: ""
|
||||||
|
};
|
||||||
|
|
||||||
|
function getConferences() {
|
||||||
|
$http.get("/api/admin/conferences", { params: $scope.query }).then(
|
||||||
|
(res) => {
|
||||||
|
$scope.total = res.data.total;
|
||||||
|
$scope.totalPage = Math.ceil(res.data.total / $scope.query.limit);
|
||||||
|
$scope.conferences = res.data.results;
|
||||||
|
$scope.$apply();
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
getConferences();
|
||||||
|
|
||||||
|
let timeClear = null;
|
||||||
|
$scope.$watch(
|
||||||
|
"query",
|
||||||
|
() => {
|
||||||
|
clearTimeout(timeClear);
|
||||||
|
timeClear = setTimeout(getConferences, 500);
|
||||||
|
},
|
||||||
|
true
|
||||||
|
);
|
||||||
|
},
|
||||||
|
]).controller("queuesAdminController", [
|
||||||
|
"$scope",
|
||||||
|
"$http",
|
||||||
|
"$location",
|
||||||
|
function ($scope, $http, $location) {
|
||||||
|
$scope.$watch("user.status", () => {
|
||||||
|
if ($scope.user == null) {
|
||||||
|
$location.url("/");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if ($scope.user == null) {
|
||||||
|
$location.url("/");
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.downloadJobs = [];
|
||||||
|
$scope.removeJobs = [];
|
||||||
|
$scope.total = -1;
|
||||||
|
$scope.totalPage = 0;
|
||||||
|
$scope.query = {
|
||||||
|
page: 1,
|
||||||
|
limit: 25,
|
||||||
|
sort: "name",
|
||||||
|
search: ""
|
||||||
|
};
|
||||||
|
|
||||||
|
function getQueues() {
|
||||||
|
$http.get("/api/admin/queues", { params: $scope.query }).then(
|
||||||
|
(res) => {
|
||||||
|
$scope.downloadJobs = res.data.downloadQueue;
|
||||||
|
$scope.removeJobs = res.data.removeQueue;
|
||||||
|
$scope.$apply();
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
getQueues();
|
||||||
|
|
||||||
|
let timeClear = null;
|
||||||
|
$scope.$watch(
|
||||||
|
"query",
|
||||||
|
() => {
|
||||||
|
clearTimeout(timeClear);
|
||||||
|
timeClear = setTimeout(getQueues, 500);
|
||||||
|
},
|
||||||
|
true
|
||||||
|
);
|
||||||
|
},
|
||||||
|
]);
|
||||||
@@ -6,6 +6,7 @@ angular
|
|||||||
"ngPDFViewer",
|
"ngPDFViewer",
|
||||||
"pascalprecht.translate",
|
"pascalprecht.translate",
|
||||||
"angular-google-analytics",
|
"angular-google-analytics",
|
||||||
|
"admin",
|
||||||
])
|
])
|
||||||
.config(function (
|
.config(function (
|
||||||
$routeProvider,
|
$routeProvider,
|
||||||
@@ -90,6 +91,26 @@ angular
|
|||||||
title: "Anonymized Repository - Anonymous GitHub",
|
title: "Anonymized Repository - Anonymous GitHub",
|
||||||
reloadOnUrl: false,
|
reloadOnUrl: false,
|
||||||
})
|
})
|
||||||
|
.when("/admin/", {
|
||||||
|
templateUrl: "/partials/admin/repositories.htm",
|
||||||
|
controller: "repositoriesAdminController",
|
||||||
|
title: "Repositories Admin - Anonymous GitHub",
|
||||||
|
})
|
||||||
|
.when("/admin/users", {
|
||||||
|
templateUrl: "/partials/admin/users.htm",
|
||||||
|
controller: "usersAdminController",
|
||||||
|
title: "Users Admin - Anonymous GitHub",
|
||||||
|
})
|
||||||
|
.when("/admin/conferences", {
|
||||||
|
templateUrl: "/partials/admin/conferences.htm",
|
||||||
|
controller: "conferencesAdminController",
|
||||||
|
title: "Conferences Admin - Anonymous GitHub",
|
||||||
|
})
|
||||||
|
.when("/admin/queues", {
|
||||||
|
templateUrl: "/partials/admin/queues.htm",
|
||||||
|
controller: "queuesAdminController",
|
||||||
|
title: "Queues Admin - Anonymous GitHub",
|
||||||
|
})
|
||||||
.when("/404", {
|
.when("/404", {
|
||||||
templateUrl: "/partials/404.htm",
|
templateUrl: "/partials/404.htm",
|
||||||
title: "Page not found - Anonymous GitHub",
|
title: "Page not found - Anonymous GitHub",
|
||||||
|
|||||||
@@ -0,0 +1,165 @@
|
|||||||
|
import * as express from "express";
|
||||||
|
import AnonymizedRepositoryModel from "../database/anonymizedRepositories/anonymizedRepositories.model";
|
||||||
|
import ConferenceModel from "../database/conference/conferences.model";
|
||||||
|
import RepositoryModel from "../database/repositories/repositories.model";
|
||||||
|
import UserModel from "../database/users/users.model";
|
||||||
|
import { downloadQueue, removeQueue } from "../queue";
|
||||||
|
import Repository from "../Repository";
|
||||||
|
import { ensureAuthenticated } from "./connection";
|
||||||
|
import { handleError, getUser, isOwnerOrAdmin } from "./route-utils";
|
||||||
|
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
|
// user needs to be connected for all user API
|
||||||
|
router.use(ensureAuthenticated);
|
||||||
|
router.use(
|
||||||
|
async (
|
||||||
|
req: express.Request,
|
||||||
|
res: express.Response,
|
||||||
|
next: express.NextFunction
|
||||||
|
) => {
|
||||||
|
const user = await getUser(req);
|
||||||
|
try {
|
||||||
|
// only admins are allowed here
|
||||||
|
isOwnerOrAdmin([], user);
|
||||||
|
next();
|
||||||
|
} catch (error) {
|
||||||
|
handleError(error, res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
router.get("/queues", async (req, res) => {
|
||||||
|
const out = await Promise.all([
|
||||||
|
downloadQueue.getJobs([
|
||||||
|
"waiting",
|
||||||
|
"active",
|
||||||
|
"completed",
|
||||||
|
"failed",
|
||||||
|
"delayed",
|
||||||
|
]),
|
||||||
|
removeQueue.getJobs([
|
||||||
|
"waiting",
|
||||||
|
"active",
|
||||||
|
"completed",
|
||||||
|
"failed",
|
||||||
|
"delayed",
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
res.json({
|
||||||
|
downloadQueue: out[0],
|
||||||
|
removeQueue: out[1],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
router.get("/repos", async (req, res) => {
|
||||||
|
const page = parseInt(req.query.page as string) || 1;
|
||||||
|
const limit = parseInt(req.query.limit as string) || 10;
|
||||||
|
const ready = req.query.ready == "true";
|
||||||
|
const error = req.query.error == "true";
|
||||||
|
const preparing = req.query.preparing == "true";
|
||||||
|
const remove = req.query.remove == "true";
|
||||||
|
const expired = req.query.expired == "true";
|
||||||
|
|
||||||
|
let sort: any = { _id: 1 };
|
||||||
|
if (req.query.sort) {
|
||||||
|
sort = {};
|
||||||
|
sort[req.query.sort as string] = -1;
|
||||||
|
}
|
||||||
|
let query = [];
|
||||||
|
if (req.query.search) {
|
||||||
|
query.push({ repoId: { $regex: req.query.search } });
|
||||||
|
}
|
||||||
|
let status = [];
|
||||||
|
query.push({ $or: status });
|
||||||
|
if (ready) {
|
||||||
|
status.push({ status: "ready" });
|
||||||
|
}
|
||||||
|
if (error) {
|
||||||
|
status.push({ status: "error" });
|
||||||
|
}
|
||||||
|
if (expired) {
|
||||||
|
status.push({ status: "expiring" });
|
||||||
|
status.push({ status: "expired" });
|
||||||
|
}
|
||||||
|
if (remove) {
|
||||||
|
status.push({ status: "removing" });
|
||||||
|
status.push({ status: "removed" });
|
||||||
|
}
|
||||||
|
if (preparing) {
|
||||||
|
status.push({ status: "preparing" });
|
||||||
|
status.push({ status: "download" });
|
||||||
|
}
|
||||||
|
const skipIndex = (page - 1) * limit;
|
||||||
|
res.json({
|
||||||
|
query: { $and: query },
|
||||||
|
page,
|
||||||
|
total: await AnonymizedRepositoryModel.find({ $and: query }).estimatedDocumentCount(),
|
||||||
|
sort,
|
||||||
|
results: await AnonymizedRepositoryModel.find({ $and: query })
|
||||||
|
.sort(sort)
|
||||||
|
.limit(limit)
|
||||||
|
.skip(skipIndex),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
router.get("/users", async (req, res) => {
|
||||||
|
const page = parseInt(req.query.page as string) || 1;
|
||||||
|
const limit = parseInt(req.query.limit as string) || 10;
|
||||||
|
const skipIndex = (page - 1) * limit;
|
||||||
|
|
||||||
|
let sort: any = { _id: 1 };
|
||||||
|
if (req.query.sort) {
|
||||||
|
sort = {};
|
||||||
|
sort[req.query.sort as string] = -1;
|
||||||
|
}
|
||||||
|
let query = {};
|
||||||
|
if (req.query.search) {
|
||||||
|
query = { username: { $regex: req.query.search } };
|
||||||
|
}
|
||||||
|
|
||||||
|
res.json({
|
||||||
|
query: query,
|
||||||
|
page,
|
||||||
|
total: await UserModel.find(query).estimatedDocumentCount(),
|
||||||
|
sort,
|
||||||
|
results: await UserModel.find(query)
|
||||||
|
.sort(sort)
|
||||||
|
.limit(limit)
|
||||||
|
.skip(skipIndex),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
router.get("/conferences", async (req, res) => {
|
||||||
|
const page = parseInt(req.query.page as string) || 1;
|
||||||
|
const limit = parseInt(req.query.limit as string) || 10;
|
||||||
|
const skipIndex = (page - 1) * limit;
|
||||||
|
|
||||||
|
let sort: any = { _id: 1 };
|
||||||
|
if (req.query.sort) {
|
||||||
|
sort = {};
|
||||||
|
sort[req.query.sort as string] = -1;
|
||||||
|
}
|
||||||
|
let query = {};
|
||||||
|
if (req.query.search) {
|
||||||
|
query = {
|
||||||
|
$or: [
|
||||||
|
{ name: { $regex: req.query.search } },
|
||||||
|
{ conferenceID: { $regex: req.query.search } },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
res.json({
|
||||||
|
query: query,
|
||||||
|
page,
|
||||||
|
total: await ConferenceModel.find(query).estimatedDocumentCount(),
|
||||||
|
sort,
|
||||||
|
results: await ConferenceModel.find(query)
|
||||||
|
.sort(sort)
|
||||||
|
.limit(limit)
|
||||||
|
.skip(skipIndex),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
+3
-1
@@ -5,6 +5,7 @@ import file from "./file";
|
|||||||
import webview from "./webview";
|
import webview from "./webview";
|
||||||
import user from "./user";
|
import user from "./user";
|
||||||
import option from "./option";
|
import option from "./option";
|
||||||
|
import admin from "./admin";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
repositoryPrivate,
|
repositoryPrivate,
|
||||||
@@ -13,5 +14,6 @@ export default {
|
|||||||
webview,
|
webview,
|
||||||
user,
|
user,
|
||||||
option,
|
option,
|
||||||
conference
|
conference,
|
||||||
|
admin,
|
||||||
};
|
};
|
||||||
|
|||||||
+5
-1
@@ -20,7 +20,11 @@ router.get("/logout", async (req: express.Request, res: express.Response) => {
|
|||||||
router.get("/", async (req: express.Request, res: express.Response) => {
|
router.get("/", async (req: express.Request, res: express.Response) => {
|
||||||
try {
|
try {
|
||||||
const user = await getUser(req);
|
const user = await getUser(req);
|
||||||
res.json({ username: user.username, photo: user.photo });
|
res.json({
|
||||||
|
username: user.username,
|
||||||
|
photo: user.photo,
|
||||||
|
isAdmin: user.isAdmin,
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
handleError(error, res);
|
handleError(error, res);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ export default async function start() {
|
|||||||
app.use("/github", rate, connection.router);
|
app.use("/github", rate, connection.router);
|
||||||
|
|
||||||
// api routes
|
// api routes
|
||||||
|
app.use("/api/admin", rate, router.admin);
|
||||||
app.use("/api/options", rate, router.option);
|
app.use("/api/options", rate, router.option);
|
||||||
app.use("/api/conferences", rate, router.conference);
|
app.use("/api/conferences", rate, router.conference);
|
||||||
app.use("/api/user", rate, router.user);
|
app.use("/api/user", rate, router.user);
|
||||||
|
|||||||
Reference in New Issue
Block a user