CT-30 BUG: Forcetracker clear button removes login token #15

Merged
mitch merged 1 commits from feature/CT-32/remove-unit-detail-page into master 2022-03-28 12:13:33 +00:00
11 changed files with 3 additions and 534 deletions
Showing only changes of commit 9747e08167 - Show all commits

View File

@ -75,7 +75,7 @@
<div class="row">
<div class="col-md-3" style="border: 1px solid black;">
Unit {{rowIndex + 1}}:
<a [routerLink]="['/unit-army', unit.id, 'view']"> {{ unit.unitName }}</a>
<a [routerLink]="['/unit-army', unit.id, 'edit']"> {{ unit.unitName }}</a>
</div>
<div class="col-md-1" style="border: 1px solid black; background: whitesmoke; color: #0f0f0f">
{{ unit.rank }}

View File

@ -53,7 +53,7 @@
</div>
<div class="row" style="justify-content: center">
<div class="col-md-6-mobile" style="width: 30%">
<a [routerLink]="['/unit-army', unit.id, 'view']">{{unit.unitName}}</a></div>
<a [routerLink]="['/unit-army', unit.id, 'edit']">{{unit.unitName}}</a></div>
<div class="col-md-6-mobile" style="width: 15%">{{unit.unitPowerLevel}}</div>
<div class="col-md-6-mobile" style="width: 15%">{{unit.crusadePointsUnit}}</div>
<div class="col-md-6-mobile" style="width: 15%; border: transparent">

View File

@ -1,23 +0,0 @@
import {Component} from "@angular/core";
import {UnitArmyDetailComponent} from "./unit-army-detail.component";
import {JhiDataUtils, JhiEventManager} from "ng-jhipster";
import {ActivatedRoute} from "@angular/router";
import {UnitArmyService} from "./unit-army.service";
import {ArmyService} from "../army/army.service";
import {FormBuilder} from "@angular/forms";
@Component({
selector: 'jhi-unit-army-detail-desktop',
templateUrl: './unit-army-detail.component-desktop.html'
})
export class UnitArmyDetailDesktopComponent extends UnitArmyDetailComponent {
constructor(protected dataUtils: JhiDataUtils,
protected activatedRoute: ActivatedRoute,
protected eventManager: JhiEventManager,
protected unitArmyService: UnitArmyService,
protected armyService: ArmyService,
protected fb: FormBuilder) {
// super(dataUtils, activatedRoute);
super(dataUtils, activatedRoute, eventManager, unitArmyService, armyService, fb);
}
}

View File

@ -1,24 +0,0 @@
import {Component} from "@angular/core";
import {UnitArmyDetailComponent} from "./unit-army-detail.component";
import {JhiDataUtils, JhiEventManager} from "ng-jhipster";
import {ActivatedRoute} from "@angular/router";
import {UnitArmyService} from "./unit-army.service";
import {ArmyService} from "../army/army.service";
import {FormBuilder} from "@angular/forms";
import {EventManager} from "@angular/platform-browser";
@Component({
selector: 'jhi-unit-army-detail-mobile',
templateUrl: './unit-army-detail.component-mobile.html'
})
export class UnitArmyDetailMobileComponent extends UnitArmyDetailComponent {
constructor(protected dataUtils: JhiDataUtils,
protected activatedRoute: ActivatedRoute,
protected eventManager: JhiEventManager,
protected unitArmyService: UnitArmyService,
protected armyService: ArmyService,
protected fb: FormBuilder) {
// super(dataUtils, activatedRoute);
super(dataUtils, activatedRoute, eventManager, unitArmyService, armyService, fb);
}
}

View File

@ -1,147 +0,0 @@
<div *ngIf="unitArmy">
<div class="row justify-content-center">
<div class="col-10" align="center">
<div *ngIf="unitArmy.army">
<h2><a [routerLink]="['/army', unitArmy.army.id, 'view']">{{ unitArmy.army.armyName }}</a> {{ unitArmy.unitName }}</h2>
</div>
<jhi-alert-error></jhi-alert-error>
</div>
</div>
<div class="unit">
<div class="row">
<div class="col-md-3">
UNIT NAME:
</div>
<div class="col-md-6">
<span>{{ unitArmy.unitName }}</span>
</div>
</div>
<div class="row">
<div class="col-md-3">
BATTLEFIELD ROLE:
</div>
<div class="col-md-6">
{{unitArmy.battlefieldRole}}
</div>
</div>
<div class="row">
<div class="col-md-3">
CRUSADE FACTION:
</div>
<div class="col-md-6">
{{unitArmy.army}}
</div>
</div>
</div>
<div class="unit" padding-top="20px">
<div class="row">
<div class="col-md-3">
UNIT TYPE:
</div>
<div class="col-md-6">
<span>{{unitArmy.unitBookName}}</span>
</div>
</div>
<div class="row">
<div class="col-md-3">
EQUIPMENT:
</div>
<div class="col-md-6">
<span>{{ unitArmy.equipment }}</span>
</div>
</div>
<div class="row">
<div class="col-md-3">
PSYCHIC POWERS:
</div>
<div class="col-md-6">
<span>{{ unitArmy.psychicPowersTaken }}</span>
</div>
</div>
<div class="row">
<div class="col-md-3">
WARLORD TRAITS:
</div>
<div class="col-md-6">
<span>{{ unitArmy.warlordTraits }}</span>
</div>
</div>
<div class="row">
<div class="col-md-3">
RELICS:
</div>
<div class="col-md-6">
<span>{{ unitArmy.relics }}</span>
</div>
</div>
</div>
<p> Entries below should remain blank when the unit is first added to your Order of Battle. Fill these entries out as you play with the unit and when it has earned any Battle Honours or Battle Scars.</p>
<div class="unit-header" align="center">
COMBAT TALLIES
</div>
<div class="row">
<div class="col-md-2">
<strong>BATTLES PLAYED:</strong>
</div>
<div class="col-3">
<span>{{ unitArmy.battlesPlayed }}</span>
</div>
<div class="col-md-2">
<strong>BATTLES SURVIVED:</strong>
</div>
<div class="col-3">
<span>{{ unitArmy.battlesSurvived }}</span>
</div>
</div>
<div class="unit">
<div class="row">
<div class="col-md-2" style="border: 1px solid black"></div>
<div class="col-md-4" style="border: 1px solid black">
<strong>...During this battle:</strong>
</div>
<div class="col-md-4" style="border: 1px solid black">
<strong>...In total:</strong>
</div>
</div>
<div class="row">
<div class="col-md-2" style="border: 1px solid black">
Enemy units destroyed:
</div>
<div class="col-md-4" style="border: 1px solid black">
<!-- <input type="number" class="form-control" name="enemyUnitsDestroyed"-->
<!-- formControlName="enemyUnitsDestroyed"/>-->
</div>
<div class="col-md-4" style="border: 1px solid black">
{{ unitArmy.enemyUnitsDestroyed }}
</div>
</div>
</div>
<div class="unit-header" align="center" >
RANK
</div>
<div class="unit-information">
<div class="row">
<div class="col-md-5" style="color: #2d2d2d; font-size: 150%; width: 10%">{{ unitArmy.experiencePoints }} Experience Points</div>
<div class="col-md-5" style="color:#ff2b31; font-size: 150%; width: 90%">{{ unitArmy.rank }}</div>
</div>
<div class="row" style="border: 1px solid black" align="center">
Unit background and other information
</div>
<div class="row" style="border: 1px solid black">
<span>{{ unitArmy.unitDescription }}</span>
</div>
<button type="submit"
(click)="previousState()"
class="btn btn-info">
<fa-icon icon="arrow-left"></fa-icon>&nbsp;<span>Back</span>
</button>
<button type="button"
[routerLink]="['/unit-army', unitArmy.id, 'edit']"
class="btn btn-primary">
<fa-icon icon="pencil-alt"></fa-icon>&nbsp;<span>Edit</span>
</button>

View File

@ -1,147 +0,0 @@
<div *ngIf="unitArmy">
<div class="row justify-content-center">
<div class="col-10" align="center">
<div *ngIf="unitArmy.army">
<h2><a [routerLink]="['/army', unitArmy.army.id, 'view']">{{ unitArmy.army.armyName }}</a> {{ unitArmy.unitName }}</h2>
</div>
<jhi-alert-error></jhi-alert-error>
</div>
</div>
<div class="unit">
<div class="row">
<div class="col-md-3">
UNIT NAME:
</div>
<div class="col-md-6">
<span>{{ unitArmy.unitName }}</span>
</div>
</div>
<div class="row">
<div class="col-md-3">
BATTLEFIELD ROLE:
</div>
<div class="col-md-6">
{{unitArmy.battlefieldRole}}
</div>
</div>
<div class="row">
<div class="col-md-3">
CRUSADE FACTION:
</div>
<div class="col-md-6">
{{unitArmy.army}}
</div>
</div>
</div>
<div class="unit" padding-top="20px">
<div class="row">
<div class="col-md-3">
UNIT TYPE:
</div>
<div class="col-md-6">
<span>{{unitArmy.unitBookName}}</span>
</div>
</div>
<div class="row">
<div class="col-md-3">
EQUIPMENT:
</div>
<div class="col-md-6">
<span>{{ unitArmy.equipment }}</span>
</div>
</div>
<div class="row">
<div class="col-md-3">
PSYCHIC POWERS:
</div>
<div class="col-md-6">
<span>{{ unitArmy.psychicPowersTaken }}</span>
</div>
</div>
<div class="row">
<div class="col-md-3">
WARLORD TRAITS:
</div>
<div class="col-md-6">
<span>{{ unitArmy.warlordTraits }}</span>
</div>
</div>
<div class="row">
<div class="col-md-3">
RELICS:
</div>
<div class="col-md-6">
<span>{{ unitArmy.relics }}</span>
</div>
</div>
</div>
<p> Entries below should remain blank when the unit is first added to your Order of Battle. Fill these entries out as you play with the unit and when it has earned any Battle Honours or Battle Scars.</p>
<div class="unit-header" align="center">
COMBAT TALLIES
</div>
<div class="row">
<div class="col-md-2">
<strong>BATTLES PLAYED:</strong>
</div>
<div class="col-3">
<span>{{ unitArmy.battlesPlayed }}</span>
</div>
<div class="col-md-2">
<strong>BATTLES SURVIVED:</strong>
</div>
<div class="col-3">
<span>{{ unitArmy.battlesSurvived }}</span>
</div>
</div>
<div class="unit">
<div class="row">
<div class="col-md-2" style="border: 1px solid black"></div>
<div class="col-md-4" style="border: 1px solid black">
<strong>...During this battle:</strong>
</div>
<div class="col-md-4" style="border: 1px solid black">
<strong>...In total:</strong>
</div>
</div>
<div class="row">
<div class="col-md-2" style="border: 1px solid black">
Enemy units destroyed:
</div>
<div class="col-md-4" style="border: 1px solid black">
<!-- <input type="number" class="form-control" name="enemyUnitsDestroyed"-->
<!-- formControlName="enemyUnitsDestroyed"/>-->
</div>
<div class="col-md-4" style="border: 1px solid black">
{{ unitArmy.enemyUnitsDestroyed }}
</div>
</div>
</div>
<div class="unit-header" align="center" >
RANK
</div>
<div class="unit-information">
<div class="row">
<div class="col-md-5" style="color: #2d2d2d; font-size: 150%; width: 30%">{{ unitArmy.experiencePoints }} EXP</div>
<div class="col-md-5" style="color:#ff2b31; font-size: 150%; width: 90%">{{ unitArmy.rank }}</div>
</div>
<div class="row" style="border: 1px solid black" align="center">
Unit background and other information
</div>
<div class="row" style="border: 1px solid black">
<span>{{ unitArmy.unitDescription }}</span>
</div>
<button type="submit"
(click)="previousState()"
class="btn btn-info">
<fa-icon icon="arrow-left"></fa-icon>&nbsp;<span>Back</span>
</button>
<button type="button"
[routerLink]="['/unit-army', unitArmy.id, 'edit']"
class="btn btn-primary">
<fa-icon icon="pencil-alt"></fa-icon>&nbsp;<span>Edit</span>
</button>

View File

@ -1,7 +0,0 @@
<div class="desktop-container" *ngIf="!isMobileResolution; else mobileContainer">
<jhi-unit-army-detail-desktop></jhi-unit-army-detail-desktop>
</div>
<ng-template #mobileContainer>
<jhi-unit-army-detail-mobile></jhi-unit-army-detail-mobile>
</ng-template>

View File

@ -1,164 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { JhiDataUtils, JhiEventManager, JhiEventWithContent, JhiFileLoadError } from 'ng-jhipster';
import { IUnitArmy, UnitArmy } from 'app/shared/model/unit-army.model';
import { FormBuilder, Validators } from '@angular/forms';
import { UnitArmyService } from './unit-army.service';
import { ArmyService } from '../army/army.service';
import { AlertError } from '../../shared/alert/alert-error.model';
import { Observable } from 'rxjs';
import { HttpResponse } from '@angular/common/http';
import { IArmy } from '../../shared/model/army.model';
import {ResponsiveService} from "../../responsive.service";
@Component({
selector: 'jhi-unit-army-detail',
templateUrl: './unit-army-detail.component.html',
})
export class UnitArmyDetailComponent implements OnInit {
unitArmy: IUnitArmy | null = null;
isSaving = false;
private responsiveService: ResponsiveService = new ResponsiveService();
public isMobileResolution: boolean;
armies: IArmy[] = [];
editForm = this.fb.group({
id: [],
unitName: [],
unitBookName: [],
unitDescription: [],
unitPowerLevel: [],
unitPoints: [],
enemyUnitsDestroyed: [],
agendaOneTally: [],
agendaTwoTally: [],
agendaThreeTally: [],
equipment: [],
psychicPowersTaken: [],
warlordTraits: [],
relics: [],
otherUpgrades: [],
crusadePointsUnit: [],
experiencePoints: [],
battlesPlayed: [],
battlesSurvived: [],
rank: [],
battleHonours: [],
battleScars: [],
battlefieldRole: [],
army: [null, Validators.required],
});
constructor(
protected dataUtils: JhiDataUtils,
protected activatedRoute: ActivatedRoute,
protected eventManager: JhiEventManager,
protected unitArmyService: UnitArmyService,
protected armyService: ArmyService,
protected fb: FormBuilder
) {
this.isMobileResolution = this.responsiveService.getMobileStatus();
}
ngOnInit(): void {
this.activatedRoute.data.subscribe(({ unitArmy }) => (this.unitArmy = unitArmy));
}
byteSize(base64String: string): string {
return this.dataUtils.byteSize(base64String);
}
openFile(contentType = '', base64String: string): void {
this.dataUtils.openFile(contentType, base64String);
}
previousState(): void {
window.history.back();
}
updateForm(unitArmy: IUnitArmy): void {
this.editForm.patchValue({
id: unitArmy.id,
unitName: unitArmy.unitName,
unitBookName: unitArmy.unitBookName,
unitDescription: unitArmy.unitDescription,
unitPowerLevel: unitArmy.unitPowerLevel,
unitPoints: unitArmy.unitPoints,
enemyUnitsDestroyed: unitArmy.enemyUnitsDestroyed,
equipment: unitArmy.equipment,
psychicPowersTaken: unitArmy.psychicPowersTaken,
warlordTraits: unitArmy.warlordTraits,
relics: unitArmy.relics,
otherUpgrades: unitArmy.otherUpgrades,
crusadePointsUnit: unitArmy.crusadePointsUnit,
experiencePoints: unitArmy.experiencePoints,
battlesPlayed: unitArmy.battlesPlayed,
battlesSurvived: unitArmy.battlesSurvived,
rank: unitArmy.rank,
battleHonours: unitArmy.battleHonours,
battleScars: unitArmy.battleScars,
battlefieldRole: unitArmy.battlefieldRole,
army: unitArmy.army,
});
}
setFileData(event: Event, field: string, isImage: boolean): void {
this.dataUtils.loadFileToForm(event, this.editForm, field, isImage).subscribe(null, (err: JhiFileLoadError) => {
this.eventManager.broadcast(
new JhiEventWithContent<AlertError>('crusadetrackerApp.error', { message: err.message })
);
});
}
save(): void {
this.isSaving = true;
const unitArmy = this.createFromForm();
if (unitArmy.id !== undefined) {
this.subscribeToSaveResponse(this.unitArmyService.update(unitArmy));
} else {
this.subscribeToSaveResponse(this.unitArmyService.create(unitArmy));
}
}
private createFromForm(): IUnitArmy {
return {
...new UnitArmy(),
id: this.editForm.get(['id'])!.value,
unitName: this.editForm.get(['unitName'])!.value,
unitDescription: this.editForm.get(['unitDescription'])!.value,
enemyUnitsDestroyed: this.editForm.get(['enemyUnitsDestroyed'])!.value,
equipment: this.editForm.get(['equipment'])!.value,
psychicPowersTaken: this.editForm.get(['psychicPowersTaken'])!.value,
warlordTraits: this.editForm.get(['warlordTraits'])!.value,
relics: this.editForm.get(['relics'])!.value,
otherUpgrades: this.editForm.get(['otherUpgrades'])!.value,
crusadePointsUnit: this.editForm.get(['crusadePointsUnit'])!.value,
experiencePoints: this.editForm.get(['experiencePoints'])!.value,
battlesPlayed: this.editForm.get(['battlesPlayed'])!.value,
battlesSurvived: this.editForm.get(['battlesSurvived'])!.value,
rank: this.editForm.get(['rank'])!.value,
battleHonours: this.editForm.get(['battleHonours'])!.value,
battleScars: this.editForm.get(['battleScars'])!.value,
battlefieldRole: this.editForm.get(['battlefieldRole'])!.value,
army: this.editForm.get(['army'])!.value,
};
}
protected subscribeToSaveResponse(result: Observable<HttpResponse<IUnitArmy>>): void {
result.subscribe(
() => this.onSaveSuccess(),
() => this.onSaveError()
);
}
protected onSaveSuccess(): void {
this.isSaving = false;
this.previousState();
}
protected onSaveError(): void {
this.isSaving = false;
}
}

View File

@ -51,7 +51,7 @@
</thead>
<tbody>
<tr *ngFor="let unitArmy of unitArmies ;trackBy: trackId">
<td><a [routerLink]="['/unit-army', unitArmy.id, 'view']">{{ unitArmy.id }}</a></td>
<td><a [routerLink]="['/unit-army', unitArmy.id, 'edit']">{{ unitArmy.id }}</a></td>
<td>{{ unitArmy.unitName }}</td>
<td>{{ unitArmy.unitBookName }}</td>
<td>{{ unitArmy.unitDescription }}</td>

View File

@ -3,19 +3,13 @@ import { RouterModule } from '@angular/router';
import { CrusadetrackerSharedModule } from 'app/shared/shared.module';
import { UnitArmyComponent } from './unit-army.component';
import { UnitArmyDetailComponent } from './unit-army-detail.component';
import { UnitArmyUpdateComponent } from './unit-army-update.component';
import { UnitArmyDeleteDialogComponent } from './unit-army-delete-dialog.component';
import { unitArmyRoute } from './unit-army.route';
import {UnitArmyDetailDesktopComponent} from "./unit-army-detail-desktop.component";
import {UnitArmyDetailMobileComponent} from "./unit-army-detail-mobile.component";
@NgModule({
imports: [CrusadetrackerSharedModule, RouterModule.forChild(unitArmyRoute)],
declarations: [UnitArmyComponent,
UnitArmyDetailComponent,
UnitArmyDetailDesktopComponent,
UnitArmyDetailMobileComponent,
UnitArmyUpdateComponent,
UnitArmyDeleteDialogComponent],
entryComponents: [UnitArmyDeleteDialogComponent],

View File

@ -9,7 +9,6 @@ import { UserRouteAccessService } from 'app/core/auth/user-route-access-service'
import { IUnitArmy, UnitArmy } from 'app/shared/model/unit-army.model';
import { UnitArmyService } from './unit-army.service';
import { UnitArmyComponent } from './unit-army.component';
import { UnitArmyDetailComponent } from './unit-army-detail.component';
import { UnitArmyUpdateComponent } from './unit-army-update.component';
@Injectable({ providedIn: 'root' })
@ -44,18 +43,6 @@ export const unitArmyRoute: Routes = [
},
canActivate: [UserRouteAccessService],
},
{
path: ':id/view',
component: UnitArmyDetailComponent,
resolve: {
unitArmy: UnitArmyResolve,
},
data: {
authorities: [Authority.USER],
pageTitle: 'UnitArmies',
},
canActivate: [UserRouteAccessService],
},
{
path: 'new',
component: UnitArmyUpdateComponent,