Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dist/1361.b86eff7134763666.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/1361.f0aca451e18a0616.js

This file was deleted.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
<body class="mat-typography">
<df-root></df-root>
<script type="text/javascript" src="https://assets.calendly.com/assets/external/widget.js"></script>
<script src="runtime.1d08080781ca9bb3.js" type="module"></script><script src="polyfills.def0190516b19e6b.js" type="module"></script><script src="main.81ab6796a46ade24.js" type="module"></script></body>
<script src="runtime.6c1d3ca2f59f96ab.js" type="module"></script><script src="polyfills.def0190516b19e6b.js" type="module"></script><script src="main.3a61f19611b057ae.js" type="module"></script></body>
</html>
1 change: 1 addition & 0 deletions dist/main.3a61f19611b057ae.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/main.81ab6796a46ade24.js

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LiveAnnouncer } from '@angular/cdk/a11y';
import { Component, Inject } from '@angular/core';
import { Component, Inject, OnInit } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';
import { TranslocoService } from '@ngneat/transloco';
Expand Down Expand Up @@ -27,7 +27,7 @@ import { catchError, throwError } from 'rxjs';
standalone: true,
imports: DfManageTableModules,
})
export class DfManageServicesTableComponent extends DfManageTableComponent<ServiceRow> {
export class DfManageServicesTableComponent extends DfManageTableComponent<ServiceRow> implements OnInit {
serviceTypes: Array<ServiceType> = [];
system = false;
constructor(
Expand All @@ -40,11 +40,19 @@ export class DfManageServicesTableComponent extends DfManageTableComponent<Servi
dialog: MatDialog
) {
super(router, activatedRoute, liveAnnouncer, translateService, dialog);
this._activatedRoute.data.subscribe(({ system, data }) => {
this.serviceTypes = data.serviceTypes;
this.system = system;
this.allowCreate = !system;
if (system) {
}

override ngOnInit(): void {
// Call parent's ngOnInit first to set up the data source
super.ngOnInit();

// Then subscribe to route data for additional setup
this._activatedRoute.data.subscribe((routeData) => {
const { data } = routeData;
this.system = routeData['system'] || this._activatedRoute.snapshot.parent?.data?.['system'] || false;
this.serviceTypes = data?.serviceTypes;
this.allowCreate = !this.system;
if (this.system) {
this.actions = {
default: this.actions.default,
additional:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,13 @@ export class DfServiceDetailsComponent implements OnInit {
}

get subscriptionRequired() {
const serviceType = this.serviceForm.controls['type'].value;
// Local email service is open source and should not require subscription
if (serviceType === 'local_email') {
return false;
}
return (
this.serviceForm.controls['type'].value && this.configSchema?.length === 0
serviceType && this.configSchema?.length === 0
);
}

Expand Down
6 changes: 3 additions & 3 deletions src/app/adf-services/resolvers/services.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export const servicesResolver =
const serviceTypeService = inject(SERVICE_TYPE_SERVICE_TOKEN);
const servicesService = inject(SERVICES_SERVICE_TOKEN);

const system: boolean = route.data['system'];
const groups: Array<string> = route.data['groups'];
const system: boolean = route.data['system'] || route.parent?.data?.['system'] || false;
const groups: Array<string> = route.data['groups'] || route.parent?.data?.['groups'];

if (groups) {
const filteredGroups = groups.map(grp =>
Expand All @@ -44,7 +44,7 @@ export const servicesResolver =
limit,
sort: 'name',
filter: `${
system ? '(created_by_id is not null) and ' : ''
system ? '(created_by_id is null) and (name != "api_docs") and ' : ''
}(type in ("${serviceTypes.map(src => src.name).join('","')}"))${
filter ? ` and ${filter}` : ''
}`,
Expand Down
25 changes: 14 additions & 11 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { Component, OnInit } from '@angular/core';
import { DfLoadingSpinnerService } from './shared/services/df-loading-spinner.service';
import { NgIf, AsyncPipe } from '@angular/common';
import { RouterOutlet, Router, ActivatedRoute, NavigationEnd } from '@angular/router';
import {
RouterOutlet,
Router,
ActivatedRoute,
NavigationEnd,
} from '@angular/router';
import { DfSideNavComponent } from './shared/components/df-side-nav/df-side-nav.component';
import { DfLicenseCheckService } from './shared/services/df-license-check.service';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
Expand Down Expand Up @@ -36,18 +41,16 @@ export class AppComponent implements OnInit {
ngOnInit() {
this.loggingService.log('AppComponent initialized');
this.handleAuthentication();

// Monitor license check changes and redirect when disable_ui is true
this.licenseCheck$
.pipe(untilDestroyed(this))
.subscribe(licenseCheck => {
if (licenseCheck?.disableUi === 'true') {
// Force navigation to license-expired page
if (!this.router.url.includes(ROUTES.LICENSE_EXPIRED)) {
this.router.navigate([ROUTES.LICENSE_EXPIRED]);
}
this.licenseCheck$.pipe(untilDestroyed(this)).subscribe(licenseCheck => {
if (licenseCheck?.disableUi === 'true') {
// Force navigation to license-expired page
if (!this.router.url.includes(ROUTES.LICENSE_EXPIRED)) {
this.router.navigate([ROUTES.LICENSE_EXPIRED]);
}
});
}
});
}

private handleAuthentication() {
Expand Down
13 changes: 8 additions & 5 deletions src/app/shared/guards/global-license.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ import { of } from 'rxjs';
export const globalLicenseGuard: CanActivateFn = (route, state) => {
const licenseCheckService = inject(DfLicenseCheckService);
const router = inject(Router);

// Get the current license check value without triggering new API calls
const licenseCheck = licenseCheckService.currentLicenseCheck;

// If disable_ui is true and we're not on the license-expired page, redirect
if (licenseCheck?.disableUi === 'true' && !state.url.includes(ROUTES.LICENSE_EXPIRED)) {
if (
licenseCheck?.disableUi === 'true' &&
!state.url.includes(ROUTES.LICENSE_EXPIRED)
) {
return of(router.createUrlTree([ROUTES.LICENSE_EXPIRED]));
}

return of(true);
};
};
7 changes: 4 additions & 3 deletions src/app/shared/guards/license.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const licenseGuard = (route: ActivatedRouteSnapshot) => {
const licenseCheckService = inject(DfLicenseCheckService);
const router = inject(Router);
const systemConfigDataService = inject(DfSystemConfigDataService);

// First check if we already have a license check result
const currentLicenseCheck = licenseCheckService.currentLicenseCheck;
if (currentLicenseCheck) {
Expand All @@ -32,7 +32,7 @@ export const licenseGuard = (route: ActivatedRouteSnapshot) => {
return of(router.createUrlTree([ROUTES.HOME]));
}
}

return systemConfigDataService.environment$.pipe(
take(1),
switchMap(environment => {
Expand Down Expand Up @@ -72,7 +72,8 @@ export const licenseGuard = (route: ActivatedRouteSnapshot) => {
catchError(error => {
// The error response is already handled in the service
// Check the current value after error
const errorLicenseCheck = licenseCheckService.currentLicenseCheck;
const errorLicenseCheck =
licenseCheckService.currentLicenseCheck;
if (errorLicenseCheck?.disableUi === 'true') {
if (route?.routeConfig?.path !== ROUTES.LICENSE_EXPIRED) {
return of(router.createUrlTree([ROUTES.LICENSE_EXPIRED]));
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/services/df-license-check.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { mapSnakeToCamel } from '../utilities/case';
export class DfLicenseCheckService {
private licenseCheckSubject = new BehaviorSubject<CheckResponse | null>(null);
licenseCheck$ = this.licenseCheckSubject.asObservable();

get currentLicenseCheck(): CheckResponse | null {
return this.licenseCheckSubject.value;
}
Expand Down
12 changes: 7 additions & 5 deletions src/app/shared/services/df-license-initializer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ export class DfLicenseInitializerService {
) {
// Check if we don't already have a license check result
if (!this.licenseCheckService.currentLicenseCheck) {
return this.licenseCheckService.check(environment.platform.licenseKey as string).pipe(
map(() => true),
catchError(() => of(true)) // Continue even if check fails
);
return this.licenseCheckService
.check(environment.platform.licenseKey as string)
.pipe(
map(() => true),
catchError(() => of(true)) // Continue even if check fails
);
}
}
return of(true);
})
);
}
}
}