Skip to content

Commit 3d36ae9

Browse files
authored
Feature: setup frontend for ee (#1539)
* setup frontend for ee * remove unused input
1 parent eb50ec2 commit 3d36ae9

10 files changed

+144
-71
lines changed

web/ui/dashboard/angular.json

+26-13
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,32 @@
6767
"outputHashing": "all",
6868
"sourceMap": true
6969
},
70+
"ee": {
71+
"budgets": [
72+
{
73+
"type": "initial",
74+
"maximumWarning": "500kb",
75+
"maximumError": "1mb"
76+
},
77+
{
78+
"type": "anyComponentStyle",
79+
"maximumWarning": "5kb",
80+
"maximumError": "8kb"
81+
}
82+
],
83+
"fileReplacements": [
84+
{
85+
"replace": "src/environments/environment.ts",
86+
"with": "src/environments/environment.ee.ts"
87+
},
88+
{
89+
"replace": "src/app/private/private-routing.module.ts",
90+
"with": "src/app/private/private-routing.ee.module.ts"
91+
}
92+
],
93+
"outputHashing": "all",
94+
"sourceMap": true
95+
},
7096
"development": {
7197
"buildOptimizer": false,
7298
"optimization": false,
@@ -108,19 +134,6 @@
108134
"styles": ["src/styles.scss"],
109135
"scripts": []
110136
}
111-
},
112-
"storybook": {
113-
"builder": "@storybook/angular:start-storybook",
114-
"options": {
115-
"browserTarget": "angular-cli:build",
116-
"port": 6006
117-
}
118-
},
119-
"build-storybook": {
120-
"builder": "@storybook/angular:build-storybook",
121-
"options": {
122-
"browserTarget": "angular-cli:build"
123-
}
124137
}
125138
}
126139
}

web/ui/dashboard/package.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
"postbuild": "mkdir -p ./source-maps && mv `pwd`/dist/*.map ./source-maps",
99
"watch": "ng build --watch --configuration development",
1010
"test": "ng test",
11-
"docs:json": "compodoc -p ./tsconfig.app.json -e json -d .",
12-
"storybook": "npm run docs:json && start-storybook -p 6006",
13-
"build-storybook": "npm run docs:json && build-storybook"
11+
"build:ee": "ng build --configuration ee"
1412
},
1513
"private": true,
1614
"dependencies": {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { EnterpriseDirective } from '../enterprise/enterprise.directive';
2+
3+
describe('EnterpriseDirective', () => {
4+
it('should create an instance', () => {
5+
const directive = new EnterpriseDirective();
6+
expect(directive).toBeTruthy();
7+
});
8+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Directive, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';
2+
import { environment } from 'src/environments/environment';
3+
4+
@Directive({
5+
selector: '[convoy-enterprise]',
6+
standalone: true
7+
})
8+
export class EnterpriseDirective implements OnInit {
9+
constructor(private templateReference: TemplateRef<any>, private viewContainerReference: ViewContainerRef) {}
10+
11+
ngOnInit(): void {
12+
const isEnterprise = environment.enterprise;
13+
if (isEnterprise) {
14+
this.viewContainerReference.createEmbeddedView(this.templateReference);
15+
}
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import { inject } from '@angular/core';
2+
import { Routes } from '@angular/router';
3+
import { PrivateComponent } from './private.component';
4+
import { PrivateService } from './private.service';
5+
6+
export const fetchOrganisations = async (privateService = inject(PrivateService)) => await privateService.getOrganizations();
7+
8+
const routes: Routes = [
9+
{
10+
path: '',
11+
component: PrivateComponent,
12+
resolve: [() => fetchOrganisations()],
13+
children: [
14+
{
15+
path: '',
16+
redirectTo: 'projects',
17+
pathMatch: 'full'
18+
},
19+
{
20+
path: 'projects',
21+
loadChildren: () => import('./pages/projects/projects.module').then(m => m.ProjectsModule)
22+
},
23+
{
24+
path: 'projects/new',
25+
loadChildren: () => import('./pages/create-project/create-project.module').then(m => m.CreateProjectModule)
26+
},
27+
{
28+
path: 'projects/:id/setup',
29+
loadComponent: () => import('./pages/setup-project/setup-project.component').then(mod => mod.SetupProjectComponent)
30+
},
31+
{
32+
path: 'projects/:id',
33+
loadChildren: () => import('./pages/project/project.module').then(m => m.ProjectModule)
34+
},
35+
{
36+
path: 'app-portal/:token',
37+
loadChildren: () => import('./pages/app/app.module').then(m => m.AppModule)
38+
},
39+
{
40+
path: 'team',
41+
loadChildren: () => import('./pages/teams/teams.module').then(m => m.TeamsModule)
42+
},
43+
{
44+
path: 'user-settings',
45+
loadChildren: () => import('./pages/account/account.module').then(m => m.AccountModule)
46+
},
47+
{
48+
path: 'settings',
49+
loadChildren: () => import('./pages/settings/settings.module').then(m => m.SettingsModule)
50+
},
51+
{
52+
path: 'get-started',
53+
loadComponent: () => import('./pages/onboarding/onboarding.component').then(mod => mod.OnboardingComponent)
54+
},
55+
{
56+
path: 'ee',
57+
loadComponent: () => import('./pages/onboarding/onboarding.component').then(mod => mod.OnboardingComponent)
58+
}
59+
]
60+
}
61+
];
62+
63+
export { routes };
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { inject, NgModule } from '@angular/core';
2+
import { RouterModule, Routes } from '@angular/router';
3+
import { PrivateComponent } from './private.component';
4+
import { PrivateService } from './private.service';
5+
import { routes } from './private-routers';
6+
7+
export const fetchOrganisations = async (privateService = inject(PrivateService)) => await privateService.getOrganizations();
8+
9+
routes[0].children?.push({
10+
path: 'ee',
11+
loadComponent: () => import('./pages/onboarding/onboarding.component').then(mod => mod.OnboardingComponent)
12+
});
13+
14+
@NgModule({
15+
imports: [RouterModule.forChild(routes)],
16+
exports: [RouterModule]
17+
})
18+
export class PrivateRoutingModule {}

web/ui/dashboard/src/app/private/private-routing.module.ts

+2-53
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,10 @@
11
import { inject, NgModule } from '@angular/core';
2-
import { RouterModule, Routes } from '@angular/router';
3-
import { PrivateComponent } from './private.component';
2+
import { RouterModule } from '@angular/router';
43
import { PrivateService } from './private.service';
4+
import { routes } from './private-routers';
55

66
export const fetchOrganisations = async (privateService = inject(PrivateService)) => await privateService.getOrganizations();
77

8-
const routes: Routes = [
9-
{
10-
path: '',
11-
component: PrivateComponent,
12-
resolve: [() => fetchOrganisations()],
13-
children: [
14-
{
15-
path: '',
16-
redirectTo: 'projects',
17-
pathMatch: 'full'
18-
},
19-
{
20-
path: 'projects',
21-
loadChildren: () => import('./pages/projects/projects.module').then(m => m.ProjectsModule)
22-
},
23-
{
24-
path: 'projects/new',
25-
loadChildren: () => import('./pages/create-project/create-project.module').then(m => m.CreateProjectModule)
26-
},
27-
{
28-
path: 'projects/:id/setup',
29-
loadComponent: () => import('./pages/setup-project/setup-project.component').then(mod => mod.SetupProjectComponent)
30-
},
31-
{
32-
path: 'projects/:id',
33-
loadChildren: () => import('./pages/project/project.module').then(m => m.ProjectModule)
34-
},
35-
{
36-
path: 'app-portal/:token',
37-
loadChildren: () => import('./pages/app/app.module').then(m => m.AppModule)
38-
},
39-
{
40-
path: 'team',
41-
loadChildren: () => import('./pages/teams/teams.module').then(m => m.TeamsModule)
42-
},
43-
{
44-
path: 'user-settings',
45-
loadChildren: () => import('./pages/account/account.module').then(m => m.AccountModule)
46-
},
47-
{
48-
path: 'settings',
49-
loadChildren: () => import('./pages/settings/settings.module').then(m => m.SettingsModule)
50-
},
51-
{
52-
path: 'get-started',
53-
loadComponent: () => import('./pages/onboarding/onboarding.component').then(mod => mod.OnboardingComponent)
54-
}
55-
]
56-
}
57-
];
58-
598
@NgModule({
609
imports: [RouterModule.forChild(routes)],
6110
exports: [RouterModule]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const environment = {
2+
production: true,
3+
posthog: 'phc_lPJnjN5hrM8Dh7kgujIccs2xnGL2lmRv6UdOmOTCqEc',
4+
enterprise: true
5+
};
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export const environment = {
22
production: true,
3-
posthog: 'phc_lPJnjN5hrM8Dh7kgujIccs2xnGL2lmRv6UdOmOTCqEc'
3+
posthog: 'phc_lPJnjN5hrM8Dh7kgujIccs2xnGL2lmRv6UdOmOTCqEc',
4+
enterprise: false
45
};

web/ui/dashboard/src/environments/environment.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
export const environment = {
66
production: false,
7-
posthog: 'phc_lPJnjN5hrM8Dh7kgujIccs2xnGL2lmRv6UdOmOTCqEc'
7+
posthog: 'phc_lPJnjN5hrM8Dh7kgujIccs2xnGL2lmRv6UdOmOTCqEc',
8+
enterprise: false
89
};
910

1011
/*

0 commit comments

Comments
 (0)