diff --git a/client/src/app/+admin/admin-routing.module.ts b/client/src/app/+admin/admin-routing.module.ts
index 839913135..bcc94a9f3 100644
--- a/client/src/app/+admin/admin-routing.module.ts
+++ b/client/src/app/+admin/admin-routing.module.ts
@@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router'
import { AdminComponent } from './admin.component'
import { FriendsRoutes } from './friends'
-import { RequestsRoutes } from './requests'
+import { RequestSchedulersRoutes } from './request-schedulers'
import { UsersRoutes } from './users'
import { VideoAbusesRoutes } from './video-abuses'
@@ -18,7 +18,7 @@ const adminRoutes: Routes = [
pathMatch: 'full'
},
...FriendsRoutes,
- ...RequestsRoutes,
+ ...RequestSchedulersRoutes,
...UsersRoutes,
...VideoAbusesRoutes
]
diff --git a/client/src/app/+admin/admin.module.ts b/client/src/app/+admin/admin.module.ts
index 9ecce5dc3..e4ba8e5b7 100644
--- a/client/src/app/+admin/admin.module.ts
+++ b/client/src/app/+admin/admin.module.ts
@@ -3,7 +3,7 @@ import { NgModule } from '@angular/core'
import { AdminComponent } from './admin.component'
import { AdminRoutingModule } from './admin-routing.module'
import { FriendsComponent, FriendAddComponent, FriendListComponent, FriendService } from './friends'
-import { RequestsComponent, RequestStatsComponent, RequestService } from './requests'
+import { RequestSchedulersComponent, RequestSchedulersStatsComponent, RequestSchedulersService } from './request-schedulers'
import { UsersComponent, UserAddComponent, UserListComponent, UserService } from './users'
import { VideoAbusesComponent, VideoAbuseListComponent } from './video-abuses'
import { SharedModule } from '../shared'
@@ -21,8 +21,8 @@ import { SharedModule } from '../shared'
FriendAddComponent,
FriendListComponent,
- RequestsComponent,
- RequestStatsComponent,
+ RequestSchedulersComponent,
+ RequestSchedulersStatsComponent,
UsersComponent,
UserAddComponent,
@@ -38,7 +38,7 @@ import { SharedModule } from '../shared'
providers: [
FriendService,
- RequestService,
+ RequestSchedulersService,
UserService
]
})
diff --git a/client/src/app/+admin/index.ts b/client/src/app/+admin/index.ts
index 11e2587c0..b628a3662 100644
--- a/client/src/app/+admin/index.ts
+++ b/client/src/app/+admin/index.ts
@@ -1,6 +1 @@
-export * from './friends'
-export * from './requests'
-export * from './users'
-export * from './admin-routing.module'
export * from './admin.module'
-export * from './admin.component'
diff --git a/client/src/app/+admin/request-schedulers/index.ts b/client/src/app/+admin/request-schedulers/index.ts
new file mode 100644
index 000000000..87b72e8c7
--- /dev/null
+++ b/client/src/app/+admin/request-schedulers/index.ts
@@ -0,0 +1,4 @@
+export * from './request-schedulers-stats'
+export * from './shared'
+export * from './request-schedulers.component'
+export * from './request-schedulers.routes'
diff --git a/client/src/app/+admin/request-schedulers/request-schedulers-stats/index.ts b/client/src/app/+admin/request-schedulers/request-schedulers-stats/index.ts
new file mode 100644
index 000000000..a3323e6be
--- /dev/null
+++ b/client/src/app/+admin/request-schedulers/request-schedulers-stats/index.ts
@@ -0,0 +1 @@
+export * from './request-schedulers-stats.component'
diff --git a/client/src/app/+admin/requests/request-stats/request-stats.component.html b/client/src/app/+admin/request-schedulers/request-schedulers-stats/request-schedulers-stats.component.html
similarity index 100%
rename from client/src/app/+admin/requests/request-stats/request-stats.component.html
rename to client/src/app/+admin/request-schedulers/request-schedulers-stats/request-schedulers-stats.component.html
diff --git a/client/src/app/+admin/requests/request-stats/request-stats.component.scss b/client/src/app/+admin/request-schedulers/request-schedulers-stats/request-schedulers-stats.component.scss
similarity index 100%
rename from client/src/app/+admin/requests/request-stats/request-stats.component.scss
rename to client/src/app/+admin/request-schedulers/request-schedulers-stats/request-schedulers-stats.component.scss
diff --git a/client/src/app/+admin/requests/request-stats/request-stats.component.ts b/client/src/app/+admin/request-schedulers/request-schedulers-stats/request-schedulers-stats.component.ts
similarity index 79%
rename from client/src/app/+admin/requests/request-stats/request-stats.component.ts
rename to client/src/app/+admin/request-schedulers/request-schedulers-stats/request-schedulers-stats.component.ts
index 140aaf47e..4e3fabc64 100644
--- a/client/src/app/+admin/requests/request-stats/request-stats.component.ts
+++ b/client/src/app/+admin/request-schedulers/request-schedulers-stats/request-schedulers-stats.component.ts
@@ -2,22 +2,22 @@ import { Component, OnInit, OnDestroy } from '@angular/core'
import { NotificationsService } from 'angular2-notifications'
-import { RequestService, RequestSchedulerStatsAttributes } from '../shared'
-import { RequestScheduler } from '../../../../../../shared'
+import { RequestSchedulersService, RequestSchedulerStatsAttributes } from '../shared'
+import { RequestSchedulerStats } from '../../../../../../shared'
@Component({
- selector: 'my-request-stats',
- templateUrl: './request-stats.component.html',
- styleUrls: [ './request-stats.component.scss' ]
+ selector: 'my-request-schedulers-stats',
+ templateUrl: './request-schedulers-stats.component.html',
+ styleUrls: [ './request-schedulers-stats.component.scss' ]
})
-export class RequestStatsComponent implements OnInit, OnDestroy {
+export class RequestSchedulersStatsComponent implements OnInit, OnDestroy {
statsTitles = {
requestScheduler: 'Basic request scheduler',
requestVideoEventScheduler: 'Video events request scheduler',
requestVideoQaduScheduler: 'Quick and dirty video updates request scheduler'
}
- stats: RequestScheduler
+ stats: RequestSchedulerStats
private intervals: { [ id: string ]: number } = {
requestScheduler: null,
@@ -33,7 +33,7 @@ export class RequestStatsComponent implements OnInit, OnDestroy {
constructor (
private notificationsService: NotificationsService,
- private requestService: RequestService
+ private requestService: RequestSchedulersService
) { }
ngOnInit () {
diff --git a/client/src/app/+admin/requests/requests.component.ts b/client/src/app/+admin/request-schedulers/request-schedulers.component.ts
similarity index 71%
rename from client/src/app/+admin/requests/requests.component.ts
rename to client/src/app/+admin/request-schedulers/request-schedulers.component.ts
index 88a90fa4e..5444d6ea5 100644
--- a/client/src/app/+admin/requests/requests.component.ts
+++ b/client/src/app/+admin/request-schedulers/request-schedulers.component.ts
@@ -3,5 +3,5 @@ import { Component } from '@angular/core'
@Component({
template: ''
})
-export class RequestsComponent {
+export class RequestSchedulersComponent {
}
diff --git a/client/src/app/+admin/requests/requests.routes.ts b/client/src/app/+admin/request-schedulers/request-schedulers.routes.ts
similarity index 51%
rename from client/src/app/+admin/requests/requests.routes.ts
rename to client/src/app/+admin/request-schedulers/request-schedulers.routes.ts
index 84db3fea8..4961c646b 100644
--- a/client/src/app/+admin/requests/requests.routes.ts
+++ b/client/src/app/+admin/request-schedulers/request-schedulers.routes.ts
@@ -1,12 +1,12 @@
import { Routes } from '@angular/router'
-import { RequestsComponent } from './requests.component'
-import { RequestStatsComponent } from './request-stats'
+import { RequestSchedulersComponent } from './request-schedulers.component'
+import { RequestSchedulersStatsComponent } from './request-schedulers-stats'
-export const RequestsRoutes: Routes = [
+export const RequestSchedulersRoutes: Routes = [
{
path: 'requests',
- component: RequestsComponent,
+ component: RequestSchedulersComponent,
children: [
{
path: '',
@@ -15,7 +15,7 @@ export const RequestsRoutes: Routes = [
},
{
path: 'stats',
- component: RequestStatsComponent,
+ component: RequestSchedulersStatsComponent,
data: {
meta: {
title: 'Request stats'
diff --git a/client/src/app/+admin/request-schedulers/shared/index.ts b/client/src/app/+admin/request-schedulers/shared/index.ts
new file mode 100644
index 000000000..1a0174409
--- /dev/null
+++ b/client/src/app/+admin/request-schedulers/shared/index.ts
@@ -0,0 +1,2 @@
+export * from './request-schedulers-stats-attributes.model'
+export * from './request-schedulers.service'
diff --git a/client/src/app/+admin/requests/shared/request-stats-attributes.model.ts b/client/src/app/+admin/request-schedulers/shared/request-schedulers-stats-attributes.model.ts
similarity index 85%
rename from client/src/app/+admin/requests/shared/request-stats-attributes.model.ts
rename to client/src/app/+admin/request-schedulers/shared/request-schedulers-stats-attributes.model.ts
index 394acc73d..6e19a0e44 100644
--- a/client/src/app/+admin/requests/shared/request-stats-attributes.model.ts
+++ b/client/src/app/+admin/request-schedulers/shared/request-schedulers-stats-attributes.model.ts
@@ -1,11 +1,11 @@
-import { RequestSchedulerAttributes as FormatedRequestSchedulerAttributes } from '../../../../../../shared'
+import { RequestSchedulerStatsAttributes as FormatedRequestSchedulerStatsAttributes } from '../../../../../../shared'
export interface Request {
request: any
to: any
}
-export class RequestSchedulerStatsAttributes implements FormatedRequestSchedulerAttributes {
+export class RequestSchedulerStatsAttributes implements FormatedRequestSchedulerStatsAttributes {
requestsLimitPods: number
requestsLimitPerPod: number
milliSecondsInterval: number
diff --git a/client/src/app/+admin/requests/shared/request.service.ts b/client/src/app/+admin/request-schedulers/shared/request-schedulers.service.ts
similarity index 62%
rename from client/src/app/+admin/requests/shared/request.service.ts
rename to client/src/app/+admin/request-schedulers/shared/request-schedulers.service.ts
index 53682b111..e9b166f78 100644
--- a/client/src/app/+admin/requests/shared/request.service.ts
+++ b/client/src/app/+admin/request-schedulers/shared/request-schedulers.service.ts
@@ -3,27 +3,27 @@ import { Observable } from 'rxjs/Observable'
import 'rxjs/add/operator/catch'
import 'rxjs/add/operator/map'
-import { RequestScheduler } from '../../../../../../shared'
+import { RequestSchedulerStats } from '../../../../../../shared'
import { AuthHttp, RestExtractor } from '../../../shared'
-import { RequestSchedulerStatsAttributes } from './request-stats-attributes.model'
+import { RequestSchedulerStatsAttributes } from './request-schedulers-stats-attributes.model'
@Injectable()
-export class RequestService {
- private static BASE_REQUEST_URL = API_URL + '/api/v1/requests/'
+export class RequestSchedulersService {
+ private static BASE_REQUEST_URL = API_URL + '/api/v1/request-schedulers/'
constructor (
private authHttp: AuthHttp,
private restExtractor: RestExtractor
) {}
- getStats (): Observable {
- return this.authHttp.get(RequestService.BASE_REQUEST_URL + 'stats')
+ getStats (): Observable {
+ return this.authHttp.get(RequestSchedulersService.BASE_REQUEST_URL + 'stats')
.map(this.restExtractor.extractDataGet)
.map(this.buildRequestObjects)
.catch((res) => this.restExtractor.handleError(res))
}
- private buildRequestObjects (data: RequestScheduler) {
+ private buildRequestObjects (data: RequestSchedulerStats) {
const requestSchedulers = {}
Object.keys(data).forEach(requestSchedulerName => {
diff --git a/client/src/app/+admin/requests/index.ts b/client/src/app/+admin/requests/index.ts
deleted file mode 100644
index d96a893c3..000000000
--- a/client/src/app/+admin/requests/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export * from './request-stats'
-export * from './shared'
-export * from './requests.component'
-export * from './requests.routes'
diff --git a/client/src/app/+admin/requests/request-stats/index.ts b/client/src/app/+admin/requests/request-stats/index.ts
deleted file mode 100644
index 740c401bb..000000000
--- a/client/src/app/+admin/requests/request-stats/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from './request-stats.component'
diff --git a/client/src/app/+admin/requests/shared/index.ts b/client/src/app/+admin/requests/shared/index.ts
deleted file mode 100644
index 857fe9d29..000000000
--- a/client/src/app/+admin/requests/shared/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from './request-stats-attributes.model'
-export * from './request.service'
diff --git a/server/controllers/api/index.ts b/server/controllers/api/index.ts
index ac3972ac6..3abe9bcf8 100644
--- a/server/controllers/api/index.ts
+++ b/server/controllers/api/index.ts
@@ -6,7 +6,7 @@ import { clientsRouter } from './clients'
import { configRouter } from './config'
import { podsRouter } from './pods'
import { remoteRouter } from './remote'
-import { requestsRouter } from './requests'
+import { requestSchedulerRouter } from './request-schedulers'
import { usersRouter } from './users'
import { videosRouter } from './videos'
@@ -16,7 +16,7 @@ apiRouter.use('/clients', clientsRouter)
apiRouter.use('/config', configRouter)
apiRouter.use('/pods', podsRouter)
apiRouter.use('/remote', remoteRouter)
-apiRouter.use('/requests', requestsRouter)
+apiRouter.use('/request-schedulers', requestSchedulerRouter)
apiRouter.use('/users', usersRouter)
apiRouter.use('/videos', videosRouter)
apiRouter.use('/ping', pong)
diff --git a/server/controllers/api/requests.ts b/server/controllers/api/request-schedulers.ts
similarity index 61%
rename from server/controllers/api/requests.ts
rename to server/controllers/api/request-schedulers.ts
index 5718b59b7..8dd849007 100644
--- a/server/controllers/api/requests.ts
+++ b/server/controllers/api/request-schedulers.ts
@@ -8,29 +8,29 @@ import {
getRequestVideoEventScheduler
} from '../../lib'
import { authenticate, ensureIsAdmin } from '../../middlewares'
-import { RequestSchedulerAttributes } from '../../../shared'
+import { RequestSchedulerStatsAttributes } from '../../../shared'
-const requestsRouter = express.Router()
+const requestSchedulerRouter = express.Router()
-requestsRouter.get('/stats',
+requestSchedulerRouter.get('/stats',
authenticate,
ensureIsAdmin,
- getStatsRequests
+ getRequestSchedulersStats
)
// ---------------------------------------------------------------------------
export {
- requestsRouter
+ requestSchedulerRouter
}
// ---------------------------------------------------------------------------
-function getStatsRequests (req: express.Request, res: express.Response, next: express.NextFunction) {
+function getRequestSchedulersStats (req: express.Request, res: express.Response, next: express.NextFunction) {
parallel({
- requestScheduler: buildRequestSchedulerFunction(getRequestScheduler()),
- requestVideoQaduScheduler: buildRequestSchedulerFunction(getRequestVideoQaduScheduler()),
- requestVideoEventScheduler: buildRequestSchedulerFunction(getRequestVideoEventScheduler())
+ requestScheduler: buildRequestSchedulerStats(getRequestScheduler()),
+ requestVideoQaduScheduler: buildRequestSchedulerStats(getRequestVideoQaduScheduler()),
+ requestVideoEventScheduler: buildRequestSchedulerStats(getRequestVideoEventScheduler())
}, function (err, result) {
if (err) return next(err)
@@ -40,12 +40,12 @@ function getStatsRequests (req: express.Request, res: express.Response, next: ex
// ---------------------------------------------------------------------------
-function buildRequestSchedulerFunction (requestScheduler: AbstractRequestScheduler) {
+function buildRequestSchedulerStats (requestScheduler: AbstractRequestScheduler) {
return function (callback) {
requestScheduler.remainingRequestsCount(function (err, count) {
if (err) return callback(err)
- const result: RequestSchedulerAttributes = {
+ const result: RequestSchedulerStatsAttributes = {
totalRequests: count,
requestsLimitPods: requestScheduler.limitPods,
requestsLimitPerPod: requestScheduler.limitPerPod,
diff --git a/server/tests/api/check-params/index.js b/server/tests/api/check-params/index.js
index 527ab65a9..1ba16ff32 100644
--- a/server/tests/api/check-params/index.js
+++ b/server/tests/api/check-params/index.js
@@ -4,7 +4,7 @@
require('./pods')
require('./remotes')
require('./users')
-require('./requests')
+require('./request-schedulers')
require('./videos')
require('./video-abuses')
require('./video-blacklists')
diff --git a/server/tests/api/check-params/requests.js b/server/tests/api/check-params/request-schedulers.js
similarity index 94%
rename from server/tests/api/check-params/requests.js
rename to server/tests/api/check-params/request-schedulers.js
index 0ce5582d6..9ba0df730 100644
--- a/server/tests/api/check-params/requests.js
+++ b/server/tests/api/check-params/request-schedulers.js
@@ -9,8 +9,8 @@ const loginUtils = require('../../utils/login')
const usersUtils = require('../../utils/users')
const serversUtils = require('../../utils/servers')
-describe('Test requests API validators', function () {
- const path = '/api/v1/requests/stats'
+describe('Test request schedulers stats API validators', function () {
+ const path = '/api/v1/request-schedulers/stats'
let server = null
let userAccessToken = null
diff --git a/server/tests/api/index.js b/server/tests/api/index.js
index cc86a3d3b..7404d7d88 100644
--- a/server/tests/api/index.js
+++ b/server/tests/api/index.js
@@ -9,6 +9,6 @@ require('./single-pod')
require('./video-abuse')
require('./video-blacklist')
require('./multiple-pods')
-require('./requests')
+require('./request-schedulers')
require('./friends-advanced')
require('./video-transcoder')
diff --git a/server/tests/api/requests.js b/server/tests/api/request-schedulers.js
similarity index 96%
rename from server/tests/api/requests.js
rename to server/tests/api/request-schedulers.js
index 8762163af..c5c443f14 100644
--- a/server/tests/api/requests.js
+++ b/server/tests/api/request-schedulers.js
@@ -12,9 +12,9 @@ const podsUtils = require('../utils/pods')
const serversUtils = require('../utils/servers')
const videosUtils = require('../utils/videos')
-describe('Test requests stats', function () {
+describe('Test requests schedulers stats', function () {
const requestSchedulerNames = [ 'requestScheduler', 'requestVideoQaduScheduler', 'requestVideoEventScheduler' ]
- const path = '/api/v1/requests/stats'
+ const path = '/api/v1/request-schedulers/stats'
let servers = []
function uploadVideo (server, callback) {
diff --git a/server/tests/real-world/real-world.js b/server/tests/real-world/real-world.js
index 3ac13f053..ea189c5f2 100644
--- a/server/tests/real-world/real-world.js
+++ b/server/tests/real-world/real-world.js
@@ -13,7 +13,7 @@ const loginUtils = require('../utils/login')
const podsUtils = require('../utils/pods')
const serversUtils = require('../utils/servers')
const videosUtils = require('../utils/videos')
-const requestStatsUtils = require('../utils/requests-stats')
+const requestSchedulersUtils = require('../utils/request-schedulers')
program
.option('-c, --create [weight]', 'Weight for creating videos')
@@ -344,7 +344,7 @@ function isThereAwaitingRequests (servers, callback) {
// Check is each server has awaiting requestq
each(servers, function (server, callbackEach) {
- requestStatsUtils.getRequestsStats(server, server.accessToken, function (err, res) {
+ requestSchedulersUtils.getRequestsStats(server, server.accessToken, function (err, res) {
if (err) throw err
const stats = res.body
diff --git a/server/tests/utils/requests-stats.js b/server/tests/utils/request-schedulers.js
similarity index 100%
rename from server/tests/utils/requests-stats.js
rename to server/tests/utils/request-schedulers.js
diff --git a/shared/models/request-scheduler.model.ts b/shared/models/request-scheduler.model.ts
index f94ccfcab..8df184a09 100644
--- a/shared/models/request-scheduler.model.ts
+++ b/shared/models/request-scheduler.model.ts
@@ -4,7 +4,7 @@ export type RequestVideoQaduType = 'likes' | 'dislikes' | 'views'
export type RequestVideoEventType = 'likes' | 'dislikes' | 'views'
-export type RequestSchedulerAttributes = {
+export type RequestSchedulerStatsAttributes = {
totalRequests: number
requestsLimitPods: number
requestsLimitPerPod: number
@@ -12,8 +12,8 @@ export type RequestSchedulerAttributes = {
milliSecondsInterval: number
}
-export interface RequestScheduler {
- requestScheduler: RequestSchedulerAttributes
- requestVideoQaduScheduler: RequestSchedulerAttributes
- requestVideoEventScheduler: RequestSchedulerAttributes
+export interface RequestSchedulerStats {
+ requestScheduler: RequestSchedulerStatsAttributes
+ requestVideoQaduScheduler: RequestSchedulerStatsAttributes
+ requestVideoEventScheduler: RequestSchedulerStatsAttributes
}