{
16 | return this.http.get(getStoredServerUrl() + this.codeUrl)
17 | .toPromise()
18 | .then(response => response as Code)
19 | .catch(this.handleError);
20 | }
21 |
22 | private handleError(error: any): Promise {
23 | console.error('An error occurred accessing ' + this.codeUrl, error);
24 | if (error instanceof HttpErrorResponse) {
25 | console.error("Response status: " + error.status + " | Message: " + error.message);
26 | }
27 | return Promise.resolve(new Code("-NOCODE-"));
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/web-client/src/app/members/User.ts:
--------------------------------------------------------------------------------
1 | export class User {
2 |
3 | constructor(id: string, login: string, alias: string, team: string) {
4 | this.id = id;
5 | this.login = login;
6 | this.alias = alias;
7 | this.team = team;
8 | }
9 |
10 | id: string;
11 | login: string;
12 | alias: string;
13 | team: string;
14 | }
15 |
--------------------------------------------------------------------------------
/web-client/src/app/members/member.service.ts:
--------------------------------------------------------------------------------
1 | import {Injectable} from '@angular/core';
2 | import {StatsRow} from '../common/StatsRow';
3 | import {HttpClient, HttpErrorResponse} from '@angular/common/http';
4 | import {User} from "./User";
5 | import {MessageResponse} from "../common/MessageResponse";
6 | import {getStoredServerUrl} from "../settings/Settings";
7 |
8 |
9 | @Injectable()
10 | export class MemberService {
11 |
12 | private memberStatsUrl = '/stats/users';
13 | private usersUrl = '/users';
14 |
15 | constructor(private http: HttpClient) {
16 | }
17 |
18 | getMemberStats(): Promise {
19 | return this.http.get(getStoredServerUrl() + this.memberStatsUrl)
20 | .toPromise()
21 | .then(response => response as StatsRow[])
22 | .catch(this.handleError);
23 | }
24 |
25 | getUsers(): Promise {
26 | return this.http.get(getStoredServerUrl() + this.usersUrl + '?assigned')
27 | .toPromise()
28 | .then(response => response as User[])
29 | .catch(this.handleError);
30 | }
31 |
32 | getUnassignedUsers(): Promise {
33 | return this.http.get(getStoredServerUrl() + this.usersUrl + '?unassigned')
34 | .toPromise()
35 | .then(response => response as User[])
36 | .catch(this.handleError);
37 | }
38 |
39 | deleteUnassignedUsers(): Promise {
40 | return this.http.delete(getStoredServerUrl() + this.usersUrl + '?unassigned')
41 | .toPromise()
42 | .then(response => response as MessageResponse)
43 | .catch(this.handleError);
44 | }
45 |
46 | updateUser(user: User) {
47 | return this.http.put(getStoredServerUrl() + this.usersUrl + '/' + user.id, user)
48 | .toPromise()
49 | .then(response => response as User)
50 | .catch(this.handleError);
51 | }
52 |
53 | removeAllStats(): Promise {
54 | return this.http.delete(getStoredServerUrl() + this.memberStatsUrl)
55 | .toPromise()
56 | .then(response => response as MessageResponse)
57 | .catch(this.handleError);
58 | }
59 |
60 | private handleError(error: any): Promise {
61 | console.error('An error occurred accessing the server', error);
62 | if (error instanceof HttpErrorResponse) {
63 | console.error("Response status: " + error.status + " | Message: " + error.message);
64 | }
65 | return Promise.reject(error.message || error);
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/web-client/src/app/members/members.component.html:
--------------------------------------------------------------------------------
1 | Player Ranking
2 |
3 |
4 |
5 |
6 | Ranking
7 | Name
8 | Team
9 | Score
10 | Badges
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 
21 | 0" align="center">{{i + 1}}
22 | {{member.userAlias}}
23 | {{member.userTeam}}
24 | {{member.totalPoints}}
25 | {{b.name}}
26 | {{member.blocker}}
27 | {{member.critical}}
28 | {{member.major}}
29 | {{member.minor}}
30 | {{member.info}}
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/web-client/src/app/members/members.component.ts:
--------------------------------------------------------------------------------
1 | import {Component} from '@angular/core';
2 | import {OnInit} from '@angular/core';
3 | import {User} from './User';
4 | import {MemberService} from './member.service';
5 | import {StatsRow} from '../common/StatsRow';
6 | import {ServerUrlService} from "../settings/server-url.service";
7 |
8 | @Component({
9 | moduleId: module.id,
10 | selector: 'members',
11 | templateUrl: 'members.component.html'
12 | })
13 | export class MembersComponent implements OnInit {
14 |
15 | ngOnInit(): void {
16 | setInterval(() => this.getMembers(), 2 * 60 * 1000);
17 | this.getMembers();
18 | this.serverUrlService.change.subscribe(ignore => this.getMembers());
19 | }
20 |
21 | memberStats: StatsRow[];
22 | selectedMember: User;
23 |
24 | constructor(private memberService: MemberService, private serverUrlService: ServerUrlService) {
25 | }
26 |
27 | onSelect(member: User): void {
28 | this.selectedMember = member;
29 | }
30 |
31 | getMembers(): void {
32 | this.memberService.getMemberStats().then(memberStats => this.memberStats = memberStats);
33 | }
34 |
35 | }
36 |
37 |
--------------------------------------------------------------------------------
/web-client/src/app/retriever/retriever.service.ts:
--------------------------------------------------------------------------------
1 | import {Injectable} from '@angular/core';
2 | import {HttpClient, HttpErrorResponse} from '@angular/common/http';
3 | import {getStoredServerUrl} from "../settings/Settings";
4 |
5 | @Injectable()
6 | export class RetrieverService {
7 |
8 | private forceRetrievalUrl = '/retriever/now';
9 |
10 | constructor(private http: HttpClient) {
11 | }
12 |
13 | forceRetrieval(): Promise {
14 | return this.http.post(getStoredServerUrl() + this.forceRetrievalUrl, {})
15 | .toPromise()
16 | .catch(this.handleError);
17 | }
18 |
19 | private handleError(error: any): Promise {
20 | if (error instanceof HttpErrorResponse) {
21 | console.error("Response status: " + error.status + " | Message: " + error.message);
22 | }
23 | return Promise.reject(error.message || error);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/web-client/src/app/settings/Settings.ts:
--------------------------------------------------------------------------------
1 | export const SERVER_URL_KEY = 'QUBOO_SERVER_URL';
2 |
3 | export function getStoredServerUrl() : string {
4 | return localStorage.getItem(SERVER_URL_KEY);
5 | }
6 |
7 | export function isServerUrlStored() : boolean {
8 | return localStorage.getItem(SERVER_URL_KEY) !== null;
9 | }
10 |
11 | export function defaultServerUrl(): string {
12 | return window.location.protocol + '//' + window.location.hostname + ':8080';
13 | }
14 |
15 | export function saveServerUrl(url: string) {
16 | localStorage.setItem(SERVER_URL_KEY, url);
17 | }
18 |
--------------------------------------------------------------------------------
/web-client/src/app/settings/organizer.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{errorMessage}}
6 |
7 |
8 | Teams
9 |
10 |
11 | {{team.name}}
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Players
25 |
26 |
27 |
28 |
31 |
32 |
33 |
34 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | Login
44 | Alias
45 | Team
46 |
47 |
48 |
49 |
50 |
51 | {{user.login}}
52 | {{user.alias}}
53 |
54 |
55 |
56 | {{user.team}}
57 |
58 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/web-client/src/app/settings/organizer.component.ts:
--------------------------------------------------------------------------------
1 | import {Component, OnInit} from "@angular/core";
2 | import {TeamsService} from "../teams/teams.service";
3 | import {Team} from "../teams/Team";
4 | import {MemberService} from "../members/member.service";
5 | import {User} from "../members/User";
6 |
7 | @Component({
8 | moduleId: module.id,
9 | selector: 'organizer',
10 | templateUrl: 'organizer.component.html'
11 | })
12 | export class OrganizerComponent implements OnInit {
13 |
14 | readonly TEAM_NOT_ASSIGNED: string = '--NO-TEAM--';
15 |
16 | constructor(private teamsService: TeamsService,
17 | private usersService: MemberService) {
18 | }
19 |
20 | teams: Team[] = [];
21 | users: User[] = [];
22 | assignedUsers: User[] = [];
23 | orphanUsers: User[] = [];
24 | editingId: string;
25 | showAssigned: boolean = true;
26 | showUnassigned: boolean = true;
27 | editingNewTeam: boolean = false;
28 | newTeamName: string = null;
29 | errorMessage: string = null;
30 |
31 | ngOnInit(): void {
32 | this.update();
33 | this.noEditing();
34 | }
35 |
36 | async update() {
37 | this.teamsService.getTeams().then(teams => this.teams = teams);
38 | let userPromise, orphanPromise;
39 | if (this.showAssigned) {
40 | userPromise = this.usersService.getUsers().then(users => this.assignedUsers = users);
41 | await userPromise;
42 | } else {
43 | this.assignedUsers = [];
44 | }
45 | if (this.showUnassigned) {
46 | orphanPromise = this.usersService.getUnassignedUsers().then(users => this.orphanUsers = users);
47 | await orphanPromise;
48 | } else {
49 | this.orphanUsers = [];
50 | }
51 | this.users = this.assignedUsers.concat(this.orphanUsers);
52 | }
53 |
54 | editUser(id: string) {
55 | this.editingId = id;
56 | }
57 |
58 | async saveUser(_user: User) {
59 | let user = new User(_user.id, _user.login, _user.alias, _user.team === this.TEAM_NOT_ASSIGNED ? null : _user.team);
60 | let userPromise = this.usersService.updateUser(user);
61 | await userPromise;
62 | this.noEditing();
63 | }
64 |
65 | cancel(): void {
66 | this.noEditing();
67 | this.update();
68 | }
69 |
70 | noEditing(): void {
71 | this.editingId = null;
72 | }
73 |
74 | addNewTeam(): void {
75 | this.editingNewTeam = true;
76 | }
77 |
78 | async saveNewTeam() {
79 | let newTeamPromise = this.teamsService.createTeam(this.newTeamName);
80 | await newTeamPromise;
81 | this.editingNewTeam = false;
82 | this.update();
83 | }
84 |
85 | cancelNewTeamEditing(): void {
86 | this.newTeamName = null;
87 | this.editingNewTeam = false;
88 | }
89 |
90 | updateErrorMessage(msg: string) {
91 | this.errorMessage = msg;
92 | }
93 |
94 | async deleteTeam(teamId: string) {
95 | let deleteTeamPromise = this.teamsService.deleteTeam(teamId)
96 | .then(response => {
97 | if(response.error) {
98 | this.updateErrorMessage(response.message);
99 | }
100 | });
101 | // TODO proper error handling here and above
102 | await deleteTeamPromise;
103 | this.update();
104 | }
105 |
106 | }
107 |
--------------------------------------------------------------------------------
/web-client/src/app/settings/server-url.component.html:
--------------------------------------------------------------------------------
1 |
4 |
28 |
--------------------------------------------------------------------------------
/web-client/src/app/settings/server-url.component.ts:
--------------------------------------------------------------------------------
1 | import {Component, OnInit} from "@angular/core";
2 | import {defaultServerUrl, getStoredServerUrl, isServerUrlStored, saveServerUrl} from "./Settings";
3 | import {ServerUrlService} from "./server-url.service";
4 |
5 | @Component({
6 | moduleId: module.id,
7 | selector: 'server-url',
8 | templateUrl: 'server-url.component.html'
9 | })
10 | export class ServerUrlComponent implements OnInit {
11 |
12 | url: string;
13 | serverUrlService: ServerUrlService;
14 |
15 | constructor(serverUrlService: ServerUrlService) {
16 | this.url = isServerUrlStored() ? getStoredServerUrl() : defaultServerUrl();
17 | this.serverUrlService = serverUrlService;
18 | }
19 |
20 | saveServerUrl(): void {
21 | saveServerUrl(this.url);
22 | this.serverUrlService.serverUrlUpdated(this.url);
23 | }
24 |
25 | hasServerUrl(): boolean {
26 | return isServerUrlStored();
27 | }
28 |
29 | ngOnInit(): void {
30 | if(!this.hasServerUrl()) {
31 | document.getElementById('showModalButton').click();
32 | }
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/web-client/src/app/settings/server-url.service.ts:
--------------------------------------------------------------------------------
1 | import {EventEmitter, Injectable, Output} from "@angular/core";
2 |
3 | @Injectable()
4 | export class ServerUrlService {
5 |
6 | @Output()
7 | change: EventEmitter = new EventEmitter();
8 |
9 | serverUrlUpdated(url: string) {
10 | // the url is not used, it's taken from memory instead
11 | this.change.emit(url);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/web-client/src/app/settings/settings.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{responseMessage.message}}
6 |
7 |
8 |
9 |
10 | Quboo Service URL
11 | Where is the Quboo backend service installed?
12 |
13 |
16 | Saved value: {{getCurrentServerUrl()}}
17 |
18 |
19 |
20 |
21 |
22 |
23 | Delete all unassigned players
24 | You can delete all players that are not assigned to a team.
25 | This is useful when you want to do a cleaning of users. Bear in mind that,
26 | if you have enabled User Sync with the server, you may get again unassigned users if they
27 | still exist there.
28 | This is a destructive action. Those players will also lose their statistics.
29 | Write below 'remove-all-unassigned' to enable the button.
30 |
31 |
32 |
35 |
36 |
37 |
38 |
39 |
40 | Delete all statistics
41 | You can delete all the statistics that are stored in this game: points and badges for all the
42 | players.
43 | This is useful when you want to do a game reset and start over again.
44 | During the next synchronization with the server, you'll get only the history of resolved issues that is kept
45 | there.
46 | This is a destructive action. All players will lose their statistics.
47 | Even after synchronization, the results may be different since the server might be storing data only
48 | for a limited period of time (e.g. the last month). Write below 'remove-all-stats' to enable the button.
49 |
50 |
51 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/web-client/src/app/settings/settings.component.ts:
--------------------------------------------------------------------------------
1 | import {Component} from "@angular/core";
2 | import {TeamsService} from "../teams/teams.service";
3 | import {MemberService} from "../members/member.service";
4 | import {MessageResponse} from "../common/MessageResponse";
5 | import {SERVER_URL_KEY} from "./Settings";
6 |
7 | @Component({
8 | moduleId: module.id,
9 | selector: 'settings',
10 | templateUrl: 'settings.component.html'
11 | })
12 | export class SettingsComponent {
13 |
14 | constructor(private teamsService: TeamsService,
15 | private usersService: MemberService) {
16 | }
17 |
18 | responseMessage: MessageResponse = null;
19 | removeAllUnassignedText: string = null;
20 | removeAllStatsText: string = null;
21 |
22 | setMessage(res: MessageResponse): void {
23 | this.responseMessage = res;
24 | }
25 |
26 | canRemoveAllUnassigned(): boolean {
27 | return this.removeAllUnassignedText === 'remove-all-unassigned';
28 | }
29 |
30 | canRemoveAllStats(): boolean {
31 | return this.removeAllStatsText === 'remove-all-stats';
32 | }
33 |
34 | removeAllUnnassignedUsers(): void {
35 | this.usersService.deleteUnassignedUsers().then(response => this.setMessage(response));
36 | this.removeAllUnassignedText = null;
37 | }
38 |
39 | removeAllStats(): void {
40 | this.usersService.removeAllStats().then(response => this.setMessage(response));
41 | this.removeAllStatsText = null;
42 | }
43 |
44 | getCurrentServerUrl(): string {
45 | return localStorage.getItem(SERVER_URL_KEY);
46 | }
47 |
48 | }
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/web-client/src/app/teams/Team.ts:
--------------------------------------------------------------------------------
1 | export class Team {
2 | constructor(name: string) {
3 | this.name = name;
4 | }
5 | id: number;
6 | name: string;
7 | }
8 |
--------------------------------------------------------------------------------
/web-client/src/app/teams/mock-teams.ts:
--------------------------------------------------------------------------------
1 | import {Team} from "./Team";
2 |
3 | export const TEAMS: Team[] = [
4 | {id: 11, name: 'Senores Patatas'},
5 | {id: 12, name: 'Totramusicos'}
6 | ];
7 |
--------------------------------------------------------------------------------
/web-client/src/app/teams/teams.component.html:
--------------------------------------------------------------------------------
1 | Team Ranking
2 |
3 |
4 |
5 |
6 |
7 | Ranking
8 | Team
9 | Total Score
10 | Total Paid Debt (min)
11 |
12 |
13 |
14 |
16 | 
17 | 0" align="center">{{i + 1}}
18 | {{team.userTeam}}
19 | {{team.totalPoints}}
20 | {{team.totalPaidDebt}}
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/web-client/src/app/teams/teams.component.ts:
--------------------------------------------------------------------------------
1 | import {Component, OnInit} from '@angular/core';
2 | import {TeamsService} from './teams.service';
3 | import {StatsRow} from '../common/StatsRow';
4 | import {ServerUrlService} from "../settings/server-url.service";
5 |
6 | @Component({
7 | moduleId: module.id,
8 | selector: 'teams',
9 | templateUrl: 'teams.component.html'
10 | })
11 | export class TeamsComponent implements OnInit {
12 |
13 | constructor(private teamsService: TeamsService, private serverUrlService: ServerUrlService) {
14 | }
15 |
16 | teams: StatsRow[];
17 |
18 | ngOnInit(): void {
19 | setInterval(() => this.getTeams(), 2 * 60 * 1000);
20 | this.getTeams();
21 | this.serverUrlService.change.subscribe(ignore => this.getTeams());
22 | }
23 |
24 | getTeams(): void {
25 | this.teamsService.getTeamStats().then(teams => this.teams = teams);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/web-client/src/app/teams/teams.service.ts:
--------------------------------------------------------------------------------
1 | import {Injectable} from '@angular/core';
2 | import {StatsRow} from '../common/StatsRow';
3 | import {HttpClient, HttpErrorResponse} from '@angular/common/http';
4 | import {Team} from "./Team";
5 | import {MessageResponse} from "../common/MessageResponse";
6 | import {getStoredServerUrl} from "../settings/Settings";
7 |
8 | @Injectable()
9 | export class TeamsService {
10 |
11 | private teamStatsUrl = '/stats/teams';
12 | private teamsUrl = '/teams';
13 |
14 | constructor(private http: HttpClient) {
15 | }
16 |
17 | getTeamStats(): Promise {
18 | return this.http.get(getStoredServerUrl() + this.teamStatsUrl)
19 | .toPromise()
20 | .then(response => response as StatsRow[])
21 | .catch(this.handleError);
22 | }
23 |
24 | getTeams(): Promise {
25 | return this.http.get(getStoredServerUrl() + this.teamsUrl).toPromise()
26 | .then(response => response as Team[])
27 | .catch(this.handleError);
28 | }
29 |
30 | createTeam(teamName): Promise {
31 | return this.http.post(getStoredServerUrl() + this.teamsUrl, new Team(teamName)).toPromise()
32 | .then(response => response as Team)
33 | .catch(this.handleError);
34 | }
35 |
36 | deleteTeam(teamId: string): Promise {
37 | return this.http.delete(getStoredServerUrl() + this.teamsUrl + '/' + teamId).toPromise()
38 | .then(response => response as MessageResponse)
39 | .catch(this.handleError)
40 | }
41 |
42 | private handleError(error: any): Promise {
43 | if (error.status === 422) {
44 | return Promise.resolve(new MessageResponse(error.error.message, true));
45 | } else {
46 | console.error('An error occurred accessing the server', error);
47 | if (error instanceof HttpErrorResponse) {
48 | console.error("Response status: " + error.status + " | Message: " + error.message);
49 | }
50 | return Promise.reject(error.message || error);
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/web-client/src/assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mechero/code-quality-game/1acd1e3f72f998bcda5877c9b628bd215e356188/web-client/src/assets/.gitkeep
--------------------------------------------------------------------------------
/web-client/src/assets/img/become_a_patron_button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mechero/code-quality-game/1acd1e3f72f998bcda5877c9b628bd215e356188/web-client/src/assets/img/become_a_patron_button.png
--------------------------------------------------------------------------------
/web-client/src/assets/img/monkey_logo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mechero/code-quality-game/1acd1e3f72f998bcda5877c9b628bd215e356188/web-client/src/assets/img/monkey_logo.gif
--------------------------------------------------------------------------------
/web-client/src/assets/img/quboo_gold.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mechero/code-quality-game/1acd1e3f72f998bcda5877c9b628bd215e356188/web-client/src/assets/img/quboo_gold.png
--------------------------------------------------------------------------------
/web-client/src/assets/img/quboo_logo_orange_250.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mechero/code-quality-game/1acd1e3f72f998bcda5877c9b628bd215e356188/web-client/src/assets/img/quboo_logo_orange_250.png
--------------------------------------------------------------------------------
/web-client/src/browserslist:
--------------------------------------------------------------------------------
1 | # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 | # For IE 9-11 support, please uncomment the last line of the file and adjust as needed
5 | > 0.5%
6 | last 2 versions
7 | Firefox ESR
8 | not dead
9 | # IE 9-11
--------------------------------------------------------------------------------
/web-client/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true,
3 | };
4 |
--------------------------------------------------------------------------------
/web-client/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false,
7 | };
8 |
9 | /*
10 | * In development mode, for easier debugging, you can ignore zone related error
11 | * stack frames such as `zone.run`/`zoneDelegate.invokeTask` by importing the
12 | * below file. Don't forget to comment it out in production mode
13 | * because it will have a performance impact when errors are thrown
14 | */
15 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
16 |
--------------------------------------------------------------------------------
/web-client/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mechero/code-quality-game/1acd1e3f72f998bcda5877c9b628bd215e356188/web-client/src/favicon.ico
--------------------------------------------------------------------------------
/web-client/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Quboo - The Code Quality Boosters
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | Loading...
14 |
15 |
16 |
--------------------------------------------------------------------------------
/web-client/src/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration file, see link for more information
2 | // https://karma-runner.github.io/1.0/config/configuration-file.html
3 |
4 | module.exports = function (config) {
5 | config.set({
6 | basePath: '',
7 | frameworks: ['jasmine', '@angular-devkit/build-angular'],
8 | plugins: [
9 | require('karma-jasmine'),
10 | require('karma-chrome-launcher'),
11 | require('karma-jasmine-html-reporter'),
12 | require('karma-coverage-istanbul-reporter'),
13 | require('@angular-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../coverage'),
20 | reports: ['html', 'lcovonly'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['progress', 'kjhtml'],
24 | port: 9876,
25 | colors: true,
26 | logLevel: config.LOG_INFO,
27 | autoWatch: true,
28 | browsers: ['Chrome'],
29 | singleRun: false
30 | });
31 | };
--------------------------------------------------------------------------------
/web-client/src/main.ts:
--------------------------------------------------------------------------------
1 | import {enableProdMode} from '@angular/core';
2 | import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
3 |
4 | import {AppModule} from './app/app.module';
5 | import {environment} from './environments/environment';
6 |
7 | if (environment.production) {
8 | enableProdMode();
9 | }
10 |
11 | platformBrowserDynamic().bootstrapModule(AppModule)
12 | .catch(err => console.log(err));
13 |
--------------------------------------------------------------------------------
/web-client/src/polyfills.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * This file includes polyfills needed by Angular and is loaded before the app.
3 | * You can add your own extra polyfills to this file.
4 | *
5 | * This file is divided into 2 sections:
6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8 | * file.
9 | *
10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13 | *
14 | * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/
22 | // import 'core-js/es6/symbol';
23 | // import 'core-js/es6/object';
24 | // import 'core-js/es6/function';
25 | // import 'core-js/es6/parse-int';
26 | // import 'core-js/es6/parse-float';
27 | // import 'core-js/es6/number';
28 | // import 'core-js/es6/math';
29 | // import 'core-js/es6/string';
30 | // import 'core-js/es6/date';
31 | // import 'core-js/es6/array';
32 | // import 'core-js/es6/regexp';
33 | // import 'core-js/es6/map';
34 | // import 'core-js/es6/weak-map';
35 | // import 'core-js/es6/set';
36 |
37 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */
38 | // import 'classlist.js'; // Run `npm install --save classlist.js`.
39 |
40 | /** IE10 and IE11 requires the following for the Reflect API. */
41 | // import 'core-js/es6/reflect';
42 |
43 |
44 | /** Evergreen browsers require these. **/
45 | // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
46 | import 'core-js/es7/reflect';
47 |
48 |
49 | /**
50 | * Web Animations `@angular/platform-browser/animations`
51 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
52 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
53 | **/
54 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
55 |
56 | /**
57 | * By default, zone.js will patch all possible macroTask and DomEvents
58 | * user can disable parts of macroTask/DomEvents patch by setting following flags
59 | */
60 |
61 | // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
62 | // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
63 | // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
64 |
65 | /*
66 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
67 | * with the following flag, it will bypass `zone.js` patch for IE/Edge
68 | */
69 | // (window as any).__Zone_enable_cross_context_check = true;
70 |
71 | /***************************************************************************************************
72 | * Zone JS is required by default for Angular itself.
73 | */
74 | import 'zone.js/dist/zone'; // Included with Angular CLI.
75 |
76 |
77 | /***************************************************************************************************
78 | * APPLICATION IMPORTS
79 | */
80 |
--------------------------------------------------------------------------------
/web-client/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 | html, body {
3 | height: 100%;
4 | }
5 | body {
6 |
7 | }
8 | .body-flex {
9 | height: 100%;
10 | display: flex;
11 | flex-direction: column;
12 | }
13 | .content {
14 | flex: 1 0 auto;
15 | }
16 | .footer {
17 | flex-shrink: 0;
18 | margin-bottom: 0;
19 | padding: 10px 0;
20 | }
21 | .footer-content {
22 | display: flex;
23 | align-items: baseline;
24 | justify-content: center;
25 | }
26 | .container-fluid {
27 | padding-left: 0;
28 | padding-right: 0;
29 | }
30 | .gameBackgroundPanel{
31 | display: flex;
32 | justify-content: center;
33 | align-items: flex-start;
34 | margin-top: 1em;
35 | }
36 | .gamePageContent{
37 | width: 1024px;
38 | max-width: 1024px;
39 | }
40 | .team-container {
41 | display: flex;
42 | flex-wrap: wrap;
43 | margin: 25px 0 25px 0;
44 | align-items: center;
45 | }
46 | .team-item {
47 | display: flex;
48 | margin-right: 10px;
49 | margin-bottom: 5px;
50 | align-items: center;
51 | }
52 | .team-item-label {
53 | padding-right: 10px;
54 | }
55 | .checks-container {
56 | display: flex;
57 | margin-top: 20px;
58 | margin-bottom: 10px;
59 | }
60 | .checkbox-and-label {
61 | margin-right: 15px;
62 | }
63 | .checkbox-in-flex {
64 | padding-right: 10px;
65 | }
66 | .players-container {
67 | margin: 25px 0 25px 0;
68 | }
69 | .sm-margin-right {
70 | margin-right: 5px;
71 | }
72 | .new-team-box {
73 | display: flex;
74 | margin: 10px 10px 10px 10px;
75 | align-items: center;
76 | }
77 | .badge-normal {
78 | font-size: 100%;
79 | }
80 | .badge-stats {
81 | font-size: 75%;
82 | font-weight: lighter;
83 | margin-right: 5px;
84 | }
85 | #players td {
86 | font-size: 18px;
87 | vertical-align: middle;
88 | }
89 | #teams td {
90 | font-size: 18px;
91 | vertical-align: middle;
92 | }
93 | .navbar-item-custom {
94 | font-size: 18px;
95 | margin-right: 1rem;
96 | }
97 | .navbar-nopadding {
98 | padding: 0 0.5rem;
99 | }
100 | .ptr {
101 | display: flex;
102 | align-items: center;
103 | }
104 | .ptr-text {
105 | font-size: 18px;
106 | margin-right: 10px;
107 | }
108 |
--------------------------------------------------------------------------------
/web-client/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'zone.js/dist/zone-testing';
4 | import {getTestBed} from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: any;
11 |
12 | // First, initialize the Angular testing environment.
13 | getTestBed().initTestEnvironment(
14 | BrowserDynamicTestingModule,
15 | platformBrowserDynamicTesting()
16 | );
17 | // Then we find all the tests.
18 | const context = require.context('./', true, /\.spec\.ts$/);
19 | // And load the modules.
20 | context.keys().map(context);
21 |
--------------------------------------------------------------------------------
/web-client/src/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/app"
5 | },
6 | "exclude": [
7 | "test.ts",
8 | "**/*.spec.ts"
9 | ]
10 | }
11 |
--------------------------------------------------------------------------------
/web-client/src/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "test.ts",
12 | "polyfills.ts"
13 | ],
14 | "include": [
15 | "**/*.spec.ts",
16 | "**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/web-client/src/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tslint.json",
3 | "rules": {
4 | "directive-selector": [
5 | true,
6 | "attribute",
7 | "app",
8 | "camelCase"
9 | ],
10 | "component-selector": [
11 | true,
12 | "element",
13 | "app",
14 | "kebab-case"
15 | ]
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/web-client/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "baseUrl": "./",
5 | "outDir": "./dist/out-tsc",
6 | "sourceMap": true,
7 | "declaration": false,
8 | "module": "es2015",
9 | "moduleResolution": "node",
10 | "emitDecoratorMetadata": true,
11 | "experimentalDecorators": true,
12 | "target": "es5",
13 | "typeRoots": [
14 | "node_modules/@types"
15 | ],
16 | "lib": [
17 | "es2017",
18 | "dom"
19 | ]
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/web-client/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rulesDirectory": [
3 | "node_modules/codelyzer"
4 | ],
5 | "rules": {
6 | "arrow-return-shorthand": true,
7 | "callable-types": true,
8 | "class-name": true,
9 | "comment-format": [
10 | true,
11 | "check-space"
12 | ],
13 | "curly": true,
14 | "deprecation": {
15 | "severity": "warn"
16 | },
17 | "eofline": true,
18 | "forin": true,
19 | "import-blacklist": [
20 | true,
21 | "rxjs/Rx"
22 | ],
23 | "import-spacing": true,
24 | "indent": [
25 | true,
26 | "spaces"
27 | ],
28 | "interface-over-type-literal": true,
29 | "label-position": true,
30 | "max-line-length": [
31 | true,
32 | 140
33 | ],
34 | "member-access": false,
35 | "member-ordering": [
36 | true,
37 | {
38 | "order": [
39 | "static-field",
40 | "instance-field",
41 | "static-method",
42 | "instance-method"
43 | ]
44 | }
45 | ],
46 | "no-arg": true,
47 | "no-bitwise": true,
48 | "no-console": [
49 | true,
50 | "debug",
51 | "info",
52 | "time",
53 | "timeEnd",
54 | "trace"
55 | ],
56 | "no-construct": true,
57 | "no-debugger": true,
58 | "no-duplicate-super": true,
59 | "no-empty": false,
60 | "no-empty-interface": true,
61 | "no-eval": true,
62 | "no-inferrable-types": [
63 | true,
64 | "ignore-params"
65 | ],
66 | "no-misused-new": true,
67 | "no-non-null-assertion": true,
68 | "no-shadowed-variable": true,
69 | "no-string-literal": false,
70 | "no-string-throw": true,
71 | "no-switch-case-fall-through": true,
72 | "no-trailing-whitespace": true,
73 | "no-unnecessary-initializer": true,
74 | "no-unused-expression": true,
75 | "no-use-before-declare": true,
76 | "no-var-keyword": true,
77 | "object-literal-sort-keys": false,
78 | "one-line": [
79 | true,
80 | "check-open-brace",
81 | "check-catch",
82 | "check-else",
83 | "check-whitespace"
84 | ],
85 | "prefer-const": true,
86 | "quotemark": [
87 | true,
88 | "single"
89 | ],
90 | "radix": true,
91 | "semicolon": [
92 | true,
93 | "always"
94 | ],
95 | "triple-equals": [
96 | true,
97 | "allow-null-check"
98 | ],
99 | "typedef-whitespace": [
100 | true,
101 | {
102 | "call-signature": "nospace",
103 | "index-signature": "nospace",
104 | "parameter": "nospace",
105 | "property-declaration": "nospace",
106 | "variable-declaration": "nospace"
107 | }
108 | ],
109 | "unified-signatures": true,
110 | "variable-name": false,
111 | "whitespace": [
112 | true,
113 | "check-branch",
114 | "check-decl",
115 | "check-operator",
116 | "check-separator",
117 | "check-type"
118 | ],
119 | "no-output-on-prefix": true,
120 | "use-input-property-decorator": true,
121 | "use-output-property-decorator": true,
122 | "use-host-property-decorator": true,
123 | "no-input-rename": true,
124 | "no-output-rename": true,
125 | "use-life-cycle-interface": true,
126 | "use-pipe-transform-interface": true,
127 | "component-class-suffix": true,
128 | "directive-class-suffix": true
129 | }
130 | }
131 |
--------------------------------------------------------------------------------