mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
⚡ fix some deps
This commit is contained in:
parent
cb6636f155
commit
cf4e9f4563
@ -4,6 +4,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
|
"serve": "ng serve",
|
||||||
"build": "ng build",
|
"build": "ng build",
|
||||||
"test": "ng test",
|
"test": "ng test",
|
||||||
"lint": "ng lint",
|
"lint": "ng lint",
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import {BrowserModule} from '@angular/platform-browser';
|
import {BrowserModule} from '@angular/platform-browser';
|
||||||
import {NgModule} from '@angular/core';
|
import {NgModule} from '@angular/core';
|
||||||
|
|
||||||
import {AppRoutingModule} from './app-routing.module';
|
import {AppRoutingModule} from './app-routing.module';
|
||||||
import {AppComponent} from './app.component';
|
import {AppComponent} from './app.component';
|
||||||
import {BaseComponent} from './pages/base-page/base.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 {AdminComponent} from './pages/admin/admin.component';
|
||||||
import {SelectorComponent} from './ui/selector/selector.component';
|
import {SelectorComponent} from './ui/selector/selector.component';
|
||||||
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
|
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
|
||||||
|
import {ConfigService} from "./services/config.service";
|
||||||
|
import {PollService} from "./services/poll.service";
|
||||||
|
|
||||||
export class MyMissingTranslationHandler implements MissingTranslationHandler {
|
export class MyMissingTranslationHandler implements MissingTranslationHandler {
|
||||||
handle(params: MissingTranslationHandlerParams) {
|
handle(params: MissingTranslationHandlerParams) {
|
||||||
@ -104,7 +105,7 @@ export function HttpLoaderFactory(http: HttpClient) {
|
|||||||
FormsModule,
|
FormsModule,
|
||||||
RouterModule.forRoot(Routes)
|
RouterModule.forRoot(Routes)
|
||||||
],
|
],
|
||||||
providers: [TranslateService],
|
providers: [TranslateService, ConfigService, PollService],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
})
|
})
|
||||||
export class AppModule {
|
export class AppModule {
|
||||||
|
@ -17,7 +17,7 @@ import {VoteChoiceComponent} from "../vote-choice/vote-choice.component";
|
|||||||
*/
|
*/
|
||||||
export const Routes =
|
export const Routes =
|
||||||
[
|
[
|
||||||
{path: '', component: CreateOrRetrieveComponent},
|
{path: '', redirectTo: 'step/creation', pathMatch: 'full'},
|
||||||
{path: 'home', component: HomeComponent},
|
{path: 'home', component: HomeComponent},
|
||||||
{path: 'base', component: BaseComponent},
|
{path: 'base', component: BaseComponent},
|
||||||
{path: 'step/base', component: BaseComponent},
|
{path: 'step/base', component: BaseComponent},
|
||||||
@ -32,5 +32,6 @@ export const Routes =
|
|||||||
{path: 'step/end', component: EndConfirmationComponent},
|
{path: 'step/end', component: EndConfirmationComponent},
|
||||||
{path: 'graphic/:poll', component: PollGraphicComponent},
|
{path: 'graphic/:poll', component: PollGraphicComponent},
|
||||||
{path: 'votechoice', component: VoteChoiceComponent},
|
{path: 'votechoice', component: VoteChoiceComponent},
|
||||||
|
{path: '**', redirectTo: '/home', pathMatch: 'full'},
|
||||||
]
|
]
|
||||||
;
|
;
|
||||||
|
@ -40,16 +40,17 @@
|
|||||||
{{"config.find_helper"|translate}} :
|
{{"config.find_helper"|translate}} :
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
#emailToFind
|
#emailToFind
|
||||||
type="email"
|
type="email"
|
||||||
name="mail"
|
name="mail"
|
||||||
id="email"
|
id="email"
|
||||||
autofocus="autofocus"
|
autofocus="autofocus"
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
type="submit"
|
type="submit"
|
||||||
class="btn btn-block"
|
class="btn btn-block"
|
||||||
i18n-value="'config.find_button'|translate"
|
i18n-value="'config.find_button'|translate"
|
||||||
|
[disabled]="!emailToFind.value"
|
||||||
/>
|
/>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
@ -57,4 +58,10 @@
|
|||||||
<ul class="poll-list" *ngFor="let poll of config.myPolls">
|
<ul class="poll-list" *ngFor="let poll of config.myPolls">
|
||||||
<li> poll</li>
|
<li> poll</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<div class="loading">
|
||||||
|
<i class="fa fa-refresh fa-spin fa-3x fa-fw"></i>
|
||||||
|
</div>
|
||||||
|
<div class="no-polls" *ngIf="!config.loading && (! config.myPolls || !config.myPolls.length)">
|
||||||
|
Aucun sondage.
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
@ -10,6 +10,8 @@ import {PollService} from "../../services/poll.service";
|
|||||||
})
|
})
|
||||||
export class CreateOrRetrieveComponent extends BaseComponent implements OnInit {
|
export class CreateOrRetrieveComponent extends BaseComponent implements OnInit {
|
||||||
|
|
||||||
|
loadedMyPolls: boolean = false;
|
||||||
|
|
||||||
constructor(public config: ConfigService,
|
constructor(public config: ConfigService,
|
||||||
public pollService: PollService) {
|
public pollService: PollService) {
|
||||||
super(config);
|
super(config);
|
||||||
@ -20,7 +22,11 @@ export class CreateOrRetrieveComponent extends BaseComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
findMyPollsByEmail(email: string) {
|
findMyPollsByEmail(email: string) {
|
||||||
|
if (!email) {
|
||||||
|
return
|
||||||
|
}
|
||||||
this.config.findPollsByEmail(email);
|
this.config.findPollsByEmail(email);
|
||||||
|
this.loadedMyPolls = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import {Component, OnInit} from "@angular/core";
|
import {Component, Inject, OnInit} from "@angular/core";
|
||||||
import {Chart} from "chart.js";
|
import {Chart} from "chart.js";
|
||||||
|
import {DOCUMENT} from '@angular/common';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "framadate-poll-graphic",
|
selector: "framadate-poll-graphic",
|
||||||
@ -8,7 +9,6 @@ import {Chart} from "chart.js";
|
|||||||
})
|
})
|
||||||
export class PollGraphicComponent implements OnInit {
|
export class PollGraphicComponent implements OnInit {
|
||||||
isColorblind: boolean = false;
|
isColorblind: boolean = false;
|
||||||
lineChart: Chart;
|
|
||||||
pollData: any;
|
pollData: any;
|
||||||
yesList: number[] = [];
|
yesList: number[] = [];
|
||||||
maybeList: number[] = [];
|
maybeList: number[] = [];
|
||||||
@ -16,7 +16,7 @@ export class PollGraphicComponent implements OnInit {
|
|||||||
nbPoll: number = 0;
|
nbPoll: number = 0;
|
||||||
dateList: string[] = [];
|
dateList: string[] = [];
|
||||||
|
|
||||||
constructor() {
|
constructor(@Inject(DOCUMENT) private document: any,) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -76,7 +76,7 @@ export class PollGraphicComponent implements OnInit {
|
|||||||
this.formatDataAnswers(toto);
|
this.formatDataAnswers(toto);
|
||||||
|
|
||||||
this.isColorblind = false;
|
this.isColorblind = false;
|
||||||
this.pollData = new Chart(document.getElementById("graph"), {
|
this.pollData = new Chart(this.document.getElementById("graph"), {
|
||||||
type: "horizontalBar",
|
type: "horizontalBar",
|
||||||
data: {
|
data: {
|
||||||
labels: ["jeudi"],
|
labels: ["jeudi"],
|
||||||
|
@ -12,6 +12,7 @@ import {environment} from "../../environments/environment";
|
|||||||
})
|
})
|
||||||
export class ConfigService extends PollConfig {
|
export class ConfigService extends PollConfig {
|
||||||
myEmail: string;
|
myEmail: string;
|
||||||
|
loading: boolean = false;
|
||||||
baseHref: any = environment.baseApiHref;
|
baseHref: any = environment.baseApiHref;
|
||||||
myPolls: any;// list of retrieved polls from the backend api
|
myPolls: any;// list of retrieved polls from the backend api
|
||||||
|
|
||||||
@ -77,16 +78,23 @@ export class ConfigService extends PollConfig {
|
|||||||
const headerDict = {
|
const headerDict = {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
|
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE',
|
||||||
|
'Access-Control-Allow-Origin': environment.baseApiHref
|
||||||
};
|
};
|
||||||
|
|
||||||
const requestOptions = {
|
const requestOptions = {
|
||||||
headers: new HttpHeaders(headerDict),
|
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 => {
|
.subscribe(res => {
|
||||||
// message: 'Trouvé! Allez voir votre boite email',
|
// message: 'Trouvé! Allez voir votre boite email',
|
||||||
this.myPolls = res;
|
this.myPolls = res;
|
||||||
|
this.loading = false;
|
||||||
}, this.handleError
|
}, this.handleError
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -99,6 +107,7 @@ export class ConfigService extends PollConfig {
|
|||||||
handleError(err: any) {
|
handleError(err: any) {
|
||||||
// TODO handle a toast message
|
// TODO handle a toast message
|
||||||
console.error('err', err)
|
console.error('err', err)
|
||||||
|
this.loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -126,7 +135,7 @@ export class ConfigService extends PollConfig {
|
|||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
getPollById(id: string, password: string) {
|
getPollById(id: string, password: string) {
|
||||||
// http://127.0.0.1:8000/
|
|
||||||
this.http
|
this.http
|
||||||
.get(`${this.baseHref}/poll/${id}`,
|
.get(`${this.baseHref}/poll/${id}`,
|
||||||
{params: new HttpParams().set('body', password)})
|
{params: new HttpParams().set('body', password)})
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
import {Injectable} from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
import {ConfigService} from "./config.service";
|
|
||||||
import {HttpClient} from "@angular/common/http";
|
|
||||||
import {environment} from "../../environments/environment";
|
import {environment} from "../../environments/environment";
|
||||||
|
|
||||||
class JsonResponse {
|
|
||||||
message: string;
|
|
||||||
data: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
@ -15,9 +8,7 @@ export class PollService {
|
|||||||
|
|
||||||
private baseHref: string = environment.baseApiHref;
|
private baseHref: string = environment.baseApiHref;
|
||||||
|
|
||||||
constructor(private configService: ConfigService,
|
constructor() {
|
||||||
private document: Document,
|
|
||||||
private http: HttpClient) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export const environment = {
|
export const environment = {
|
||||||
production: true,
|
production: true,
|
||||||
baseApiHref : 'http://127.0.0.1:8000/api/v1/'
|
baseApiHref: 'http://127.0.0.1:8000/api/v1/'
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
|
|
||||||
export const environment = {
|
export const environment = {
|
||||||
production: false,
|
production: false,
|
||||||
baseApiHref: "http://localhost:8000/api/v1"
|
baseApiHref: "https://framadate-api.cipherbliss.com/api/v1"
|
||||||
|
// baseApiHref: "http://localhost:8000/api/v1"
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user