Skip to content

Commit

Permalink
fix(console): To be standalone
Browse files Browse the repository at this point in the history
Signed-off-by: Kwong Tung Nan <[email protected]>
  • Loading branch information
kwongtn committed Jun 18, 2024
1 parent ceb9b15 commit 5ed7720
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 97 deletions.
18 changes: 7 additions & 11 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
} from "@angular/fire/auth-guard";
import { RouterModule, Routes } from "@angular/router";

import { ConsoleMainComponent } from "./console/console.component";
import { ConstructionComponent } from "./construction/construction.component";
import { GalleryComponent } from "./gallery/gallery.component";
import { InsidenMainComponent } from "./insiden/insiden.component";
Expand Down Expand Up @@ -203,20 +202,17 @@ const routes: Routes = [
{
path: "console",
title: "MLPTF | Console",
loadChildren: async () => {
if (maintenance.console.curentlyInMaintenance) {
const module = await import(
"./construction/construction.module"
loadComponent: () => {
if (maintenance.spotting.curentlyInMaintenance) {
return import("./construction/construction.component").then(
(m) => m.ConstructionComponent
);
return module.ConstructionModule;
} else {
const module = await import("./console/console.module");
return module.ConsoleModule;
return import("./console/console.component").then(
(m) => m.ConsoleMainComponent
);
}
},
component: maintenance.console.curentlyInMaintenance
? ConstructionComponent
: ConsoleMainComponent,
...canActivate(adminOnly),
},
{
Expand Down
6 changes: 6 additions & 0 deletions src/app/console/console.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@

import { Component, OnInit } from "@angular/core";

import {
ConsoleEventsTableComponent,
} from "./events-table/events-table.component";

@Component({
selector: "app-console-main",
templateUrl: "./console.component.html",
styleUrls: ["./console.component.scss"],
standalone: true,
imports:[ConsoleEventsTableComponent]
})
export class ConsoleMainComponent implements OnInit {
constructor() {
Expand Down
84 changes: 0 additions & 84 deletions src/app/console/console.module.ts

This file was deleted.

48 changes: 46 additions & 2 deletions src/app/console/events-table/events-table.component.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,45 @@
import { QueryRef } from "apollo-angular";
import { DataTableComponent, TableWidthConfig } from "ng-devui";
import { ICategorySearchTagItem, SearchEvent } from "ng-devui/category-search";
import {
ButtonModule,
CheckBoxModule,
DataTableComponent,
DataTableModule,
TableWidthConfig,
ToggleModule,
TooltipModule,
} from "ng-devui";
import {
CategorySearchModule,
ICategorySearchTagItem,
SearchEvent,
} from "ng-devui/category-search";
import { NzSpinModule } from "ng-zorro-antd/spin";
import { Subscription } from "rxjs";
import {
SpottingTypeCellDisplayComponent,
} from "src/app/@ui/spotting-type-cell-display/spotting-type-cell-display.component";
import {
ImagePreviewButtonComponent,
} from "src/app/@ui/spotting/image-preview-button/image-preview-button.component";
import {
VehicleStatusTagModule,
} from "src/app/@ui/vehicle-status-tag/vehicle-status-tag.module";
import {
VehicleTableCellDisplayComponent,
} from "src/app/@ui/vehicle-table-cell-display/vehicle-table-cell-display.component";
import { LastSpottingsTableElement } from "src/app/models/query/get-vehicles";
import { AuthService } from "src/app/services/auth.service";
import { environment } from "src/environments/environment";

import { CommonModule } from "@angular/common";
import {
Component,
HostListener,
OnDestroy,
OnInit,
ViewChild,
} from "@angular/core";
import { FormsModule } from "@angular/forms";

import {
ConsoleEventsGqlResponseElement,
Expand All @@ -34,6 +61,23 @@ interface TableSourceType extends ConsoleEventsGqlResponseTableDataElement {
selector: "console-events-table",
templateUrl: "./events-table.component.html",
styleUrls: ["./events-table.component.scss"],
standalone: true,
imports: [
ButtonModule,
CategorySearchModule,
CheckBoxModule,
CommonModule,
DataTableModule,
FormsModule,
ImagePreviewButtonComponent,
NzSpinModule,
SpottingTypeCellDisplayComponent,
ToggleModule,
TooltipModule,
VehicleStatusTagModule,
VehicleTableCellDisplayComponent,

]
})
export class ConsoleEventsTableComponent implements OnInit, OnDestroy {
@ViewChild(DataTableComponent, { static: true })
Expand Down

0 comments on commit 5ed7720

Please sign in to comment.