diff --git a/common/entities/AutoCompleteItem.ts b/common/entities/AutoCompleteItem.ts new file mode 100644 index 00000000..e03907da --- /dev/null +++ b/common/entities/AutoCompleteItem.ts @@ -0,0 +1,10 @@ +export enum AutoCompeleteTypes { + image, + directory, + imageTag +} + +export class AutoCompleteItem{ + constructor(text:string, type:AutoCompeleteTypes){} +} + diff --git a/frontend/app/admin/StringifyRolePipe.ts b/frontend/app/admin/StringifyRolePipe.ts index df0baf4a..60b1d2d3 100644 --- a/frontend/app/admin/StringifyRolePipe.ts +++ b/frontend/app/admin/StringifyRolePipe.ts @@ -1,4 +1,4 @@ -import {Pipe, PipeTransform} from "angular2/core"; +import {Pipe, PipeTransform} from "@angular/core"; import {UserRoles} from "../../../common/entities/User"; diff --git a/frontend/app/admin/admin.component.ts b/frontend/app/admin/admin.component.ts index d5ee6261..70a589a9 100644 --- a/frontend/app/admin/admin.component.ts +++ b/frontend/app/admin/admin.component.ts @@ -1,15 +1,15 @@ /// -import {Component, OnInit, Pipe, PipeTransform} from "angular2/core"; +import {Component, OnInit} from "@angular/core"; import {AuthenticationService} from "../model/network/authentication.service.ts"; -import {Router} from "angular2/router"; +import {Router} from "@angular/router-deprecated"; import {FrameComponent} from "../frame/frame.component"; import {User, UserRoles} from "../../../common/entities/User"; -import {FORM_DIRECTIVES} from "angular2/common"; +import {FORM_DIRECTIVES} from "@angular/common"; import {Utils} from "../../../common/Utils"; import {AdminService} from "./admin.service"; import {Message} from "../../../common/entities/Message"; -import {StringifyRole} from "./StringifyRolePipe"; +import {StringifyRole} from "./StringifyRolePipe"; @Component({ selector: 'admin', @@ -36,44 +36,44 @@ export class AdminComponent implements OnInit { this.userRoles = Utils.enumToArray(UserRoles).filter(r => r.key <= this._authService.getUser().role); this.getUsersList(); } - - private getUsersList(){ - this._adminService.getUsers().then((result:Message>) =>{ + + private getUsersList() { + this._adminService.getUsers().then((result:Message>) => { this.users = result.result; }); } - - canModifyUser(user:User):boolean{ - let currentUser = this._authService.getUser(); - if(!currentUser){ + + canModifyUser(user:User):boolean { + let currentUser = this._authService.getUser(); + if (!currentUser) { return false; } - + return currentUser.name != user.name && currentUser.role >= user.role; } - - initNewUser() { + + initNewUser() { this.newUser = new User(); - this.newUser.role = UserRoles.User; + this.newUser.role = UserRoles.User; } - addNewUser(){ - this._adminService.createUser(this.newUser).then(() =>{ + addNewUser() { + this._adminService.createUser(this.newUser).then(() => { this.getUsersList(); }); } - updateRole(user:User){ - this._adminService.updateRole(user).then(() =>{ + updateRole(user:User) { + this._adminService.updateRole(user).then(() => { this.getUsersList(); }); } - - deleteUser(user:User){ - this._adminService.deleteUser(user).then(() =>{ + + deleteUser(user:User) { + this._adminService.deleteUser(user).then(() => { this.getUsersList(); - }); + }); } } diff --git a/frontend/app/admin/admin.service.ts b/frontend/app/admin/admin.service.ts index 0660fa3e..dae29ff0 100644 --- a/frontend/app/admin/admin.service.ts +++ b/frontend/app/admin/admin.service.ts @@ -1,8 +1,8 @@ /// -import {Injectable} from 'angular2/core'; +import {Injectable} from '@angular/core'; import {NetworkService} from "../model/network/network.service.ts"; -import {Http} from "angular2/http"; +import {Http} from "@angular/http"; import {Message} from "../../../common/entities/Message"; import {User} from "../../../common/entities/User"; diff --git a/frontend/app/admin/newuser/new.user.admin.component.html b/frontend/app/admin/newuser/new.user.admin.component.html deleted file mode 100644 index 8b137891..00000000 --- a/frontend/app/admin/newuser/new.user.admin.component.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/frontend/app/admin/newuser/new.user.admin.component.ts b/frontend/app/admin/newuser/new.user.admin.component.ts deleted file mode 100644 index ede34669..00000000 --- a/frontend/app/admin/newuser/new.user.admin.component.ts +++ /dev/null @@ -1,14 +0,0 @@ - -import {Component} from 'angular2/core'; - -@Component({ - selector: 'admin-new-user', - templateUrl: 'app/admin/newuser/new.user.admin.component.html', - styleUrls:['app/admin/newuser/new.user.admin.component.css'] -}) -export class NewUserComponent{ - constructor() { - } - -} - diff --git a/frontend/app/app.component.ts b/frontend/app/app.component.ts index 48b1ce68..a6b5731a 100644 --- a/frontend/app/app.component.ts +++ b/frontend/app/app.component.ts @@ -1,14 +1,12 @@ /// -import { Component } from 'angular2/core'; -import {RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouterLink} from 'angular2/router'; +import { Component,OnInit } from '@angular/core'; import {LoginComponent} from "./login/login.component"; import {AuthenticationService} from "./model/network/authentication.service.ts"; -import {GalleryComponent} from "./gallery/gallery.component"; -import {OnInit} from "angular2/core"; +import {GalleryComponent} from "./gallery/gallery.component"; import {User} from "../../common/entities/User"; -import {Router} from "angular2/router"; -import {HTTP_PROVIDERS} from "angular2/http"; +import {Router, RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS} from "@angular/router-deprecated"; +import {HTTP_PROVIDERS} from "@angular/http"; import {UserService} from "./model/network/user.service.ts"; import {GalleryService} from "./gallery/gallery.service"; import {AdminComponent} from "./admin/admin.component"; @@ -17,7 +15,7 @@ import {AdminComponent} from "./admin/admin.component"; @Component({ selector: 'pi-gallery2-app', template: ``, - directives: [ROUTER_DIRECTIVES, RouterLink], + directives: [ROUTER_DIRECTIVES], providers: [ HTTP_PROVIDERS, ROUTER_PROVIDERS, diff --git a/frontend/app/frame/frame.component.ts b/frontend/app/frame/frame.component.ts index a9f71ae8..e6b753ce 100644 --- a/frontend/app/frame/frame.component.ts +++ b/frontend/app/frame/frame.component.ts @@ -1,7 +1,7 @@ /// -import {Component, ViewEncapsulation} from 'angular2/core'; -import {RouterLink} from "angular2/router"; +import {Component, ViewEncapsulation} from '@angular/core'; +import {RouterLink} from "@angular/router-deprecated"; @Component({ selector: 'app-frame', diff --git a/frontend/app/gallery/directory/directory.gallery.component.ts b/frontend/app/gallery/directory/directory.gallery.component.ts index a676d463..180cba25 100644 --- a/frontend/app/gallery/directory/directory.gallery.component.ts +++ b/frontend/app/gallery/directory/directory.gallery.component.ts @@ -1,8 +1,8 @@ /// -import {Component, Input, OnInit} from 'angular2/core'; +import {Component, Input} from '@angular/core'; import {Directory} from "../../../../common/entities/Directory"; -import {RouterLink} from "angular2/router"; +import {RouterLink} from "@angular/router-deprecated"; import {Utils} from "../../../../common/Utils"; @Component({ diff --git a/frontend/app/gallery/gallery.component.ts b/frontend/app/gallery/gallery.component.ts index ccee65b4..f80a1a82 100644 --- a/frontend/app/gallery/gallery.component.ts +++ b/frontend/app/gallery/gallery.component.ts @@ -1,8 +1,8 @@ /// -import {Component, OnInit, QueryList, ViewChild, AfterViewInit} from 'angular2/core'; +import {Component, OnInit, QueryList, ViewChild, AfterViewInit} from '@angular/core'; import {AuthenticationService} from "../model/network/authentication.service.ts"; -import {Router, RouteParams} from "angular2/router"; +import {Router, RouteParams} from "@angular/router-deprecated"; import {GalleryService} from "./gallery.service"; import {Directory} from "../../../common/entities/Directory"; import {Message} from "../../../common/entities/Message"; diff --git a/frontend/app/gallery/gallery.service.ts b/frontend/app/gallery/gallery.service.ts index 382592a9..31649397 100644 --- a/frontend/app/gallery/gallery.service.ts +++ b/frontend/app/gallery/gallery.service.ts @@ -1,8 +1,8 @@ /// -import {Injectable} from 'angular2/core'; +import {Injectable} from '@angular/core'; import {NetworkService} from "../model/network/network.service.ts"; -import {Http} from "angular2/http"; +import {Http} from "@angular/http"; import {Message} from "../../../common/entities/Message"; import {Directory} from "../../../common/entities/Directory"; diff --git a/frontend/app/gallery/grid/grid.gallery.component.ts b/frontend/app/gallery/grid/grid.gallery.component.ts index 47e2636a..66f910a4 100644 --- a/frontend/app/gallery/grid/grid.gallery.component.ts +++ b/frontend/app/gallery/grid/grid.gallery.component.ts @@ -1,106 +1,109 @@ /// import { - Component, Input, ElementRef, OnChanges, ViewChild, ViewChildren, QueryList, Output, AfterViewInit, EventEmitter -} from 'angular2/core'; + Component, + Input, + ElementRef, + OnChanges, + ViewChild, + ViewChildren, + QueryList, + AfterViewInit +} from "@angular/core"; import {Directory} from "../../../../common/entities/Directory"; import {Photo} from "../../../../common/entities/Photo"; import {GalleryPhotoComponent} from "../photo/photo.gallery.component"; import {GridRowBuilder} from "./GridRowBuilder"; -import {AnimationBuilder} from "angular2/animate"; -import {Utils} from "../../../../common/Utils"; import {GalleryLightboxComponent} from "../lightbox/lightbox.gallery.component"; -import {Observable} from "rxjs/Observable"; + @Component({ selector: 'gallery-grid', templateUrl: 'app/gallery/grid/grid.gallery.component.html', styleUrls: ['app/gallery/grid/grid.gallery.component.css'], - directives:[GalleryPhotoComponent] + directives: [GalleryPhotoComponent] }) -export class GalleryGridComponent implements OnChanges,AfterViewInit{ +export class GalleryGridComponent implements OnChanges,AfterViewInit { @ViewChild('gridContainer') gridContainer:ElementRef; - @ViewChildren(GalleryPhotoComponent) gridPhotoQL:QueryList; - + @ViewChildren(GalleryPhotoComponent) gridPhotoQL:QueryList; + @Input() directory:Directory; @Input() lightbox:GalleryLightboxComponent; - + photosToRender:Array = []; - + private IMAGE_MARGIN = 2; private TARGET_COL_COUNT = 5; private MIN_ROW_COUNT = 2; private MAX_ROW_COUNT = 5; - + constructor() { } - ngOnChanges(){ + ngOnChanges() { this.renderPhotos(); } - - ngAfterViewInit(){ + + ngAfterViewInit() { this.lightbox.gridPhotoQL = this.gridPhotoQL; - this.gridPhotoQL.changes.subscribe( + this.gridPhotoQL.changes.subscribe( (x)=> { - if(this.gridPhotoQL.length < this.photosToRender.length){ + if (this.gridPhotoQL.length < this.photosToRender.length) { return; } - if(this.renderedConteinerWidth != this.getContainerWidth()){ + if (this.renderedConteinerWidth != this.getContainerWidth()) { this.renderPhotos(); } }); - + } - + private renderedConteinerWidth = 0; - private renderPhotos() { - let maxRowHeight = window.innerHeight / this.MIN_ROW_COUNT; - let minRowHeight = window.innerHeight / this.MAX_ROW_COUNT; - let containerWidth = this.getContainerWidth(); - this.renderedConteinerWidth = containerWidth; - this.photosToRender = []; - let i = 0; + private renderPhotos() { + let maxRowHeight = window.innerHeight / this.MIN_ROW_COUNT; + let minRowHeight = window.innerHeight / this.MAX_ROW_COUNT; + let containerWidth = this.getContainerWidth(); + this.renderedConteinerWidth = containerWidth; - while (i < this.directory.photos.length ) { + this.photosToRender = []; + let i = 0; - let photoRowBuilder = new GridRowBuilder(this.directory.photos,i,this.IMAGE_MARGIN,this.getContainerWidth()); - photoRowBuilder.addPhotos(this.TARGET_COL_COUNT); - photoRowBuilder.adjustRowHeightBetween(minRowHeight,maxRowHeight); + while (i < this.directory.photos.length) { - let rowHeight = photoRowBuilder.calcRowHeight(); - let imageHeight = rowHeight - (this.IMAGE_MARGIN * 2); + let photoRowBuilder = new GridRowBuilder(this.directory.photos, i, this.IMAGE_MARGIN, this.getContainerWidth()); + photoRowBuilder.addPhotos(this.TARGET_COL_COUNT); + photoRowBuilder.adjustRowHeightBetween(minRowHeight, maxRowHeight); - photoRowBuilder.getPhotoRow().forEach((photo) => { - let imageWidth = imageHeight * (photo.width / photo.height); - this.photosToRender.push(new GridPhoto(photo,imageWidth,imageHeight)); - }); + let rowHeight = photoRowBuilder.calcRowHeight(); + let imageHeight = rowHeight - (this.IMAGE_MARGIN * 2); - i+= photoRowBuilder.getPhotoRow().length; - } - } + photoRowBuilder.getPhotoRow().forEach((photo) => { + let imageWidth = imageHeight * (photo.width / photo.height); + this.photosToRender.push(new GridPhoto(photo, imageWidth, imageHeight)); + }); + + i += photoRowBuilder.getPhotoRow().length; + } + } onResize() { this.renderPhotos(); } - - private getContainerWidth(): number{ - if(!this.gridContainer){ + + private getContainerWidth():number { + if (!this.gridContainer) { return 0; - } + } return this.gridContainer.nativeElement.clientWidth; } - - - } class GridPhoto { - constructor(public photo:Photo, public renderWidth:number, public renderHeight:number){ + constructor(public photo:Photo, public renderWidth:number, public renderHeight:number) { } } diff --git a/frontend/app/gallery/lightbox/lightbox.gallery.component.ts b/frontend/app/gallery/lightbox/lightbox.gallery.component.ts index f4ee21dd..82e9f229 100644 --- a/frontend/app/gallery/lightbox/lightbox.gallery.component.ts +++ b/frontend/app/gallery/lightbox/lightbox.gallery.component.ts @@ -1,10 +1,10 @@ /// -import {Component, ElementRef, ViewChild, QueryList} from "angular2/core"; +import {Component, ElementRef, ViewChild, QueryList} from "@angular/core"; import {Photo} from "../../../../common/entities/Photo"; import {GalleryPhotoComponent} from "../photo/photo.gallery.component"; -import {AnimationBuilder} from "angular2/animate"; -import {BrowserDomAdapter} from "angular2/src/platform/browser/browser_adapter"; +import {AnimationBuilder} from "@angular/platform-browser/src/animate/animation_builder"; +import {BrowserDomAdapter} from "@angular/platform-browser/src/browser_common"; import {Dimension} from "../../model/IRenderable"; @Component({ diff --git a/frontend/app/gallery/photo/photo.gallery.component.ts b/frontend/app/gallery/photo/photo.gallery.component.ts index 9dd06a8e..ce8e4726 100644 --- a/frontend/app/gallery/photo/photo.gallery.component.ts +++ b/frontend/app/gallery/photo/photo.gallery.component.ts @@ -1,6 +1,6 @@ /// -import {Component, Input, ElementRef, ViewChild} from 'angular2/core'; +import {Component, Input, ElementRef, ViewChild} from '@angular/core'; import {Photo} from "../../../../common/entities/Photo"; import {Directory} from "../../../../common/entities/Directory"; import {Utils} from "../../../../common/Utils"; diff --git a/frontend/app/gallery/search/autocomplete.service.ts b/frontend/app/gallery/search/autocomplete.service.ts index 8d1284c3..5c3d34cb 100644 --- a/frontend/app/gallery/search/autocomplete.service.ts +++ b/frontend/app/gallery/search/autocomplete.service.ts @@ -1,7 +1,7 @@ /// -import {Injectable} from "angular2/core"; -import {Http} from "angular2/http"; +import {Injectable} from "@angular/core"; +import {Http} from "@angular/http"; import {NetworkService} from "../../model/network/network.service"; @Injectable() diff --git a/frontend/app/gallery/search/search.gallery.component.ts b/frontend/app/gallery/search/search.gallery.component.ts index 462d49de..9c2b489e 100644 --- a/frontend/app/gallery/search/search.gallery.component.ts +++ b/frontend/app/gallery/search/search.gallery.component.ts @@ -1,6 +1,6 @@ /// -import {Component} from "angular2/core"; +import {Component} from "@angular/core"; import {AutoCompleteService} from "./autocomplete.service"; @Component({ diff --git a/frontend/app/login/login.component.ts b/frontend/app/login/login.component.ts index f09d75f1..0b7c94c1 100644 --- a/frontend/app/login/login.component.ts +++ b/frontend/app/login/login.component.ts @@ -1,10 +1,10 @@ /// -import {Component, OnInit} from 'angular2/core'; +import {Component, OnInit} from '@angular/core'; import {LoginCredential} from '../../../common/entities/LoginCredential'; import {AuthenticationService} from "../model/network/authentication.service.ts"; -import {Router} from "angular2/router"; -import {FORM_DIRECTIVES} from "angular2/common"; +import {Router} from "@angular/router-deprecated"; +import {FORM_DIRECTIVES} from "@angular/common"; @Component({ selector: 'login', diff --git a/frontend/app/model/network/autehentication.service.spec.ts b/frontend/app/model/network/autehentication.service.spec.ts index b4ff6cb9..7cb5aa39 100644 --- a/frontend/app/model/network/autehentication.service.spec.ts +++ b/frontend/app/model/network/autehentication.service.spec.ts @@ -4,11 +4,11 @@ import { it, inject, injectAsync, - beforeEachProviders, - TestComponentBuilder -} from 'angular2/testing'; + beforeEachProviders +} from '@angular/core/testing'; + -import {provide} from 'angular2/core'; +import {provide} from '@angular/core'; import {AuthenticationService} from "./authentication.service.ts"; import {UserService} from "./user.service.ts"; import {User} from "../../../../common/entities/User"; diff --git a/frontend/app/model/network/authentication.service.ts b/frontend/app/model/network/authentication.service.ts index 6f57ac82..e69557cf 100644 --- a/frontend/app/model/network/authentication.service.ts +++ b/frontend/app/model/network/authentication.service.ts @@ -1,6 +1,6 @@ /// -import {Injectable} from 'angular2/core'; +import {Injectable} from '@angular/core'; import {User} from "../../../../common/entities/User"; import {Event} from "../../../../common/event/Event"; import {UserService} from "./user.service.ts"; diff --git a/frontend/app/model/network/network.service.ts b/frontend/app/model/network/network.service.ts index aed86d84..85122692 100644 --- a/frontend/app/model/network/network.service.ts +++ b/frontend/app/model/network/network.service.ts @@ -1,9 +1,8 @@ /// -import {Http, Headers, RequestOptions, Response} from "angular2/http"; +import {Http, Headers, RequestOptions} from "@angular/http"; import {Message} from "../../../../common/entities/Message"; -import "rxjs/Rx"; -import {Utils} from "../../../../common/Utils"; +import "rxjs/Rx"; export class NetworkService{ diff --git a/frontend/app/model/network/user.service.ts b/frontend/app/model/network/user.service.ts index 92f7e440..c838873d 100644 --- a/frontend/app/model/network/user.service.ts +++ b/frontend/app/model/network/user.service.ts @@ -1,8 +1,8 @@ /// -import {Injectable} from 'angular2/core'; +import {Injectable} from '@angular/core'; import {LoginCredential} from "../../../../common/entities/LoginCredential"; -import {Http} from "angular2/http"; +import {Http} from "@angular/http"; import {NetworkService} from "./network.service.ts"; import {User} from "../../../../common/entities/User"; import {Message} from "../../../../common/entities/Message"; diff --git a/frontend/browser.d.ts b/frontend/browser.d.ts index d2bd18c6..b128e8cb 100644 --- a/frontend/browser.d.ts +++ b/frontend/browser.d.ts @@ -1,6 +1,9 @@ /// -/// -/// +/// /// +/// +/// +/// +/// /// diff --git a/frontend/main.ts b/frontend/main.ts index 3c39be4f..cad7eb43 100644 --- a/frontend/main.ts +++ b/frontend/main.ts @@ -1,6 +1,8 @@ /// -import { bootstrap } from 'angular2/platform/browser'; +import { bootstrap } from '@angular/platform-browser-dynamic'; import {AppComponent} from "./app/app.component.ts"; -bootstrap(AppComponent); +bootstrap(AppComponent) + .catch(err => console.error(err)); + diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 9fcc3436..f0c90ffb 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -8,6 +8,7 @@ }, "exclude": [ "node_modules", - "typings" + "typings/main.d.ts", + "typings/main" ] } \ No newline at end of file diff --git a/package.json b/package.json index 72ee3157..0c6e480b 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,15 @@ "url": "https://github.com/bpatrik/PiGallery2/issues" }, "dependencies": { - "angular2": "^2.0.0-beta.17", + "@angular/common": "2.0.0-rc.1", + "@angular/compiler": "2.0.0-rc.1", + "@angular/core": "2.0.0-rc.1", + "@angular/http": "2.0.0-rc.1", + "@angular/platform-browser": "2.0.0-rc.1", + "@angular/platform-browser-dynamic": "2.0.0-rc.1", + "@angular/platform-server": "2.0.0-rc.1", + "@angular/router": "2.0.0-rc.1", + "@angular/router-deprecated": "2.0.0-rc.1", "body-parser": "^1.15.0", "core-js": "^2.3.0", "debug": "^2.2.0", @@ -38,7 +46,7 @@ "optimist": "^0.6.1", "rxjs": "5.0.0-beta.6", "ts-loader": "^0.8.2", - "tslint": "^3.8.1", + "tslint": "^3.9.0", "typescript": "^1.8.10", "typings": "^0.8.1", "webpack": "^1.13.0", diff --git a/test/tsconfig.json b/test/tsconfig.json index 9fcc3436..f0c90ffb 100644 --- a/test/tsconfig.json +++ b/test/tsconfig.json @@ -8,6 +8,7 @@ }, "exclude": [ "node_modules", - "typings" + "typings/main.d.ts", + "typings/main" ] } \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 9fcc3436..f0c90ffb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,6 +8,7 @@ }, "exclude": [ "node_modules", - "typings" + "typings/main.d.ts", + "typings/main" ] } \ No newline at end of file diff --git a/typings.json b/typings.json index 9f8298ba..4d01caaa 100644 --- a/typings.json +++ b/typings.json @@ -3,6 +3,7 @@ "version": false, "ambientDependencies": { "body-parser": "registry:dt/body-parser#0.0.0+20160317120654", + "core-js": "registry:dt/core-js#0.0.0+20160317120654", "debug": "github:DefinitelyTyped/DefinitelyTyped/debug/debug.d.ts#0d622d857f97d44ea7dcad2b3edec1f23c48fe9e", "express": "github:DefinitelyTyped/DefinitelyTyped/express/express.d.ts#0d622d857f97d44ea7dcad2b3edec1f23c48fe9e", "express-session": "registry:dt/express-session#0.0.0+20160331200931", @@ -13,5 +14,8 @@ "node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#0d622d857f97d44ea7dcad2b3edec1f23c48fe9e", "optimist": "registry:dt/optimist#0.0.0+20160316171810", "serve-static": "github:DefinitelyTyped/DefinitelyTyped/serve-static/serve-static.d.ts#0d622d857f97d44ea7dcad2b3edec1f23c48fe9e" + }, + "dependencies": { + "es6-promise": "registry:npm/es6-promise#3.0.0+20160211003958" } }