Client: little refractoring

This commit is contained in:
Chocobozzz 2017-05-05 16:08:43 +02:00
parent c24ac1c18e
commit 1f0215a908
23 changed files with 58 additions and 104 deletions

View File

@ -1,7 +1,7 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
@Component({ @Component({
template: '<router-outlet></router-outlet>' template: '<router-outlet></router-outlet>'
}) })
export class FriendsComponent { export class FriendsComponent {

View File

@ -6,7 +6,6 @@ import { AuthHttp, RestExtractor, RestDataSource, User } from '../../../shared';
@Injectable() @Injectable()
export class UserService { export class UserService {
// TODO: merge this constant with account
private static BASE_USERS_URL = '/api/v1/users/'; private static BASE_USERS_URL = '/api/v1/users/';
constructor( constructor(

View File

@ -1,7 +1,3 @@
.glyphicon-remove {
cursor: pointer;
}
.add-user { .add-user {
margin-top: 10px; margin-top: 10px;
} }

View File

@ -1,7 +1,7 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
@Component({ @Component({
template: '<router-outlet></router-outlet>' template: '<router-outlet></router-outlet>'
}) })
export class UsersComponent { export class UsersComponent {

View File

@ -6,32 +6,32 @@ import { UserListComponent } from './user-list';
export const UsersRoutes: Routes = [ export const UsersRoutes: Routes = [
{ {
path: 'users', path: 'users',
component: UsersComponent, component: UsersComponent,
children: [ children: [
{ {
path: '', path: '',
redirectTo: 'list', redirectTo: 'list',
pathMatch: 'full' pathMatch: 'full'
}, },
{ {
path: 'list', path: 'list',
component: UserListComponent, component: UserListComponent,
data: { data: {
meta: { meta: {
title: 'Users list' title: 'Users list'
}
}
},
{
path: 'add',
component: UserAddComponent,
data: {
meta: {
title: 'Add a user'
}
} }
} }
] },
} {
path: 'add',
component: UserAddComponent,
data: {
meta: {
title: 'Add a user'
}
}
}
]
}
]; ];

View File

@ -1,7 +0,0 @@
.cell-id {
width: 40px;
}
.cell-reason {
width: 200px;
}

View File

@ -6,8 +6,7 @@ import { Utils, VideoAbuseService, VideoAbuse } from '../../../shared';
@Component({ @Component({
selector: 'my-video-abuse-list', selector: 'my-video-abuse-list',
templateUrl: './video-abuse-list.component.html', templateUrl: './video-abuse-list.component.html'
styleUrls: [ './video-abuse-list.component.scss' ]
}) })
export class VideoAbuseListComponent { export class VideoAbuseListComponent {
videoAbusesSource = null; videoAbusesSource = null;

View File

@ -5,24 +5,24 @@ import { VideoAbuseListComponent } from './video-abuse-list';
export const VideoAbusesRoutes: Routes = [ export const VideoAbusesRoutes: Routes = [
{ {
path: 'video-abuses', path: 'video-abuses',
component: VideoAbusesComponent component: VideoAbusesComponent
, ,
children: [ children: [
{ {
path: '', path: '',
redirectTo: 'list', redirectTo: 'list',
pathMatch: 'full' pathMatch: 'full'
}, },
{ {
path: 'list', path: 'list',
component: VideoAbuseListComponent, component: VideoAbuseListComponent,
data: { data: {
meta: { meta: {
title: 'Video abuses list' title: 'Video abuses list'
}
} }
} }
] }
} ]
}
]; ];

View File

@ -1,5 +1,4 @@
<menu> <menu>
<div class="panel-block"> <div class="panel-block">
<a routerLink="/admin/users/list" routerLinkActive="active"> <a routerLink="/admin/users/list" routerLinkActive="active">
<span class="hidden-xs glyphicon glyphicon-user"></span> <span class="hidden-xs glyphicon glyphicon-user"></span>

View File

@ -1,4 +1,3 @@
export * from './loader';
export * from './sort-field.type'; export * from './sort-field.type';
export * from './rate-type.type'; export * from './rate-type.type';
export * from './video.model'; export * from './video.model';

View File

@ -1 +0,0 @@
export * from './loader.component';

View File

@ -1,3 +1,4 @@
export * from './loader.component';
export * from './video-list.component'; export * from './video-list.component';
export * from './video-miniature.component'; export * from './video-miniature.component';
export * from './video-sort.component'; export * from './video-sort.component';

View File

@ -23,19 +23,6 @@
my-video-miniature { my-video-miniature {
text-align: left; text-align: left;
transition: all 0.5s ease;
&.ng-enter {
opacity: 0;
}
&.ng-enter-active {
opacity: 1;
}
&.ng-leave {
opacity: 0;
}
} }
.no-video { .no-video {

View File

@ -76,10 +76,7 @@ export class VideoListComponent implements OnInit, OnDestroy {
this.loading.next(true); this.loading.next(true);
this.videos = []; this.videos = [];
this.changeDetector.detectChanges();
let observable = null; let observable = null;
if (this.search.value) { if (this.search.value) {
observable = this.videoService.searchVideos(this.search, this.pagination, this.sort); observable = this.videoService.searchVideos(this.search, this.pagination, this.sort);
} else { } else {
@ -150,8 +147,6 @@ export class VideoListComponent implements OnInit, OnDestroy {
} else { } else {
this.pagination.currentPage = 1; this.pagination.currentPage = 1;
} }
this.changeDetector.detectChanges();
} }
private navigateToNewParams() { private navigateToNewParams() {

View File

@ -1,4 +1,4 @@
<div class="video-miniature" (mouseenter)="onHover()" (mouseleave)="onBlur()"> <div class="video-miniature">
<a <a
[routerLink]="['/videos/watch', video.id]" [attr.title]="video.description" [routerLink]="['/videos/watch', video.id]" [attr.title]="video.description"
class="video-miniature-thumbnail" class="video-miniature-thumbnail"

View File

@ -1,5 +1,3 @@
@import "../../../sass/pre-customizations.scss";
.video-miniature { .video-miniature {
margin-top: 30px; margin-top: 30px;
display: inline-block; display: inline-block;
@ -71,7 +69,7 @@
} }
.video-miniature-tags { .video-miniature-tags {
// Fix for chrome when tags a long // Fix for chrome when tags are long
width: 201px; width: 201px;
.video-miniature-tag { .video-miniature-tag {
@ -81,7 +79,6 @@
top: -2px; top: -2px;
.label { .label {
line-height: $line-height-base;
transition: background-color 0.2s; transition: background-color 0.2s;
} }
} }

View File

@ -17,8 +17,6 @@ export class VideoMiniatureComponent {
@Input() user: User; @Input() user: User;
@Input() video: Video; @Input() video: Video;
hovering = false;
constructor( constructor(
private notificationsService: NotificationsService, private notificationsService: NotificationsService,
private confirmService: ConfirmService, private confirmService: ConfirmService,
@ -33,14 +31,6 @@ export class VideoMiniatureComponent {
return this.video.name; return this.video.name;
} }
onBlur() {
this.hovering = false;
}
onHover() {
this.hovering = true;
}
isVideoNSFWForThisUser() { isVideoNSFWForThisUser() {
return this.video.isVideoNSFWForUser(this.user); return this.video.isVideoNSFWForUser(this.user);
} }

View File

@ -22,12 +22,14 @@
<div *ngIf="videoNotFound" id="video-not-found">Video not found :'(</div> <div *ngIf="videoNotFound" id="video-not-found">Video not found :'(</div>
</div> </div>
<!-- P2P informations -->
<div id="torrent-info" class="row"> <div id="torrent-info" class="row">
<div id="torrent-info-download" class="col-md-4 col-sm-4 col-xs-4">Download: {{ downloadSpeed | bytes }}/s</div> <div id="torrent-info-download" class="col-md-4 col-sm-4 col-xs-4">Download: {{ downloadSpeed | bytes }}/s</div>
<div id="torrent-info-upload" class="col-md-4 col-sm-4 col-xs-4">Upload: {{ uploadSpeed | bytes }}/s</div> <div id="torrent-info-upload" class="col-md-4 col-sm-4 col-xs-4">Upload: {{ uploadSpeed | bytes }}/s</div>
<div id="torrent-info-peers" class="col-md-4 col-sm-4 col-xs-4">Number of peers: {{ numPeers }}</div> <div id="torrent-info-peers" class="col-md-4 col-sm-4 col-xs-4">Number of peers: {{ numPeers }}</div>
</div> </div>
<!-- Video informations -->
<div *ngIf="video !== null" id="video-info"> <div *ngIf="video !== null" id="video-info">
<div class="row video-name-views"> <div class="row video-name-views">
<div class="col-xs-8 col-md-8 video-name"> <div class="col-xs-8 col-md-8 video-name">

View File

@ -13,6 +13,10 @@
.embed-responsive { .embed-responsive {
height: 500px; height: 500px;
@media screen and (max-width: 600px) {
height: 300px;
}
} }
#torrent-info { #torrent-info {
@ -25,12 +29,6 @@
} }
} }
.embed-responsive {
@media screen and (max-width: 600px) {
height: 300px;
}
}
#video-info { #video-info {
.video-name-views { .video-name-views {
font-weight: bold; font-weight: bold;

View File

@ -5,7 +5,7 @@ import { TagInputModule } from 'ng2-tag-input';
import { VideosRoutingModule } from './videos-routing.module'; import { VideosRoutingModule } from './videos-routing.module';
import { VideosComponent } from './videos.component'; import { VideosComponent } from './videos.component';
import { VideoAddComponent, VideoUpdateComponent } from './video-edit'; import { VideoAddComponent, VideoUpdateComponent } from './video-edit';
import { VideoListComponent, VideoMiniatureComponent, VideoSortComponent } from './video-list'; import { LoaderComponent, VideoListComponent, VideoMiniatureComponent, VideoSortComponent } from './video-list';
import { import {
VideoWatchComponent, VideoWatchComponent,
VideoMagnetComponent, VideoMagnetComponent,
@ -13,7 +13,7 @@ import {
VideoShareComponent, VideoShareComponent,
WebTorrentService WebTorrentService
} from './video-watch'; } from './video-watch';
import { LoaderComponent, VideoService } from './shared'; import { VideoService } from './shared';
import { SharedModule } from '../shared'; import { SharedModule } from '../shared';
@NgModule({ @NgModule({