diff --git a/backend/model/mongoose/DatabaseManager.ts b/backend/model/mongoose/DatabaseManager.ts index b90cd3e4..6c59d47c 100644 --- a/backend/model/mongoose/DatabaseManager.ts +++ b/backend/model/mongoose/DatabaseManager.ts @@ -4,13 +4,18 @@ export class DatabaseManager{ private static _instance:DatabaseManager = null; private connectionError = false; - constructor(onError?:(err)=>void){ + constructor(onError?:(err)=>void,onConnected?:() =>void){ mongoose.connection.on('error', function (err) { this.connectionError = true; if(onError){ onError(err); } }); + mongoose.connection.on('connected', function () { + if(onConnected){ + onConnected(); + } + }); try { mongoose.connect('mongodb://localhost/EQZT6L'); }catch(ex){ @@ -21,9 +26,13 @@ export class DatabaseManager{ } } - public static getInstance(onError?:(err)=>void){ + public static getInstance(onError?:(err)=>void,onConnected?:() =>void){ if(DatabaseManager._instance === null){ - DatabaseManager._instance = new DatabaseManager(onError); + DatabaseManager._instance = new DatabaseManager(onError,onConnected); + }else{ + if(DatabaseManager._instance.connectionError === false && onConnected){ + onConnected(); + } } return DatabaseManager._instance; } diff --git a/frontend/app/gallery/directory/directory.gallery.component.html b/frontend/app/gallery/directory/directory.gallery.component.html index 69fa3efa..bd2c0732 100644 --- a/frontend/app/gallery/directory/directory.gallery.component.html +++ b/frontend/app/gallery/directory/directory.gallery.component.html @@ -1 +1,3 @@ -{{directory.name}} \ No newline at end of file + + folder {{directory.name}} + diff --git a/frontend/app/gallery/directory/directory.gallery.component.ts b/frontend/app/gallery/directory/directory.gallery.component.ts index 6e2e0a34..9fe0ec25 100644 --- a/frontend/app/gallery/directory/directory.gallery.component.ts +++ b/frontend/app/gallery/directory/directory.gallery.component.ts @@ -4,11 +4,15 @@ import {Component, Input, OnInit} from 'angular2/core'; import {Directory} from "../../../../common/entities/Directory"; import {RouterLink} from "angular2/router"; import {Utils} from "../../../../common/Utils"; +import {MATERIAL_BROWSER_PROVIDERS} from "ng2-material/all"; +import {ViewportHelper} from "ng2-material/all"; +import {MATERIAL_DIRECTIVES} from "ng2-material/all"; @Component({ selector: 'gallery-directory', templateUrl: 'app/gallery/directory/directory.gallery.component.html', - directives:[RouterLink] + directives:[RouterLink,MATERIAL_DIRECTIVES], + providers:[MATERIAL_BROWSER_PROVIDERS, ViewportHelper] }) export class GalleryDirectoryComponent{ @Input() directory: Directory; diff --git a/package.json b/package.json index 1cce3e1b..bb9b49ca 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "dependencies": { "angular2": "^2.0.0-beta.15", "body-parser": "^1.15.0", - "core-js": "^2.2.2", + "core-js": "^2.3.0", "debug": "^2.2.0", "ejs": "^2.4.1", "express": "^4.13.4", @@ -37,13 +37,14 @@ "mongoose": "^4.4.13", "morgan": "^1.7.0", "ng2-cookies": "^0.1.5", - "ng2-material": "^0.3.6", + "ng2-material": "^0.3.7", "optimist": "^0.6.1", "remap-istanbul": "^0.6.3", "rxjs": "5.0.0-beta.2", "style-loader": "^0.13.1", "ts-loader": "^0.8.2", "tslint": "^3.8.0", + "tslint-loader": "^2.1.4", "typescript": "^1.8.10", "typings": "^0.7.9", "webpack": "^1.13.0", diff --git a/test/backend/initMongo.ts b/test/backend/initMongo.ts index a7196f5e..44ed5316 100644 --- a/test/backend/initMongo.ts +++ b/test/backend/initMongo.ts @@ -2,7 +2,10 @@ import {MongoUserManager} from "../../backend/model/mongoose/MongoUserManager"; import {User, UserRoles} from "../../common/entities/User"; import {DatabaseManager} from "../../backend/model/mongoose/DatabaseManager"; -let userManager = new MongoUserManager(); -userManager.createUser(new User(0,"demo","demo@demo.hu","demo",UserRoles.Developer),(err)=>{ - DatabaseManager.getInstance().disconnect(); + +DatabaseManager.getInstance((err)=>{},()=>{ + let userManager = new MongoUserManager(); + userManager.createUser(new User(0,"demo","demo@demo.hu","demo",UserRoles.Developer),(err)=>{ + DatabaseManager.getInstance().disconnect(); + }); }); \ No newline at end of file