폴더명 수정
This commit is contained in:
parent
f5de3d038c
commit
c9a6fa01f7
|
@ -430,11 +430,11 @@ export const appRoutes: Route[] = [
|
|||
).then((m: any) => m.UserSessionModule),
|
||||
},
|
||||
{
|
||||
path: 'sessionin-overlap',
|
||||
path: 'duplicated-session',
|
||||
loadChildren: () =>
|
||||
import(
|
||||
'app/modules/admin/report/sessionin-overlap/sessionin-overlap.module'
|
||||
).then((m: any) => m.SessioninOverlapModule),
|
||||
'app/modules/admin/report/duplicated-session/duplicated-session.module'
|
||||
).then((m: any) => m.DuplicatedSessionModule),
|
||||
},
|
||||
{
|
||||
path: 'admin-session',
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { assign, cloneDeep } from 'lodash-es';
|
||||
import { FuseMockApiService, FuseMockApiUtils } from '@fuse/lib/mock-api';
|
||||
import { sessioninOverlaps as sessioninOverlapsData } from './data';
|
||||
import { duplicatedSessions as duplicatedSessionsData } from './data';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ReportSessioninOverlapMockApi {
|
||||
private _sessioninOverlaps: any[] = sessioninOverlapsData;
|
||||
export class ReportDuplicatedSessionMockApi {
|
||||
private _duplicatedSessions: any[] = duplicatedSessionsData;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -26,26 +26,26 @@ export class ReportSessioninOverlapMockApi {
|
|||
*/
|
||||
registerHandlers(): void {
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ SessioninOverlaps - GET
|
||||
// @ DuplicatedSessions - GET
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onGet('api/apps/report/sessionin-overlap/sessionin-overlaps', 300)
|
||||
.onGet('api/apps/report/duplicated-session/duplicated-sessions', 300)
|
||||
.reply(({ request }) => {
|
||||
// Get available queries
|
||||
const search = request.params.get('search');
|
||||
const sort = request.params.get('sort') || 'name';
|
||||
const sort = request.params.get('sort') || 'overlapCount';
|
||||
const order = request.params.get('order') || 'asc';
|
||||
const page = parseInt(request.params.get('page') ?? '1', 10);
|
||||
const size = parseInt(request.params.get('size') ?? '10', 10);
|
||||
|
||||
// Clone the sessioninoverlaps
|
||||
let sessioninOverlaps: any[] | null = cloneDeep(
|
||||
this._sessioninOverlaps
|
||||
// Clone the duplicatedSessions
|
||||
let duplicatedSessions: any[] | null = cloneDeep(
|
||||
this._duplicatedSessions
|
||||
);
|
||||
|
||||
// Sort the sessioninOverlaps
|
||||
// Sort the duplicatedSessions
|
||||
if (sort === 'overlapCount') {
|
||||
sessioninOverlaps.sort((a, b) => {
|
||||
duplicatedSessions.sort((a, b) => {
|
||||
const fieldA = a[sort].toString().toUpperCase();
|
||||
const fieldB = b[sort].toString().toUpperCase();
|
||||
return order === 'asc'
|
||||
|
@ -53,15 +53,15 @@ export class ReportSessioninOverlapMockApi {
|
|||
: fieldB.localeCompare(fieldA);
|
||||
});
|
||||
} else {
|
||||
sessioninOverlaps.sort((a, b) =>
|
||||
duplicatedSessions.sort((a, b) =>
|
||||
order === 'asc' ? a[sort] - b[sort] : b[sort] - a[sort]
|
||||
);
|
||||
}
|
||||
|
||||
// If search exists...
|
||||
if (search) {
|
||||
// Filter the sessioninOverlaps
|
||||
sessioninOverlaps = sessioninOverlaps.filter(
|
||||
// Filter the duplicatedSessions
|
||||
duplicatedSessions = duplicatedSessions.filter(
|
||||
(contact: any) =>
|
||||
contact.name &&
|
||||
contact.name.toLowerCase().includes(search.toLowerCase())
|
||||
|
@ -69,32 +69,35 @@ export class ReportSessioninOverlapMockApi {
|
|||
}
|
||||
|
||||
// Paginate - Start
|
||||
const sessioninOverlapsLength = sessioninOverlaps.length;
|
||||
const duplicatedSessionsLength = duplicatedSessions.length;
|
||||
|
||||
// Calculate pagination details
|
||||
const begin = page * size;
|
||||
const end = Math.min(size * (page + 1), sessioninOverlapsLength);
|
||||
const lastPage = Math.max(Math.ceil(sessioninOverlapsLength / size), 1);
|
||||
const end = Math.min(size * (page + 1), duplicatedSessionsLength);
|
||||
const lastPage = Math.max(
|
||||
Math.ceil(duplicatedSessionsLength / size),
|
||||
1
|
||||
);
|
||||
|
||||
// Prepare the pagination object
|
||||
let pagination = {};
|
||||
|
||||
// If the requested page number is bigger than
|
||||
// the last possible page number, return null for
|
||||
// sessioninOverlaps but also send the last possible page so
|
||||
// duplicatedSessions but also send the last possible page so
|
||||
// the app can navigate to there
|
||||
if (page > lastPage) {
|
||||
sessioninOverlaps = null;
|
||||
duplicatedSessions = null;
|
||||
pagination = {
|
||||
lastPage,
|
||||
};
|
||||
} else {
|
||||
// Paginate the results by size
|
||||
sessioninOverlaps = sessioninOverlaps.slice(begin, end);
|
||||
duplicatedSessions = duplicatedSessions.slice(begin, end);
|
||||
|
||||
// Prepare the pagination mock-api
|
||||
pagination = {
|
||||
length: sessioninOverlapsLength,
|
||||
length: duplicatedSessionsLength,
|
||||
size: size,
|
||||
page: page,
|
||||
lastPage: lastPage,
|
||||
|
@ -107,41 +110,41 @@ export class ReportSessioninOverlapMockApi {
|
|||
return [
|
||||
200,
|
||||
{
|
||||
sessioninOverlaps,
|
||||
duplicatedSessions,
|
||||
pagination,
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ SessioninOverlap - GET
|
||||
// @ DuplicatedSession - GET
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onGet('api/apps/report/sessionin-overlap/sessionin-overlap')
|
||||
.onGet('api/apps/report/duplicated-session/duplicated-session')
|
||||
.reply(({ request }) => {
|
||||
// Get the id from the params
|
||||
const id = request.params.get('id');
|
||||
|
||||
// Clone the sessioninOverlaps
|
||||
const sessioninOverlaps = cloneDeep(this._sessioninOverlaps);
|
||||
// Clone the duplicatedSessions
|
||||
const duplicatedSessions = cloneDeep(this._duplicatedSessions);
|
||||
|
||||
// Find the sessioninOverlap
|
||||
const sessioninOverlap = sessioninOverlaps.find(
|
||||
// Find the duplicatedSession
|
||||
const duplicatedSession = duplicatedSessions.find(
|
||||
(item: any) => item.id === id
|
||||
);
|
||||
|
||||
// Return the response
|
||||
return [200, sessioninOverlap];
|
||||
return [200, duplicatedSession];
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ SessioninOverlap - POST
|
||||
// @ DuplicatedSession - POST
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onPost('api/apps/report/sessionin-overlap/sessionin-overlap')
|
||||
.onPost('api/apps/report/duplicated-session/duplicated-session')
|
||||
.reply(() => {
|
||||
// Generate a new sessioninOverlap
|
||||
const newSessioninOverlap = {
|
||||
// Generate a new duplicatedSession
|
||||
const newDuplicatedSession = {
|
||||
id: FuseMockApiUtils.guid(),
|
||||
category: '',
|
||||
name: 'A New User',
|
||||
|
@ -163,58 +166,58 @@ export class ReportSessioninOverlapMockApi {
|
|||
active: false,
|
||||
};
|
||||
|
||||
// Unshift the new sessioninOverlap
|
||||
this._sessioninOverlaps.unshift(newSessioninOverlap);
|
||||
// Unshift the new duplicatedSession
|
||||
this._duplicatedSessions.unshift(newDuplicatedSession);
|
||||
|
||||
// Return the response
|
||||
return [200, newSessioninOverlap];
|
||||
return [200, newDuplicatedSession];
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ SessioninOverlap - PATCH
|
||||
// @ DuplicatedSession - PATCH
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onPatch('api/apps/report/sessionin-overlap/sessionin-overlap')
|
||||
.onPatch('api/apps/report/duplicated-session/duplicated-session')
|
||||
.reply(({ request }) => {
|
||||
// Get the id and sessioninOverlap
|
||||
// Get the id and duplicatedSession
|
||||
const id = request.body.id;
|
||||
const sessioninOverlap = cloneDeep(request.body.sessioninOverlap);
|
||||
const duplicatedSession = cloneDeep(request.body.duplicatedSession);
|
||||
|
||||
// Prepare the updated sessioninOverlap
|
||||
let updatedSessioninOverlap = null;
|
||||
// Prepare the updated duplicatedSession
|
||||
let updatedDuplicatedSession = null;
|
||||
|
||||
// Find the sessioninOverlap and update it
|
||||
this._sessioninOverlaps.forEach((item, index, sessioninOverlaps) => {
|
||||
// Find the duplicatedSession and update it
|
||||
this._duplicatedSessions.forEach((item, index, duplicatedSessions) => {
|
||||
if (item.id === id) {
|
||||
// Update the sessioninOverlap
|
||||
sessioninOverlaps[index] = assign(
|
||||
// Update the duplicatedSession
|
||||
duplicatedSessions[index] = assign(
|
||||
{},
|
||||
sessioninOverlaps[index],
|
||||
sessioninOverlap
|
||||
duplicatedSessions[index],
|
||||
duplicatedSession
|
||||
);
|
||||
|
||||
// Store the updated sessioninOverlap
|
||||
updatedSessioninOverlap = sessioninOverlaps[index];
|
||||
// Store the updated duplicatedSession
|
||||
updatedDuplicatedSession = duplicatedSessions[index];
|
||||
}
|
||||
});
|
||||
|
||||
// Return the response
|
||||
return [200, updatedSessioninOverlap];
|
||||
return [200, updatedDuplicatedSession];
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ SessioninOverlap - DELETE
|
||||
// @ DuplicatedSession - DELETE
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onDelete('api/apps/report/sessionin-overlap/sessionin-overlap')
|
||||
.onDelete('api/apps/report/duplicated-session/duplicated-session')
|
||||
.reply(({ request }) => {
|
||||
// Get the id
|
||||
const id = request.params.get('id');
|
||||
|
||||
// Find the sessioninOverlap and delete it
|
||||
this._sessioninOverlaps.forEach((item, index) => {
|
||||
// Find the duplicatedSession and delete it
|
||||
this._duplicatedSessions.forEach((item, index) => {
|
||||
if (item.id === id) {
|
||||
this._sessioninOverlaps.splice(index, 1);
|
||||
this._duplicatedSessions.splice(index, 1);
|
||||
}
|
||||
});
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
/* eslint-disable */
|
||||
|
||||
export const sessioninOverlaps = [
|
||||
export const duplicatedSessions = [
|
||||
{
|
||||
id: '1',
|
||||
overlapCount: '3',
|
|
@ -322,11 +322,11 @@ export const defaultNavigation: FuseNavigationItem[] = [
|
|||
link: '/report/user-session',
|
||||
},
|
||||
{
|
||||
id: 'report.sessionin-overlap',
|
||||
title: 'Sessionin Overlap',
|
||||
id: 'report.duplicated-session',
|
||||
title: 'Duplicated Session',
|
||||
type: 'basic',
|
||||
icon: 'heroicons_outline:academic-cap',
|
||||
link: '/report/sessionin-overlap',
|
||||
link: '/report/duplicated-session',
|
||||
},
|
||||
{
|
||||
id: 'report.admin-session',
|
||||
|
|
|
@ -59,7 +59,7 @@ import { ReportCompLogMockApi } from './apps/report/comp-log/api';
|
|||
import { ReportModificationLogMockApi } from './apps/report/modification-log/api';
|
||||
import { ReportPaymentLogMockApi } from './apps/report/payment-log/api';
|
||||
import { ReportUserSessionMockApi } from './apps/report/user-session/api';
|
||||
import { ReportSessioninOverlapMockApi } from './apps/report/sessionin-overlap/api';
|
||||
import { ReportDuplicatedSessionMockApi } from './apps/report/duplicated-session/api';
|
||||
import { ReportAdminSessionMockApi } from './apps/report/admin-session/api';
|
||||
import { ReportExcelLogMockApi } from './apps/report/excel-log/api';
|
||||
import { ReportLoosingMockApi } from './apps/report/loosing/api';
|
||||
|
@ -132,7 +132,7 @@ export const mockApiServices = [
|
|||
ReportModificationLogMockApi,
|
||||
ReportPaymentLogMockApi,
|
||||
ReportUserSessionMockApi,
|
||||
ReportSessioninOverlapMockApi,
|
||||
ReportDuplicatedSessionMockApi,
|
||||
ReportAdminSessionMockApi,
|
||||
ReportExcelLogMockApi,
|
||||
ReportLoosingMockApi,
|
||||
|
|
|
@ -65,8 +65,10 @@
|
|||
<div
|
||||
class="flex flex-col flex-auto sm:mb-18 overflow-hidden sm:overflow-y-auto"
|
||||
>
|
||||
<ng-container *ngIf="sessioninOverlaps$ | async as sessioninOverlaps">
|
||||
<ng-container *ngIf="sessioninOverlaps.length > 0; else noUser">
|
||||
<ng-container *ngIf="duplicatedSessions$ | async as duplicatedSessions">
|
||||
<ng-container
|
||||
*ngIf="duplicatedSessions.length > 0; else noDuplicatedSession"
|
||||
>
|
||||
<div class="grid">
|
||||
<!-- Header -->
|
||||
<div
|
||||
|
@ -79,11 +81,11 @@
|
|||
</div>
|
||||
<!-- Rows -->
|
||||
<ng-container
|
||||
*ngIf="sessioninOverlaps$ | async as sessioninOverlaps"
|
||||
*ngIf="duplicatedSessions$ | async as duplicatedSessions"
|
||||
>
|
||||
<ng-container
|
||||
*ngFor="
|
||||
let info of sessioninOverlaps;
|
||||
let info of duplicatedSessions;
|
||||
let i = index;
|
||||
trackBy: __trackByFn
|
||||
"
|
||||
|
@ -130,7 +132,7 @@
|
|||
</ng-container>
|
||||
</ng-container>
|
||||
|
||||
<ng-template #noUser>
|
||||
<ng-template #noDuplicatedSession>
|
||||
<div
|
||||
class="p-8 sm:p-16 border-t text-4xl font-semibold tracking-tight text-center"
|
||||
>
|
|
@ -30,13 +30,13 @@ import { fuseAnimations } from '@fuse/animations';
|
|||
import { FuseConfirmationService } from '@fuse/services/confirmation';
|
||||
|
||||
import { User } from '../../../member/user/models/user';
|
||||
import { SessioninOverlap } from '../models/sessionin-overlap';
|
||||
import { SessioninOverlapPagination } from '../models/sessionin-Overlap-pagination';
|
||||
import { SessioninOverlapService } from '../services/sessionin-overlap.service';
|
||||
import { DuplicatedSession } from '../models/duplicated-session';
|
||||
import { DuplicatedSessionPagination } from '../models/duplicated-session-pagination';
|
||||
import { DuplicatedSessionService } from '../services/duplicated-session.service';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'sessionin-overlap-list',
|
||||
selector: 'duplicated-session-list',
|
||||
templateUrl: './list.component.html',
|
||||
styles: [
|
||||
/* language=SCSS */
|
||||
|
@ -66,13 +66,13 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
@ViewChild(MatPaginator) private _paginator!: MatPaginator;
|
||||
@ViewChild(MatSort) private _sort!: MatSort;
|
||||
|
||||
sessioninOverlaps$!: Observable<SessioninOverlap[] | undefined>;
|
||||
duplicatedSessions$!: Observable<DuplicatedSession[] | undefined>;
|
||||
users$!: Observable<User[] | undefined>;
|
||||
|
||||
isLoading = false;
|
||||
searchInputControl = new FormControl();
|
||||
selectedSessioninOverlap?: SessioninOverlap;
|
||||
pagination?: SessioninOverlapPagination;
|
||||
selectedDuplicatedSession?: DuplicatedSession;
|
||||
pagination?: DuplicatedSessionPagination;
|
||||
|
||||
__isSearchOpened = false;
|
||||
|
||||
|
@ -85,7 +85,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
private _changeDetectorRef: ChangeDetectorRef,
|
||||
private _fuseConfirmationService: FuseConfirmationService,
|
||||
private _formBuilder: FormBuilder,
|
||||
private _sessioninOverlapService: SessioninOverlapService,
|
||||
private _duplicatedSessionService: DuplicatedSessionService,
|
||||
private router: Router
|
||||
) {}
|
||||
|
||||
|
@ -98,9 +98,9 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
*/
|
||||
ngOnInit(): void {
|
||||
// Get the pagination
|
||||
this._sessioninOverlapService.pagination$
|
||||
this._duplicatedSessionService.pagination$
|
||||
.pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe((pagination: SessioninOverlapPagination | undefined) => {
|
||||
.subscribe((pagination: DuplicatedSessionPagination | undefined) => {
|
||||
// Update the pagination
|
||||
this.pagination = pagination;
|
||||
|
||||
|
@ -109,7 +109,8 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
});
|
||||
|
||||
// Get the products
|
||||
this.sessioninOverlaps$ = this._sessioninOverlapService.sessioninOverlaps$;
|
||||
this.duplicatedSessions$ =
|
||||
this._duplicatedSessionService.duplicatedSessions$;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,7 +120,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
if (this._sort && this._paginator) {
|
||||
// Set the initial sort
|
||||
this._sort.sort({
|
||||
id: 'name',
|
||||
id: 'overlapCount',
|
||||
start: 'asc',
|
||||
disableClear: true,
|
||||
});
|
||||
|
@ -127,7 +128,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
|
||||
// If the sessioninOverlap changes the sort order...
|
||||
// If the duplicatedSession changes the sort order...
|
||||
this._sort.sortChange
|
||||
.pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe(() => {
|
||||
|
@ -140,7 +141,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
.pipe(
|
||||
switchMap(() => {
|
||||
this.isLoading = true;
|
||||
return this._sessioninOverlapService.getSessioninOverlaps(
|
||||
return this._duplicatedSessionService.getDuplicatedSessions(
|
||||
this._paginator.pageIndex,
|
||||
this._paginator.pageSize,
|
||||
this._sort.active,
|
|
@ -22,14 +22,14 @@ import { SharedModule } from 'app/shared/shared.module';
|
|||
|
||||
import { COMPONENTS } from './components';
|
||||
|
||||
import { sessioninOverlapRoutes } from './sessionin-overlap.routing';
|
||||
import { duplicatedSessionRoutes } from './duplicated-session.routing';
|
||||
|
||||
@NgModule({
|
||||
declarations: [COMPONENTS],
|
||||
imports: [
|
||||
TranslocoModule,
|
||||
SharedModule,
|
||||
RouterModule.forChild(sessioninOverlapRoutes),
|
||||
RouterModule.forChild(duplicatedSessionRoutes),
|
||||
|
||||
MatButtonModule,
|
||||
MatFormFieldModule,
|
||||
|
@ -47,4 +47,4 @@ import { sessioninOverlapRoutes } from './sessionin-overlap.routing';
|
|||
MatCheckboxModule,
|
||||
],
|
||||
})
|
||||
export class SessioninOverlapModule {}
|
||||
export class DuplicatedSessionModule {}
|
|
@ -3,15 +3,15 @@ import { Route } from '@angular/router';
|
|||
import { ListComponent } from './components/list.component';
|
||||
import { ViewComponent } from '../../member/user/components/view.component';
|
||||
|
||||
import { SessioninOverlapsResolver } from './resolvers/sessionin-overlap.resolver';
|
||||
import { DuplicatedSessionsResolver } from './resolvers/duplicated-session.resolver';
|
||||
import { UserResolver } from '../../member/user/resolvers/user.resolver';
|
||||
|
||||
export const sessioninOverlapRoutes: Route[] = [
|
||||
export const duplicatedSessionRoutes: Route[] = [
|
||||
{
|
||||
path: '',
|
||||
component: ListComponent,
|
||||
resolve: {
|
||||
sessioninOverlaps: SessioninOverlapsResolver,
|
||||
duplicatedSessions: DuplicatedSessionsResolver,
|
||||
},
|
||||
},
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
export interface SessioninOverlapPagination {
|
||||
export interface DuplicatedSessionPagination {
|
||||
length: number;
|
||||
size: number;
|
||||
page: number;
|
|
@ -1,4 +1,4 @@
|
|||
export interface SessioninOverlap {
|
||||
export interface DuplicatedSession {
|
||||
id?: string;
|
||||
overlapCount?: string;
|
||||
ip?: string;
|
|
@ -7,19 +7,19 @@ import {
|
|||
} from '@angular/router';
|
||||
import { catchError, Observable, throwError } from 'rxjs';
|
||||
|
||||
import { SessioninOverlap } from '../models/sessionin-overlap';
|
||||
import { SessioninOverlapPagination } from '../models/sessionin-Overlap-pagination';
|
||||
import { SessioninOverlapService } from '../services/sessionin-overlap.service';
|
||||
import { DuplicatedSession } from '../models/duplicated-session';
|
||||
import { DuplicatedSessionPagination } from '../models/duplicated-session-pagination';
|
||||
import { DuplicatedSessionService } from '../services/duplicated-session.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class SessioninOverlapResolver implements Resolve<any> {
|
||||
export class DuplicatedSessionResolver implements Resolve<any> {
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
constructor(
|
||||
private _sessioninOverlapService: SessioninOverlapService,
|
||||
private _duplicatedSessionService: DuplicatedSessionService,
|
||||
private _router: Router
|
||||
) {}
|
||||
|
||||
|
@ -36,9 +36,9 @@ export class SessioninOverlapResolver implements Resolve<any> {
|
|||
resolve(
|
||||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot
|
||||
): Observable<SessioninOverlap | undefined> {
|
||||
return this._sessioninOverlapService
|
||||
.getSessioninOverlapById(route.paramMap.get('id'))
|
||||
): Observable<DuplicatedSession | undefined> {
|
||||
return this._duplicatedSessionService
|
||||
.getDuplicatedSessionById(route.paramMap.get('id'))
|
||||
.pipe(
|
||||
// Error here means the requested product is not available
|
||||
catchError((error) => {
|
||||
|
@ -61,11 +61,11 @@ export class SessioninOverlapResolver implements Resolve<any> {
|
|||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class SessioninOverlapsResolver implements Resolve<any> {
|
||||
export class DuplicatedSessionsResolver implements Resolve<any> {
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
constructor(private _sessioninOverlapService: SessioninOverlapService) {}
|
||||
constructor(private _duplicatedSessionService: DuplicatedSessionService) {}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Public methods
|
||||
|
@ -81,9 +81,9 @@ export class SessioninOverlapsResolver implements Resolve<any> {
|
|||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot
|
||||
): Observable<{
|
||||
pagination: SessioninOverlapPagination;
|
||||
sessioninOverlaps: SessioninOverlap[];
|
||||
pagination: DuplicatedSessionPagination;
|
||||
duplicatedSessions: DuplicatedSession[];
|
||||
}> {
|
||||
return this._sessioninOverlapService.getSessioninOverlaps();
|
||||
return this._duplicatedSessionService.getDuplicatedSessions();
|
||||
}
|
||||
}
|
|
@ -12,22 +12,22 @@ import {
|
|||
throwError,
|
||||
} from 'rxjs';
|
||||
|
||||
import { SessioninOverlap } from '../models/sessionin-overlap';
|
||||
import { SessioninOverlapPagination } from '../models/sessionin-Overlap-pagination';
|
||||
import { DuplicatedSession } from '../models/duplicated-session';
|
||||
import { DuplicatedSessionPagination } from '../models/duplicated-session-pagination';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class SessioninOverlapService {
|
||||
export class DuplicatedSessionService {
|
||||
// Private
|
||||
private __pagination = new BehaviorSubject<
|
||||
SessioninOverlapPagination | undefined
|
||||
DuplicatedSessionPagination | undefined
|
||||
>(undefined);
|
||||
private __sessioninOverlap = new BehaviorSubject<
|
||||
SessioninOverlap | undefined
|
||||
private __duplicatedSession = new BehaviorSubject<
|
||||
DuplicatedSession | undefined
|
||||
>(undefined);
|
||||
private __sessioninOverlaps = new BehaviorSubject<
|
||||
SessioninOverlap[] | undefined
|
||||
private __duplicatedSessions = new BehaviorSubject<
|
||||
DuplicatedSession[] | undefined
|
||||
>(undefined);
|
||||
|
||||
/**
|
||||
|
@ -42,22 +42,22 @@ export class SessioninOverlapService {
|
|||
/**
|
||||
* Getter for pagination
|
||||
*/
|
||||
get pagination$(): Observable<SessioninOverlapPagination | undefined> {
|
||||
get pagination$(): Observable<DuplicatedSessionPagination | undefined> {
|
||||
return this.__pagination.asObservable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for sessioninOverlap
|
||||
* Getter for duplicatedSession
|
||||
*/
|
||||
get sessioninOverlap$(): Observable<SessioninOverlap | undefined> {
|
||||
return this.__sessioninOverlap.asObservable();
|
||||
get duplicatedSession$(): Observable<DuplicatedSession | undefined> {
|
||||
return this.__duplicatedSession.asObservable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for sessioninOverlaps
|
||||
* Getter for duplicatedSessions
|
||||
*/
|
||||
get sessioninOverlaps$(): Observable<SessioninOverlap[] | undefined> {
|
||||
return this.__sessioninOverlaps.asObservable();
|
||||
get duplicatedSessions$(): Observable<DuplicatedSession[] | undefined> {
|
||||
return this.__duplicatedSessions.asObservable();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
@ -65,7 +65,7 @@ export class SessioninOverlapService {
|
|||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get SessioninOverlaps
|
||||
* Get DuplicatedSessions
|
||||
*
|
||||
*
|
||||
* @param page
|
||||
|
@ -74,21 +74,21 @@ export class SessioninOverlapService {
|
|||
* @param order
|
||||
* @param search
|
||||
*/
|
||||
getSessioninOverlaps(
|
||||
getDuplicatedSessions(
|
||||
page: number = 0,
|
||||
size: number = 10,
|
||||
sort: string = 'name',
|
||||
sort: string = 'signinId',
|
||||
order: 'asc' | 'desc' | '' = 'asc',
|
||||
search: string = ''
|
||||
): Observable<{
|
||||
pagination: SessioninOverlapPagination;
|
||||
sessioninOverlaps: SessioninOverlap[];
|
||||
pagination: DuplicatedSessionPagination;
|
||||
duplicatedSessions: DuplicatedSession[];
|
||||
}> {
|
||||
return this._httpClient
|
||||
.get<{
|
||||
pagination: SessioninOverlapPagination;
|
||||
sessioninOverlaps: SessioninOverlap[];
|
||||
}>('api/apps/report/sessionin-overlap/sessionin-overlaps', {
|
||||
pagination: DuplicatedSessionPagination;
|
||||
duplicatedSessions: DuplicatedSession[];
|
||||
}>('api/apps/report/duplicated-session/duplicated-sessions', {
|
||||
params: {
|
||||
page: '' + page,
|
||||
size: '' + size,
|
||||
|
@ -100,7 +100,7 @@ export class SessioninOverlapService {
|
|||
.pipe(
|
||||
tap((response) => {
|
||||
this.__pagination.next(response.pagination);
|
||||
this.__sessioninOverlaps.next(response.sessioninOverlaps);
|
||||
this.__duplicatedSessions.next(response.duplicatedSessions);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
@ -108,19 +108,19 @@ export class SessioninOverlapService {
|
|||
/**
|
||||
* Get product by id
|
||||
*/
|
||||
getSessioninOverlapById(id: string | null): Observable<SessioninOverlap> {
|
||||
return this.__sessioninOverlaps.pipe(
|
||||
getDuplicatedSessionById(id: string | null): Observable<DuplicatedSession> {
|
||||
return this.__duplicatedSessions.pipe(
|
||||
take(1),
|
||||
map((sessioninOverlaps) => {
|
||||
map((duplicatedSessions) => {
|
||||
// Find the product
|
||||
const sessioninOverlap =
|
||||
sessioninOverlaps?.find((item) => item.id === id) || undefined;
|
||||
const duplicatedSession =
|
||||
duplicatedSessions?.find((item) => item.id === id) || undefined;
|
||||
|
||||
// Update the product
|
||||
this.__sessioninOverlap.next(sessioninOverlap);
|
||||
this.__duplicatedSession.next(duplicatedSession);
|
||||
|
||||
// Return the product
|
||||
return sessioninOverlap;
|
||||
return duplicatedSession;
|
||||
}),
|
||||
switchMap((product) => {
|
||||
if (!product) {
|
||||
|
@ -135,27 +135,27 @@ export class SessioninOverlapService {
|
|||
/**
|
||||
* Create product
|
||||
*/
|
||||
createSessioninOverlap(): Observable<SessioninOverlap> {
|
||||
return this.sessioninOverlaps$.pipe(
|
||||
createDuplicatedSession(): Observable<DuplicatedSession> {
|
||||
return this.duplicatedSessions$.pipe(
|
||||
take(1),
|
||||
switchMap((sessioninOverlaps) =>
|
||||
switchMap((duplicatedSessions) =>
|
||||
this._httpClient
|
||||
.post<SessioninOverlap>(
|
||||
'api/apps/report/sessionin-overlap/product',
|
||||
.post<DuplicatedSession>(
|
||||
'api/apps/report/duplicated-session/product',
|
||||
{}
|
||||
)
|
||||
.pipe(
|
||||
map((newSessioninOverlap) => {
|
||||
// Update the sessioninOverlaps with the new product
|
||||
if (!!sessioninOverlaps) {
|
||||
this.__sessioninOverlaps.next([
|
||||
newSessioninOverlap,
|
||||
...sessioninOverlaps,
|
||||
map((newDuplicatedSession) => {
|
||||
// Update the duplicatedSessions with the new product
|
||||
if (!!duplicatedSessions) {
|
||||
this.__duplicatedSessions.next([
|
||||
newDuplicatedSession,
|
||||
...duplicatedSessions,
|
||||
]);
|
||||
}
|
||||
|
||||
// Return the new product
|
||||
return newSessioninOverlap;
|
||||
return newDuplicatedSession;
|
||||
})
|
||||
)
|
||||
)
|
|
@ -36,7 +36,7 @@ import { UserSessionService } from '../services/user-session.service';
|
|||
import { Router } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'sessionin-info-list',
|
||||
selector: 'user-session-list',
|
||||
templateUrl: './list.component.html',
|
||||
styles: [
|
||||
/* language=SCSS */
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
"Payment Log": "Manual Payment Logs",
|
||||
"User Session": "User Session",
|
||||
"Admin Session": "Admin Session",
|
||||
"Sessionin Overlap": "Sessionin Overlap",
|
||||
"Duplicated Session": "Duplicated Session",
|
||||
"Excel Log": "Excel Download Logs",
|
||||
"Loosing": "Loosing Management",
|
||||
"Notice": "Notice",
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
"Modification Log": "회원수정 로그",
|
||||
"Payment Log": "수동지급/회수 로그",
|
||||
"User Session": "로그인정보",
|
||||
"Sessionin Overlap": "중복로그인",
|
||||
"Duplicated Session": "중복로그인",
|
||||
"Admin Session": "관리자 로그인정보",
|
||||
"Excel Log": "엑셀다운 로그",
|
||||
"Loosing": "루징관리",
|
||||
|
|
Loading…
Reference in New Issue
Block a user