add filters for archive raids. add date/time on raid details
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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()
|
||||
Generated
+5
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user