From f223b760fff0cfc769396891f5528fc97b55099d Mon Sep 17 00:00:00 2001 From: Baptiste Lemoine Date: Tue, 3 Dec 2019 17:20:57 +0100 Subject: [PATCH 01/15] :zap: start backend calls --- package.json | 2 + src/app/app.module.ts | 2 + src/app/config.service.ts | 37 ----- src/app/debugger/debugger.component.ts | 2 +- src/app/pages/admin/admin.component.ts | 2 +- src/app/pages/answers/answers.component.ts | 2 +- src/app/pages/base-page/base.component.ts | 2 +- .../create-or-retrieve.component.ts | 10 +- src/app/pages/dates/dates.component.ts | 2 +- .../end-confirmation.component.ts | 2 +- src/app/pages/home/home.component.ts | 2 +- src/app/pages/kind/kind.component.ts | 2 +- src/app/pages/password/password.component.ts | 2 +- src/app/pages/pictures/pictures.component.ts | 2 +- src/app/pages/resume/resume.component.ts | 2 +- .../pages/visibility/visibility.component.ts | 2 +- .../voting-choice/voting-choice.component.ts | 2 +- .../voting-graph/voting-graph.component.ts | 2 +- .../voting-summary.component.ts | 2 +- src/app/services/config.service.ts | 142 ++++++++++++++++++ src/app/services/poll-service.service.spec.ts | 4 +- src/app/services/poll-service.service.ts | 32 ---- src/app/services/poll.service.ts | 24 +++ .../progression.service.spec.ts | 0 src/app/ui/navigation/navigation.component.ts | 2 +- src/environments/environment.ts | 2 +- yarn.lock | 10 ++ 27 files changed, 205 insertions(+), 92 deletions(-) delete mode 100644 src/app/config.service.ts create mode 100644 src/app/services/config.service.ts delete mode 100644 src/app/services/poll-service.service.ts create mode 100644 src/app/services/poll.service.ts rename src/app/{ => services}/progression.service.spec.ts (100%) diff --git a/package.json b/package.json index 5cb7f424..6301943b 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,9 @@ "@ngx-translate/http-loader": "^4.0.0", "chart.js": "^2.8.0", "ngx-markdown": "^8.2.1", + "ngx-toaster": "^1.0.1", "rxjs": "~6.4.0", + "rxjs-compat": "^6.5.3", "tslib": "^1.10.0", "zone.js": "~0.9.1" }, diff --git a/src/app/app.module.ts b/src/app/app.module.ts index d448b962..1c51d044 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -41,6 +41,7 @@ import {PollGraphicComponent} from './poll-graphic/poll-graphic.component'; import {AdminComponent} from './pages/admin/admin.component'; import {SelectorComponent} from './ui/selector/selector.component'; +import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; export class MyMissingTranslationHandler implements MissingTranslationHandler { handle(params: MissingTranslationHandlerParams) { @@ -84,6 +85,7 @@ export function HttpLoaderFactory(http: HttpClient) { imports: [ CommonModule, BrowserModule, + BrowserAnimationsModule, AppRoutingModule, MarkdownModule.forRoot(), TranslateModule.forRoot({ diff --git a/src/app/config.service.ts b/src/app/config.service.ts deleted file mode 100644 index 39d1dcaf..00000000 --- a/src/app/config.service.ts +++ /dev/null @@ -1,37 +0,0 @@ -import {Injectable} from '@angular/core'; -import {PollConfig} from './config/PollConfig'; -import {HttpClient} from "@angular/common/http"; -import {environment} from "../environments/environment"; - - -/** - * le service transverse à chaque page qui permet de syncroniser la configuration de sondage souhaitée - */ -@Injectable({ - providedIn: 'root' -}) -export class ConfigService extends PollConfig { - myEmail: string; - myPolls: any;// list of retrieved polls from the backend api - - - constructor(public http: HttpClient) { - super(); - } - - set(key, val) { - this[key] = val; - } - - createPoll() { - // todo - console.log('sends the form'); - alert('envoi de formulaire pour création de sondage en XHR à faire'); - const payload = this; - this.http.post(`${environment.baseApiHref}/poll`, payload) - .subscribe(res => { - console.log('res', res) - }, - err => console.error('err', err)) - } -} diff --git a/src/app/debugger/debugger.component.ts b/src/app/debugger/debugger.component.ts index 6b08ea6b..2dac8523 100644 --- a/src/app/debugger/debugger.component.ts +++ b/src/app/debugger/debugger.component.ts @@ -1,5 +1,5 @@ import {Component, OnInit} from '@angular/core'; -import {ConfigService} from '../config.service'; +import {ConfigService} from '../services/config.service'; @Component({ selector: 'framadate-debugger', diff --git a/src/app/pages/admin/admin.component.ts b/src/app/pages/admin/admin.component.ts index 13ec96e6..316fac84 100644 --- a/src/app/pages/admin/admin.component.ts +++ b/src/app/pages/admin/admin.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import {BaseComponent} from '../base-page/base.component'; -import {ConfigService} from '../../config.service'; +import {ConfigService} from '../../services/config.service'; @Component({ selector: 'framadate-admin', templateUrl: './admin.component.html', diff --git a/src/app/pages/answers/answers.component.ts b/src/app/pages/answers/answers.component.ts index cf8b169a..1b5906fd 100644 --- a/src/app/pages/answers/answers.component.ts +++ b/src/app/pages/answers/answers.component.ts @@ -1,6 +1,6 @@ import {AfterViewInit, ChangeDetectorRef, Component, Inject, OnInit} from '@angular/core'; import {BaseComponent} from '../base-page/base.component'; -import {ConfigService} from '../../config.service'; +import {ConfigService} from '../../services/config.service'; import {DOCUMENT} from '@angular/common'; diff --git a/src/app/pages/base-page/base.component.ts b/src/app/pages/base-page/base.component.ts index 660f90b9..4dd4c6a7 100644 --- a/src/app/pages/base-page/base.component.ts +++ b/src/app/pages/base-page/base.component.ts @@ -1,5 +1,5 @@ import {Component, OnInit} from '@angular/core'; -import {ConfigService} from '../../config.service'; +import {ConfigService} from '../../services/config.service'; @Component({ selector: 'framadate-base-page', diff --git a/src/app/pages/create-or-retrieve/create-or-retrieve.component.ts b/src/app/pages/create-or-retrieve/create-or-retrieve.component.ts index 12ee44f1..00536fbf 100644 --- a/src/app/pages/create-or-retrieve/create-or-retrieve.component.ts +++ b/src/app/pages/create-or-retrieve/create-or-retrieve.component.ts @@ -1,7 +1,7 @@ import {Component, OnInit} from '@angular/core'; import {BaseComponent} from "../base-page/base.component"; -import {ConfigService} from "../../config.service"; -import {PollServiceService} from "../../services/poll-service.service"; +import {ConfigService} from "../../services/config.service"; +import {PollService} from "../../services/poll.service"; @Component({ selector: 'framadate-create-or-retrieve', @@ -10,15 +10,17 @@ import {PollServiceService} from "../../services/poll-service.service"; }) export class CreateOrRetrieveComponent extends BaseComponent implements OnInit { - constructor(public config: ConfigService, public pollService: PollServiceService) { + constructor(public config: ConfigService, + public pollService: PollService) { super(config); } ngOnInit() { + this.findMyPollsByEmail('tktest@tktest.com') } findMyPollsByEmail(email: string) { - this.pollService.findPollsByEmail(email); + this.config.findPollsByEmail(email); } } diff --git a/src/app/pages/dates/dates.component.ts b/src/app/pages/dates/dates.component.ts index 7e0d8f6a..b75b7a35 100644 --- a/src/app/pages/dates/dates.component.ts +++ b/src/app/pages/dates/dates.component.ts @@ -1,5 +1,5 @@ import {ChangeDetectorRef, Component, Inject, OnInit} from '@angular/core'; -import {ConfigService} from '../../config.service'; +import {ConfigService} from '../../services/config.service'; import {BaseComponent} from '../base-page/base.component'; import {DOCUMENT} from '@angular/common'; diff --git a/src/app/pages/end-confirmation/end-confirmation.component.ts b/src/app/pages/end-confirmation/end-confirmation.component.ts index 2d0752b5..3c16cbd7 100644 --- a/src/app/pages/end-confirmation/end-confirmation.component.ts +++ b/src/app/pages/end-confirmation/end-confirmation.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import {BaseComponent} from "../base-page/base.component"; -import {ConfigService} from "../../config.service"; +import {ConfigService} from "../../services/config.service"; @Component({ selector: 'framadate-end-confirmation', diff --git a/src/app/pages/home/home.component.ts b/src/app/pages/home/home.component.ts index 597b65bb..2397d5f5 100644 --- a/src/app/pages/home/home.component.ts +++ b/src/app/pages/home/home.component.ts @@ -1,5 +1,5 @@ import {Component, OnInit} from '@angular/core'; -import {ConfigService} from "../../config.service"; +import {ConfigService} from "../../services/config.service"; import {BaseComponent} from "../base-page/base.component"; @Component({ diff --git a/src/app/pages/kind/kind.component.ts b/src/app/pages/kind/kind.component.ts index 2724c701..52a03bb5 100644 --- a/src/app/pages/kind/kind.component.ts +++ b/src/app/pages/kind/kind.component.ts @@ -1,6 +1,6 @@ import {Component, OnInit} from '@angular/core'; import {BaseComponent} from '../base-page/base.component'; -import {ConfigService} from '../../config.service'; +import {ConfigService} from '../../services/config.service'; @Component({ selector: 'framadate-page-kind', diff --git a/src/app/pages/password/password.component.ts b/src/app/pages/password/password.component.ts index 4bbb1ef1..f6947854 100644 --- a/src/app/pages/password/password.component.ts +++ b/src/app/pages/password/password.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import {BaseComponent} from "../base-page/base.component"; -import {ConfigService} from "../../config.service"; +import {ConfigService} from "../../services/config.service"; @Component({ selector: 'framadate-password', diff --git a/src/app/pages/pictures/pictures.component.ts b/src/app/pages/pictures/pictures.component.ts index 624e95a2..ee04cf1f 100644 --- a/src/app/pages/pictures/pictures.component.ts +++ b/src/app/pages/pictures/pictures.component.ts @@ -1,5 +1,5 @@ import {Component, OnInit} from '@angular/core'; -import {ConfigService} from '../../config.service'; +import {ConfigService} from '../../services/config.service'; import {BaseComponent} from '../base-page/base.component'; @Component({ diff --git a/src/app/pages/resume/resume.component.ts b/src/app/pages/resume/resume.component.ts index 027fe685..aad88b0e 100644 --- a/src/app/pages/resume/resume.component.ts +++ b/src/app/pages/resume/resume.component.ts @@ -1,6 +1,6 @@ import {Component, OnInit} from '@angular/core'; import {BaseComponent} from '../base-page/base.component'; -import {ConfigService} from '../../config.service'; +import {ConfigService} from '../../services/config.service'; @Component({ selector: 'framadate-resume', diff --git a/src/app/pages/visibility/visibility.component.ts b/src/app/pages/visibility/visibility.component.ts index 6dd86867..cfa20022 100644 --- a/src/app/pages/visibility/visibility.component.ts +++ b/src/app/pages/visibility/visibility.component.ts @@ -1,6 +1,6 @@ import {Component, OnInit} from '@angular/core'; import {BaseComponent} from '../base-page/base.component'; -import {ConfigService} from '../../config.service'; +import {ConfigService} from '../../services/config.service'; @Component({ selector: 'framadate-visibility', diff --git a/src/app/pages/voting-choice/voting-choice.component.ts b/src/app/pages/voting-choice/voting-choice.component.ts index 898f8eac..a1bc67f3 100644 --- a/src/app/pages/voting-choice/voting-choice.component.ts +++ b/src/app/pages/voting-choice/voting-choice.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import {BaseComponent} from "../base-page/base.component"; -import {ConfigService} from "../../config.service"; +import {ConfigService} from "../../services/config.service"; @Component({ selector: 'framadate-voting-choice', diff --git a/src/app/pages/voting-graph/voting-graph.component.ts b/src/app/pages/voting-graph/voting-graph.component.ts index 725bd1f1..fb2ae6f1 100644 --- a/src/app/pages/voting-graph/voting-graph.component.ts +++ b/src/app/pages/voting-graph/voting-graph.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import {BaseComponent} from "../base-page/base.component"; -import {ConfigService} from "../../config.service"; +import {ConfigService} from "../../services/config.service"; @Component({ selector: 'framadate-voting-graph', diff --git a/src/app/pages/voting-summary/voting-summary.component.ts b/src/app/pages/voting-summary/voting-summary.component.ts index 7c10d7ad..09b4435f 100644 --- a/src/app/pages/voting-summary/voting-summary.component.ts +++ b/src/app/pages/voting-summary/voting-summary.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import {BaseComponent} from "../base-page/base.component"; -import {ConfigService} from "../../config.service"; +import {ConfigService} from "../../services/config.service"; @Component({ selector: 'framadate-voting-summary', diff --git a/src/app/services/config.service.ts b/src/app/services/config.service.ts new file mode 100644 index 00000000..be6d0fcc --- /dev/null +++ b/src/app/services/config.service.ts @@ -0,0 +1,142 @@ +import {Injectable} from '@angular/core'; +import {PollConfig} from '../config/PollConfig'; +import {HttpClient, HttpHeaders} from "@angular/common/http"; +import {environment} from "../../environments/environment"; + + +/** + * le service transverse à chaque page qui permet de syncroniser la configuration de sondage souhaitée + */ +@Injectable({ + providedIn: 'root' +}) +export class ConfigService extends PollConfig { + myEmail: string; + baseHref: any = environment.baseApiHref; + myPolls: any;// list of retrieved polls from the backend api + + + constructor(public http: HttpClient) { + super(); + } + + set(key, val) { + this[key] = val; + } + + createPoll() { + console.log('sends the form'); + // alert('envoi de formulaire pour création de sondage en XHR à faire'); + this.http.get(`${this.baseHref}/`) + .subscribe((res) => { + console.log('res', res); + this.createPollFromConfig(this.getPollConfig()) + }, + this.handleError + ) + ; + + } + + createPollFromConfig(config: any) { + this.http.post(`${this.baseHref}/poll`, config) + .subscribe((res: any) => { + // redirect to the page to administrate the new poll + alert("succès!"); + this.myPolls = res; + }, this.handleError + ); + } + + findPollsByEmail(email: string) { + + + this.findLocalStorageData(); + // If no key is found in the localstorage, ask the backend to send an email to the user + + this.myEmail = email; + const headers = new HttpHeaders('Content-Type:application/json'); + const headerDict = { + 'Content-Type': 'application/json', + 'Accept': 'application/json', + }; + + const requestOptions = { + headers: new HttpHeaders(headerDict), + }; + + this.http.get(`${this.baseHref}/my-polls`) + .subscribe(res => { + // message: 'Trouvé! Allez voir votre boite email', + this.myPolls = res; + }, this.handleError + ) + } + + getPollConfig() { + const jsonConfig = { + method: 'POST', + data: { + + owner: { + email: this.myEmail, + pseudo: this.myName, + }, + title: this.title, + description: this.description, + type: this.pollType, + visibility: this.visibility, + voteChoices: this.voteChoices, + allowSeveralHours: this.allowSeveralHours, + expirationDate: this.expirationDate, + passwordAccess: this.passwordAccess, + password: this.password, + customUrl: this.customUrl, + canModifyAnswers: this.canModifyAnswers, + whoModifiesAnswers: this.whoModifiesAnswers, + dateList: this.dateList, + timeList: this.timeList, + answers: this.answers, + } + }; + console.log('jsonConfig', jsonConfig); + return jsonConfig + } + + handleError(err: any) { + console.error('err', err) + } + + + findLocalStorageData() { + // TODO check if the person has a key to retrieve her polls + + } + + + /** + * + * @param url + */ + getPollByURL(url: string) { + this.http.get(`${this.baseHref}/poll/${url}`).subscribe( + (res: any) => { + this.myPolls = res.data; + }, this.handleError + ); + } + + /** + * + * @param id + */ + getPollById(id: string) { + // http://127.0.0.1:8000/api/v1/poll/1 + this.http.get(`${this.baseHref}/poll/${id}`).subscribe( + (res: any) => { + this.myPolls = res.data; + }, this.handleError + ); + } + +} diff --git a/src/app/services/poll-service.service.spec.ts b/src/app/services/poll-service.service.spec.ts index c9b6bcec..c47006ba 100644 --- a/src/app/services/poll-service.service.spec.ts +++ b/src/app/services/poll-service.service.spec.ts @@ -1,12 +1,12 @@ import { TestBed } from '@angular/core/testing'; -import { PollServiceService } from './poll-service.service'; +import { PollService } from './poll.service'; describe('PollServiceService', () => { beforeEach(() => TestBed.configureTestingModule({})); it('should be created', () => { - const service: PollServiceService = TestBed.get(PollServiceService); + const service: PollService = TestBed.get(PollService); expect(service).toBeTruthy(); }); }); diff --git a/src/app/services/poll-service.service.ts b/src/app/services/poll-service.service.ts deleted file mode 100644 index 0bf09ae0..00000000 --- a/src/app/services/poll-service.service.ts +++ /dev/null @@ -1,32 +0,0 @@ -import {Injectable} from '@angular/core'; -import {ConfigService} from "../config.service"; -import {HttpClient} from "@angular/common/http"; -import {environment} from "../../environments/environment"; - -class JsonResponse { - message: string; - data: string; -} - -@Injectable({ - providedIn: 'root' -}) -export class PollServiceService { - - private baseHref: string = environment.baseApiHref; - - constructor(private configService: ConfigService, - private http: HttpClient) { - } - - findPollsByEmail(email: string) { - // TODO check if the person has a key to retrieve her polls - // If no key is found in the localstorage, ask the backend to send an email to the user - - this.configService.myEmail = email; - this.http.get(this.baseHref + '/').subscribe(res => { - this.configService.myPolls = res; - }, err => console.error('err', err) - ) - } -} diff --git a/src/app/services/poll.service.ts b/src/app/services/poll.service.ts new file mode 100644 index 00000000..b30b45a6 --- /dev/null +++ b/src/app/services/poll.service.ts @@ -0,0 +1,24 @@ +import {Injectable} from '@angular/core'; +import {ConfigService} from "./config.service"; +import {HttpClient} from "@angular/common/http"; +import {environment} from "../../environments/environment"; + +class JsonResponse { + message: string; + data: string; +} + +@Injectable({ + providedIn: 'root' +}) +export class PollService { + + private baseHref: string = environment.baseApiHref; + + constructor(private configService: ConfigService, + private document: Document, + private http: HttpClient) { + } + + +} diff --git a/src/app/progression.service.spec.ts b/src/app/services/progression.service.spec.ts similarity index 100% rename from src/app/progression.service.spec.ts rename to src/app/services/progression.service.spec.ts diff --git a/src/app/ui/navigation/navigation.component.ts b/src/app/ui/navigation/navigation.component.ts index 52bd53d7..d0fbd588 100644 --- a/src/app/ui/navigation/navigation.component.ts +++ b/src/app/ui/navigation/navigation.component.ts @@ -1,6 +1,6 @@ import {Component, OnInit} from '@angular/core'; import {BaseComponent} from '../../pages/base-page/base.component'; -import {ConfigService} from '../../config.service'; +import {ConfigService} from '../../services/config.service'; @Component({ selector: 'framadate-navigation', diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 918f5d2b..b2a49141 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,7 +4,7 @@ export const environment = { production: false, - baseApiHref: "http://127.0.0.1:8000/api/v1/" + baseApiHref: "http://127.0.0.1:8000/api/v1" }; /* diff --git a/yarn.lock b/yarn.lock index 3ea57eea..8334bfae 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4521,6 +4521,11 @@ ngx-markdown@^8.2.1: prismjs "^1.16.0" tslib "^1.9.0" +ngx-toaster@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/ngx-toaster/-/ngx-toaster-1.0.1.tgz#ee54f83bcbe3da26210097baac08445952899515" + integrity sha1-7lT4O8vj2iYhAJe6rAhEWVKJlRU= + nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" @@ -5707,6 +5712,11 @@ run-queue@^1.0.0, run-queue@^1.0.3: dependencies: aproba "^1.1.1" +rxjs-compat@^6.5.3: + version "6.5.3" + resolved "https://registry.yarnpkg.com/rxjs-compat/-/rxjs-compat-6.5.3.tgz#18440949b2678bf87a78a754009676b2c49183dc" + integrity sha512-BIJX2yovz3TBpjJoAZyls2QYuU6ZiCaZ+U96SmxQpuSP/qDUfiXPKOVLbThBB2WZijNHkdTTJXKRwvv5Y48H7g== + rxjs@6.4.0, rxjs@~6.4.0: version "6.4.0" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.4.0.tgz#f3bb0fe7bda7fb69deac0c16f17b50b0b8790504" From cb6636f1557cdf4e33f0a2163245f6ab5ae63755 Mon Sep 17 00:00:00 2001 From: Baptiste Lemoine Date: Wed, 4 Dec 2019 12:45:50 +0100 Subject: [PATCH 02/15] organise calls, add headers --- src/app/config/PollConfig.ts | 2 + src/app/debugger/debugger.component.html | 53 +--- src/app/services/config.service.ts | 233 +++++++++++---- src/environments/environment.ts | 2 +- src/locale/messages.xlf | 343 ----------------------- 5 files changed, 192 insertions(+), 441 deletions(-) delete mode 100644 src/locale/messages.xlf diff --git a/src/app/config/PollConfig.ts b/src/app/config/PollConfig.ts index c34bb98a..db150ad1 100644 --- a/src/app/config/PollConfig.ts +++ b/src/app/config/PollConfig.ts @@ -58,6 +58,8 @@ export class PollConfig { visibility = 'link_only'; // visible to anyone with the link: voteChoices = 'only_yes'; // possible answers to a vote choice: only "yes", "yes, maybe, no" expirationDate = ''; // expiracy date + pollId = null; // id of the current poll when created. data given by the backend api + selectedPoll = null; // current poll selected with createPoll or getPoll of ConfigService passwordAccess = 0; password = ''; customUrl = ''; diff --git a/src/app/debugger/debugger.component.html b/src/app/debugger/debugger.component.html index c9e8a4f6..b7f72cfe 100644 --- a/src/app/debugger/debugger.component.html +++ b/src/app/debugger/debugger.component.html @@ -17,48 +17,9 @@
  • type de formulaire: {{config.pollType}}
  • -
  • - config: -
    -				{{config.answers|json}}
    -			
    -
  • - - Choix cornélien syncronisé: - - - - - + + diff --git a/src/app/services/config.service.ts b/src/app/services/config.service.ts index be6d0fcc..483ceaa4 100644 --- a/src/app/services/config.service.ts +++ b/src/app/services/config.service.ts @@ -1,6 +1,6 @@ import {Injectable} from '@angular/core'; import {PollConfig} from '../config/PollConfig'; -import {HttpClient, HttpHeaders} from "@angular/common/http"; +import {HttpClient, HttpHeaders, HttpParams} from "@angular/common/http"; import {environment} from "../../environments/environment"; @@ -24,55 +24,14 @@ export class ConfigService extends PollConfig { this[key] = val; } - createPoll() { - console.log('sends the form'); - // alert('envoi de formulaire pour création de sondage en XHR à faire'); - this.http.get(`${this.baseHref}/`) - .subscribe((res) => { - console.log('res', res); - this.createPollFromConfig(this.getPollConfig()) - }, - this.handleError - ) - ; - - } - - createPollFromConfig(config: any) { - this.http.post(`${this.baseHref}/poll`, config) - .subscribe((res: any) => { - // redirect to the page to administrate the new poll - alert("succès!"); - this.myPolls = res; - }, this.handleError - ); - } - - findPollsByEmail(email: string) { - - - this.findLocalStorageData(); - // If no key is found in the localstorage, ask the backend to send an email to the user - - this.myEmail = email; - const headers = new HttpHeaders('Content-Type:application/json'); - const headerDict = { - 'Content-Type': 'application/json', - 'Accept': 'application/json', - }; - - const requestOptions = { - headers: new HttpHeaders(headerDict), - }; - - this.http.get(`${this.baseHref}/my-polls`) - .subscribe(res => { - // message: 'Trouvé! Allez voir votre boite email', - this.myPolls = res; - }, this.handleError - ) - } - + /** ================================== + * + * poll public calls to get non authenticated info + * + * ==================================/ + /** + * convert current poll config to a payload to send to the backend API + */ getPollConfig() { const jsonConfig = { method: 'POST', @@ -103,7 +62,42 @@ export class ConfigService extends PollConfig { return jsonConfig } + /** + * search in localstorage, fallback asking the backend to send an email to the owner if it exists + * @param email + */ + findPollsByEmail(email: string) { + + + this.findLocalStorageData(); + // If no key is found in the localstorage, ask the backend to send an email to the user + + this.myEmail = email; + + const headerDict = { + 'Content-Type': 'application/json', + 'Accept': 'application/json', + }; + + const requestOptions = { + headers: new HttpHeaders(headerDict), + }; + + this.http.get(`${this.baseHref}/my-polls`) + .subscribe(res => { + // message: 'Trouvé! Allez voir votre boite email', + this.myPolls = res; + }, this.handleError + ) + } + + + /** + * display error message depending on the response of the backend + * @param err + */ handleError(err: any) { + // TODO handle a toast message console.error('err', err) } @@ -127,16 +121,139 @@ export class ConfigService extends PollConfig { } /** - * + * GET + * api/v1/poll/{id} * @param id */ - getPollById(id: string) { - // http://127.0.0.1:8000/api/v1/poll/1 - this.http.get(`${this.baseHref}/poll/${id}`).subscribe( - (res: any) => { - this.myPolls = res.data; - }, this.handleError - ); + getPollById(id: string, password: string) { + // http://127.0.0.1:8000/ + this.http + .get(`${this.baseHref}/poll/${id}`, + {params: new HttpParams().set('body', password)}) + .subscribe( + (res: any) => { + this.myPolls = res.data; + }, this.handleError + ); } + /** + * GET + * api/v1/my-polls + * @param ownerEmail + */ + getMyPolls(ownerEmail: string) { + this.http + .get(`${this.baseHref}/my-polls`, + { + headers: new HttpHeaders() + .append('Content-Type', 'application/json') + .append('Charset', 'UTF-8') + , + params: new HttpParams().set('ownerEmail', ownerEmail) + }) + .subscribe( + (res: any) => { + this.myPolls = res.data; + }, this.handleError + ); + } + + + /** + * action of the form + */ + createPoll() { + console.log('sends the form'); + // alert('envoi de formulaire pour création de sondage en XHR à faire'); + this.http.get(`${this.baseHref}/`) + .subscribe((res) => { + console.log('res', res); + this.createPollFromConfig(this.getPollConfig()) + }, + this.handleError + ) + ; + + } + + /** + * POST + * /api/v1/poll/{id}/poll + * @param config + */ + createPollFromConfig(config: any) { + this.http.post(`${this.baseHref}/poll`, config) + .subscribe((res: any) => { + // redirect to the page to administrate the new poll + alert("succès!"); + this.selectedPoll = res; + this.pollId = res.pollId; + }, this.handleError + ); + } + + /** + * UPDATE + * /api/v1/poll/{id}/vote + * @param voteStack + */ + updatePoll(voteStack: any) { + this.http.put(`${this.baseHref}/poll/${this.pollId}`, voteStack) + .subscribe((res: any) => { + + alert("succès!"); + this.myPolls = res; + }, this.handleError + ); + } + + /** + * POST + * /api/v1/poll/{id}/vote + * @param voteStack + */ + addVote(voteStack: any) { + this.http.post(`${this.baseHref}/poll/${this.pollId}/vote`, voteStack) + .subscribe((res: any) => { + + alert("succès!"); + this.myPolls = res; + }, this.handleError + ); + } + + /** + * UPDATE + * /api/v1/poll/{id}/vote + * @param voteStack + */ + updateVote(voteStack: any) { + this.http.put(`${this.baseHref}/poll/${this.pollId}/vote`, voteStack) + .subscribe((res: any) => { + + alert("succès!"); + this.myPolls = res; + }, this.handleError + ); + } + + /** + * POST + * /api/v1/poll/{id}/comment + * @param comment + */ + addComment(comment: any) { + this.http.post(`${this.baseHref}/poll/${this.pollId}/comment`, comment) + .subscribe((res: any) => { + alert("succès!"); + }, this.handleError + ); + } + + + /** + * administrator calls + */ + } diff --git a/src/environments/environment.ts b/src/environments/environment.ts index b2a49141..4d63b3f5 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,7 +4,7 @@ export const environment = { production: false, - baseApiHref: "http://127.0.0.1:8000/api/v1" + baseApiHref: "http://localhost:8000/api/v1" }; /* diff --git a/src/locale/messages.xlf b/src/locale/messages.xlf deleted file mode 100644 index ba35cf85..00000000 --- a/src/locale/messages.xlf +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - Ceci est une démo - - - src/app/app.component.html - 7 - - introduction header saying just demo - demo title - - - - Updated - - - src/app/app.component.html - 10 - - - - {VAR_PLURAL, plural, =0 {just now} =1 {one minute ago} other { minutes ago} } - - src/app/app.component.html - 11 - - - - placeholder à traduire - - src/app/app.component.html - 13 - - - - C'est parfait! - - src/app/pages/base-page/base.component.html - 2 - - - src/app/pages/kind/kind.component.html - 4 - - - src/app/pages/visibility/visibility.component.html - 14 - - - src/app/pages/resume/resume.component.html - 10 - - - - - Config spécialement pour les dates - - - src/app/pages/dates/dates.component.html - 1 - - - - - Je souhaite mettre des créneaux horaires - - - src/app/pages/dates/dates.component.html - 16 - - - - - pour chaque journée - - - src/app/pages/dates/dates.component.html - 20 - - - - - Ajouter une plage de dates - - - src/app/pages/dates/dates.component.html - 30 - - - - - choix de Dates - - - src/app/pages/dates/dates.component.html - 35 - - - - - infos de debug - - - src/app/debugger/debugger.component.html - 4 - - - - - Choix cornélien syncronisé: - - - src/app/debugger/debugger.component.html - 27 - - - - - sondage classique - - - src/app/debugger/debugger.component.html - 37 - - - - - sondage spécial date - - - src/app/debugger/debugger.component.html - 51 - - - - - Envoyer le formulaire - - - src/app/debugger/debugger.component.html - 64 - - - - - Visibilité des réponses - - - src/app/pages/visibility/visibility.component.html - 1 - - - - - Votes - - - src/app/pages/visibility/visibility.component.html - 4 - - - - - Archivage - - - src/app/pages/visibility/visibility.component.html - 7 - - - - - Accès au sondage - - - src/app/pages/visibility/visibility.component.html - 11 - - - - - Résumé avant validation - - - src/app/pages/resume/resume.component.html - 1 - - - - - Images - - - src/app/pages/pictures/pictures.component.html - 2 - - - - - Choisir les propositions - - - src/app/pages/answers/answers.component.html - 2 - - - - - vous pouvez utiliser la syntaxe markdown - - - src/app/pages/answers/answers.component.html - 6 - - - - - Et c'est tout pour nous! - - - src/app/pages/end-confirmation/end-confirmation.component.html - 1 - - - - Coté administrateur-ice-eux - - src/app/pages/end-confirmation/end-confirmation.component.html - 4 - - - - Coté sondés - - src/app/pages/end-confirmation/end-confirmation.component.html - 5 - - - - recevoir les liens par e-mail - - src/app/pages/end-confirmation/end-confirmation.component.html - 6 - - - - - Créer un sondage - - - src/app/pages/create-or-retrieve/create-or-retrieve.component.html - 2 - - - - - Planifiez des rendez-vous avec vos amis ou votre famille ou créez un sondage avec du texte, des images ou des - liens… un sondage quoi ! - - - src/app/pages/create-or-retrieve/create-or-retrieve.component.html - 8 - - - - - C'est parti - - - src/app/pages/create-or-retrieve/create-or-retrieve.component.html - 19 - - - - - Où sont mes sondages ? - - - src/app/pages/create-or-retrieve/create-or-retrieve.component.html - 29 - - - - - Je cherche les sondages qui correspondent à mon mail : - - - src/app/pages/create-or-retrieve/create-or-retrieve.component.html - 40 - - - - - Pour commencer - - - src/app/pages/home/home.component.html - 4 - - - - - Je veux créer un sondage - - - src/app/pages/home/home.component.html - 10 - - - - - Dont le titre sera - - - src/app/pages/home/home.component.html - 34 - - - - - et la description serait - - - src/app/pages/home/home.component.html - 64 - - - - - Continuer - - - src/app/pages/home/home.component.html - 82 - - - - - From cf4e9f45634b0eb8fa52bf77c52373876ce5eaef Mon Sep 17 00:00:00 2001 From: Baptiste Lemoine Date: Wed, 15 Jan 2020 11:40:39 +0100 Subject: [PATCH 03/15] :zap: fix some deps --- package.json | 1 + src/app/app.module.ts | 5 +++-- src/app/config/Routes.ts | 3 ++- .../create-or-retrieve.component.html | 17 ++++++++++++----- .../create-or-retrieve.component.ts | 6 ++++++ src/app/poll-graphic/poll-graphic.component.ts | 8 ++++---- src/app/services/config.service.ts | 13 +++++++++++-- src/app/services/poll.service.ts | 11 +---------- src/environments/environment.prod.ts | 2 +- src/environments/environment.ts | 3 ++- 10 files changed, 43 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index 6301943b..a372d3b2 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "scripts": { "ng": "ng", "start": "ng serve", + "serve": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 1c51d044..88d468e0 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,6 +1,5 @@ import {BrowserModule} from '@angular/platform-browser'; import {NgModule} from '@angular/core'; - import {AppRoutingModule} from './app-routing.module'; import {AppComponent} from './app.component'; import {BaseComponent} from './pages/base-page/base.component'; @@ -42,6 +41,8 @@ import {PollGraphicComponent} from './poll-graphic/poll-graphic.component'; import {AdminComponent} from './pages/admin/admin.component'; import {SelectorComponent} from './ui/selector/selector.component'; import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; +import {ConfigService} from "./services/config.service"; +import {PollService} from "./services/poll.service"; export class MyMissingTranslationHandler implements MissingTranslationHandler { handle(params: MissingTranslationHandlerParams) { @@ -104,7 +105,7 @@ export function HttpLoaderFactory(http: HttpClient) { FormsModule, RouterModule.forRoot(Routes) ], - providers: [TranslateService], + providers: [TranslateService, ConfigService, PollService], bootstrap: [AppComponent] }) export class AppModule { diff --git a/src/app/config/Routes.ts b/src/app/config/Routes.ts index 52360ff5..c9fcf5c7 100644 --- a/src/app/config/Routes.ts +++ b/src/app/config/Routes.ts @@ -17,7 +17,7 @@ import {VoteChoiceComponent} from "../vote-choice/vote-choice.component"; */ export const Routes = [ - {path: '', component: CreateOrRetrieveComponent}, + {path: '', redirectTo: 'step/creation', pathMatch: 'full'}, {path: 'home', component: HomeComponent}, {path: 'base', component: BaseComponent}, {path: 'step/base', component: BaseComponent}, @@ -32,5 +32,6 @@ export const Routes = {path: 'step/end', component: EndConfirmationComponent}, {path: 'graphic/:poll', component: PollGraphicComponent}, {path: 'votechoice', component: VoteChoiceComponent}, + {path: '**', redirectTo: '/home', pathMatch: 'full'}, ] ; diff --git a/src/app/pages/create-or-retrieve/create-or-retrieve.component.html b/src/app/pages/create-or-retrieve/create-or-retrieve.component.html index 20c0b141..8212aba4 100644 --- a/src/app/pages/create-or-retrieve/create-or-retrieve.component.html +++ b/src/app/pages/create-or-retrieve/create-or-retrieve.component.html @@ -40,16 +40,17 @@ {{"config.find_helper"|translate}} : @@ -57,4 +58,10 @@
    • poll
    +
    + +
    +
    + Aucun sondage. +
    diff --git a/src/app/pages/create-or-retrieve/create-or-retrieve.component.ts b/src/app/pages/create-or-retrieve/create-or-retrieve.component.ts index 00536fbf..469f80ab 100644 --- a/src/app/pages/create-or-retrieve/create-or-retrieve.component.ts +++ b/src/app/pages/create-or-retrieve/create-or-retrieve.component.ts @@ -10,6 +10,8 @@ import {PollService} from "../../services/poll.service"; }) export class CreateOrRetrieveComponent extends BaseComponent implements OnInit { + loadedMyPolls: boolean = false; + constructor(public config: ConfigService, public pollService: PollService) { super(config); @@ -20,7 +22,11 @@ export class CreateOrRetrieveComponent extends BaseComponent implements OnInit { } findMyPollsByEmail(email: string) { + if (!email) { + return + } this.config.findPollsByEmail(email); + this.loadedMyPolls = true; } } diff --git a/src/app/poll-graphic/poll-graphic.component.ts b/src/app/poll-graphic/poll-graphic.component.ts index f3ba0682..1356e25a 100644 --- a/src/app/poll-graphic/poll-graphic.component.ts +++ b/src/app/poll-graphic/poll-graphic.component.ts @@ -1,5 +1,6 @@ -import {Component, OnInit} from "@angular/core"; +import {Component, Inject, OnInit} from "@angular/core"; import {Chart} from "chart.js"; +import {DOCUMENT} from '@angular/common'; @Component({ selector: "framadate-poll-graphic", @@ -8,7 +9,6 @@ import {Chart} from "chart.js"; }) export class PollGraphicComponent implements OnInit { isColorblind: boolean = false; - lineChart: Chart; pollData: any; yesList: number[] = []; maybeList: number[] = []; @@ -16,7 +16,7 @@ export class PollGraphicComponent implements OnInit { nbPoll: number = 0; dateList: string[] = []; - constructor() { + constructor(@Inject(DOCUMENT) private document: any,) { } ngOnInit() { @@ -76,7 +76,7 @@ export class PollGraphicComponent implements OnInit { this.formatDataAnswers(toto); this.isColorblind = false; - this.pollData = new Chart(document.getElementById("graph"), { + this.pollData = new Chart(this.document.getElementById("graph"), { type: "horizontalBar", data: { labels: ["jeudi"], diff --git a/src/app/services/config.service.ts b/src/app/services/config.service.ts index 483ceaa4..56de8d53 100644 --- a/src/app/services/config.service.ts +++ b/src/app/services/config.service.ts @@ -12,6 +12,7 @@ import {environment} from "../../environments/environment"; }) export class ConfigService extends PollConfig { myEmail: string; + loading: boolean = false; baseHref: any = environment.baseApiHref; myPolls: any;// list of retrieved polls from the backend api @@ -77,16 +78,23 @@ export class ConfigService extends PollConfig { const headerDict = { 'Content-Type': 'application/json', 'Accept': 'application/json', + 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE', + 'Access-Control-Allow-Origin': environment.baseApiHref }; const requestOptions = { headers: new HttpHeaders(headerDict), + email: this.myEmail }; - this.http.get(`${this.baseHref}/my-polls`) + this.loading = true; + this.http.get(`${this.baseHref}/my-polls`, + requestOptions, + ) .subscribe(res => { // message: 'Trouvé! Allez voir votre boite email', this.myPolls = res; + this.loading = false; }, this.handleError ) } @@ -99,6 +107,7 @@ export class ConfigService extends PollConfig { handleError(err: any) { // TODO handle a toast message console.error('err', err) + this.loading = false; } @@ -126,7 +135,7 @@ export class ConfigService extends PollConfig { * @param id */ getPollById(id: string, password: string) { - // http://127.0.0.1:8000/ + this.http .get(`${this.baseHref}/poll/${id}`, {params: new HttpParams().set('body', password)}) diff --git a/src/app/services/poll.service.ts b/src/app/services/poll.service.ts index b30b45a6..33f190d2 100644 --- a/src/app/services/poll.service.ts +++ b/src/app/services/poll.service.ts @@ -1,13 +1,6 @@ import {Injectable} from '@angular/core'; -import {ConfigService} from "./config.service"; -import {HttpClient} from "@angular/common/http"; import {environment} from "../../environments/environment"; -class JsonResponse { - message: string; - data: string; -} - @Injectable({ providedIn: 'root' }) @@ -15,9 +8,7 @@ export class PollService { private baseHref: string = environment.baseApiHref; - constructor(private configService: ConfigService, - private document: Document, - private http: HttpClient) { + constructor() { } diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 0a1bc680..8ccf98f9 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -1,4 +1,4 @@ export const environment = { production: true, - baseApiHref : 'http://127.0.0.1:8000/api/v1/' + baseApiHref: 'http://127.0.0.1:8000/api/v1/' }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 4d63b3f5..0ab15255 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,7 +4,8 @@ export const environment = { production: false, - baseApiHref: "http://localhost:8000/api/v1" + baseApiHref: "https://framadate-api.cipherbliss.com/api/v1" + // baseApiHref: "http://localhost:8000/api/v1" }; /* From ded5e71e73a037096d0497b615faf82d733a775b Mon Sep 17 00:00:00 2001 From: Baptiste Lemoine Date: Wed, 15 Jan 2020 11:59:02 +0100 Subject: [PATCH 04/15] :zap: update dependencies with yarn, add primefaces to make toasts --- angular.json | 256 ++-- package.json | 7 +- src/app/app.module.ts | 5 +- .../create-or-retrieve.component.html | 8 +- src/app/services/config.service.ts | 6 +- src/environments/environment.prod.ts | 2 +- yarn.lock | 1258 ++++++++--------- 7 files changed, 769 insertions(+), 773 deletions(-) diff --git a/angular.json b/angular.json index df9c8dac..4fc871a3 100644 --- a/angular.json +++ b/angular.json @@ -1,133 +1,137 @@ { - "$schema": "./node_modules/@angular/cli/lib/config/schema.json", - "version": 1, - "newProjectRoot": "projects", - "projects": { - "framadate": { - "projectType": "application", - "schematics": { - "@schematics/angular:component": { - "style": "scss" - } - }, - "root": "", - "sourceRoot": "src", - "prefix": "framadate", - "architect": { - "build": { - "builder": "@angular-devkit/build-angular:browser", - "options": { - "outputPath": "dist/framadate", - "index": "src/index.html", - "main": "src/main.ts", - "polyfills": "src/polyfills.ts", - "tsConfig": "tsconfig.app.json", - "aot": false, - "assets": [ - "src/favicon.ico", - "src/assets" - ], - "styles": [ - "src/styles.scss" - ], - "scripts": [ - "node_modules/marked/lib/marked.js", - "node_modules/prismjs/prism.js", - "node_modules/prismjs/components/prism-css.min.js" - ] - }, - "configurations": { - "production": { - "fileReplacements": [ - { - "replace": "src/environments/environment.ts", - "with": "src/environments/environment.prod.ts" + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "projects": { + "framadate": { + "projectType": "application", + "schematics": { + "@schematics/angular:component": { + "style": "scss" } - ], - "optimization": true, - "outputHashing": "all", - "sourceMap": false, - "extractCss": true, - "namedChunks": false, - "aot": true, - "extractLicenses": true, - "vendorChunk": false, - "buildOptimizer": true, - "budgets": [ - { - "type": "initial", - "maximumWarning": "2mb", - "maximumError": "5mb" + }, + "root": "", + "sourceRoot": "src", + "prefix": "framadate", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:browser", + "options": { + "outputPath": "dist/framadate", + "index": "src/index.html", + "main": "src/main.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "tsconfig.app.json", + "aot": false, + "assets": [ + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "node_modules/primeicons/primeicons.css", + "node_modules/primeng/resources/themes/nova-light/theme.css", + "node_modules/primeng/resources/primeng.min.css", + "src/styles.scss" + ], + "scripts": [ + "node_modules/marked/lib/marked.js", + "node_modules/prismjs/prism.js", + "node_modules/prismjs/components/prism-css.min.js" + ] + }, + "configurations": { + "production": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.prod.ts" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "extractCss": true, + "namedChunks": false, + "aot": true, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true, + "budgets": [ + { + "type": "initial", + "maximumWarning": "2mb", + "maximumError": "5mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "6kb", + "maximumError": "10kb" + } + ] + } + } }, - { - "type": "anyComponentStyle", - "maximumWarning": "6kb", - "maximumError": "10kb" + "serve": { + "builder": "@angular-devkit/build-angular:dev-server", + "options": { + "browserTarget": "framadate:build" + }, + "configurations": { + "production": { + "browserTarget": "framadate:build:production" + } + } + }, + "extract-i18n": { + "builder": "@angular-devkit/build-angular:extract-i18n", + "options": { + "browserTarget": "framadate:build" + } + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "main": "src/test.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "tsconfig.spec.json", + "karmaConfig": "karma.conf.js", + "assets": [ + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "src/styles.scss" + ], + "scripts": [] + } + }, + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": [ + "tsconfig.app.json", + "tsconfig.spec.json", + "e2e/tsconfig.json" + ], + "exclude": [ + "**/node_modules/**" + ] + } + }, + "e2e": { + "builder": "@angular-devkit/build-angular:protractor", + "options": { + "protractorConfig": "e2e/protractor.conf.js", + "devServerTarget": "framadate:serve" + }, + "configurations": { + "production": { + "devServerTarget": "framadate:serve:production" + } + } } - ] } - } - }, - "serve": { - "builder": "@angular-devkit/build-angular:dev-server", - "options": { - "browserTarget": "framadate:build" - }, - "configurations": { - "production": { - "browserTarget": "framadate:build:production" - } - } - }, - "extract-i18n": { - "builder": "@angular-devkit/build-angular:extract-i18n", - "options": { - "browserTarget": "framadate:build" - } - }, - "test": { - "builder": "@angular-devkit/build-angular:karma", - "options": { - "main": "src/test.ts", - "polyfills": "src/polyfills.ts", - "tsConfig": "tsconfig.spec.json", - "karmaConfig": "karma.conf.js", - "assets": [ - "src/favicon.ico", - "src/assets" - ], - "styles": [ - "src/styles.scss" - ], - "scripts": [] - } - }, - "lint": { - "builder": "@angular-devkit/build-angular:tslint", - "options": { - "tsConfig": [ - "tsconfig.app.json", - "tsconfig.spec.json", - "e2e/tsconfig.json" - ], - "exclude": [ - "**/node_modules/**" - ] - } - }, - "e2e": { - "builder": "@angular-devkit/build-angular:protractor", - "options": { - "protractorConfig": "e2e/protractor.conf.js", - "devServerTarget": "framadate:serve" - }, - "configurations": { - "production": { - "devServerTarget": "framadate:serve:production" - } - } } - } - }}, - "defaultProject": "framadate" + }, + "defaultProject": "framadate" } diff --git a/package.json b/package.json index a372d3b2..0357a1aa 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ }, "private": true, "dependencies": { - "@angular/animations": "~8.2.0", + "@angular/animations": "^8.2.14", + "@angular/cdk": "^8.2.3", "@angular/common": "~8.2.0", "@angular/compiler": "~8.2.0", "@angular/core": "~8.2.0", @@ -21,11 +22,15 @@ "@angular/platform-browser": "~8.2.0", "@angular/platform-browser-dynamic": "~8.2.0", "@angular/router": "~8.2.0", + "@fullcalendar/core": "^4.3.1", "@ngx-translate/core": "^11.0.1", "@ngx-translate/http-loader": "^4.0.0", "chart.js": "^2.8.0", "ngx-markdown": "^8.2.1", "ngx-toaster": "^1.0.1", + "primeicons": "^2.0.0", + "primeng": "^9.0.0-rc.2", + "quill": "^1.3.7", "rxjs": "~6.4.0", "rxjs-compat": "^6.5.3", "tslib": "^1.10.0", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 88d468e0..a977073f 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -43,6 +43,8 @@ import {SelectorComponent} from './ui/selector/selector.component'; import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; import {ConfigService} from "./services/config.service"; import {PollService} from "./services/poll.service"; +import {ToastModule} from 'primeng/toast'; +import {MessageService} from "primeng"; export class MyMissingTranslationHandler implements MissingTranslationHandler { handle(params: MissingTranslationHandlerParams) { @@ -88,6 +90,7 @@ export function HttpLoaderFactory(http: HttpClient) { BrowserModule, BrowserAnimationsModule, AppRoutingModule, + ToastModule, MarkdownModule.forRoot(), TranslateModule.forRoot({ missingTranslationHandler: { @@ -105,7 +108,7 @@ export function HttpLoaderFactory(http: HttpClient) { FormsModule, RouterModule.forRoot(Routes) ], - providers: [TranslateService, ConfigService, PollService], + providers: [TranslateService, ConfigService, PollService, MessageService], bootstrap: [AppComponent] }) export class AppModule { diff --git a/src/app/pages/create-or-retrieve/create-or-retrieve.component.html b/src/app/pages/create-or-retrieve/create-or-retrieve.component.html index 8212aba4..cc7bc355 100644 --- a/src/app/pages/create-or-retrieve/create-or-retrieve.component.html +++ b/src/app/pages/create-or-retrieve/create-or-retrieve.component.html @@ -30,7 +30,7 @@ {{"config.find_my_polls"|translate}}