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'
pathMatch: 'full'
},
...FriendsRoutes,
- ...RequestsRoutes,
+ ...RequestSchedulersRoutes,
...UsersRoutes,
...VideoAbusesRoutes
]
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'
FriendAddComponent,
FriendListComponent,
- RequestsComponent,
- RequestStatsComponent,
+ RequestSchedulersComponent,
+ RequestSchedulersStatsComponent,
UsersComponent,
UserAddComponent,
providers: [
FriendService,
- RequestService,
+ RequestSchedulersService,
UserService
]
})
-export * from './friends'
-export * from './requests'
-export * from './users'
-export * from './admin-routing.module'
export * from './admin.module'
-export * from './admin.component'
--- /dev/null
+export * from './request-schedulers-stats'
+export * from './shared'
+export * from './request-schedulers.component'
+export * from './request-schedulers.routes'
--- /dev/null
+export * from './request-schedulers-stats.component'
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,
constructor (
private notificationsService: NotificationsService,
- private requestService: RequestService
+ private requestService: RequestSchedulersService
) { }
ngOnInit () {
@Component({
template: '<router-outlet></router-outlet>'
})
-export class RequestsComponent {
+export class RequestSchedulersComponent {
}
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: '',
},
{
path: 'stats',
- component: RequestStatsComponent,
+ component: RequestSchedulersStatsComponent,
data: {
meta: {
title: 'Request stats'
--- /dev/null
+export * from './request-schedulers-stats-attributes.model'
+export * from './request-schedulers.service'
-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
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<RequestScheduler> {
- return this.authHttp.get(RequestService.BASE_REQUEST_URL + 'stats')
+ getStats (): Observable<RequestSchedulerStats> {
+ 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 => {
+++ /dev/null
-export * from './request-stats'
-export * from './shared'
-export * from './requests.component'
-export * from './requests.routes'
+++ /dev/null
-export * from './request-stats.component'
+++ /dev/null
-export * from './request-stats-attributes.model'
-export * from './request.service'
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'
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)
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)
// ---------------------------------------------------------------------------
-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,
require('./pods')
require('./remotes')
require('./users')
-require('./requests')
+require('./request-schedulers')
require('./videos')
require('./video-abuses')
require('./video-blacklists')
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
require('./video-abuse')
require('./video-blacklist')
require('./multiple-pods')
-require('./requests')
+require('./request-schedulers')
require('./friends-advanced')
require('./video-transcoder')
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) {
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')
// 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
export type RequestVideoEventType = 'likes' | 'dislikes' | 'views'
-export type RequestSchedulerAttributes = {
+export type RequestSchedulerStatsAttributes = {
totalRequests: number
requestsLimitPods: number
requestsLimitPerPod: number
milliSecondsInterval: number
}
-export interface RequestScheduler {
- requestScheduler: RequestSchedulerAttributes
- requestVideoQaduScheduler: RequestSchedulerAttributes
- requestVideoEventScheduler: RequestSchedulerAttributes
+export interface RequestSchedulerStats {
+ requestScheduler: RequestSchedulerStatsAttributes
+ requestVideoQaduScheduler: RequestSchedulerStatsAttributes
+ requestVideoEventScheduler: RequestSchedulerStatsAttributes
}