2016-03-14 13:20:29 +01:00
|
|
|
///<reference path="../../browser.d.ts"/>
|
2016-03-13 11:28:29 +01:00
|
|
|
|
2016-03-19 09:58:27 +01:00
|
|
|
import {Component, OnInit} from 'angular2/core';
|
|
|
|
import {AuthenticationService} from "../model/authentication.service";
|
2016-04-26 12:03:44 +02:00
|
|
|
import {Router, RouteParams} from "angular2/router";
|
2016-03-20 16:54:30 +01:00
|
|
|
import {GalleryService} from "./gallery.service";
|
|
|
|
import {Directory} from "../../../common/entities/Directory";
|
|
|
|
import {Message} from "../../../common/entities/Message";
|
2016-03-20 20:05:51 +01:00
|
|
|
import {GalleryDirectoryComponent} from "./directory/directory.gallery.component";
|
2016-04-09 15:19:25 +02:00
|
|
|
import {GalleryGridComponent} from "./grid/grid.gallery.component";
|
2016-04-18 21:27:15 +02:00
|
|
|
import {MATERIAL_DIRECTIVES} from "ng2-material/all";
|
|
|
|
import {SidenavService} from "ng2-material/all";
|
2016-04-26 15:10:05 +02:00
|
|
|
import {FrameComponent} from "../frame/frame.component";
|
2016-03-13 11:28:29 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'gallery',
|
2016-03-20 16:54:30 +01:00
|
|
|
templateUrl: 'app/gallery/gallery.component.html',
|
2016-04-18 21:27:15 +02:00
|
|
|
styleUrls: ['app/gallery/gallery.component.css'],
|
2016-04-09 15:19:25 +02:00
|
|
|
directives:[GalleryGridComponent,
|
2016-04-18 21:27:15 +02:00
|
|
|
GalleryDirectoryComponent,
|
2016-04-26 15:10:05 +02:00
|
|
|
FrameComponent,
|
|
|
|
MATERIAL_DIRECTIVES]
|
2016-03-13 11:28:29 +01:00
|
|
|
})
|
2016-03-19 09:58:27 +01:00
|
|
|
export class GalleryComponent implements OnInit{
|
|
|
|
|
2016-03-26 16:25:48 +01:00
|
|
|
currentDirectory:Directory = new Directory(-1,"","/",new Date(),[],[]);
|
2016-03-20 16:54:30 +01:00
|
|
|
|
|
|
|
constructor(private _galleryService:GalleryService,
|
|
|
|
private _params: RouteParams,
|
|
|
|
private _authService: AuthenticationService,
|
2016-04-26 15:10:05 +02:00
|
|
|
private _router: Router) {
|
2016-03-19 09:58:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit(){
|
|
|
|
if (!this._authService.isAuthenticated()) {
|
|
|
|
this._router.navigate(['Login']);
|
2016-03-20 16:54:30 +01:00
|
|
|
return;
|
2016-03-19 09:58:27 +01:00
|
|
|
}
|
2016-03-27 21:21:47 +02:00
|
|
|
|
2016-04-09 18:06:29 +02:00
|
|
|
let directoryName = this._params.get('directory');
|
|
|
|
console.log(this._params);
|
|
|
|
console.log(directoryName);
|
2016-03-20 16:54:30 +01:00
|
|
|
directoryName = directoryName ? directoryName : "";
|
|
|
|
this._galleryService.getDirectory(directoryName).then(( message:Message<Directory>) => {
|
2016-03-26 11:19:10 +01:00
|
|
|
if(message.error){
|
2016-03-20 16:54:30 +01:00
|
|
|
//TODO: implement
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-03-26 16:25:48 +01:00
|
|
|
this.currentDirectory = message.result;
|
2016-03-20 16:54:30 +01:00
|
|
|
});
|
2016-03-19 09:58:27 +01:00
|
|
|
}
|
2016-04-26 15:10:05 +02:00
|
|
|
|
2016-03-19 09:58:27 +01:00
|
|
|
|
2016-03-13 11:28:29 +01:00
|
|
|
}
|
|
|
|
|