{
- return this.http.get(this.codeUrl)
+ return this.http.get(getStoredServerUrl() + this.codeUrl)
.toPromise()
.then(response => response as Code)
.catch(this.handleError);
diff --git a/web-client/src/app/members/Member.js b/web-client/src/app/members/Member.js
deleted file mode 100644
index fb0b941..0000000
--- a/web-client/src/app/members/Member.js
+++ /dev/null
@@ -1,8 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", {value: true});
-
-class Member {
-}
-
-exports.Member = Member;
-//# sourceMappingURL=Member.js.map
diff --git a/web-client/src/app/members/Member.js.map b/web-client/src/app/members/Member.js.map
deleted file mode 100644
index 35d95c5..0000000
--- a/web-client/src/app/members/Member.js.map
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "version": 3,
- "file": "Member.js",
- "sourceRoot": "",
- "sources": [
- "Member.ts"
- ],
- "names": [],
- "mappings": ";;AAAA;CAGC;AAHD,wBAGC"
-}
diff --git a/web-client/src/app/members/member.service.js b/web-client/src/app/members/member.service.js
deleted file mode 100644
index da6add7..0000000
--- a/web-client/src/app/members/member.service.js
+++ /dev/null
@@ -1,45 +0,0 @@
-"use strict";
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- var c = arguments.length,
- r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var __metadata = (this && this.__metadata) || function (k, v) {
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
-};
-Object.defineProperty(exports, "__esModule", {value: true});
-const core_1 = require("@angular/core");
-const http_1 = require("@angular/http");
-const config_component_1 = require("../config.component");
-require("rxjs/add/operator/toPromise");
-let MemberService = class MemberService {
- constructor(http) {
- this.http = http;
- this.membersUrl = config_component_1.SERVER_URL + '/stats/users';
- }
-
- getMembers() {
- return this.http.get(this.membersUrl)
- .toPromise()
- .then(response = > response.json()
- )
- .
- catch(this.handleError);
- }
-
- // getMember(id: number): Promise {
- // return this.getMembers().then(members => members.find(member => member.id === id));
- // }
- handleError(error) {
- console.error('An error occurred', error);
- return Promise.reject(error.message || error);
- }
-};
-MemberService = __decorate([
- core_1.Injectable(),
- __metadata("design:paramtypes", [http_1.Http])
-], MemberService);
-exports.MemberService = MemberService;
-//# sourceMappingURL=member.service.js.map
diff --git a/web-client/src/app/members/member.service.js.map b/web-client/src/app/members/member.service.js.map
deleted file mode 100644
index f3457f6..0000000
--- a/web-client/src/app/members/member.service.js.map
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "version": 3,
- "file": "member.service.js",
- "sourceRoot": "",
- "sources": [
- "member.service.ts"
- ],
- "names": [],
- "mappings": ";;;;;;;;;;;AAAA,wCAA2C;AAC3C,wCAAqC;AAErC,0DAA+C;AAC/C,uCAAqC;AAGrC,IAAa,aAAa,GAA1B;IAII,YAAoB,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;QAFtB,eAAU,GAAG,6BAAU,GAAG,cAAc,CAAC;IAEf,CAAC;IAEnC,UAAU;QACN,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC;aAChC,SAAS,EAAE;aACX,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAgB,CAAC;aAC/C,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;IAED,2CAA2C;IAC3C,0FAA0F;IAC1F,IAAI;IAEI,WAAW,CAAC,KAAU;QAC1B,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;QAC1C,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,CAAC;IAClD,CAAC;CACJ,CAAA;AArBY,aAAa;IADzB,iBAAU,EAAE;qCAKiB,WAAI;GAJrB,aAAa,CAqBzB;AArBY,sCAAa"
-}
diff --git a/web-client/src/app/members/member.service.ts b/web-client/src/app/members/member.service.ts
index 1b99489..7081009 100644
--- a/web-client/src/app/members/member.service.ts
+++ b/web-client/src/app/members/member.service.ts
@@ -1,64 +1,64 @@
import {Injectable} from '@angular/core';
import {StatsRow} from '../common/StatsRow';
import {HttpClient, HttpErrorResponse} from '@angular/common/http';
-import {environment} from "../../environments/environment";
import {User} from "./User";
import {MessageResponse} from "../common/MessageResponse";
+import {getStoredServerUrl} from "../settings/Settings";
@Injectable()
export class MemberService {
- private memberStatsUrl = environment.serverUrl + '/stats/users';
- private usersUrl = environment.serverUrl + '/users';
+ private memberStatsUrl = '/stats/users';
+ private usersUrl = '/users';
constructor(private http: HttpClient) {
}
getMemberStats(): Promise {
- return this.http.get(this.memberStatsUrl)
+ return this.http.get(getStoredServerUrl() + this.memberStatsUrl)
.toPromise()
.then(response => response as StatsRow[])
.catch(this.handleError);
}
getUsers(): Promise {
- return this.http.get(this.usersUrl + '?assigned')
+ return this.http.get(getStoredServerUrl() + this.usersUrl + '?assigned')
.toPromise()
.then(response => response as User[])
.catch(this.handleError);
}
getUnassignedUsers(): Promise {
- return this.http.get(this.usersUrl + '?unassigned')
+ return this.http.get(getStoredServerUrl() + this.usersUrl + '?unassigned')
.toPromise()
.then(response => response as User[])
.catch(this.handleError);
}
deleteUnassignedUsers(): Promise {
- return this.http.delete(this.usersUrl + '?unassigned')
+ return this.http.delete(getStoredServerUrl() + this.usersUrl + '?unassigned')
.toPromise()
.then(response => response as MessageResponse)
.catch(this.handleError);
}
updateUser(user: User) {
- return this.http.put(this.usersUrl + '/' + user.id, user)
+ return this.http.put(getStoredServerUrl() + this.usersUrl + '/' + user.id, user)
.toPromise()
.then(response => response as User)
.catch(this.handleError);
}
removeAllStats(): Promise {
- return this.http.delete(this.memberStatsUrl)
+ return this.http.delete(getStoredServerUrl() + this.memberStatsUrl)
.toPromise()
.then(response => response as MessageResponse)
.catch(this.handleError);
}
private handleError(error: any): Promise {
- console.error('An error occurred accessing ' + environment.serverUrl, error);
+ console.error('An error occurred accessing the server', error);
if (error instanceof HttpErrorResponse) {
console.error("Response status: " + error.status + " | Message: " + error.message);
}
diff --git a/web-client/src/app/members/members.component.js b/web-client/src/app/members/members.component.js
deleted file mode 100644
index a103329..0000000
--- a/web-client/src/app/members/members.component.js
+++ /dev/null
@@ -1,47 +0,0 @@
-"use strict";
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- var c = arguments.length,
- r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var __metadata = (this && this.__metadata) || function (k, v) {
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
-};
-Object.defineProperty(exports, "__esModule", {value: true});
-const core_1 = require("@angular/core");
-const member_service_1 = require("./member.service");
-let MembersComponent = class MembersComponent {
- constructor(memberService) {
- this.memberService = memberService;
- }
-
- ngOnInit() {
- this.getMembers();
- }
-
- onSelect(member) {
- this.selectedMember = member;
- }
-
- getMembers() {
- this.memberService.getMemberStats().then(members = > this.memberStats = members
- )
- ;
- }
-
- gotoDetail() {
- // this.router.navigate(['/detail', this.selectedMember.id]);
- }
-};
-MembersComponent = __decorate([
- core_1.Component({
- moduleId: module.id,
- selector: 'members',
- templateUrl: 'members.component.html'
- }),
- __metadata("design:paramtypes", [member_service_1.MemberService])
-], MembersComponent);
-exports.MembersComponent = MembersComponent;
-//# sourceMappingURL=members.component.js.map
diff --git a/web-client/src/app/members/members.component.js.map b/web-client/src/app/members/members.component.js.map
deleted file mode 100644
index cddb514..0000000
--- a/web-client/src/app/members/members.component.js.map
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "version": 3,
- "file": "members.component.js",
- "sourceRoot": "",
- "sources": [
- "members.component.ts"
- ],
- "names": [],
- "mappings": ";;;;;;;;;;;AAAA,wCAA0C;AAG1C,qDAAiD;AASjD,IAAa,gBAAgB,GAA7B;IAOE,YAAoB,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAAI,CAAC;IANrD,QAAQ;QACN,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IAMD,QAAQ,CAAC,MAAc;QACrB,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;IAC/B,CAAC;IAED,UAAU;QACR,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC;IAC1E,CAAC;IAED,UAAU;QACR,6DAA6D;IAC/D,CAAC;CACF,CAAA;AApBY,gBAAgB;IAN5B,gBAAS,CAAC;QACT,QAAQ,EAAE,MAAM,CAAC,EAAE;QACnB,QAAQ,EAAE,SAAS;QACnB,WAAW,EAAE,wBAAwB;KACtC,CAAC;qCASmC,8BAAa;GAPrC,gBAAgB,CAoB5B;AApBY,4CAAgB"
-}
diff --git a/web-client/src/app/members/members.component.ts b/web-client/src/app/members/members.component.ts
index 8329c45..fd7e7b0 100644
--- a/web-client/src/app/members/members.component.ts
+++ b/web-client/src/app/members/members.component.ts
@@ -1,8 +1,9 @@
import {Component} from '@angular/core';
import {OnInit} from '@angular/core';
-import {User} from './Member';
+import {User} from './User';
import {MemberService} from './member.service';
import {StatsRow} from '../common/StatsRow';
+import {ServerUrlService} from "../settings/server-url.service";
@Component({
moduleId: module.id,
@@ -10,15 +11,17 @@ import {StatsRow} from '../common/StatsRow';
templateUrl: 'members.component.html'
})
export class MembersComponent implements OnInit {
+
ngOnInit(): void {
- setInterval(() => this.getMembers(), 20 * 1000);
+ setInterval(() => this.getMembers(), 2 * 60 * 1000);
this.getMembers();
+ this.serverUrlService.change.subscribe(ignore => this.getMembers());
}
memberStats: StatsRow[];
selectedMember: User;
- constructor(private memberService: MemberService) {
+ constructor(private memberService: MemberService, private serverUrlService: ServerUrlService) {
}
onSelect(member: User): void {
@@ -26,7 +29,6 @@ export class MembersComponent implements OnInit {
}
getMembers(): void {
- console.log('get members');
this.memberService.getMemberStats().then(memberStats => this.memberStats = memberStats);
}
diff --git a/web-client/src/app/retriever/retriever.service.ts b/web-client/src/app/retriever/retriever.service.ts
index 73643d5..9b362c3 100644
--- a/web-client/src/app/retriever/retriever.service.ts
+++ b/web-client/src/app/retriever/retriever.service.ts
@@ -1,17 +1,17 @@
import {Injectable} from '@angular/core';
import {HttpClient, HttpErrorResponse} from '@angular/common/http';
-import {environment} from "../../environments/environment";
+import {getStoredServerUrl} from "../settings/Settings";
@Injectable()
export class RetrieverService {
- private forceRetrievalUrl = environment.serverUrl + '/retriever/now';
+ private forceRetrievalUrl = '/retriever/now';
constructor(private http: HttpClient) {
}
forceRetrieval(): Promise {
- return this.http.post(this.forceRetrievalUrl, {})
+ return this.http.post(getStoredServerUrl() + this.forceRetrievalUrl, {})
.toPromise()
.catch(this.handleError);
}
diff --git a/web-client/src/app/settings/Settings.ts b/web-client/src/app/settings/Settings.ts
new file mode 100644
index 0000000..a594d29
--- /dev/null
+++ b/web-client/src/app/settings/Settings.ts
@@ -0,0 +1,17 @@
+export const SERVER_URL_KEY = 'QUBOO_SERVER_URL';
+
+export function getStoredServerUrl() : string {
+ return localStorage.getItem(SERVER_URL_KEY);
+}
+
+export function isServerUrlStored() : boolean {
+ return localStorage.getItem(SERVER_URL_KEY) !== null;
+}
+
+export function defaultServerUrl(): string {
+ return window.location.protocol + '//' + window.location.hostname + ':8080';
+}
+
+export function saveServerUrl(url: string) {
+ localStorage.setItem(SERVER_URL_KEY, url);
+}
diff --git a/web-client/src/app/settings/server-url.component.html b/web-client/src/app/settings/server-url.component.html
new file mode 100644
index 0000000..ae05196
--- /dev/null
+++ b/web-client/src/app/settings/server-url.component.html
@@ -0,0 +1,27 @@
+
+ = new EventEmitter();
+
+ serverUrlUpdated(url: string) {
+ // the url is not used, it's taken from memory instead
+ this.change.emit(url);
+ }
+}
diff --git a/web-client/src/app/settings/settings.component.html b/web-client/src/app/settings/settings.component.html
index 07e0fc6..143488d 100644
--- a/web-client/src/app/settings/settings.component.html
+++ b/web-client/src/app/settings/settings.component.html
@@ -5,6 +5,19 @@
{{responseMessage.message}}
+
+
+ Quboo Service URL
+ Where is the Quboo backend service installed?
+
+
+ Saved value: {{getCurrentServerUrl()}}
+
+
+
+
Delete all unassigned players
diff --git a/web-client/src/app/settings/settings.component.ts b/web-client/src/app/settings/settings.component.ts
index e757fe1..9030b65 100644
--- a/web-client/src/app/settings/settings.component.ts
+++ b/web-client/src/app/settings/settings.component.ts
@@ -2,6 +2,7 @@ import {Component} from "@angular/core";
import {TeamsService} from "../teams/teams.service";
import {MemberService} from "../members/member.service";
import {MessageResponse} from "../common/MessageResponse";
+import {SERVER_URL_KEY} from "./Settings";
@Component({
moduleId: module.id,
@@ -40,6 +41,10 @@ export class SettingsComponent {
this.removeAllStatsText = null;
}
+ getCurrentServerUrl(): string {
+ return localStorage.getItem(SERVER_URL_KEY);
+ }
+
}
diff --git a/web-client/src/app/teams/Team.js b/web-client/src/app/teams/Team.js
deleted file mode 100644
index fb734f2..0000000
--- a/web-client/src/app/teams/Team.js
+++ /dev/null
@@ -1,8 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", {value: true});
-
-class Team {
-}
-
-exports.Team = Team;
-//# sourceMappingURL=Team.js.map
diff --git a/web-client/src/app/teams/Team.js.map b/web-client/src/app/teams/Team.js.map
deleted file mode 100644
index c2c413d..0000000
--- a/web-client/src/app/teams/Team.js.map
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "version": 3,
- "file": "Team.js",
- "sourceRoot": "",
- "sources": [
- "Team.ts"
- ],
- "names": [],
- "mappings": ";;AAAA;CAGC;AAHD,oBAGC"
-}
diff --git a/web-client/src/app/teams/mock-teams.js b/web-client/src/app/teams/mock-teams.js
deleted file mode 100644
index 36fb8fd..0000000
--- a/web-client/src/app/teams/mock-teams.js
+++ /dev/null
@@ -1,7 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", {value: true});
-exports.TEAMS = [
- {id: 11, name: 'Senores Patatas'},
- {id: 12, name: 'Totramusicos'}
-];
-//# sourceMappingURL=mock-teams.js.map
diff --git a/web-client/src/app/teams/mock-teams.js.map b/web-client/src/app/teams/mock-teams.js.map
deleted file mode 100644
index 033e93b..0000000
--- a/web-client/src/app/teams/mock-teams.js.map
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "version": 3,
- "file": "mock-teams.js",
- "sourceRoot": "",
- "sources": [
- "mock-teams.ts"
- ],
- "names": [],
- "mappings": ";;AAEa,QAAA,KAAK,GAAW;IACzB,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE;IACnC,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;CACnC,CAAC"
-}
diff --git a/web-client/src/app/teams/teams.component.html b/web-client/src/app/teams/teams.component.html
index 1c29485..6b6ef6b 100644
--- a/web-client/src/app/teams/teams.component.html
+++ b/web-client/src/app/teams/teams.component.html
@@ -1,4 +1,5 @@
Team Ranking
+
diff --git a/web-client/src/app/settings/server-url.component.ts b/web-client/src/app/settings/server-url.component.ts
new file mode 100644
index 0000000..ae52f32
--- /dev/null
+++ b/web-client/src/app/settings/server-url.component.ts
@@ -0,0 +1,35 @@
+import {Component, OnInit} from "@angular/core";
+import {defaultServerUrl, getStoredServerUrl, isServerUrlStored, saveServerUrl} from "./Settings";
+import {ServerUrlService} from "./server-url.service";
+
+@Component({
+ moduleId: module.id,
+ selector: 'server-url',
+ templateUrl: 'server-url.component.html'
+})
+export class ServerUrlComponent implements OnInit {
+
+ url: string;
+ serverUrlService: ServerUrlService;
+
+ constructor(serverUrlService: ServerUrlService) {
+ this.url = isServerUrlStored() ? getStoredServerUrl() : defaultServerUrl();
+ this.serverUrlService = serverUrlService;
+ }
+
+ saveServerUrl(): void {
+ saveServerUrl(this.url);
+ this.serverUrlService.serverUrlUpdated(this.url);
+ }
+
+ hasServerUrl(): boolean {
+ return isServerUrlStored();
+ }
+
+ ngOnInit(): void {
+ if(!this.hasServerUrl()) {
+ document.getElementById('showModalButton').click();
+ }
+ }
+
+}
diff --git a/web-client/src/app/settings/server-url.service.ts b/web-client/src/app/settings/server-url.service.ts
new file mode 100644
index 0000000..64c4ad5
--- /dev/null
+++ b/web-client/src/app/settings/server-url.service.ts
@@ -0,0 +1,13 @@
+import {EventEmitter, Injectable, Output} from "@angular/core";
+
+@Injectable()
+export class ServerUrlService {
+
+ @Output()
+ change: EventEmitter