-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feat] Time & Activities Register Dynamic Tabs (#8182)
* feat: dynamic tabs & routes registered for time & activity page * feat: routes registered for time & activities page - Added [Apps/URL] routes registered. - Added [Screenshot] routes registered. * feat: routes registered for time & activities page - Added [Apps/URL] routes registered. - Added [Screenshot] routes registered. * fix: screenshots started at group by * fix(cspell): typo spelling :-)
- Loading branch information
1 parent
55c659b
commit be8a556
Showing
38 changed files
with
323 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 0 additions & 41 deletions
41
apps/gauzy/src/app/pages/employees/activity/activity-routing.module.ts
This file was deleted.
Oops, something went wrong.
122 changes: 115 additions & 7 deletions
122
apps/gauzy/src/app/pages/employees/activity/activity.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,120 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { NbCardModule, NbRouteTabsetModule } from '@nebular/theme'; | ||
import { Inject, NgModule } from '@angular/core'; | ||
import { ROUTES, RouterModule } from '@angular/router'; | ||
import { NbCardModule, NbSpinnerModule } from '@nebular/theme'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { SharedModule } from '@gauzy/ui-core/shared'; | ||
import { ActivityRoutingModule } from './activity-routing.module'; | ||
import { PageRouteRegistryService } from '@gauzy/ui-core/core'; | ||
import { | ||
ActivityItemModule, | ||
DateRangePickerResolver, | ||
DynamicTabsModule, | ||
GauzyFiltersModule, | ||
NoDataMessageModule, | ||
SharedModule | ||
} from '@gauzy/ui-core/shared'; | ||
import { createActivityRoutes } from './activity.routes'; | ||
import { ActivityLayoutComponent } from './layout/layout.component'; | ||
import { AppUrlActivityComponent } from './app-url-activity/app-url-activity.component'; | ||
|
||
// Nebular Modules | ||
const NB_MODULES = [NbCardModule, NbSpinnerModule]; | ||
|
||
// Components | ||
const COMPONENTS = [AppUrlActivityComponent]; | ||
|
||
@NgModule({ | ||
declarations: [ActivityLayoutComponent], | ||
imports: [NbCardModule, NbRouteTabsetModule, TranslateModule.forChild(), ActivityRoutingModule, SharedModule] | ||
imports: [ | ||
RouterModule.forChild([]), | ||
...NB_MODULES, | ||
TranslateModule.forChild(), | ||
ActivityItemModule, | ||
DynamicTabsModule, | ||
GauzyFiltersModule, | ||
NoDataMessageModule, | ||
SharedModule | ||
], | ||
declarations: [ActivityLayoutComponent, ...COMPONENTS], | ||
providers: [ | ||
{ | ||
provide: ROUTES, | ||
useFactory: (service: PageRouteRegistryService) => createActivityRoutes(service), | ||
deps: [PageRouteRegistryService], | ||
multi: true | ||
} | ||
] | ||
}) | ||
export class ActivityModule {} | ||
export class ActivityModule { | ||
private static hasRegisteredPageRoutes = false; // Flag to check if routes have been registered | ||
|
||
constructor(@Inject(PageRouteRegistryService) readonly _pageRouteRegistryService: PageRouteRegistryService) { | ||
// Register the routes | ||
this.registerPageRoutes(); | ||
} | ||
|
||
/** | ||
* Registers page routes for the activity module. | ||
* Ensures that routes are registered only once. | ||
* | ||
* @returns {void} | ||
*/ | ||
registerPageRoutes(): void { | ||
if (ActivityModule.hasRegisteredPageRoutes) { | ||
return; | ||
} | ||
|
||
// Register Time & Activity Page Routes | ||
this._pageRouteRegistryService.registerPageRoute({ | ||
location: 'time-activity', | ||
path: 'time-activities', | ||
loadChildren: () => | ||
import('./time-activities/time-activities.module').then((m) => m.TimeAndActivitiesModule) | ||
}); | ||
|
||
// Register Screenshot Page Routes | ||
this._pageRouteRegistryService.registerPageRoute({ | ||
location: 'time-activity', | ||
path: 'screenshots', | ||
loadChildren: () => import('./screenshot/screenshot.module').then((m) => m.ScreenshotModule) | ||
}); | ||
|
||
// Register App Activity Page Routes | ||
this._pageRouteRegistryService.registerPageRoute({ | ||
location: 'time-activity', | ||
path: 'apps', | ||
component: AppUrlActivityComponent, | ||
data: { | ||
datePicker: { | ||
unitOfTime: 'day', | ||
isLockDatePicker: true, | ||
isSaveDatePicker: true, | ||
isSingleDatePicker: true, | ||
isDisableFutureDate: true | ||
}, | ||
title: 'ACTIVITY.APPS', // Register the title for the page | ||
type: 'apps' // Register the type for the page | ||
}, | ||
resolve: { dates: DateRangePickerResolver } | ||
}); | ||
|
||
// Register URL Activity Page Routes | ||
this._pageRouteRegistryService.registerPageRoute({ | ||
location: 'time-activity', | ||
path: 'urls', | ||
component: AppUrlActivityComponent, | ||
data: { | ||
datePicker: { | ||
unitOfTime: 'day', | ||
isLockDatePicker: true, | ||
isSaveDatePicker: true, | ||
isSingleDatePicker: true, | ||
isDisableFutureDate: true | ||
}, | ||
title: 'ACTIVITY.VISITED_SITES', // Register the title for the page | ||
type: 'urls' // Register the type for the page | ||
}, | ||
resolve: { dates: DateRangePickerResolver } | ||
}); | ||
|
||
// Set the flag to true | ||
ActivityModule.hasRegisteredPageRoutes = true; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
apps/gauzy/src/app/pages/employees/activity/activity.routes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Route } from '@angular/router'; | ||
import { PageRouteRegistryService } from '@gauzy/ui-core/core'; | ||
import { ActivityLayoutComponent } from './layout/layout.component'; | ||
|
||
/** | ||
* Create and configures routes for the activity module. | ||
* | ||
* @param _pageRouteRegistryService - An instance of PageRouteRegistryService | ||
* @returns An array of Route objects | ||
*/ | ||
export const createActivityRoutes = (_pageRouteRegistryService: PageRouteRegistryService): Route[] => [ | ||
{ | ||
path: '', | ||
component: ActivityLayoutComponent, | ||
data: { | ||
tabsetId: 'time-activity' | ||
}, | ||
children: [ | ||
{ | ||
path: '', | ||
redirectTo: 'time-activities', | ||
pathMatch: 'full' | ||
}, | ||
..._pageRouteRegistryService.getPageLocationRoutes('time-activity') | ||
] | ||
} | ||
]; |
49 changes: 0 additions & 49 deletions
49
...auzy/src/app/pages/employees/activity/app-url-activity/app-url-activity-routing.module.ts
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...-activity/app-url-activity.component.html → ...-activity/app-url-activity.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...-activity/app-url-activity.component.scss → ...-activity/app-url-activity.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
22 changes: 0 additions & 22 deletions
22
apps/gauzy/src/app/pages/employees/activity/app-url-activity/app-url-activity.module.ts
This file was deleted.
Oops, something went wrong.
8 changes: 3 additions & 5 deletions
8
apps/gauzy/src/app/pages/employees/activity/layout/layout.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
<nb-card> | ||
<nb-card-header class="card-header-title"> | ||
<h4> | ||
<ngx-header-title> | ||
{{ title | translate }} | ||
</ngx-header-title> | ||
<ngx-header-title> {{ title | translate }} </ngx-header-title> | ||
</h4> | ||
</nb-card-header> | ||
<nb-card-body class="p-0"> | ||
<nb-route-tabset [tabs]="tabs"></nb-route-tabset> | ||
<gz-dynamic-tabs [tabsetId]="tabsetId"></gz-dynamic-tabs> | ||
</nb-card-body> | ||
</nb-card> | ||
</nb-card> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.