Skip to content

Commit

Permalink
fix(console): rename envId to envHrid to avoid any confusion
Browse files Browse the repository at this point in the history
this property does not always contain the environment Id but the hrid and if not defines the environment id.
  • Loading branch information
ThibaudAV committed Mar 20, 2024
1 parent 212a058 commit 7c8bf29
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion gravitee-apim-console-webui/src/app-routing.module.ts
Expand Up @@ -56,7 +56,7 @@ const appRoutes: Routes = [
import('./organization/configuration/organization-settings-routing.module').then((m) => m.OrganizationSettingsRoutingModule),
},
{
path: ':envId',
path: ':envHrid',
component: AppComponent,
loadChildren: () => import('./management/management.module').then((m) => m.ManagementModule),
},
Expand Down
Expand Up @@ -370,7 +370,7 @@ export class ApiNavigationComponent implements OnInit, OnDestroy {
}

private getApiNavigationSearchItems() {
const environmentId = this.activatedRoute.snapshot.params.envId;
const environmentId = this.activatedRoute.snapshot.params.envHrid;
const apiId = this.currentApi.id;
const parentRouterLink = getPathFromRoot(this.activatedRoute);

Expand Down
Expand Up @@ -177,7 +177,7 @@ export class ApplicationNavigationComponent implements OnInit, OnDestroy {
}

private getApplicationNavigationSearchItems(): MenuSearchItem[] {
const environmentId = this.activatedRoute.snapshot.params.envId;
const environmentId = this.activatedRoute.snapshot.params.envHrid;
const applicationId = this.activatedRoute.snapshot.params.applicationId;
const parentRouterLink = getPathFromRoot(this.activatedRoute);

Expand Down
Expand Up @@ -39,7 +39,7 @@ export const EnvironmentGuard: {
const gioMenuSearchService = inject(GioMenuSearchService);
const settingsNavigationService = inject(SettingsNavigationService);

const paramEnv = route.params.envId;
const paramEnv = route.params.envHrid;

return environmentService.list().pipe(
map((environments) => {
Expand All @@ -62,7 +62,7 @@ export const EnvironmentGuard: {
switchMap(() => environmentSettingsService.load()),
// Load search items in menu
map(() => {
gioMenuSearchService.addMenuSearchItems(settingsNavigationService.getSettingsNavigationSearchItems(route.params.envId));
gioMenuSearchService.addMenuSearchItems(settingsNavigationService.getSettingsNavigationSearchItems(route.params.envHrid));
return true;
}),
);
Expand All @@ -73,7 +73,7 @@ export const EnvironmentGuard: {
const gioMenuSearchService = inject(GioMenuSearchService);

gioPermissionService.clearEnvironmentPermissions();
gioMenuSearchService.removeMenuSearchItems([currentRoute.params.envId]);
gioMenuSearchService.removeMenuSearchItems([currentRoute.params.envHrid]);
return true;
},
};
Expand Up @@ -58,7 +58,7 @@ const IdentityProvidersComponentAjs: ng.IComponentOptions = {
this.providedConfigurationMessage = 'Configuration provided by the system';

this.$onInit = () => {
this.envId = this.activatedRoute.snapshot.params.envId;
this.envId = Constants.org.currentEnv.id;
this.canUpdatePortalSettings = UserService.isUserHasPermissions([
'environment-settings-c',
'environment-settings-u',
Expand Down
6 changes: 4 additions & 2 deletions gravitee-apim-console-webui/src/user/tasks/tasks.component.ts
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Component, OnDestroy, OnInit } from '@angular/core';
import { Component, Inject, OnDestroy, OnInit } from '@angular/core';
import { filter, map, switchMap, takeUntil, tap } from 'rxjs/operators';
import { Subject } from 'rxjs';
import { MatDialog } from '@angular/material/dialog';
Expand All @@ -32,6 +32,7 @@ import { PromotionApprovalTaskData, Task } from '../../entities/task/task';
import { PromotionService } from '../../services-ngx/promotion.service';
import { SnackBarService } from '../../services-ngx/snack-bar.service';
import { Workflow } from '../../entities/workflow/workflow';
import { Constants } from '../../entities/Constants';

class TaskData {
icon: string;
Expand Down Expand Up @@ -61,6 +62,7 @@ export class TasksComponent implements OnInit, OnDestroy {
private readonly promotionService: PromotionService,
private readonly matDialog: MatDialog,
private readonly snackBarService: SnackBarService,
@Inject(Constants) private readonly constants: Constants,
) {}

ngOnInit(): void {
Expand Down Expand Up @@ -97,7 +99,7 @@ export class TasksComponent implements OnInit, OnDestroy {
}

go(task: TaskData): void {
const currentEnvironmentId = this.activatedRoute.snapshot.params.environmentId;
const currentEnvironmentId = this.constants.org.currentEnv.id;

switch (task.type) {
case 'SUBSCRIPTION_APPROVAL': {
Expand Down

0 comments on commit 7c8bf29

Please sign in to comment.