[DEV] some updates
This commit is contained in:
parent
f6df685694
commit
fe67849ea7
10
.checkstyle
Normal file
10
.checkstyle
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
|
||||||
|
<local-check-config name="Scenarium" location="/home/heero/dev/workspace-scenarium/scenarium-core/CheckStyle.xml" type="external" description="">
|
||||||
|
<additional-data name="protect-config-file" value="false"/>
|
||||||
|
</local-check-config>
|
||||||
|
<fileset name="all" enabled="true" check-config-name="Scenarium" local="true">
|
||||||
|
<file-match-pattern match-pattern="." include-pattern="true"/>
|
||||||
|
</fileset>
|
||||||
|
</fileset-config>
|
@ -187,73 +187,3 @@ def add(_app, _name_api):
|
|||||||
await _response.write(json.dumps(return_bdd, sort_keys=True, indent=4))
|
await _response.write(json.dumps(return_bdd, sort_keys=True, indent=4))
|
||||||
return response.stream(streaming, content_type='application/json')
|
return response.stream(streaming, content_type='application/json')
|
||||||
|
|
||||||
@elem_blueprint.get('/' + _name_api + '/<id:int>/<custom_user_video_name:string>', strict_slashes=True)
|
|
||||||
@doc.summary("get a specific resource")
|
|
||||||
@doc.description("Get a resource with all the needed datas ... It permeit seek for video stream.")
|
|
||||||
@doc.produces(content_type='application/json')
|
|
||||||
def retrive2(request, id, custom_user_video_name):
|
|
||||||
return retrive(request, id)
|
|
||||||
|
|
||||||
@elem_blueprint.get('/' + _name_api + '/<id:int>', strict_slashes=True)
|
|
||||||
@doc.summary("get a specific resource")
|
|
||||||
@doc.description("Get a resource with all the needed datas ... It permeit seek for video stream.")
|
|
||||||
@doc.produces(content_type='application/json')
|
|
||||||
async def retrive(request, id):
|
|
||||||
debug.warning("Request data media 2 : " + str(id));
|
|
||||||
"""
|
|
||||||
if id[-4:] == ".mp4":
|
|
||||||
id = id[:-4]
|
|
||||||
if id[-4:] == ".mkv":
|
|
||||||
id = id[:-4]
|
|
||||||
"""
|
|
||||||
filename = os.path.join(_app.config['REST_MEDIA_DATA'], str(id), "data")
|
|
||||||
value = data_global_elements.get_interface(_name_api).get(id)
|
|
||||||
debug.info("plouuuuuuf " + str(value))
|
|
||||||
headers = {
|
|
||||||
'Content-Type': value["mime_type"],
|
|
||||||
'Accept-Ranges': 'Accept-Ranges: bytes'
|
|
||||||
}
|
|
||||||
|
|
||||||
if tools.exist(filename) == False:
|
|
||||||
return response.HTTPResponse(status=404)
|
|
||||||
file_length = tools.file_size(filename);
|
|
||||||
try:
|
|
||||||
range_start = None
|
|
||||||
range_end = None
|
|
||||||
try:
|
|
||||||
range_ = '0-' + str(file_length)
|
|
||||||
if 'range' in request.headers:
|
|
||||||
range_ = request.headers['range'].split('=')[1]
|
|
||||||
range_split = range_.split('-')
|
|
||||||
range_start = int(range_split[0])
|
|
||||||
range_end = int(range_split[1])
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
if range_start and range_start != 0:
|
|
||||||
if not range_end:
|
|
||||||
range_end = file_length
|
|
||||||
read_length = range_end - range_start
|
|
||||||
else:
|
|
||||||
range_start = 0
|
|
||||||
read_length = file_length
|
|
||||||
range_end = file_length
|
|
||||||
headers['Content-Length'] = read_length
|
|
||||||
headers['Content-Range'] = f'bytes {range_start}-{range_end-1}/{file_length}'
|
|
||||||
async def streaming_fn(response):
|
|
||||||
with open(filename, 'rb') as fff:
|
|
||||||
chunk_size = 8192
|
|
||||||
current_offset = range_start
|
|
||||||
while (current_offset < file_length):
|
|
||||||
chunk_start = current_offset
|
|
||||||
fff.seek(current_offset)
|
|
||||||
chunk_data = fff.read(min(chunk_size, file_length - current_offset))
|
|
||||||
current_offset += chunk_size
|
|
||||||
await response.write(chunk_data)
|
|
||||||
return response.stream(streaming_fn, headers=headers, status=206)
|
|
||||||
except FileNotFoundError:
|
|
||||||
return response.HTTPResponse(status=404)
|
|
||||||
|
|
||||||
|
|
||||||
_app.blueprint(elem_blueprint)
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,140 +1,184 @@
|
|||||||
{
|
{
|
||||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
"$schema" : "./node_modules/@angular/cli/lib/config/schema.json",
|
||||||
"version": 1,
|
"version" : 1,
|
||||||
"newProjectRoot": "projects",
|
"newProjectRoot" : "projects",
|
||||||
"projects": {
|
"defaultProject" : "no-comment",
|
||||||
"no-comment": {
|
"projects" : {
|
||||||
"root": "",
|
"no-comment" : {
|
||||||
"sourceRoot": "src",
|
"root" : "",
|
||||||
"projectType": "application",
|
"sourceRoot" : "src",
|
||||||
"architect": {
|
"projectType" : "application",
|
||||||
"build": {
|
"architect" : {
|
||||||
"builder": "@angular-devkit/build-angular:browser",
|
"build" : {
|
||||||
"options": {
|
"builder" : "@angular-devkit/build-angular:browser",
|
||||||
"outputPath": "dist",
|
"options" : {
|
||||||
"index": "src/index.html",
|
"outputPath" : "dist",
|
||||||
"main": "src/main.ts",
|
"index" : "src/index.html",
|
||||||
"tsConfig": "src/tsconfig.app.json",
|
"main" : "src/main.ts",
|
||||||
"polyfills": "src/polyfills.ts",
|
"tsConfig" : "src/tsconfig.app.json",
|
||||||
"assets": [
|
"polyfills" : "src/polyfills.ts",
|
||||||
"src/assets",
|
"assets" : [ "src/assets", "src/favicon.ico" ],
|
||||||
"src/favicon.ico"
|
"styles" : [ "src/styles.less", "src/generic_page.less", "src/theme.color.blue.less", "src/theme.checkbox.less", "src/theme.modal.less" ],
|
||||||
],
|
"scripts" : [ ]
|
||||||
"styles": [
|
|
||||||
"src/styles.less",
|
|
||||||
"src/generic_page.less",
|
|
||||||
"src/theme.color.blue.less",
|
|
||||||
"src/theme.checkbox.less",
|
|
||||||
"src/theme.modal.less"
|
|
||||||
],
|
|
||||||
"scripts": []
|
|
||||||
},
|
},
|
||||||
"configurations": {
|
"configurations" : {
|
||||||
"production": {
|
"production" : {
|
||||||
"optimization": true,
|
"optimization" : true,
|
||||||
"outputHashing": "all",
|
"outputHashing" : "all",
|
||||||
"sourceMap": false,
|
"sourceMap" : false,
|
||||||
"extractCss": true,
|
"extractCss" : true,
|
||||||
"namedChunks": false,
|
"namedChunks" : false,
|
||||||
"aot": true,
|
"aot" : true,
|
||||||
"extractLicenses": true,
|
"extractLicenses" : true,
|
||||||
"vendorChunk": false,
|
"vendorChunk" : false,
|
||||||
"buildOptimizer": true,
|
"buildOptimizer" : true,
|
||||||
"fileReplacements": [
|
"fileReplacements" : [ {
|
||||||
{
|
"replace" : "src/environments/environment.ts",
|
||||||
"replace": "src/environments/environment.ts",
|
"with" : "src/environments/environment.prod.ts"
|
||||||
"with": "src/environments/environment.prod.ts"
|
} ]
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"serve": {
|
"serve" : {
|
||||||
"builder": "@angular-devkit/build-angular:dev-server",
|
"builder" : "@angular-devkit/build-angular:dev-server",
|
||||||
"options": {
|
"options" : {
|
||||||
"browserTarget": "no-comment:build"
|
"browserTarget" : "no-comment:build"
|
||||||
},
|
},
|
||||||
"configurations": {
|
"configurations" : {
|
||||||
"production": {
|
"production" : {
|
||||||
"browserTarget": "no-comment:build:production"
|
"browserTarget" : "no-comment:build:production"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extract-i18n": {
|
"extract-i18n" : {
|
||||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
"builder" : "@angular-devkit/build-angular:extract-i18n",
|
||||||
"options": {
|
"options" : {
|
||||||
"browserTarget": "no-comment:build"
|
"browserTarget" : "no-comment:build"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"test": {
|
"test" : {
|
||||||
"builder": "@angular-devkit/build-angular:karma",
|
"builder" : "@angular-devkit/build-angular:karma",
|
||||||
"options": {
|
"options" : {
|
||||||
"main": "src/test.ts",
|
"main" : "src/test.ts",
|
||||||
"karmaConfig": "./karma.conf.js",
|
"karmaConfig" : "./karma.conf.js",
|
||||||
"polyfills": "src/polyfills.ts",
|
"polyfills" : "src/polyfills.ts",
|
||||||
"tsConfig": "src/tsconfig.spec.json",
|
"tsConfig" : "src/tsconfig.spec.json",
|
||||||
"scripts": [],
|
"scripts" : [ ],
|
||||||
"styles": [
|
"styles" : [ "src/styles.less", "src/generic_page.less", "src/theme.color.blue.less", "src/theme.checkbox.less", "src/theme.modal.less" ],
|
||||||
"src/styles.less",
|
"assets" : [ "src/assets", "src/favicon.ico" ]
|
||||||
"src/generic_page.less",
|
|
||||||
"src/theme.color.blue.less",
|
|
||||||
"src/theme.checkbox.less",
|
|
||||||
"src/theme.modal.less"
|
|
||||||
],
|
|
||||||
"assets": [
|
|
||||||
"src/assets",
|
|
||||||
"src/favicon.ico"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lint": {
|
"lint" : {
|
||||||
"builder": "@angular-devkit/build-angular:tslint",
|
"builder" : "@angular-devkit/build-angular:tslint",
|
||||||
"options": {
|
"options" : {
|
||||||
"tsConfig": [
|
"tsConfig" : [ "src/tsconfig.app.json", "src/tsconfig.spec.json" ],
|
||||||
"src/tsconfig.app.json",
|
"exclude" : [ "**/node_modules/**" ]
|
||||||
"src/tsconfig.spec.json"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"**/node_modules/**"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"no-comment-e2e": {
|
"no-comment-e2e" : {
|
||||||
"root": "e2e",
|
"root" : "e2e",
|
||||||
"sourceRoot": "e2e",
|
"sourceRoot" : "e2e",
|
||||||
"projectType": "application",
|
"projectType" : "application",
|
||||||
"architect": {
|
"architect" : {
|
||||||
"e2e": {
|
"e2e" : {
|
||||||
"builder": "@angular-devkit/build-angular:protractor",
|
"builder" : "@angular-devkit/build-angular:protractor",
|
||||||
"options": {
|
"options" : {
|
||||||
"protractorConfig": "./protractor.conf.js",
|
"protractorConfig" : "./protractor.conf.js",
|
||||||
"devServerTarget": "no-comment:serve"
|
"devServerTarget" : "no-comment:serve"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lint": {
|
"lint" : {
|
||||||
"builder": "@angular-devkit/build-angular:tslint",
|
"builder" : "@angular-devkit/build-angular:tslint",
|
||||||
"options": {
|
"options" : {
|
||||||
"tsConfig": [
|
"tsConfig" : [ "e2e/tsconfig.e2e.json" ],
|
||||||
"e2e/tsconfig.e2e.json"
|
"exclude" : [ "**/node_modules/**" ]
|
||||||
],
|
}
|
||||||
"exclude": [
|
}
|
||||||
"**/node_modules/**"
|
}
|
||||||
]
|
},
|
||||||
|
"__design__" : {
|
||||||
|
"root" : "",
|
||||||
|
"sourceRoot" : ".design",
|
||||||
|
"projectType" : "application",
|
||||||
|
"architect" : {
|
||||||
|
"build" : {
|
||||||
|
"builder" : "@angular-devkit/build-angular:browser",
|
||||||
|
"options" : {
|
||||||
|
"outputPath" : "dist",
|
||||||
|
"index" : ".design/index.html",
|
||||||
|
"main" : ".design/main.ts",
|
||||||
|
"tsConfig" : ".design/tsconfig.app.json",
|
||||||
|
"polyfills" : ".design/polyfills.ts",
|
||||||
|
"assets" : [ ".design/assets", ".design/favicon.ico" ],
|
||||||
|
"styles" : [ ".design/styles.less", ".design/generic_page.less", ".design/theme.color.blue.less", ".design/theme.checkbox.less", ".design/theme.modal.less" ],
|
||||||
|
"scripts" : [ ]
|
||||||
|
},
|
||||||
|
"configurations" : {
|
||||||
|
"production" : {
|
||||||
|
"optimization" : true,
|
||||||
|
"outputHashing" : "all",
|
||||||
|
"sourceMap" : false,
|
||||||
|
"extractCss" : true,
|
||||||
|
"namedChunks" : false,
|
||||||
|
"aot" : true,
|
||||||
|
"extractLicenses" : true,
|
||||||
|
"vendorChunk" : false,
|
||||||
|
"buildOptimizer" : true,
|
||||||
|
"fileReplacements" : [ {
|
||||||
|
"replace" : ".design/environments/environment.ts",
|
||||||
|
"with" : ".design/environments/environment.prod.ts"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"serve" : {
|
||||||
|
"builder" : "@angular-devkit/build-angular:dev-server",
|
||||||
|
"options" : {
|
||||||
|
"browserTarget" : "__design__:build"
|
||||||
|
},
|
||||||
|
"configurations" : {
|
||||||
|
"production" : {
|
||||||
|
"browserTarget" : "__design__:build:production"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extract-i18n" : {
|
||||||
|
"builder" : "@angular-devkit/build-angular:extract-i18n",
|
||||||
|
"options" : {
|
||||||
|
"browserTarget" : "__design__:build"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test" : {
|
||||||
|
"builder" : "@angular-devkit/build-angular:karma",
|
||||||
|
"options" : {
|
||||||
|
"main" : ".design/test.ts",
|
||||||
|
"karmaConfig" : "./karma.conf.js",
|
||||||
|
"polyfills" : ".design/polyfills.ts",
|
||||||
|
"tsConfig" : ".design/tsconfig.spec.json",
|
||||||
|
"scripts" : [ ],
|
||||||
|
"styles" : [ ".design/styles.less", ".design/generic_page.less", ".design/theme.color.blue.less", ".design/theme.checkbox.less", ".design/theme.modal.less" ],
|
||||||
|
"assets" : [ ".design/assets", ".design/favicon.ico" ]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint" : {
|
||||||
|
"builder" : "@angular-devkit/build-angular:tslint",
|
||||||
|
"options" : {
|
||||||
|
"tsConfig" : [ ".design/tsconfig.app.json", ".design/tsconfig.spec.json" ],
|
||||||
|
"exclude" : [ "**/node_modules/**" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"defaultProject": "no-comment",
|
"schematics" : {
|
||||||
"schematics": {
|
"@schematics/angular:component" : {
|
||||||
"@schematics/angular:component": {
|
"prefix" : "app",
|
||||||
"prefix": "app",
|
"styleext" : "less"
|
||||||
"styleext": "less"
|
|
||||||
},
|
},
|
||||||
"@schematics/angular:directive": {
|
"@schematics/angular:directive" : {
|
||||||
"prefix": "app"
|
"prefix" : "app"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
6141
front/package-lock.json
generated
6141
front/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -23,13 +23,14 @@
|
|||||||
"@angular/platform-browser-dynamic": "~9.0.5",
|
"@angular/platform-browser-dynamic": "~9.0.5",
|
||||||
"@angular/router": "^9.0.5",
|
"@angular/router": "^9.0.5",
|
||||||
"core-js": "^3.6.4",
|
"core-js": "^3.6.4",
|
||||||
"jquery": "3.4.1",
|
"jquery": "^3.5.1",
|
||||||
|
"ngx-select-dropdown": "^1.4.4",
|
||||||
"rxjs": "^6.5.4",
|
"rxjs": "^6.5.4",
|
||||||
"tslib": "^1.11.1",
|
"tslib": "^1.11.1",
|
||||||
"zone.js": "~0.9.1"
|
"zone.js": "~0.9.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/build-angular": "^0.900.5",
|
"@angular-devkit/build-angular": "^0.901.9",
|
||||||
"@angular/cli": "^9.0.5",
|
"@angular/cli": "^9.0.5",
|
||||||
"@angular/compiler-cli": "~9.0.5",
|
"@angular/compiler-cli": "~9.0.5",
|
||||||
"@angular/language-service": "~9.0.5",
|
"@angular/language-service": "~9.0.5",
|
||||||
|
@ -12,11 +12,14 @@ upgrade package
|
|||||||
npm audit fix
|
npm audit fix
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## npm install -g angular-cli
|
||||||
|
|
||||||
start the application:
|
start the application:
|
||||||
```
|
```
|
||||||
npx ng serve --watch
|
npx ng serve --watch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
plus facilement:
|
||||||
|
npm install @angular-devkit/build-angular@0.901.9
|
||||||
|
npm start
|
||||||
|
|
||||||
|
@ -20,12 +20,14 @@ import { SettingsComponent } from './scene/settings/settings';
|
|||||||
import { VideoEditComponent } from './scene/video-edit/video-edit';
|
import { VideoEditComponent } from './scene/video-edit/video-edit';
|
||||||
import { GroupEditComponent } from './scene/group-edit/group-edit';
|
import { GroupEditComponent } from './scene/group-edit/group-edit';
|
||||||
import { SaisonEditComponent } from './scene/saison-edit/saison-edit';
|
import { SaisonEditComponent } from './scene/saison-edit/saison-edit';
|
||||||
|
import { UploadScene } from './scene/upload/upload';
|
||||||
//import { HelpComponent } from './help/help.component';
|
//import { HelpComponent } from './help/help.component';
|
||||||
|
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{ path: '', redirectTo: '/home', pathMatch: 'full'},
|
{ path: '', redirectTo: '/home', pathMatch: 'full'},
|
||||||
{ path: 'home', component: HomeComponent },
|
{ path: 'home', component: HomeComponent },
|
||||||
|
{ path: 'upload', component: UploadScene },
|
||||||
{ path: 'type/:univers_id/:type_id/:group_id/:saison_id/:video_id', component: TypeComponent },
|
{ path: 'type/:univers_id/:type_id/:group_id/:saison_id/:video_id', component: TypeComponent },
|
||||||
|
|
||||||
{ path: 'univers/:univers_id/:type_id/:group_id/:saison_id/:video_id', component: UniversComponent },
|
{ path: 'univers/:univers_id/:type_id/:group_id/:saison_id/:video_id', component: UniversComponent },
|
||||||
|
@ -35,10 +35,10 @@ export class AppComponent implements OnInit {
|
|||||||
this.userService.loginSha(login, password)
|
this.userService.loginSha(login, password)
|
||||||
.then(function(response) {
|
.then(function(response) {
|
||||||
console.log("auto log ==> OK");
|
console.log("auto log ==> OK");
|
||||||
self.sessionService.create(response['sessionId'],
|
self.sessionService.create(response['session'],
|
||||||
response['login'],
|
response['login'],
|
||||||
response['email'],
|
response['email'],
|
||||||
response['role'],
|
response['admin'],
|
||||||
response['avatar']);
|
response['avatar']);
|
||||||
//self.router.navigate(['home']);
|
//self.router.navigate(['home']);
|
||||||
}).catch(function(response) {
|
}).catch(function(response) {
|
||||||
|
@ -12,7 +12,7 @@ import { HttpClientModule } from '@angular/common/http';
|
|||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||||
import { routing } from './app-routing.module';
|
import { routing } from './app-routing.module';
|
||||||
|
import { SelectDropDownModule } from 'ngx-select-dropdown'
|
||||||
|
|
||||||
import { UploadFileComponent } from './component/upload-file/upload-file';
|
import { UploadFileComponent } from './component/upload-file/upload-file';
|
||||||
import { TopMenuComponent } from './component/top-menu/top-menu';
|
import { TopMenuComponent } from './component/top-menu/top-menu';
|
||||||
@ -37,6 +37,7 @@ import { SettingsComponent } from './scene/settings/settings';
|
|||||||
import { ErrorViewerComponent } from './scene/error-viewer/error-viewer';
|
import { ErrorViewerComponent } from './scene/error-viewer/error-viewer';
|
||||||
import { ErrorComponent } from './error/error';
|
import { ErrorComponent } from './error/error';
|
||||||
import { VideoEditComponent } from './scene/video-edit/video-edit';
|
import { VideoEditComponent } from './scene/video-edit/video-edit';
|
||||||
|
import { UploadScene } from './scene/upload/upload';
|
||||||
import { SaisonEditComponent } from './scene/saison-edit/saison-edit';
|
import { SaisonEditComponent } from './scene/saison-edit/saison-edit';
|
||||||
import { GroupEditComponent } from './scene/group-edit/group-edit';
|
import { GroupEditComponent } from './scene/group-edit/group-edit';
|
||||||
|
|
||||||
@ -44,6 +45,7 @@ import { AuthService } from './service/auth';
|
|||||||
import { ArianeService } from './service/ariane';
|
import { ArianeService } from './service/ariane';
|
||||||
import { CookiesService } from './service/cookies';
|
import { CookiesService } from './service/cookies';
|
||||||
import { HttpWrapperService } from './service/http-wrapper';
|
import { HttpWrapperService } from './service/http-wrapper';
|
||||||
|
import { HttpOAuthWrapperService } from './service/http-oauth-wrapper';
|
||||||
import { UserService } from './service/user';
|
import { UserService } from './service/user';
|
||||||
import { UniversService } from './service/univers';
|
import { UniversService } from './service/univers';
|
||||||
import { GroupService } from './service/group';
|
import { GroupService } from './service/group';
|
||||||
@ -82,7 +84,8 @@ import { AppComponent } from './app.component';
|
|||||||
SaisonEditComponent,
|
SaisonEditComponent,
|
||||||
GroupEditComponent,
|
GroupEditComponent,
|
||||||
PopInComponent,
|
PopInComponent,
|
||||||
CreateTypeComponent
|
CreateTypeComponent,
|
||||||
|
UploadScene
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
@ -92,11 +95,13 @@ import { AppComponent } from './app.component';
|
|||||||
HttpClientModule,
|
HttpClientModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
MatProgressSpinnerModule
|
MatProgressSpinnerModule,
|
||||||
|
SelectDropDownModule
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
PopInService,
|
PopInService,
|
||||||
HttpWrapperService,
|
HttpWrapperService,
|
||||||
|
HttpOAuthWrapperService,
|
||||||
BddService,
|
BddService,
|
||||||
AuthService,
|
AuthService,
|
||||||
SessionService,
|
SessionService,
|
||||||
|
@ -126,6 +126,11 @@
|
|||||||
(auxclick)="onLogout($event)">
|
(auxclick)="onLogout($event)">
|
||||||
<i class="material-icons">exit_to_app</i> Sign out
|
<i class="material-icons">exit_to_app</i> Sign out
|
||||||
</button>
|
</button>
|
||||||
|
<button class="item"
|
||||||
|
(click)="onAddMedia($event)"
|
||||||
|
(auxclick)="onAddMedia($event)">
|
||||||
|
<i class="material-icons">add_circle</i> Add media
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="fill-all" *ngIf="displayEditMenu == true" (click)="onOutUserProperty()">
|
<div class="fill-all" *ngIf="displayEditMenu == true" (click)="onOutUserProperty()">
|
||||||
|
@ -162,6 +162,12 @@ export class TopMenuComponent implements OnInit {
|
|||||||
this.displayUserMenu = false;
|
this.displayUserMenu = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onAddMedia(_event: any): void {
|
||||||
|
console.log("onAddMedia()");
|
||||||
|
this.router.navigate(['upload']);
|
||||||
|
this.displayUserMenu = false;
|
||||||
|
}
|
||||||
|
|
||||||
onSetting(_event: any): void {
|
onSetting(_event: any): void {
|
||||||
console.log("onSetting()");
|
console.log("onSetting()");
|
||||||
this.router.navigate(['settings']);
|
this.router.navigate(['settings']);
|
||||||
|
@ -31,8 +31,13 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<button class="button cancel color-button-cancel color-shadow-black" (click)="onCancel()">Cancel</button>
|
<button class="button cancel color-button-cancel color-shadow-black"
|
||||||
<button class="button login color-button-validate color-shadow-black" id="login-button" [disabled]="loginButtonDisabled" (click)="onLogin()" type="submit">Login</button>
|
(click)="onCancel()">Cancel</button>
|
||||||
|
<button class="button login color-button-validate color-shadow-black"
|
||||||
|
id="login-button"
|
||||||
|
[disabled]="loginButtonDisabled"
|
||||||
|
(click)="onLogin()"
|
||||||
|
type="submit">Login</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{{error}}
|
{{error}}
|
||||||
|
@ -33,7 +33,7 @@ export let checkEmailValidity = function(_value:string):boolean {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export let checkPasswordValidity = function(_value:string):boolean {
|
export let checkPasswordValidity = function(_value:string):boolean {
|
||||||
let regexCheck = new RegExp("^[a-zA-Z0-9_\.@ %:;,=}{\?\!\*\+\(\)\[\]\|&#%~°/\\\<\>-]+$");
|
let regexCheck = new RegExp("^[a-zA-Z0-9_\.@ %:;,=}{\?\!\*\+\(\)\[\]\|&#%~/\\\<\>-£€]+$");
|
||||||
if (regexCheck.test(_value)) {
|
if (regexCheck.test(_value)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -87,7 +87,9 @@ export class LoginComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
this.error = "";
|
this.error = "";
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Check the login writing rules
|
||||||
|
*/
|
||||||
checkLogin(_newValue:string):void {
|
checkLogin(_newValue:string):void {
|
||||||
this.login = _newValue;
|
this.login = _newValue;
|
||||||
if (this.login == null) {
|
if (this.login == null) {
|
||||||
@ -120,6 +122,9 @@ export class LoginComponent implements OnInit {
|
|||||||
this.updateButtonVisibility();
|
this.updateButtonVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check the password writing rules
|
||||||
|
*/
|
||||||
checkPassword(_newValue:string):void {
|
checkPassword(_newValue:string):void {
|
||||||
this.password = _newValue;
|
this.password = _newValue;
|
||||||
if (this.password == null) {
|
if (this.password == null) {
|
||||||
@ -154,8 +159,8 @@ export class LoginComponent implements OnInit {
|
|||||||
response['role'],
|
response['role'],
|
||||||
response['avatar']);
|
response['avatar']);
|
||||||
if (self.rememberMe == true) {
|
if (self.rememberMe == true) {
|
||||||
self.cookiesService.set("yota-login", response['login'], 365);
|
self.cookiesService.set("yota-login", response['login'], 120);
|
||||||
self.cookiesService.set("yota-password", SHA512(self.password), 365);
|
self.cookiesService.set("yota-password", SHA512(self.password), 60);
|
||||||
}
|
}
|
||||||
self.router.navigate(['home']);
|
self.router.navigate(['home']);
|
||||||
}).catch(function(response) {
|
}).catch(function(response) {
|
||||||
|
135
front/src/app/scene/upload/upload.html
Normal file
135
front/src/app/scene/upload/upload.html
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
<div class="main-reduce">
|
||||||
|
<div class="fill-all">
|
||||||
|
<div class="title">
|
||||||
|
>>> Upload Media <<<
|
||||||
|
</div>
|
||||||
|
<div class="request_raw">
|
||||||
|
<div class="label">
|
||||||
|
format:
|
||||||
|
</div>
|
||||||
|
<div class="input">
|
||||||
|
The format of the media permit to automatic find meta-data:<br/>
|
||||||
|
Media series name-media universe name-sXX-eXX-my name of my media.mkv<br/>
|
||||||
|
<b> example:</b> Captain America-Marvel-e02-The winter soldier.mkv
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="request_raw2">
|
||||||
|
<div class="label">
|
||||||
|
Media:
|
||||||
|
</div>
|
||||||
|
<div class="input">
|
||||||
|
<input type="file"
|
||||||
|
(change)="onChangeFile($event.target)"
|
||||||
|
placeholder="Select a media file"
|
||||||
|
accept=".mkv,.webm"/>{{upload_file_value}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="clear"></div>
|
||||||
|
<div class="title">
|
||||||
|
Parsed data:
|
||||||
|
</div>
|
||||||
|
<div class="request_raw">
|
||||||
|
<div class="label">
|
||||||
|
*Type:
|
||||||
|
</div>
|
||||||
|
<div class="input">
|
||||||
|
<select [ngModel]="type_id"
|
||||||
|
(ngModelChange)="onChangeType($event)">
|
||||||
|
<option *ngFor="let element of listType" [ngValue]="element.value">{{element.label}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="request_raw">
|
||||||
|
<div class="label">
|
||||||
|
*Title:
|
||||||
|
</div>
|
||||||
|
<div class="input">
|
||||||
|
<input type="text"
|
||||||
|
placeholder="Name of the Media"
|
||||||
|
[value]="parse_title"
|
||||||
|
(input)="onTitle($event.target.value)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="request_raw">
|
||||||
|
<div class="label">
|
||||||
|
Universe:
|
||||||
|
</div>
|
||||||
|
<div class="input">
|
||||||
|
<input type="text"
|
||||||
|
placeholder="Universe of the Media"
|
||||||
|
[value]="parse_universe"
|
||||||
|
(input)="onUniverse($event.target.value)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="request_raw">
|
||||||
|
<div class="label">
|
||||||
|
Series:
|
||||||
|
</div>
|
||||||
|
<div class="input">
|
||||||
|
<input type="text"
|
||||||
|
placeholder="Series of the Media"
|
||||||
|
[value]="parse_serie"
|
||||||
|
(input)="onSerie($event.target.value)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="request_raw">
|
||||||
|
<div class="label">
|
||||||
|
==>
|
||||||
|
</div>
|
||||||
|
<div class="input">
|
||||||
|
<!-- <ngx-select-dropdown [config]="config" [options]="listGroup2"
|
||||||
|
[(ngModel)]="parse_serie" [multiple]="false" ></ngx-select-dropdown>-->
|
||||||
|
<select [ngModel]="serie_id"
|
||||||
|
(ngModelChange)="onChangeGroup($event)">
|
||||||
|
<option *ngFor="let element of listGroup" [ngValue]="element.value">{{element.label}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="input_add">
|
||||||
|
<button class="button color-button-normal color-shadow-black" (click)="newSerie()" type="submit">
|
||||||
|
<i class="material-icons">add_circle_outline</i>
|
||||||
|
</button>
|
||||||
|
</div>-->
|
||||||
|
</div>
|
||||||
|
<div class="request_raw">
|
||||||
|
<div class="label">
|
||||||
|
Season:
|
||||||
|
</div>
|
||||||
|
<div class="input">
|
||||||
|
<input type="number"
|
||||||
|
pattern="[0-9]{0-4}"
|
||||||
|
placeholder="saison of the Media"
|
||||||
|
[value]="parse_saison"
|
||||||
|
(input)="onSaison($event.target.value)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="request_raw">
|
||||||
|
<div class="label">
|
||||||
|
Episode:
|
||||||
|
</div>
|
||||||
|
<div class="input">
|
||||||
|
<input type="number"
|
||||||
|
pattern="[0-9]{0-4}"
|
||||||
|
placeholder="Episode of the Media"
|
||||||
|
[value]="parse_episode"
|
||||||
|
(input)="onEpisode($event.target.value)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="clear"></div>
|
||||||
|
|
||||||
|
<div class="send_value">
|
||||||
|
<button class="button fill-x color-button-validate color-shadow-black"
|
||||||
|
[disabled]="!need_send"
|
||||||
|
(click)="sendFile()"
|
||||||
|
type="submit">
|
||||||
|
<i class="material-icons">cloud_upload</i> Upload
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="clear"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
145
front/src/app/scene/upload/upload.less
Normal file
145
front/src/app/scene/upload/upload.less
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
d.fill-all{
|
||||||
|
//width:100%;
|
||||||
|
max-width:80%;
|
||||||
|
height:100%;
|
||||||
|
margin: 20px auto;
|
||||||
|
padding: 20px;
|
||||||
|
border:0;
|
||||||
|
background-color: rgba(200, 200, 200, 0.5);
|
||||||
|
box-shadow: 0px 2px 4px 0 rgba(0, 0, 0, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
width: 90%;
|
||||||
|
margin: 0 auto;
|
||||||
|
font-size: 50px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.request_raw2 {
|
||||||
|
width: 90%;
|
||||||
|
margin: 0 auto;
|
||||||
|
height: 160px;
|
||||||
|
.label {
|
||||||
|
width: 15%;
|
||||||
|
margin-right: 10px;
|
||||||
|
text-align: right;
|
||||||
|
float: left;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.input {
|
||||||
|
width: 75%;
|
||||||
|
float: left;
|
||||||
|
display: block;
|
||||||
|
textarea {
|
||||||
|
width: 100%;
|
||||||
|
font-size: 20px;
|
||||||
|
resize: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.request_raw {
|
||||||
|
width: 90%;
|
||||||
|
margin: 0 auto;
|
||||||
|
height: 45px;
|
||||||
|
.label {
|
||||||
|
width: 15%;
|
||||||
|
margin-right: 10px;
|
||||||
|
text-align: right;
|
||||||
|
float: left;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.input {
|
||||||
|
width: 75%;
|
||||||
|
float: left;
|
||||||
|
display: block;
|
||||||
|
input {
|
||||||
|
width: 100%;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
select {
|
||||||
|
width: 100%;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
textarea {
|
||||||
|
width: 100%;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.input_add {
|
||||||
|
width: 5%;
|
||||||
|
float: right;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.cover_div {
|
||||||
|
float: left;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.cover_remove_div {
|
||||||
|
float: left;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.cover {
|
||||||
|
max-width: 30%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.send_value {
|
||||||
|
width: 300px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 10px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
font-size: 20px;
|
||||||
|
height: 21%;
|
||||||
|
width: 23%;
|
||||||
|
margin: 1%;
|
||||||
|
padding: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
//box-shadow: 0 1px 1.5px 0 rgba(0,0,0,.12),0 1px 1px 0 rgba(0,0,0,.24);
|
||||||
|
box-shadow: 0px 2px 4px 0 rgba(0, 0, 0, 0.6);
|
||||||
|
line-height: normal;
|
||||||
|
border: none;
|
||||||
|
font-family: "Roboto","Helvetica","Arial",sans-serif;
|
||||||
|
font-weight: 500;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0;
|
||||||
|
will-change: box-shadow;
|
||||||
|
outline: none;
|
||||||
|
cursor: pointer;
|
||||||
|
text-decoration: none;
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
transition-duration: 0.4s;
|
||||||
|
float:left;
|
||||||
|
display:block;
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: #F00;
|
||||||
|
}
|
||||||
|
|
||||||
|
.material-icons {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.material-icons {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: ~"translate(-12px,-12px)";
|
||||||
|
line-height: 24px;
|
||||||
|
width: 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-video {
|
||||||
|
&:hover {
|
||||||
|
background-color: #0F0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
477
front/src/app/scene/upload/upload.ts
Normal file
477
front/src/app/scene/upload/upload.ts
Normal file
@ -0,0 +1,477 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2018, Edouard DUPIN, all right reserved
|
||||||
|
* @license PROPRIETARY (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { Router, ActivatedRoute, ParamMap } from '@angular/router';
|
||||||
|
import { Location } from '@angular/common';
|
||||||
|
import { NgForm } from '@angular/forms';
|
||||||
|
import { FormGroup, FormControl } from "@angular/forms";
|
||||||
|
import { fadeInAnimation } from '../../_animations/index';
|
||||||
|
import { HttpWrapperService } from '../../service/http-wrapper';
|
||||||
|
import { HttpEventType, HttpResponse } from '@angular/common/http';
|
||||||
|
|
||||||
|
|
||||||
|
import { PopInService } from '../../service/popin';
|
||||||
|
import { TypeService } from '../../service/type';
|
||||||
|
import { UniversService } from '../../service/univers';
|
||||||
|
import { GroupService } from '../../service/group';
|
||||||
|
import { VideoService } from '../../service/video';
|
||||||
|
import { DataService } from '../../service/data';
|
||||||
|
import { ArianeService } from '../../service/ariane';
|
||||||
|
|
||||||
|
export class ElementList {
|
||||||
|
value: number;
|
||||||
|
label: string;
|
||||||
|
constructor(_value: number, _label: string) {
|
||||||
|
this.value = _value;
|
||||||
|
this.label = _label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-video-edit',
|
||||||
|
templateUrl: './upload.html',
|
||||||
|
styleUrls: ['./upload.less'],
|
||||||
|
animations: [fadeInAnimation],
|
||||||
|
host: { '[@fadeInAnimation]': '' }
|
||||||
|
})
|
||||||
|
// https://www.sitepoint.com/angular-forms/
|
||||||
|
export class UploadScene implements OnInit {
|
||||||
|
id_video: number = -1;
|
||||||
|
|
||||||
|
error: string = "";
|
||||||
|
|
||||||
|
coverFile: File;
|
||||||
|
mediaFile: File = null;
|
||||||
|
upload_file_value: string = ""
|
||||||
|
selectedFiles: FileList;
|
||||||
|
type_id: number = undefined
|
||||||
|
serie_id: number = undefined
|
||||||
|
need_send: boolean = false;
|
||||||
|
|
||||||
|
covers_display: Array<any> = [];
|
||||||
|
|
||||||
|
listType: ElementList[] = [
|
||||||
|
{ value: undefined, label: '---' },
|
||||||
|
];
|
||||||
|
listUnivers: ElementList[] = [
|
||||||
|
{ value: undefined, label: '---' },
|
||||||
|
{ value: null, label: '---' },
|
||||||
|
];
|
||||||
|
listGroup: ElementList[] = [
|
||||||
|
{ value: undefined, label: '---' },
|
||||||
|
];
|
||||||
|
listGroup2 = [{ id: undefined, description: '---' }];
|
||||||
|
/*
|
||||||
|
config = {
|
||||||
|
displayKey: "label", // if objects array passed which key to be displayed defaults to description
|
||||||
|
search: true,
|
||||||
|
limitTo: 3,
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
config = {
|
||||||
|
displayKey: "description", //if objects array passed which key to be displayed defaults to description
|
||||||
|
search: true, //true/false for the search functionlity defaults to false,
|
||||||
|
height: 'auto', //height of the list so that if there are more no of items it can show a scroll defaults to auto. With auto height scroll will never appear
|
||||||
|
placeholder: 'Select', // text to be displayed when no item is selected defaults to Select,
|
||||||
|
customComparator: ()=>{}, // a custom function using which user wants to sort the items. default is undefined and Array.sort() will be used in that case,
|
||||||
|
limitTo: 10, // number thats limits the no of options displayed in the UI (if zero, options will not be limited)
|
||||||
|
moreText: 'more', // text to be displayed whenmore than one items are selected like Option 1 + 5 more
|
||||||
|
noResultsFound: 'No results found!', // text to be displayed when no items are found while searching
|
||||||
|
searchPlaceholder: 'Search', // label thats displayed in search input,
|
||||||
|
searchOnKey: 'description', // key on which search should be performed this will be selective search. if undefined this will be extensive search on all keys
|
||||||
|
}
|
||||||
|
listSaison: ElementList[] = [
|
||||||
|
{ value: undefined, label: '---' },
|
||||||
|
];
|
||||||
|
parse_universe: string = "";
|
||||||
|
parse_serie: string = "";
|
||||||
|
parse_saison: number = null;
|
||||||
|
parse_episode: number = null;
|
||||||
|
parse_title: string = "";
|
||||||
|
constructor(private route: ActivatedRoute,
|
||||||
|
private router: Router,
|
||||||
|
private locate: Location,
|
||||||
|
private dataService: DataService,
|
||||||
|
private typeService: TypeService,
|
||||||
|
private universService: UniversService,
|
||||||
|
private groupService: GroupService,
|
||||||
|
private videoService: VideoService,
|
||||||
|
private httpService: HttpWrapperService,
|
||||||
|
private arianeService: ArianeService,
|
||||||
|
private popInService: PopInService) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
updateNeedSend (): boolean {
|
||||||
|
if (this.mediaFile == null) {
|
||||||
|
this.need_send = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.need_send = true;
|
||||||
|
if (this.parse_title === undefined || this.parse_title === null || this.parse_title === "") {
|
||||||
|
this.need_send = false;
|
||||||
|
}
|
||||||
|
if (this.type_id === undefined) {
|
||||||
|
this.need_send = false;
|
||||||
|
}
|
||||||
|
return this.need_send;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit () {
|
||||||
|
this.arianeService.updateManual(this.route.snapshot.paramMap);
|
||||||
|
this.id_video = this.arianeService.getVideoId();
|
||||||
|
let self = this;
|
||||||
|
this.listType = [{ value: undefined, label: '---' }];
|
||||||
|
this.listUnivers = [{ value: undefined, label: '---' }];
|
||||||
|
this.listGroup = [{ value: undefined, label: '---' }];
|
||||||
|
this.listSaison = [{ value: undefined, label: '---' }];
|
||||||
|
this.universService.getData()
|
||||||
|
.then(function (response2) {
|
||||||
|
for (let iii = 0; iii < response2.length; iii++) {
|
||||||
|
self.listUnivers.push({ value: response2[iii].id, label: response2[iii].name });
|
||||||
|
}
|
||||||
|
}).catch(function (response2) {
|
||||||
|
console.log("get response22 : " + JSON.stringify(response2, null, 2));
|
||||||
|
});
|
||||||
|
this.typeService.getData()
|
||||||
|
.then(function (response2) {
|
||||||
|
for (let iii = 0; iii < response2.length; iii++) {
|
||||||
|
self.listType.push({ value: response2[iii].id, label: response2[iii].name });
|
||||||
|
}
|
||||||
|
}).catch(function (response2) {
|
||||||
|
console.log("get response22 : " + JSON.stringify(response2, null, 2));
|
||||||
|
});
|
||||||
|
//this.groupService.getOrder()
|
||||||
|
this.groupService.getData()
|
||||||
|
.then(function (response3) {
|
||||||
|
for (let iii = 0; iii < response3.length; iii++) {
|
||||||
|
self.listGroup.push({ value: response3[iii].id, label: response3[iii].name });
|
||||||
|
self.listGroup2 = [...self.listGroup2,{ id: response3[iii].id, description: response3[iii].name }];
|
||||||
|
//self.listGroup2.push(response3[iii].name);
|
||||||
|
console.log("[" + self.data_id + "] Get serie: " + response3[iii].id + ", label:" + response3[iii].name)
|
||||||
|
}
|
||||||
|
}).catch(function (response3) {
|
||||||
|
console.log("get response3 : " + JSON.stringify(response3, null, 2));
|
||||||
|
});
|
||||||
|
/*
|
||||||
|
this.videoService.get(this.id_video)
|
||||||
|
.then(function (response) {
|
||||||
|
console.log("get response of video : " + JSON.stringify(response, null, 2));
|
||||||
|
self.data.name = response.name;
|
||||||
|
self.data.description = response.description;
|
||||||
|
self.data.episode = response.episode;
|
||||||
|
self.data.univers_id = response.univers_id;
|
||||||
|
self.data.data_id = response.data_id;
|
||||||
|
self.data.time = response.time;
|
||||||
|
self.data.generated_name = response.generated_name;
|
||||||
|
self.onChangeType(response.type_id);
|
||||||
|
self.onChangeGroup(response.serie_id);
|
||||||
|
self.data.saison_id = response.saison_id;
|
||||||
|
self.data_ori = self.data.clone();
|
||||||
|
if (response.covers !== undefined && response.covers !== null) {
|
||||||
|
for (let iii = 0; iii < response.covers.length; iii++) {
|
||||||
|
self.data.covers.push(response.covers[iii]);
|
||||||
|
self.covers_display.push({
|
||||||
|
id: response.covers[iii],
|
||||||
|
url: self.videoService.getCoverUrl(response.covers[iii])
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
self.covers_display = []
|
||||||
|
}
|
||||||
|
self.updateNeedSend();
|
||||||
|
console.log("covers_list : " + JSON.stringify(self.covers_display, null, 2));
|
||||||
|
}).catch(function (response) {
|
||||||
|
self.error = "Can not get the data";
|
||||||
|
self.data = new DataToSend();
|
||||||
|
self.covers_display = [];
|
||||||
|
self.data_ori = self.data.clone();
|
||||||
|
self.updateNeedSend();
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
console.log(" END INIT ");
|
||||||
|
}
|
||||||
|
|
||||||
|
onChangeType (_value: any): void {
|
||||||
|
console.log("Change requested of type ... " + _value);
|
||||||
|
this.type_id = _value;
|
||||||
|
//this.data.serie_id = null;
|
||||||
|
//this.data.saison_id = null;
|
||||||
|
//this.listGroup = [{value: undefined, label: '---'}];
|
||||||
|
//this.listSaison = [{value: undefined, label: '---'}];
|
||||||
|
let self = this;
|
||||||
|
this.updateNeedSend();
|
||||||
|
/*
|
||||||
|
if (this.type_id != undefined) {
|
||||||
|
self.typeService.getSubGroup(this.type_id, ["id", "name"])
|
||||||
|
.then(function(response2) {
|
||||||
|
for(let iii= 0; iii < response2.length; iii++) {
|
||||||
|
self.listGroup.push({value: response2[iii].id, label: response2[iii].name});
|
||||||
|
}
|
||||||
|
}).catch(function(response2) {
|
||||||
|
console.log("get response22 : " + JSON.stringify(response2, null, 2));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
onChangeGroup (_value: any): void {
|
||||||
|
this.serie_id = _value;
|
||||||
|
if (_value === undefined || _value === null) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
for (let iii = 0 ; iii<this.listGroup.length ; iii++) {
|
||||||
|
if (this.listGroup[iii].value == _value) {
|
||||||
|
this.parse_serie = this.listGroup[iii].label;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.updateNeedSend();
|
||||||
|
}
|
||||||
|
onSaison (_value: any): void {
|
||||||
|
this.parse_saison = _value;
|
||||||
|
this.updateNeedSend();
|
||||||
|
}
|
||||||
|
|
||||||
|
onTitle (_value: any): void {
|
||||||
|
this.parse_title = _value;
|
||||||
|
this.updateNeedSend();
|
||||||
|
}
|
||||||
|
|
||||||
|
onUniverse (_value: any): void {
|
||||||
|
this.parse_universe = _value;
|
||||||
|
this.updateNeedSend();
|
||||||
|
}
|
||||||
|
|
||||||
|
onEpisode (_value: any): void {
|
||||||
|
this.parse_episode = parseInt(_value.value, 10);
|
||||||
|
this.updateNeedSend();
|
||||||
|
}
|
||||||
|
onSerie (_value: any): void {
|
||||||
|
this.parse_serie = _value;
|
||||||
|
let self = this;
|
||||||
|
if (this.parse_serie != "") {
|
||||||
|
this.groupService.getLike(this.parse_serie)
|
||||||
|
.then(function(response) {
|
||||||
|
console.log("find elemet: " + response.name + " " + response.id);
|
||||||
|
self.serie_id = response.id;
|
||||||
|
}).catch(function(response) {
|
||||||
|
console.log("CAN NOT find element: " );
|
||||||
|
self.serie_id = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.updateNeedSend();
|
||||||
|
}
|
||||||
|
|
||||||
|
sendFile(): void {
|
||||||
|
|
||||||
|
}
|
||||||
|
sendValues (): void {
|
||||||
|
console.log("send new values....");
|
||||||
|
let data = {}
|
||||||
|
if (this.data.name != this.data_ori.name) {
|
||||||
|
data["name"] = this.data.name;
|
||||||
|
}
|
||||||
|
if (this.data.description != this.data_ori.description) {
|
||||||
|
data["description"] = this.data.description;
|
||||||
|
}
|
||||||
|
if (this.data.episode != this.data_ori.episode) {
|
||||||
|
data["episode"] = this.data.episode;
|
||||||
|
}
|
||||||
|
if (this.data.time != this.data_ori.time) {
|
||||||
|
data["time"] = this.data.time;
|
||||||
|
}
|
||||||
|
if (this.data.type_id != this.data_ori.type_id) {
|
||||||
|
data["type_id"] = this.data.type_id;
|
||||||
|
}
|
||||||
|
if (this.data.univers_id != this.data_ori.univers_id) {
|
||||||
|
data["univers_id"] = this.data.univers_id;
|
||||||
|
}
|
||||||
|
if (this.data.serie_id != this.data_ori.serie_id) {
|
||||||
|
data["serie_id"] = this.data.serie_id;
|
||||||
|
}
|
||||||
|
if (this.data.saison_id != this.data_ori.saison_id) {
|
||||||
|
data["saison_id"] = this.data.saison_id;
|
||||||
|
}
|
||||||
|
let tmpp = this.data.clone();
|
||||||
|
let self = this;
|
||||||
|
this.videoService.put(this.id_video, data)
|
||||||
|
.then(function (response3) {
|
||||||
|
self.data_ori = tmpp;
|
||||||
|
self.updateNeedSend();
|
||||||
|
}).catch(function (response3) {
|
||||||
|
console.log("get response22 : " + JSON.stringify(response3, null, 2));
|
||||||
|
self.updateNeedSend();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// At the drag drop area
|
||||||
|
// (drop)="onDropFile($event)"
|
||||||
|
onDropFile (_event: DragEvent) {
|
||||||
|
_event.preventDefault();
|
||||||
|
this.uploadFile(_event.dataTransfer.files[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// At the drag drop area
|
||||||
|
// (dragover)="onDragOverFile($event)"
|
||||||
|
onDragOverFile (_event) {
|
||||||
|
_event.stopPropagation();
|
||||||
|
_event.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
// At the file input element
|
||||||
|
// (change)="selectFile($event)"
|
||||||
|
onChangeFile (_value: any): void {
|
||||||
|
this.parse_universe = "";
|
||||||
|
this.parse_serie = "";
|
||||||
|
this.parse_saison = null;
|
||||||
|
this.parse_episode = null;
|
||||||
|
this.parse_title = "";
|
||||||
|
this.selectedFiles = _value.files
|
||||||
|
this.mediaFile = this.selectedFiles[0];
|
||||||
|
console.log("select file " + this.mediaFile.name);
|
||||||
|
const splitElement = this.mediaFile.name.split('-');
|
||||||
|
if (splitElement.length == 1) {
|
||||||
|
this.parse_title = splitElement[0];
|
||||||
|
} else {
|
||||||
|
if (splitElement.length>=2) {
|
||||||
|
this.parse_serie = splitElement[0];
|
||||||
|
}
|
||||||
|
splitElement.splice(0,1);
|
||||||
|
if (splitElement.length == 1) {
|
||||||
|
this.parse_title = splitElement[0];
|
||||||
|
} else {
|
||||||
|
while (splitElement.length>0) {
|
||||||
|
let element = splitElement[0];
|
||||||
|
let find = false;
|
||||||
|
if (this.parse_saison == null) {
|
||||||
|
if (element.length >= 1 && (element[0] == 's' || element[0] == 'S') ) {
|
||||||
|
element = element.substring(1);
|
||||||
|
this.parse_saison = parseInt(element, 10);
|
||||||
|
find = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.parse_episode == null && find == false) {
|
||||||
|
if (element.length >= 1 && (element[0] == 'e' || element[0] == 'E') ) {
|
||||||
|
element = element.substring(1);
|
||||||
|
this.parse_episode = parseInt(element, 10);
|
||||||
|
find = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (find == false) {
|
||||||
|
if (this.parse_saison == null && this.parse_episode == null) {
|
||||||
|
if (this.parse_universe == "") {
|
||||||
|
this.parse_universe = element;
|
||||||
|
} else {
|
||||||
|
this.parse_universe = this.parse_universe + "-" + element;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (this.parse_title == "") {
|
||||||
|
this.parse_title = element;
|
||||||
|
} else {
|
||||||
|
this.parse_title = this.parse_title + "-" + element;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
splitElement.splice(0,1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// remove extention
|
||||||
|
this.parse_title = this.parse_title.replace(new RegExp("\.(mkv|MKV|Mkv|webm|WEBM|Webm)"),"");
|
||||||
|
//this.uploadFile(this.coverFile);
|
||||||
|
this.updateNeedSend();
|
||||||
|
|
||||||
|
let self = this;
|
||||||
|
if (this.parse_serie != "") {
|
||||||
|
this.groupService.getLike(this.parse_serie)
|
||||||
|
.then(function(response) {
|
||||||
|
console.log("find elemet: " + response.name + " " + response.id);
|
||||||
|
self.serie_id = response.id;
|
||||||
|
}).catch(function(response) {
|
||||||
|
console.log("CAN NOT find element: " );
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
uploadFile (_file: File) {
|
||||||
|
if (_file == undefined) {
|
||||||
|
console.log("No file selected!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let self = this;
|
||||||
|
this.dataService.sendFile(_file)
|
||||||
|
.then(function (response) {
|
||||||
|
console.log("get response of video : " + JSON.stringify(response, null, 2));
|
||||||
|
let id_of_image = response.id;
|
||||||
|
self.videoService.addCover(self.id_video, id_of_image)
|
||||||
|
.then(function (response) {
|
||||||
|
console.log("cover added");
|
||||||
|
self.covers_display.push(self.videoService.getCoverUrl(id_of_image));
|
||||||
|
}).catch(function (response) {
|
||||||
|
console.log("Can not cover in the cover_list...");
|
||||||
|
});
|
||||||
|
}).catch(function (response) {
|
||||||
|
//self.error = "Can not get the data";
|
||||||
|
console.log("Can not add the data in the system...");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
removeCover (_id) {
|
||||||
|
console.log("Request remove cover: " + _id);
|
||||||
|
}
|
||||||
|
removeMedia () {
|
||||||
|
console.log("Request remove Media...");
|
||||||
|
this.videoService.delete(this.id_video)
|
||||||
|
.then(function (response3) {
|
||||||
|
//self.data_ori = tmpp;
|
||||||
|
//self.updateNeedSend();
|
||||||
|
}).catch(function (response3) {
|
||||||
|
|
||||||
|
//self.updateNeedSend();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
eventPopUpSaison (_event: string): void {
|
||||||
|
console.log("GET event: " + _event);
|
||||||
|
this.popInService.close("popin-new-saison");
|
||||||
|
}
|
||||||
|
eventPopUpSerie (_event: string): void {
|
||||||
|
console.log("GET event: " + _event);
|
||||||
|
this.popInService.close("popin-new-serie");
|
||||||
|
}
|
||||||
|
eventPopUpType (_event: string): void {
|
||||||
|
console.log("GET event: " + _event);
|
||||||
|
this.popInService.close("popin-new-type");
|
||||||
|
}
|
||||||
|
eventPopUpUnivers (_event: string): void {
|
||||||
|
console.log("GET event: " + _event);
|
||||||
|
this.popInService.close("popin-new-univers");
|
||||||
|
}
|
||||||
|
|
||||||
|
newSaison (): void {
|
||||||
|
console.log("Request new Saison...");
|
||||||
|
this.popInService.open("popin-new-saison");
|
||||||
|
}
|
||||||
|
newSerie (): void {
|
||||||
|
console.log("Request new Serie...");
|
||||||
|
this.popInService.open("popin-new-serie");
|
||||||
|
}
|
||||||
|
newType (): void {
|
||||||
|
console.log("Request new Type...");
|
||||||
|
this.popInService.open("popin-create-type");
|
||||||
|
}
|
||||||
|
newUnivers () {
|
||||||
|
console.log("Request new Univers...");
|
||||||
|
this.popInService.open("popin-new-univers");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -71,11 +71,13 @@ export class BddService {
|
|||||||
resolve(self.bdd[_name]);
|
resolve(self.bdd[_name]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
console.log("get DB: ?? " + _name + " ??");
|
||||||
if (this.bddPomise[_name] == null) {
|
if (this.bddPomise[_name] == null) {
|
||||||
this.bddPomise[_name] = new Array<any>();
|
this.bddPomise[_name] = new Array<any>();
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.http.get_specific(_name)
|
self.http.get_specific(_name)
|
||||||
.then(function(response) {
|
.then(function(response) {
|
||||||
|
console.log("end download DB: ==> " + _name + " " + response.length);
|
||||||
self.bdd[_name] = new DataInterface(_name, response);
|
self.bdd[_name] = new DataInterface(_name, response);
|
||||||
for (let iii=0; iii<self.bddPomise[_name].length; iii++) {
|
for (let iii=0; iii<self.bddPomise[_name].length; iii++) {
|
||||||
self.bddPomise[_name][iii]["resolve"](self.bdd[_name]);
|
self.bddPomise[_name][iii]["resolve"](self.bdd[_name]);
|
||||||
|
@ -53,6 +53,33 @@ export class DataInterface {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getNameLikeAll(_name: string){
|
||||||
|
let out = undefined;
|
||||||
|
let nameLower =_name.toLowerCase();
|
||||||
|
for (let iii=0; iii<this.bdd.length; iii++) {
|
||||||
|
if (this.bdd[iii]['name'].toLowerCase() == nameLower) {
|
||||||
|
out.push(this.bdd[iii]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (out.length == 0) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
getNameLike(_name: string){
|
||||||
|
let out = undefined;
|
||||||
|
let nameLower = _name.toLowerCase();
|
||||||
|
for (let iii=0; iii<this.bdd.length; iii++) {
|
||||||
|
//console.log("compare '" + _name + "' ??? '" + this.bdd[iii]['name'] + "'");
|
||||||
|
if (this.bdd[iii]['name'] == _name) {
|
||||||
|
return this.bdd[iii];
|
||||||
|
} else if (this.bdd[iii]['name'].toLowerCase() == nameLower) {
|
||||||
|
out = this.bdd[iii];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
set(_id, _value){
|
set(_id, _value){
|
||||||
console.log("[I] Set " + this.name + " " + _id)
|
console.log("[I] Set " + this.name + " " + _id)
|
||||||
for (let iii=0; iii<this.bdd.length; iii++) {
|
for (let iii=0; iii<this.bdd.length; iii++) {
|
||||||
|
@ -63,16 +63,10 @@ export class GroupService {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getVideoAll(_id:number):any {
|
getVideoAll(_id:number):any {
|
||||||
if (environment.localBdd != true) {
|
|
||||||
return this.http.get_specific(this.serviceName, _id, "video_all");
|
|
||||||
}
|
|
||||||
//this.checkLocalBdd();
|
//this.checkLocalBdd();
|
||||||
};
|
};
|
||||||
|
|
||||||
getVideo(_id:number):any {
|
getVideo(_id:number):any {
|
||||||
if (environment.localBdd != true) {
|
|
||||||
return this.http.get_specific(this.serviceName, _id, "video");
|
|
||||||
}
|
|
||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.getVideo()
|
self.bdd.getVideo()
|
||||||
@ -87,9 +81,6 @@ export class GroupService {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getSaison(_id:number, _select:Array<string> = []):any {
|
getSaison(_id:number, _select:Array<string> = []):any {
|
||||||
if (environment.localBdd != true) {
|
|
||||||
return this.http.get_specific(this.serviceName, _id, "saison", _select);
|
|
||||||
}
|
|
||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.getSaison()
|
self.bdd.getSaison()
|
||||||
@ -115,9 +106,6 @@ export class GroupService {
|
|||||||
|
|
||||||
put(_id:number, _data:any):any {
|
put(_id:number, _data:any):any {
|
||||||
let ret = this.http.put_specific(this.serviceName, _id, _data);
|
let ret = this.http.put_specific(this.serviceName, _id, _data);
|
||||||
if (environment.localBdd != true) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
return this.bdd.setAfterPut(this.serviceName, _id, ret);
|
return this.bdd.setAfterPut(this.serviceName, _id, ret);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -128,5 +116,23 @@ export class GroupService {
|
|||||||
getCoverUrl(_coverId:number):any {
|
getCoverUrl(_coverId:number):any {
|
||||||
return this.http.createRESTCall("data/" + _coverId);
|
return this.http.createRESTCall("data/" + _coverId);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
getLike(_nameGroup:string):any {
|
||||||
|
let self = this;
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
self.bdd.getGroup()
|
||||||
|
.then(function(response) {
|
||||||
|
let data = response.getNameLike(_nameGroup);
|
||||||
|
if (data === null || data === undefined) {
|
||||||
|
reject("Data does not exist in the local BDD");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
resolve(data);
|
||||||
|
return;
|
||||||
|
}).catch(function(response) {
|
||||||
|
reject(response);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
425
front/src/app/service/http-oauth-wrapper.ts
Normal file
425
front/src/app/service/http-oauth-wrapper.ts
Normal file
@ -0,0 +1,425 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
|
import { HttpClient, HttpHeaders, HttpParams, HttpRequest, HttpEvent} from '@angular/common/http';
|
||||||
|
import { catchError, map, tap } from 'rxjs/operators';
|
||||||
|
import {Observable} from "rxjs";
|
||||||
|
|
||||||
|
import { environment } from 'environments/environment';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class HttpOAuthWrapperService {
|
||||||
|
private displayReturn:boolean = false;
|
||||||
|
constructor(private http: HttpClient) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
createRESTCall(_api:string, _options:any = undefined) {
|
||||||
|
let basePage = environment.apiOAuthUrl;
|
||||||
|
let addressServerRest = basePage + "/";
|
||||||
|
let out;
|
||||||
|
if (typeof _options === 'undefined') {
|
||||||
|
_options = [];
|
||||||
|
}
|
||||||
|
out = addressServerRest + _api;
|
||||||
|
let first = true;
|
||||||
|
for (let iii=0; iii<_options.length; iii++) {
|
||||||
|
if (first ==false) {
|
||||||
|
out += "&";
|
||||||
|
} else {
|
||||||
|
out += "?";
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
out += _options[iii];
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
get(_uriRest:string, _headerOption:any, _params:any) {
|
||||||
|
let connectionAdresse = this.createRESTCall(_uriRest, {});
|
||||||
|
let config = {
|
||||||
|
params: _params,
|
||||||
|
headers: new HttpHeaders(_headerOption)
|
||||||
|
};
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (this.displayReturn == true) {
|
||||||
|
console.log("call GET " + connectionAdresse + " params=" + JSON.stringify(_params, null, 2));
|
||||||
|
}
|
||||||
|
let request = this.http.get<any>(connectionAdresse, config);
|
||||||
|
let self = this;
|
||||||
|
request.subscribe((res: any) => {
|
||||||
|
if (self.displayReturn == true) {
|
||||||
|
console.log("!! data " + JSON.stringify(res, null, 2));
|
||||||
|
}
|
||||||
|
if (res) {
|
||||||
|
if (res.httpCode) {
|
||||||
|
resolve({status:res.httpCode, data:res});
|
||||||
|
} else {
|
||||||
|
resolve({status:200, data:res});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resolve({status:200, data:""});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
if (self.displayReturn == true) {
|
||||||
|
console.log("an error occured status: " + error.status);
|
||||||
|
console.log("answer: " + JSON.stringify(error, null, 2));
|
||||||
|
}
|
||||||
|
reject({status:error.status, data:error.error});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
post(_uriRest:string, _headerOption:any, _data:any) {
|
||||||
|
let connectionAdresse = this.createRESTCall(_uriRest, {});
|
||||||
|
const httpOption = {
|
||||||
|
headers: new HttpHeaders(_headerOption)
|
||||||
|
};
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (this.displayReturn == true) {
|
||||||
|
console.log("call POST " + connectionAdresse + " data=" + JSON.stringify(_data, null, 2));
|
||||||
|
}
|
||||||
|
let request = this.http.post<any>(connectionAdresse, _data, httpOption);
|
||||||
|
let self = this;
|
||||||
|
request.subscribe((res: any) => {
|
||||||
|
if (self.displayReturn == true) {
|
||||||
|
console.log("!! data " + JSON.stringify(res, null, 2));
|
||||||
|
}
|
||||||
|
if (res) {
|
||||||
|
if (res.httpCode) {
|
||||||
|
resolve({status:res.httpCode, data:res});
|
||||||
|
} else {
|
||||||
|
resolve({status:200, data:res});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resolve({status:200, data:""});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
if (self.displayReturn == true) {
|
||||||
|
console.log("an error occured status: " + error.status);
|
||||||
|
console.log("answer: " + JSON.stringify(error, null, 2));
|
||||||
|
}
|
||||||
|
reject({status:error.status, data:error.error});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
put(_uriRest:string, _headerOption:any, _data:any) {
|
||||||
|
let connectionAdresse = this.createRESTCall(_uriRest, {});
|
||||||
|
const httpOption = {
|
||||||
|
headers: new HttpHeaders(_headerOption)
|
||||||
|
};
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (this.displayReturn == true) {
|
||||||
|
console.log("call POST " + connectionAdresse + " data=" + JSON.stringify(_data, null, 2));
|
||||||
|
}
|
||||||
|
let request = this.http.put<any>(connectionAdresse, _data, httpOption);
|
||||||
|
let self = this;
|
||||||
|
request.subscribe((res: any) => {
|
||||||
|
if (self.displayReturn == true) {
|
||||||
|
console.log("!! data " + JSON.stringify(res, null, 2));
|
||||||
|
}
|
||||||
|
if (res) {
|
||||||
|
if (res.httpCode) {
|
||||||
|
resolve({status:res.httpCode, data:res});
|
||||||
|
} else {
|
||||||
|
resolve({status:200, data:res});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resolve({status:200, data:""});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
if (self.displayReturn == true) {
|
||||||
|
console.log("an error occured status: " + error.status);
|
||||||
|
console.log("answer: " + JSON.stringify(error, null, 2));
|
||||||
|
}
|
||||||
|
reject({status:error.status, data:error.error});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
delete(_uriRest:string, _headerOption:any) {
|
||||||
|
let connectionAdresse = this.createRESTCall(_uriRest, {});
|
||||||
|
const httpOption = {
|
||||||
|
headers: new HttpHeaders(_headerOption)
|
||||||
|
};
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (this.displayReturn == true) {
|
||||||
|
console.log("call POST " + connectionAdresse);
|
||||||
|
}
|
||||||
|
let request = this.http.delete<any>(connectionAdresse, httpOption);
|
||||||
|
let self = this;
|
||||||
|
request.subscribe((res: any) => {
|
||||||
|
if (self.displayReturn == true) {
|
||||||
|
console.log("!! data " + JSON.stringify(res, null, 2));
|
||||||
|
}
|
||||||
|
if (res) {
|
||||||
|
if (res.httpCode) {
|
||||||
|
resolve({status:res.httpCode, data:res});
|
||||||
|
} else {
|
||||||
|
resolve({status:200, data:res});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resolve({status:200, data:""});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
if (self.displayReturn == true) {
|
||||||
|
console.log("an error occured status: " + error.status);
|
||||||
|
console.log("answer: " + JSON.stringify(error, null, 2));
|
||||||
|
}
|
||||||
|
reject({status:error.status, data:error.error});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
uploadFileMultipart(_base:string, _id:number, _file:File): any {
|
||||||
|
console.log("Upload file to " + _base);
|
||||||
|
|
||||||
|
let url = _base;
|
||||||
|
if (_id != null) {
|
||||||
|
url += "/" + _id;
|
||||||
|
}
|
||||||
|
let formData = new FormData();
|
||||||
|
formData.append('upload', _file);
|
||||||
|
let headers = new Headers();
|
||||||
|
console.log("upload filename : " + _file.name);
|
||||||
|
let extention = _file.name.split('.').pop();
|
||||||
|
if (extention == "jpg") {
|
||||||
|
headers.append('Content-Type', "image/jpeg");
|
||||||
|
} else if (extention == "png") {
|
||||||
|
headers.append('Content-Type', "image/png");
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
headers.append('filename', _file.name);
|
||||||
|
|
||||||
|
const httpOption = {
|
||||||
|
headers: headers,
|
||||||
|
reportProgress: true,
|
||||||
|
};
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.post(url, httpOption, formData)
|
||||||
|
.then(function(response: any) {
|
||||||
|
console.log("URL: " + url + "\nRespond(" + response.status + "): " + JSON.stringify(response.data, null, 2));
|
||||||
|
if (response.status == 200) {
|
||||||
|
resolve(response.data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
reject("An error occured");
|
||||||
|
}, function(response: any) {
|
||||||
|
if (typeof response.data === 'undefined') {
|
||||||
|
reject("return ERROR undefined");
|
||||||
|
} else {
|
||||||
|
reject("return ERROR " + JSON.stringify(response.data, null, 2));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
uploadFileBase64(_base:string, _id:number, _file:File): any {
|
||||||
|
console.log("Upload file to " + _base);
|
||||||
|
|
||||||
|
let url = _base;
|
||||||
|
if (_id != null) {
|
||||||
|
url += "/" + _id;
|
||||||
|
}
|
||||||
|
let self = this;
|
||||||
|
let reader = new FileReader();
|
||||||
|
reader.readAsArrayBuffer(_file);
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
reader.onload = () => {
|
||||||
|
let headers = {};//new Headers();
|
||||||
|
console.log("upload filename : " + _file.name);
|
||||||
|
let extention = _file.name.split('.').pop();
|
||||||
|
if (extention == "jpg") {
|
||||||
|
//headers.append('Content-Type', "image/jpeg");
|
||||||
|
headers['Content-Type'] = "image/jpeg";
|
||||||
|
headers['mime-type'] = "image/jpeg";
|
||||||
|
} else if (extention == "jpeg") {
|
||||||
|
//headers.append('Content-Type', "image/jpeg");
|
||||||
|
headers['Content-Type'] = "image/jpeg";
|
||||||
|
headers['mime-type'] = "image/jpeg";
|
||||||
|
} else if (extention == "webp") {
|
||||||
|
//headers.append('Content-Type', "image/webp");
|
||||||
|
headers['Content-Type'] = "image/webp";
|
||||||
|
headers['mime-type'] = "image/webp";
|
||||||
|
} else if (extention == "png") {
|
||||||
|
//headers.append('Content-Type', "image/png");
|
||||||
|
headers['Content-Type'] = "image/png";
|
||||||
|
headers['mime-type'] = "image/png";
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
//headers.append('filename', _file.name);
|
||||||
|
headers['filename'] = _file.name;
|
||||||
|
|
||||||
|
self.post(url, headers, reader.result)
|
||||||
|
.then(function(response: any) {
|
||||||
|
console.log("URL: " + url + "\nRespond(" + response.status + "): " + JSON.stringify(response.data, null, 2));
|
||||||
|
if (response.status == 200) {
|
||||||
|
resolve(response.data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
reject("An error occured");
|
||||||
|
}, function(response: any) {
|
||||||
|
if (typeof response.data === 'undefined') {
|
||||||
|
reject("return ERROR undefined");
|
||||||
|
} else {
|
||||||
|
reject("return ERROR ...");// + JSON.stringify(response, null, 2));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Complex wrapper to simplify interaction:
|
||||||
|
get_specific(_base:string, _id:number = null, _subElement:string = "", _select:Array<string> = []):any {
|
||||||
|
console.log("Get All data from " + _base);
|
||||||
|
const httpOption = { 'Content-Type': 'application/json' };
|
||||||
|
let url = _base;
|
||||||
|
if (_id != null) {
|
||||||
|
url += "/" + _id;
|
||||||
|
}
|
||||||
|
if (_subElement != "") {
|
||||||
|
url += "/" + _subElement;
|
||||||
|
}
|
||||||
|
if (_select.length != 0) {
|
||||||
|
let select = ""
|
||||||
|
for (let iii=0; iii<_select.length; iii++) {
|
||||||
|
if (select.length != 0) {
|
||||||
|
select += "&";
|
||||||
|
}
|
||||||
|
select += "select=" + _select[iii];
|
||||||
|
}
|
||||||
|
url += "?" + select;
|
||||||
|
}
|
||||||
|
//console.log("call GET " + url);
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.get(url, httpOption, {})
|
||||||
|
.then(function(response: any) {
|
||||||
|
//console.log("URL: " + url + "\nRespond(" + response.status + "): " + JSON.stringify(response.data, null, 2));
|
||||||
|
if (response.status == 200) {
|
||||||
|
resolve(response.data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
reject("An error occured");
|
||||||
|
}, function(response: any) {
|
||||||
|
if (typeof response.data === 'undefined') {
|
||||||
|
reject("return ERROR undefined");
|
||||||
|
} else {
|
||||||
|
reject("return ERROR " + JSON.stringify(response.data, null, 2));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// Complex wrapper to simplify interaction:
|
||||||
|
delete_specific(_base:string, _id:number, _subElement:string = ""):any {
|
||||||
|
//console.log("delete data to " + _base);
|
||||||
|
const httpOption = { 'Content-Type': 'application/json' };
|
||||||
|
let url = _base;
|
||||||
|
if (_id != null) {
|
||||||
|
url += "/" + _id;
|
||||||
|
}
|
||||||
|
if (_subElement != "") {
|
||||||
|
url += "/" + _subElement;
|
||||||
|
}
|
||||||
|
//console.log("call DELETE: " + url);
|
||||||
|
//console.log(" data: " + JSON.stringify(_data, null, 2));
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.delete(url, httpOption)
|
||||||
|
.then(function(response: any) {
|
||||||
|
//console.log("URL: " + url + "\nRespond(" + response.status + "): " + JSON.stringify(response.data, null, 2));
|
||||||
|
if (response.status == 200) {
|
||||||
|
resolve(response.data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (response.status == 201) {
|
||||||
|
resolve(response.data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
reject("An error occured");
|
||||||
|
}, function(response: any) {
|
||||||
|
if (typeof response.data === 'undefined') {
|
||||||
|
reject("return ERROR undefined");
|
||||||
|
} else {
|
||||||
|
reject("return ERROR " + JSON.stringify(response.data, null, 2));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
// Complex wrapper to simplify interaction:
|
||||||
|
put_specific(_base:string, _id:number, _data:any, _subElement:string = ""):any {
|
||||||
|
//console.log("put data to " + _base);
|
||||||
|
const httpOption = { 'Content-Type': 'application/json' };
|
||||||
|
let url = _base;
|
||||||
|
if (_id != null) {
|
||||||
|
url += "/" + _id;
|
||||||
|
}
|
||||||
|
if (_subElement != "") {
|
||||||
|
url += "/" + _subElement;
|
||||||
|
}
|
||||||
|
//console.log("call PUT: " + url);
|
||||||
|
//console.log(" data: " + JSON.stringify(_data, null, 2));
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.put(url, httpOption, _data)
|
||||||
|
.then(function(response: any) {
|
||||||
|
//console.log("URL: " + url + "\nRespond(" + response.status + "): " + JSON.stringify(response.data, null, 2));
|
||||||
|
if (response.status == 200) {
|
||||||
|
resolve(response.data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (response.status == 201) {
|
||||||
|
resolve(response.data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
reject("An error occured");
|
||||||
|
}, function(response: any) {
|
||||||
|
if (typeof response.data === 'undefined') {
|
||||||
|
reject("return ERROR undefined");
|
||||||
|
} else {
|
||||||
|
reject("return ERROR " + JSON.stringify(response.data, null, 2));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
// Complex wrapper to simplify interaction:
|
||||||
|
post_specific(_base:string, _id:number, _data:any, _subElement:string = ""):any {
|
||||||
|
//console.log("put data to " + _base);
|
||||||
|
const httpOption = { 'Content-Type': 'application/json' };
|
||||||
|
let url = _base;
|
||||||
|
if (_id != null) {
|
||||||
|
url += "/" + _id;
|
||||||
|
}
|
||||||
|
if (_subElement != "") {
|
||||||
|
url += "/" + _subElement;
|
||||||
|
}
|
||||||
|
//console.log("call PUT: " + url);
|
||||||
|
//console.log(" data: " + JSON.stringify(_data, null, 2));
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.post(url, httpOption, _data)
|
||||||
|
.then(function(response: any) {
|
||||||
|
//console.log("URL: " + url + "\nRespond(" + response.status + "): " + JSON.stringify(response.data, null, 2));
|
||||||
|
if (response.status == 200) {
|
||||||
|
resolve(response.data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (response.status == 201) {
|
||||||
|
resolve(response.data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
reject("An error occured");
|
||||||
|
}, function(response: any) {
|
||||||
|
if (typeof response.data === 'undefined') {
|
||||||
|
reject("return ERROR undefined");
|
||||||
|
} else {
|
||||||
|
reject("return ERROR " + JSON.stringify(response.data, null, 2));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
@ -5,11 +5,13 @@ import { catchError, map, tap } from 'rxjs/operators';
|
|||||||
import {Observable} from "rxjs";
|
import {Observable} from "rxjs";
|
||||||
|
|
||||||
import { environment } from 'environments/environment';
|
import { environment } from 'environments/environment';
|
||||||
|
import { SessionService } from 'app/service/session';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class HttpWrapperService {
|
export class HttpWrapperService {
|
||||||
private displayReturn:boolean = false;
|
private displayReturn:boolean = false;
|
||||||
constructor(private http: HttpClient) {
|
constructor(private http: HttpClient,
|
||||||
|
private session: SessionService) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +36,17 @@ export class HttpWrapperService {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addTokenIfNeeded(_headerOption:any): any {
|
||||||
|
if (this.session.sessionData != null) {
|
||||||
|
if (_headerOption.authorization === undefined) {
|
||||||
|
_headerOption["authorization"] = "Yota " + this.session.sessionData.userId + ":" + this.session.sessionData.token;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _headerOption;
|
||||||
|
}
|
||||||
|
|
||||||
get(_uriRest:string, _headerOption:any, _params:any) {
|
get(_uriRest:string, _headerOption:any, _params:any) {
|
||||||
|
this.addTokenIfNeeded(_headerOption);
|
||||||
let connectionAdresse = this.createRESTCall(_uriRest, {});
|
let connectionAdresse = this.createRESTCall(_uriRest, {});
|
||||||
let config = {
|
let config = {
|
||||||
params: _params,
|
params: _params,
|
||||||
@ -71,7 +83,10 @@ export class HttpWrapperService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
post(_uriRest:string, _headerOption:any, _data:any) {
|
post(_uriRest:string, _headerOption:any, _data:any) {
|
||||||
|
this.addTokenIfNeeded(_headerOption);
|
||||||
let connectionAdresse = this.createRESTCall(_uriRest, {});
|
let connectionAdresse = this.createRESTCall(_uriRest, {});
|
||||||
|
|
||||||
|
if (false) {
|
||||||
const httpOption = {
|
const httpOption = {
|
||||||
headers: new HttpHeaders(_headerOption)
|
headers: new HttpHeaders(_headerOption)
|
||||||
};
|
};
|
||||||
@ -103,8 +118,66 @@ export class HttpWrapperService {
|
|||||||
reject({status:error.status, data:error.error});
|
reject({status:error.status, data:error.error});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
|
||||||
|
const httpOption = {
|
||||||
|
headers: new HttpHeaders(_headerOption),
|
||||||
|
reportProgress: true,
|
||||||
|
observe: 'events'
|
||||||
|
};
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (this.displayReturn == true) {
|
||||||
|
console.log("call POST " + connectionAdresse + " data=" + JSON.stringify(_data, null, 2));
|
||||||
|
}
|
||||||
|
let request = this.http.post<any>(connectionAdresse, _data, httpOption);
|
||||||
|
let self = this;
|
||||||
|
request.subscribe((res: any) => {
|
||||||
|
if (self.displayReturn == true) {
|
||||||
|
console.log("!! data " + JSON.stringify(res, null, 2));
|
||||||
|
}
|
||||||
|
if (res) {
|
||||||
|
if (res.httpCode) {
|
||||||
|
resolve({status:res.httpCode, data:res});
|
||||||
|
} else {
|
||||||
|
resolve({status:200, data:res});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resolve({status:200, data:""});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
if (self.displayReturn == true) {
|
||||||
|
console.log("an error occured status: " + error.status);
|
||||||
|
console.log("answer: " + JSON.stringify(error, null, 2));
|
||||||
|
}
|
||||||
|
reject({status:error.status, data:error.error});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
return this.http.post<any>(uploadURL, data, {
|
||||||
|
reportProgress: true,
|
||||||
|
observe: 'events'
|
||||||
|
}).pipe(map((event) => {
|
||||||
|
|
||||||
|
switch (event.type) {
|
||||||
|
|
||||||
|
case HttpEventType.UploadProgress:
|
||||||
|
const progress = Math.round(100 * event.loaded / event.total);
|
||||||
|
return { status: 'progress', message: progress };
|
||||||
|
|
||||||
|
case HttpEventType.Response:
|
||||||
|
return event.body;
|
||||||
|
default:
|
||||||
|
return `Unhandled event: ${event.type}`;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
put(_uriRest:string, _headerOption:any, _data:any) {
|
put(_uriRest:string, _headerOption:any, _data:any) {
|
||||||
|
this.addTokenIfNeeded(_headerOption);
|
||||||
let connectionAdresse = this.createRESTCall(_uriRest, {});
|
let connectionAdresse = this.createRESTCall(_uriRest, {});
|
||||||
const httpOption = {
|
const httpOption = {
|
||||||
headers: new HttpHeaders(_headerOption)
|
headers: new HttpHeaders(_headerOption)
|
||||||
@ -139,6 +212,7 @@ export class HttpWrapperService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
delete(_uriRest:string, _headerOption:any) {
|
delete(_uriRest:string, _headerOption:any) {
|
||||||
|
this.addTokenIfNeeded(_headerOption);
|
||||||
let connectionAdresse = this.createRESTCall(_uriRest, {});
|
let connectionAdresse = this.createRESTCall(_uriRest, {});
|
||||||
const httpOption = {
|
const httpOption = {
|
||||||
headers: new HttpHeaders(_headerOption)
|
headers: new HttpHeaders(_headerOption)
|
||||||
@ -271,7 +345,32 @@ export class HttpWrapperService {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
public upload(_base:string, _id:number, _file:File): any {
|
||||||
|
data, userId) {
|
||||||
|
}
|
||||||
|
let uploadURL = `${this.SERVER_URL}/auth/${userId}/avatar`;
|
||||||
|
|
||||||
|
return this.http.post<any>(uploadURL, data, {
|
||||||
|
reportProgress: true,
|
||||||
|
observe: 'events'
|
||||||
|
}).pipe(map((event) => {
|
||||||
|
|
||||||
|
switch (event.type) {
|
||||||
|
|
||||||
|
case HttpEventType.UploadProgress:
|
||||||
|
const progress = Math.round(100 * event.loaded / event.total);
|
||||||
|
return { status: 'progress', message: progress };
|
||||||
|
|
||||||
|
case HttpEventType.Response:
|
||||||
|
return event.body;
|
||||||
|
default:
|
||||||
|
return `Unhandled event: ${event.type}`;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
*/
|
||||||
// Complex wrapper to simplify interaction:
|
// Complex wrapper to simplify interaction:
|
||||||
get_specific(_base:string, _id:number = null, _subElement:string = "", _select:Array<string> = []):any {
|
get_specific(_base:string, _id:number = null, _subElement:string = "", _select:Array<string> = []):any {
|
||||||
console.log("Get All data from " + _base);
|
console.log("Get All data from " + _base);
|
||||||
|
@ -17,9 +17,6 @@ export class SaisonService {
|
|||||||
|
|
||||||
|
|
||||||
get(_id:number):any {
|
get(_id:number):any {
|
||||||
if (environment.localBdd != true) {
|
|
||||||
return this.http.get_specific(this.serviceName, _id);
|
|
||||||
}
|
|
||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.getSaison()
|
self.bdd.getSaison()
|
||||||
@ -36,9 +33,6 @@ export class SaisonService {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
getVideo(_id:number):any {
|
getVideo(_id:number):any {
|
||||||
if (environment.localBdd != true) {
|
|
||||||
return this.http.get_specific(this.serviceName, _id, "video");
|
|
||||||
}
|
|
||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.getVideo()
|
self.bdd.getVideo()
|
||||||
@ -52,9 +46,6 @@ export class SaisonService {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
countVideo(_id:number):any {
|
countVideo(_id:number):any {
|
||||||
if (environment.localBdd != true) {
|
|
||||||
return this.http.get_specific(this.serviceName, _id, "video");
|
|
||||||
}
|
|
||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.getVideo()
|
self.bdd.getVideo()
|
||||||
@ -69,9 +60,6 @@ export class SaisonService {
|
|||||||
};
|
};
|
||||||
put(_id:number, _data:any):any {
|
put(_id:number, _data:any):any {
|
||||||
let ret = this.http.put_specific(this.serviceName, _id, _data);
|
let ret = this.http.put_specific(this.serviceName, _id, _data);
|
||||||
if (environment.localBdd != true) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
return this.bdd.setAfterPut(this.serviceName, _id, ret);
|
return this.bdd.setAfterPut(this.serviceName, _id, ret);
|
||||||
};
|
};
|
||||||
addCover(_id:number, _coverId:number):any {
|
addCover(_id:number, _coverId:number):any {
|
||||||
|
@ -14,9 +14,9 @@ enum USER_ROLES {
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SessionService {
|
export class SessionService {
|
||||||
public id = null;
|
public sessionData = null;
|
||||||
public userId = null;
|
public userLogin = null;
|
||||||
public userRole = null;
|
public userAdmin = null;
|
||||||
public userEMail = null;
|
public userEMail = null;
|
||||||
public userAvatar = null;
|
public userAvatar = null;
|
||||||
//public tocken = null;
|
//public tocken = null;
|
||||||
@ -29,15 +29,15 @@ export class SessionService {
|
|||||||
/**
|
/**
|
||||||
* @brief Create a new session.
|
* @brief Create a new session.
|
||||||
*/
|
*/
|
||||||
create(sessionId,
|
create(sessionData,
|
||||||
userId,
|
userLogin:string,
|
||||||
userEMail:string,
|
userEMail:string,
|
||||||
userRole:string,
|
userAdmin:boolean,
|
||||||
userAvatar:string) {
|
userAvatar:string) {
|
||||||
console.log("Session Create");
|
console.log("Session Create");
|
||||||
this.id = sessionId;
|
this.sessionData = sessionData;
|
||||||
this.userId = userId;
|
this.userLogin = userLogin;
|
||||||
this.userRole = userRole;
|
this.userAdmin = userAdmin;
|
||||||
this.userEMail = userEMail;
|
this.userEMail = userEMail;
|
||||||
this.userAvatar = userAvatar;
|
this.userAvatar = userAvatar;
|
||||||
this.change.emit(true);
|
this.change.emit(true);
|
||||||
@ -49,29 +49,29 @@ export class SessionService {
|
|||||||
console.log("Session REMOVE");
|
console.log("Session REMOVE");
|
||||||
//Cookies.remove("yota-login");
|
//Cookies.remove("yota-login");
|
||||||
//Cookies.remove("yota-password");
|
//Cookies.remove("yota-password");
|
||||||
let last = this.id;
|
let last = this.sessionData;
|
||||||
this.id = null;
|
this.sessionData = null;
|
||||||
this.userId = null;
|
this.userLogin = null;
|
||||||
this.userRole = null;
|
this.userAdmin = null;
|
||||||
this.userEMail = null;
|
this.userEMail = null;
|
||||||
this.userAvatar = null;
|
this.userAvatar = null;
|
||||||
this.change.emit(false);
|
this.change.emit(false);
|
||||||
};
|
};
|
||||||
islogged() {
|
islogged() {
|
||||||
return this.id != null;
|
return this.sessionData != null;
|
||||||
}
|
}
|
||||||
hasRight(type) {
|
hasRight(type) {
|
||||||
if (type == USER_ROLES.admin) {
|
if (type == USER_ROLES.admin) {
|
||||||
return this.userRole == USER_ROLES.admin;
|
// sometime needed...
|
||||||
|
return this.userAdmin;
|
||||||
}
|
}
|
||||||
if (type == USER_ROLES.user) {
|
if (type == USER_ROLES.user) {
|
||||||
return this.userRole == USER_ROLES.admin
|
// is connected ==> is user
|
||||||
|| this.userRole == USER_ROLES.user;
|
return this.sessionData != null;
|
||||||
}
|
}
|
||||||
if (type == USER_ROLES.guest) {
|
if (type == USER_ROLES.guest) {
|
||||||
return this.userRole == USER_ROLES.admin
|
// TODO all the other ... maybe unneeded
|
||||||
|| this.userRole == USER_ROLES.user
|
return true;
|
||||||
|| this.userRole == USER_ROLES.guest;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ export class SessionService {
|
|||||||
return !this.hasRight(type);
|
return !this.hasRight(type);
|
||||||
}
|
}
|
||||||
getLogin() {
|
getLogin() {
|
||||||
return this.userId;
|
return this.userLogin;
|
||||||
}
|
}
|
||||||
getAvatar() {
|
getAvatar() {
|
||||||
if (this.userAvatar == "") {
|
if (this.userAvatar == "") {
|
||||||
|
@ -30,9 +30,6 @@ export class TypeService {
|
|||||||
|
|
||||||
|
|
||||||
getData():any {
|
getData():any {
|
||||||
if (environment.localBdd != true) {
|
|
||||||
return this.http.get_specific(this.serviceName);
|
|
||||||
}
|
|
||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.getType()
|
self.bdd.getType()
|
||||||
@ -47,9 +44,6 @@ export class TypeService {
|
|||||||
};
|
};
|
||||||
|
|
||||||
get(_id:number):any {
|
get(_id:number):any {
|
||||||
if (environment.localBdd != true) {
|
|
||||||
return this.http.get_specific(this.serviceName, _id);
|
|
||||||
}
|
|
||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.getType()
|
self.bdd.getType()
|
||||||
@ -67,9 +61,6 @@ export class TypeService {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getSubVideo(_id:number, _select:Array<string> = []):any {
|
getSubVideo(_id:number, _select:Array<string> = []):any {
|
||||||
if (environment.localBdd != true) {
|
|
||||||
return this.http.get_specific(this.serviceName, _id, "video", _select);
|
|
||||||
}
|
|
||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.getVideo()
|
self.bdd.getVideo()
|
||||||
@ -94,9 +85,6 @@ export class TypeService {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getSubGroup(_id:number, _select:Array<string> = []):any {
|
getSubGroup(_id:number, _select:Array<string> = []):any {
|
||||||
if (environment.localBdd != true) {
|
|
||||||
return this.http.get_specific(this.serviceName, _id, "group", _select);
|
|
||||||
}
|
|
||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.getVideo()
|
self.bdd.getVideo()
|
||||||
@ -126,9 +114,6 @@ export class TypeService {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getSubUnivers(_id:number, _select:Array<string> = []):any {
|
getSubUnivers(_id:number, _select:Array<string> = []):any {
|
||||||
if (environment.localBdd != true) {
|
|
||||||
return this.http.get_specific(this.serviceName, _id, "univers", _select);
|
|
||||||
}
|
|
||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.getVideo()
|
self.bdd.getVideo()
|
||||||
|
@ -17,9 +17,6 @@ export class UniversService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getData():any {
|
getData():any {
|
||||||
if (environment.localBdd != true) {
|
|
||||||
return this.http.get_specific(this.serviceName);
|
|
||||||
}
|
|
||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.getUnivers()
|
self.bdd.getUnivers()
|
||||||
@ -33,9 +30,6 @@ export class UniversService {
|
|||||||
};
|
};
|
||||||
|
|
||||||
get(_id:number):any {
|
get(_id:number):any {
|
||||||
if (environment.localBdd != true) {
|
|
||||||
return this.http.get_specific(this.serviceName, _id);
|
|
||||||
}
|
|
||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.getUnivers()
|
self.bdd.getUnivers()
|
||||||
@ -53,24 +47,15 @@ export class UniversService {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getSubGroup(_id:number, _select:Array<string> = []):any {
|
getSubGroup(_id:number, _select:Array<string> = []):any {
|
||||||
if (environment.localBdd != true) {
|
|
||||||
return this.http.get_specific(this.serviceName, _id, "group", _select);
|
|
||||||
}
|
|
||||||
//this.checkLocalBdd();
|
//this.checkLocalBdd();
|
||||||
};
|
};
|
||||||
|
|
||||||
getSubVideo(_id:number, _select:Array<string> = []):any {
|
getSubVideo(_id:number, _select:Array<string> = []):any {
|
||||||
if (environment.localBdd != true) {
|
|
||||||
return this.http.get_specific(this.serviceName, _id, "video", _select);
|
|
||||||
}
|
|
||||||
//this.checkLocalBdd();
|
//this.checkLocalBdd();
|
||||||
};
|
};
|
||||||
|
|
||||||
put(_id:number, _data:any):any {
|
put(_id:number, _data:any):any {
|
||||||
let ret = this.http.put_specific(this.serviceName, _id, _data);
|
let ret = this.http.put_specific(this.serviceName, _id, _data);
|
||||||
if (environment.localBdd != true) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
return this.bdd.setAfterPut(this.serviceName, _id, ret);
|
return this.bdd.setAfterPut(this.serviceName, _id, ret);
|
||||||
};
|
};
|
||||||
addCover(_id:number, _coverId:number):any {
|
addCover(_id:number, _coverId:number):any {
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
import { HttpOAuthWrapperService } from 'app/service/http-oauth-wrapper';
|
||||||
import { HttpWrapperService } from 'app/service/http-wrapper';
|
import { HttpWrapperService } from 'app/service/http-wrapper';
|
||||||
//import { SHA512 } from 'assets/js_3rd_party/sha512';
|
//import { SHA512 } from 'assets/js_3rd_party/sha512';
|
||||||
|
|
||||||
interface MessageLogIn {
|
interface MessageLogIn {
|
||||||
login: string;
|
login: string;
|
||||||
methode: string;
|
method: string;
|
||||||
time: number;
|
time: number;
|
||||||
password: string;
|
password: string;
|
||||||
};
|
};
|
||||||
@ -25,43 +26,69 @@ export class UserService {
|
|||||||
// 0: Not hide password; 1 hide password;
|
// 0: Not hide password; 1 hide password;
|
||||||
private identificationVersion: number = 1;
|
private identificationVersion: number = 1;
|
||||||
|
|
||||||
constructor(private http: HttpWrapperService) {
|
constructor(private httpOAuth: HttpOAuthWrapperService,
|
||||||
|
private http: HttpWrapperService) {
|
||||||
console.log("Start UserService");
|
console.log("Start UserService");
|
||||||
}
|
}
|
||||||
|
|
||||||
login(_login: string, _password: string):any {
|
login(_login: string, _password: string):any {
|
||||||
return this.loginSha(_login, SHA512(_password));
|
return this.loginSha(_login, SHA512(_password));
|
||||||
}
|
}
|
||||||
|
loginSha(_login: string, _password: string):any {
|
||||||
|
let self = this;
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
self.getTocken(_login, _password).then(
|
||||||
|
function(value) {
|
||||||
|
console.log("Get token ...");
|
||||||
|
self.loginWithToken(value['userId'], value['token']).then(
|
||||||
|
function(value2) {
|
||||||
|
// transfer the session token property
|
||||||
|
value2["session"] = {
|
||||||
|
userId: value['userId'],
|
||||||
|
token: value['token'],
|
||||||
|
endValidityTime: value['endValidityTime']
|
||||||
|
};
|
||||||
|
resolve(value2);
|
||||||
|
}, function(value2) {
|
||||||
|
reject("sdfsdfsdf");
|
||||||
|
});
|
||||||
|
}, function(value) {
|
||||||
|
console.log("User NOT created");
|
||||||
|
reject("rrfrrrrr");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
loginSha(_login : string, _password : string) {
|
getTocken(_login : string, _password : string) {
|
||||||
console.log("AuthService.login ... '" + _login + "':'" + _password + "'");
|
console.log("AuthService.getToken ... '" + _login + "':'" + _password + "'");
|
||||||
let currentDate:number = dateFormat(new Date(), 'm-d-Y h:i:s ms');
|
let currentDate:number = dateFormat(new Date(), 'm-d-Y h:i:s ms');
|
||||||
let data:MessageLogIn;
|
let data:MessageLogIn;
|
||||||
// create request:
|
// create request:
|
||||||
if (this.identificationVersion == 0) {
|
if (this.identificationVersion == 1) {
|
||||||
data = {
|
data = {
|
||||||
login: _login,
|
login: _login,
|
||||||
methode: "v0",
|
method: "v1",
|
||||||
time: currentDate,
|
|
||||||
password: _password
|
|
||||||
};
|
|
||||||
} else if (this.identificationVersion == 1) {
|
|
||||||
data = {
|
|
||||||
login: _login,
|
|
||||||
methode: "v1",
|
|
||||||
time: currentDate,
|
time: currentDate,
|
||||||
// we mix the password to be sure that it can not be used an other time ...
|
// we mix the password to be sure that it can not be used an other time ...
|
||||||
password: SHA512("login='" + _login + "';pass='" + _password + "';date='" + currentDate + "'")
|
password: SHA512("login='" + _login + "';pass='" + _password + "';date='" + currentDate + "'")
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
console.log("AuthService.login ... Wrong method ...");
|
||||||
}
|
}
|
||||||
|
|
||||||
const httpOption = { 'Content-Type': 'application/json' };
|
const httpOption = { 'Content-Type': 'application/json' };
|
||||||
console.log("call users/connect data=" + JSON.stringify(data, null, 2));
|
console.log("call users/connect data=" + JSON.stringify(data, null, 2));
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.http.post("rest-auth/login", httpOption, data)
|
this.httpOAuth.post("users/get_token", httpOption, data)
|
||||||
.then(function(response: any) {
|
.then(function(response: any) {
|
||||||
if (response.status == 200) {
|
console.log("response status=" + response.status);
|
||||||
|
if (response.status >= 200 && response.status <= 299) {
|
||||||
|
console.log("Data token: id=" + response.data['id']);
|
||||||
|
console.log("Data token: userId=" + response.data['userId']);
|
||||||
|
console.log("Data token: token=" + response.data['token']);
|
||||||
|
console.log("Data token: createTime=" + response.data['createTime']);
|
||||||
|
console.log("Data token: endValidityTime=" + response.data['endValidityTime']);
|
||||||
resolve(response.data);
|
resolve(response.data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -76,13 +103,72 @@ export class UserService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
loginWithToken(_user_id : string, _token : string) {
|
||||||
|
console.log("AuthService.loginWithToken ... '" + _user_id + "':'" + _token + "'");
|
||||||
|
let headers = {
|
||||||
|
authorization: "Yota " + _user_id + ":" + _token
|
||||||
|
};
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.http.get("users/me", headers, {})
|
||||||
|
.then(function(response: any) {
|
||||||
|
if (response.status == 200) {
|
||||||
|
resolve(response.data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
reject("An error occured");
|
||||||
|
}, function(response: any) {
|
||||||
|
if (typeof response.data === 'undefined') {
|
||||||
|
reject("return ERROR undefined");
|
||||||
|
} else {
|
||||||
|
reject("return ERROR " + JSON.stringify(response.data, null, 2));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
/*
|
||||||
|
console.log("AuthService.login ... '" + _login + "':'" + _password + "'");
|
||||||
|
let currentDate:number = dateFormat(new Date(), 'm-d-Y h:i:s ms');
|
||||||
|
let data:MessageLogIn;
|
||||||
|
// create request:
|
||||||
|
if (this.identificationVersion == 1) {
|
||||||
|
data = {
|
||||||
|
login: _login,
|
||||||
|
method: "v1",
|
||||||
|
time: currentDate,
|
||||||
|
// we mix the password to be sure that it can not be used an other time ...
|
||||||
|
password: SHA512("login='" + _login + "';pass='" + _password + "';date='" + currentDate + "'")
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
console.log("AuthService.login ... Wrong method ...");
|
||||||
|
}
|
||||||
|
|
||||||
|
const httpOption = { 'Content-Type': 'application/json' };
|
||||||
|
console.log("call users/connect data=" + JSON.stringify(data, null, 2));
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.httpOAuth.post("users/connect", httpOption, data)
|
||||||
|
.then(function(response: any) {
|
||||||
|
if (response.status == 200) {
|
||||||
|
resolve(response.data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
reject("An error occured");
|
||||||
|
}, function(response: any) {
|
||||||
|
if (typeof response.data === 'undefined') {
|
||||||
|
reject("return ERROR undefined");
|
||||||
|
} else {
|
||||||
|
reject("return ERROR " + JSON.stringify(response.data, null, 2));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
};
|
||||||
|
|
||||||
create(_login : string, _email : string, _password : string) {
|
create(_login : string, _email : string, _password : string) {
|
||||||
return this.createSha(_login, _email, SHA512(_password));
|
return this.createSha(_login, _email, SHA512(_password));
|
||||||
}
|
}
|
||||||
createSha(_login : string, _email : string, _password : string, ) {
|
createSha(_login : string, _email : string, _password : string, ) {
|
||||||
let data = {
|
let data = {
|
||||||
"methode": "v?",
|
"method": "v?",
|
||||||
"login": _login,
|
"login": _login,
|
||||||
"email": _email,
|
"email": _email,
|
||||||
"password": _password
|
"password": _password
|
||||||
@ -90,14 +176,12 @@ export class UserService {
|
|||||||
const httpOption = { 'Content-Type': 'application/json' };
|
const httpOption = { 'Content-Type': 'application/json' };
|
||||||
console.log("call users data=" + JSON.stringify(data, null, 2));
|
console.log("call users data=" + JSON.stringify(data, null, 2));
|
||||||
|
|
||||||
if (this.identificationVersion == 0) {
|
if (this.identificationVersion == 1) {
|
||||||
data["methode"] = "v0"
|
|
||||||
} else if (this.identificationVersion == 1) {
|
|
||||||
data["methode"] = "v1"
|
data["methode"] = "v1"
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.http.post("users", httpOption, data)
|
this.httpOAuth.post("users", httpOption, data)
|
||||||
.then(function(response: any) {
|
.then(function(response: any) {
|
||||||
if (response.status == 200) {
|
if (response.status == 200) {
|
||||||
resolve(response.data)
|
resolve(response.data)
|
||||||
@ -134,7 +218,7 @@ export class UserService {
|
|||||||
login: _login
|
login: _login
|
||||||
};
|
};
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.http.get("users/check_login", {}, params).then(
|
this.httpOAuth.get("users/check_login", {}, params).then(
|
||||||
(res: Response) => {
|
(res: Response) => {
|
||||||
resolve()
|
resolve()
|
||||||
},
|
},
|
||||||
@ -149,7 +233,7 @@ export class UserService {
|
|||||||
"email": _email
|
"email": _email
|
||||||
};
|
};
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.http.get("users/check_email", {}, params).then(
|
this.httpOAuth.get("users/check_email", {}, params).then(
|
||||||
(res: Response) => {
|
(res: Response) => {
|
||||||
resolve()
|
resolve()
|
||||||
},
|
},
|
||||||
|
@ -18,9 +18,6 @@ export class VideoService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get(_id:number):any {
|
get(_id:number):any {
|
||||||
if (environment.localBdd != true) {
|
|
||||||
return this.http.get_specific(this.serviceName, _id);
|
|
||||||
}
|
|
||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.get(this.serviceName)
|
self.bdd.get(this.serviceName)
|
||||||
|
@ -7,9 +7,9 @@ export const environment = {
|
|||||||
production: false,
|
production: false,
|
||||||
// URL of development API
|
// URL of development API
|
||||||
//apiUrl: 'http://localhost:15080',
|
//apiUrl: 'http://localhost:15080',
|
||||||
apiUrl: 'http://192.168.1.156/karideo/api',
|
apiUrl: 'http://localhost:18080/karideo/api',
|
||||||
|
apiOAuthUrl: 'http://localhost:17080/oauth/api',
|
||||||
frontBaseUrl: '',
|
frontBaseUrl: '',
|
||||||
//apiMode: "QUERRY"
|
//apiMode: "QUERRY"
|
||||||
apiMode: "REWRITE",
|
apiMode: "REWRITE"
|
||||||
localBdd: true
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user