add filters for archive raids. add date/time on raid details

This commit is contained in:
peter
2020-05-10 13:15:29 +02:00
parent a949085e62
commit f9110bd2df
13 changed files with 62 additions and 153 deletions
+1
View File
@@ -8,6 +8,7 @@ plugins
static
data
conf
log.txt
*.d.ts
*.js
-138
View File
@@ -1,138 +0,0 @@
[2020-04-12T02:46:02.286] [DEBUG] Admin#makeKnex - Making new knex: {
client: 'sqlite3',
connection: {
filename: '/home/cake/nitowa.xyz/frontcraft/admin/data/frontworkAdmin.sqlite'
},
migrations: {
directory: '/home/cake/nitowa.xyz/frontcraft/admin/migrations',
extension: 'ts'
},
useNullAsDefault: true
}
[2020-04-12T02:46:02.426] [DEBUG] Admin#startWebsocket - Websocket up on 20000
[2020-04-12T02:46:02.427] [DEBUG] UserManager#initialize - setting up permissions
skipping spec insertion
[2020-04-12T02:46:02.613] [DEBUG] Admin#start - 6 components initialized
[2020-04-12T02:46:03.296] [INFO] Admin#startWebserver - Frontend from /home/cake/nitowa.xyz/frontcraft/admin/dist/server.js loaded
[2020-04-12T02:46:03.297] [INFO] Admin#startWebserver - Admin panel listening for HTTP on *8080
[2020-04-12T02:46:42.194] [DEBUG] UserManager#checkConnection - {
celinda: {
connections: { '45536': [Socket] },
auth: { token: [Object], user: [Object], port: 20001 },
user: {
id: 3,
username: 'celinda',
rank: 'Officer',
MC: 1,
BWL: 0,
ZG: 1,
AQ20: 1,
AQ40: 1,
Naxx: 1
}
}
} [ 'cfa202ff-5f2c-4e4e-9fa5-9a45233ab0e0' ]
[2020-04-12T02:49:29.208] [DEBUG] UserManager#closeHandler - {
celinda: {
connections: {},
auth: { token: [Object], user: [Object], port: 20001 },
user: {
id: 3,
username: 'celinda',
rank: 'Officer',
MC: 1,
BWL: 0,
ZG: 1,
AQ20: 1,
AQ40: 1,
Naxx: 1
}
}
} [ 'cfa202ff-5f2c-4e4e-9fa5-9a45233ab0e0' ]
[2020-04-12T02:49:31.572] [DEBUG] UserManager#checkConnection - {
celinda: {
connections: { '46948': [Socket] },
auth: { token: [Object], user: [Object], port: 20001 },
user: {
id: 3,
username: 'celinda',
rank: 'Officer',
MC: 1,
BWL: 0,
ZG: 1,
AQ20: 1,
AQ40: 1,
Naxx: 1
}
}
} [ 'cfa202ff-5f2c-4e4e-9fa5-9a45233ab0e0' ]
[2020-04-12T02:49:37.031] [DEBUG] UserManager#closeHandler - {
celinda: {
connections: {},
auth: { token: [Object], user: [Object], port: 20001 },
user: {
id: 3,
username: 'celinda',
rank: 'Officer',
MC: 1,
BWL: 0,
ZG: 1,
AQ20: 1,
AQ40: 1,
Naxx: 1
}
}
} [ 'cfa202ff-5f2c-4e4e-9fa5-9a45233ab0e0' ]
[2020-04-12T02:49:38.886] [DEBUG] UserManager#checkConnection - {
celinda: {
connections: { '47044': [Socket] },
auth: { token: [Object], user: [Object], port: 20001 },
user: {
id: 3,
username: 'celinda',
rank: 'Officer',
MC: 1,
BWL: 0,
ZG: 1,
AQ20: 1,
AQ40: 1,
Naxx: 1
}
}
} [ 'cfa202ff-5f2c-4e4e-9fa5-9a45233ab0e0' ]
[2020-04-12T02:49:44.132] [DEBUG] UserManager#closeHandler - {} []
[2020-04-12T02:52:10.916] [DEBUG] UserManager#checkConnection - {
celinda: {
connections: { '48390': [Socket] },
auth: { token: [Object], user: [Object], port: 20001 },
user: {
id: 3,
username: 'celinda',
rank: 'Officer',
MC: 1,
BWL: 0,
ZG: 0,
AQ20: 1,
AQ40: 1,
Naxx: 1
}
}
} [ '7a8bbb51-412a-4bee-9e0e-9b7cbaef82d8' ]
[2020-04-12T02:52:47.682] [INFO] process#SIGINT - Shutting down from SIGINT (Ctrl-C)
[2020-04-12T02:52:47.684] [DEBUG] UserManager#closeHandler - {
celinda: {
connections: {},
auth: { token: [Object], user: [Object], port: 20001 },
user: {
id: 3,
username: 'celinda',
rank: 'Officer',
MC: 1,
BWL: 0,
ZG: 0,
AQ20: 1,
AQ40: 1,
Naxx: 1
}
}
} [ '7a8bbb51-412a-4bee-9e0e-9b7cbaef82d8' ]
+2 -1
View File
@@ -5,7 +5,8 @@
"scripts": {
"tsc": "tsc",
"knex": "knex",
"launch": "node lib/src/backend/Launcher.js > log.txt",
"launch": "npm run debug > log.txt",
"debug": "node lib/src/backend/Launcher.js",
"start": "npm run build && npm run launch",
"start-backend": "npm run build-backend && npm run launch",
"test": "rm -rf data && npm run build-backend && mocha lib/test/backendTest.js",
+14 -5
View File
@@ -7,6 +7,7 @@ import * as Path from 'path'
import * as Knex from 'knex';
import * as http from 'http';
import * as express from 'express';
import { existsSync } from "fs";
import { GuildManager } from '../Components/Guild/GuildManager';
import { ItemManager } from '../Components/Item/ItemManager';
import { RaidManager } from '../Components/Raid/RaidManager';
@@ -21,8 +22,6 @@ import { IAdmin } from './Interface';
import { Injector } from '../Injector/Injector';
import { PubSub } from '../Components/PubSub/PubSub';
getLogger().level = 'debug'
@RootComponent({
injectable: IAdmin,
injects: [
@@ -137,14 +136,24 @@ export class FrontworkAdmin
this.express.get('*.*', (req, res) => {
//console.log('*.*', req.path);
res.sendFile(Path.join(__dirname, distFolder, 'browser', decodeURIComponent(req.path)))
res.status(200)
try{
const filepath = Path.join(__dirname, distFolder, 'browser', decodeURIComponent(req.path))
if(!existsSync(filepath)){
throw new Error("Bad file access: "+filepath)
}
res.sendFile(filepath)
res.status(200)
}catch(e){
getLogger('Admin#startWebserver#serveFile').error(String(e))
res.send("404 NOT FOUND")
res.status(404)
}
})
try {
const req = require(distFolder + "/server.js")
await req.attachExpress(this.express, './dist', getLogger('angularSSR#'))
getLogger('Admin#startWebserver').info('Frontend from ' + ngExpressServer + " loaded")
getLogger('Admin#startWebserver').debug('Frontend from ' + ngExpressServer + " loaded")
} catch (e) {
getLogger('Admin#startWebserver').error(e)
getLogger('Admin#startWebserver').warn("No angular SSR module was provided in " + ngExpressServer)
@@ -7,6 +7,7 @@ import { getSpecTableData, SpecT } from "../../Types/PlayerSpecs";
import { IAdmin } from "../../Admin/Interface";
import { IUserManager } from "../User/Interface";
import { ICharacterManager } from "./Interface";
import { getLogger } from "log4js";
@Injectable(ICharacterManager)
export class CharacterManager
@@ -61,7 +62,9 @@ implements FrontworkComponent<CharacterManagerIfc, RPCInterface>, ICharacterMana
initialize = async () => {
if(this.initialized) return
this.initialized = true
await this.admin.knex('specs').insert(getSpecTableData()).catch(e => { console.log("skipping spec insertion") })
await this.admin.knex('specs').insert(getSpecTableData()).catch(e => {
getLogger('CharacterManager#createCharacter').debug("skipping spec insertion")
})
}
createCharacter = async (userToken: string, character : Character) : Promise<Character> => {
@@ -72,7 +75,7 @@ implements FrontworkComponent<CharacterManagerIfc, RPCInterface>, ICharacterMana
const char : Character = await this.admin.knex.select('*').from('characters').where(character).first()
return char
}catch(e){
console.log(e);
getLogger('CharacterManager#createCharacter').error(e);
}
throw new Error('Unable to create character')
}
@@ -17,8 +17,6 @@ import { IRaidManager } from "../Raid/Interface";
import { IItemManager } from "../Item/Interface";
import { IGuildManager } from "../Guild/Interface";
getLogger().level = "debug"
const uuid = require('uuid/v4')
const salt = "6pIbc6yjSN"
+3 -1
View File
@@ -1,6 +1,8 @@
import { Injector } from './Injector/Injector';
import { IAdmin } from './Admin/Interface';
import "./Admin/Admin"
require('events').EventEmitter.defaultMaxListeners = 0;
import {getLogger} from 'log4js';
getLogger().level = "debug"
require('events').EventEmitter.defaultMaxListeners = 0;
Injector.resolve<IAdmin>(IAdmin).start()
+5
View File
@@ -13523,6 +13523,11 @@
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
"dev": true
},
"node-fetch": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
"integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA=="
},
"node-fetch-npm": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/node-fetch-npm/-/node-fetch-npm-2.0.2.tgz",
+1
View File
@@ -74,6 +74,7 @@
"ng2-smart-table": "1.3.5",
"ngx-cookie-service": "^2.2.0",
"ngx-echarts": "^4.0.1",
"node-fetch": "^2.6.0",
"node-sass": "^4.13.1",
"normalize.css": "6.0.0",
"pace-js": "1.0.2",
+9 -1
View File
@@ -7,11 +7,15 @@ import { resolve } from 'path';
import { enableProdMode } from '@angular/core';
const domino = require('domino');
const win = domino.createWindow('');
const fetch = require('node-fetch');
global['window'] = win;
global['document'] = win.document;
global['alert'] = console.log
global['XMLHttpRequest'] = require('xmlhttprequest').XMLHttpRequest;
global['fetch'] = fetch.default;
export async function attachExpress(app, staticDir = "./dist", logger = console) {
const STATIC_FOLDER = resolve(process.cwd(), staticDir);
@@ -54,6 +58,10 @@ export async function attachExpress(app, staticDir = "./dist", logger = console)
app.get('*', (req, res) => {
//console.log('*', req.path);
res.render(resolve(STATIC_FOLDER, 'browser/index'), { req, res })
try{
res.render(resolve(STATIC_FOLDER, 'browser/index'), { req, res })
}catch(e){
loggerService.error(e)
}
});
}
@@ -15,6 +15,9 @@
<p style="white-space: pre-line;">
{{raid.description}}
</p>
<p>
{{raid.start | date : 'EEE MMM d'}} {{raid.start | date : 'HH:mm'}}
</p>
<div *ngIf="canSignup">
<div *ngIf="isSignedup" style="width: 100%;">
<p style="white-space: pre-line;">
@@ -39,7 +39,15 @@
</nb-card>
<nb-card class="col-12 col-xl-9">
<nb-card-header>Previous raids</nb-card-header>
<nb-card-header>Previous raids (Limit <input nbInput style="width: 100px;" type="number" [(ngModel)]="archiveCount" (change)="refresh()" />
Showing only tier
<nb-select [(selected)]="tier" placeholder="Tier" (selectedChange)="refresh()">
<nb-option *ngFor="let _tier of tiers" [value]="_tier">
{{_tier}}
</nb-option>
</nb-select>
)
</nb-card-header>
<nb-list nbInfiniteList listenWindowScroll [threshold]="500">
<nb-list-item *ngFor="let raid of oldraids" [routerLink]="'/frontcraft/archive/'+raid.id">
<a [routerLink]="'/frontcraft/archive/'+raid.id">
@@ -6,6 +6,7 @@ import { IApiService } from '../../services/ApiService/ApiService';
import { UpdatingComponent } from '../../UpdatingComponent';
import { LoggerService } from '../../services/LoggerService/logger.service';
import { FlashService } from '../../services/flash-service';
import { Tiers, _Tiers } from '../../../../../../backend/Types/Items';
@Component({
selector: 'raids',
@@ -16,11 +17,14 @@ export class FrontcraftRaidsComponent
extends UpdatingComponent
implements OnInit {
archiveCount = 50
tiers:string[] = ["any", ..._Tiers]
tier = "any"
manageRaid
raids = []
oldraids = []
pageSize = 10;
pageSize = 25;
constructor(
injector: Injector,
@@ -47,7 +51,11 @@ export class FrontcraftRaidsComponent
async refresh() {
this.raids = await this.api.get('RaidManager').getRaids()
const raidManager = this.api.get('RaidManager')
this.oldraids = await raidManager.getPastRaids(10)
this.oldraids = await raidManager.getPastRaids(this.archiveCount)
if(this.tier !== "any"){
this.oldraids = this.oldraids.filter(raid => raid.tier === this.tier)
}
}
create() {