diff --git a/webapp/packages/core-authentication/src/TeamInfoMetaParametersResource.ts b/webapp/packages/core-authentication/src/TeamInfoMetaParametersResource.ts index 21987208d3..53859c6079 100644 --- a/webapp/packages/core-authentication/src/TeamInfoMetaParametersResource.ts +++ b/webapp/packages/core-authentication/src/TeamInfoMetaParametersResource.ts @@ -9,7 +9,7 @@ import { injectable } from '@cloudbeaver/core-di'; import { CachedMapAllKey, CachedMapResource, isResourceAlias, ResourceKey, resourceKeyList, ResourceKeyUtils } from '@cloudbeaver/core-resource'; import { GraphQLService } from '@cloudbeaver/core-sdk'; -import { TeamMetaParameter } from './TeamMetaParametersResource'; +import type { TeamMetaParameter } from './TeamMetaParametersResource'; import { TeamsResource } from './TeamsResource'; @injectable() @@ -56,6 +56,10 @@ export class TeamInfoMetaParametersResource extends CachedMapResource): Promise { + await this.graphQLService.sdk.saveTeamMetaParameters({ teamId, parameters }); + } + protected validateKey(key: string): boolean { return typeof key === 'string'; } diff --git a/webapp/packages/core-authentication/src/TeamsResource.ts b/webapp/packages/core-authentication/src/TeamsResource.ts index 23dbdd4fc3..f65b7edaa8 100644 --- a/webapp/packages/core-authentication/src/TeamsResource.ts +++ b/webapp/packages/core-authentication/src/TeamsResource.ts @@ -24,7 +24,7 @@ import { } from '@cloudbeaver/core-sdk'; import { isArraysEqual, UndefinedToNull } from '@cloudbeaver/core-utils'; -import { TeamMetaParameter } from './TeamMetaParametersResource'; +import type { TeamMetaParameter } from './TeamMetaParametersResource'; const NEW_TEAM_SYMBOL = Symbol('new-team'); @@ -40,10 +40,7 @@ export class TeamsResource extends CachedMapResource, - ): Promise { + async createTeam({ teamId, teamPermissions, teamName, description }: TeamInfo): Promise { const response = await this.graphQLService.sdk.createTeam({ teamId, teamName, @@ -59,16 +56,12 @@ export class TeamsResource extends CachedMapResource, - ): Promise { + async updateTeam({ teamId, teamPermissions, teamName, description }: TeamInfo): Promise { const { team } = await this.graphQLService.sdk.updateTeam({ teamId, teamName, @@ -78,7 +71,6 @@ export class TeamsResource extends CachedMapResource): Promise { - await this.graphQLService.sdk.saveTeamMetaParameters({ teamId, parameters }); - } - protected async loader(originalKey: ResourceKey, includes?: string[]): Promise> { const all = this.aliases.isAlias(originalKey, CachedMapAllKey); const teamsList: TeamInfo[] = []; diff --git a/webapp/packages/core-authentication/src/UserInfoMetaParametersResource.ts b/webapp/packages/core-authentication/src/UserInfoMetaParametersResource.ts index 38cc888f18..976bb380bd 100644 --- a/webapp/packages/core-authentication/src/UserInfoMetaParametersResource.ts +++ b/webapp/packages/core-authentication/src/UserInfoMetaParametersResource.ts @@ -10,7 +10,7 @@ import { CachedDataResource, ResourceKey } from '@cloudbeaver/core-resource'; import { GraphQLService } from '@cloudbeaver/core-sdk'; import { UserInfoResource } from './UserInfoResource'; -import { UserMetaParameter } from './UserMetaParametersResource'; +import type { UserMetaParameter } from './UserMetaParametersResource'; @injectable() export class UserInfoMetaParametersResource extends CachedDataResource { diff --git a/webapp/packages/core-authentication/src/UsersMetaParametersResource.ts b/webapp/packages/core-authentication/src/UsersMetaParametersResource.ts index 454f043138..d9bbda478e 100644 --- a/webapp/packages/core-authentication/src/UsersMetaParametersResource.ts +++ b/webapp/packages/core-authentication/src/UsersMetaParametersResource.ts @@ -20,7 +20,7 @@ import { } from '@cloudbeaver/core-resource'; import { GraphQLService } from '@cloudbeaver/core-sdk'; -import { UserMetaParameter } from './UserMetaParametersResource'; +import type { UserMetaParameter } from './UserMetaParametersResource'; import { UsersResource, UsersResourceFilterKey } from './UsersResource'; @injectable() @@ -39,7 +39,6 @@ export class UsersMetaParametersResource extends CachedMapResource): Promise> { const all = this.aliases.isAlias(originalKey, CachedMapAllKey); const keys: string[] = []; diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/Contexts/teamContext.ts b/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/Contexts/teamContext.ts index 846e214eab..a0d0674660 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/Contexts/teamContext.ts +++ b/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/Contexts/teamContext.ts @@ -5,7 +5,7 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { TeamInfoConfig } from '../ITeamFormProps'; +import type { TeamInfoConfig } from '../ITeamFormProps'; export function teamContext(): TeamInfoConfig { return { diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/Options/TeamOptionsTabService.ts b/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/Options/TeamOptionsTabService.ts index ff02edc114..d9fcbca3d1 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/Options/TeamOptionsTabService.ts +++ b/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/Options/TeamOptionsTabService.ts @@ -7,7 +7,7 @@ */ import React from 'react'; -import { TeamsResource } from '@cloudbeaver/core-authentication'; +import { TeamInfoMetaParametersResource, TeamsResource } from '@cloudbeaver/core-authentication'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import type { IExecutionContextProvider } from '@cloudbeaver/core-executor'; import { LocalizationService } from '@cloudbeaver/core-localization'; @@ -27,6 +27,7 @@ export class TeamOptionsTabService extends Bootstrap { constructor( private readonly teamFormService: TeamFormService, private readonly teamResource: TeamsResource, + private readonly teamsMetaParametersResource: TeamInfoMetaParametersResource, private readonly localizationService: LocalizationService, ) { super(); @@ -108,11 +109,18 @@ export class TeamOptionsTabService extends Bootstrap { try { if (create) { - const team = await this.teamResource.createTeam(config, metaParameters); + const [team] = await Promise.all([ + this.teamResource.createTeam(config), + this.teamsMetaParametersResource.setMetaParameters(config.teamId, metaParameters), + ]); + status.info('administration_teams_team_info_created'); status.info(team.teamId); } else { - const team = await this.teamResource.updateTeam(config, metaParameters); + const [team] = await Promise.all([ + this.teamResource.updateTeam(config), + this.teamsMetaParametersResource.setMetaParameters(config.teamId, metaParameters), + ]); status.info('administration_teams_team_info_updated'); status.info(team.teamId); diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/TeamFormState.ts b/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/TeamFormState.ts index fdf936bdd7..60c6789b96 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/TeamFormState.ts +++ b/webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/TeamFormState.ts @@ -150,7 +150,6 @@ export class TeamFormState implements ITeamFormState { return; } - await this.resource.load(data.config.teamId); - await this.teamInfoMetaParametersResource.load(data.config.teamId); + await Promise.all([this.resource.load(data.config.teamId), this.teamInfoMetaParametersResource.load(data.config.teamId)]); } } diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Info/UserFormInfoPart.ts b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Info/UserFormInfoPart.ts index f571968b46..3236b7566c 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Info/UserFormInfoPart.ts +++ b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/Info/UserFormInfoPart.ts @@ -207,10 +207,9 @@ export class UserFormInfoPart extends FormPart