mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-05 13:52:15 +00:00
fix(console): Implement generic feature toggle (#9516)
This PR implements a component which is used to render the feature settings in a generic way. All features besides`loginV2` and `improvedPerformance` are rendered. Note: The feature flags are not autogenerated as the console needs descriptions for the respective features and there are multiple types where additional fields like text input is required Closes #9090 --------- Co-authored-by: conblem <[email protected]>
This commit is contained in:
@@ -1,57 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { GrpcService } from './grpc.service';
|
||||
|
||||
import {
|
||||
GetOrganizationFeaturesRequest,
|
||||
GetOrganizationFeaturesResponse,
|
||||
} from '../proto/generated/zitadel/feature/v2beta/organization_pb';
|
||||
import { GetUserFeaturesRequest, GetUserFeaturesResponse } from '../proto/generated/zitadel/feature/v2beta/user_pb';
|
||||
import { GetSystemFeaturesRequest, GetSystemFeaturesResponse } from '../proto/generated/zitadel/feature/v2beta/system_pb';
|
||||
import {
|
||||
GetInstanceFeaturesRequest,
|
||||
GetInstanceFeaturesResponse,
|
||||
ResetInstanceFeaturesRequest,
|
||||
SetInstanceFeaturesRequest,
|
||||
SetInstanceFeaturesResponse,
|
||||
} from '../proto/generated/zitadel/feature/v2/instance_pb';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class FeatureService {
|
||||
constructor(private readonly grpcService: GrpcService) {}
|
||||
|
||||
public getInstanceFeatures(inheritance: boolean): Promise<GetInstanceFeaturesResponse> {
|
||||
const req = new GetInstanceFeaturesRequest();
|
||||
req.setInheritance(inheritance);
|
||||
return this.grpcService.feature.getInstanceFeatures(req, null).then((resp) => resp);
|
||||
}
|
||||
|
||||
public setInstanceFeatures(req: SetInstanceFeaturesRequest): Promise<SetInstanceFeaturesResponse> {
|
||||
return this.grpcService.feature.setInstanceFeatures(req, null);
|
||||
}
|
||||
|
||||
public resetInstanceFeatures(): Promise<SetInstanceFeaturesResponse> {
|
||||
const req = new ResetInstanceFeaturesRequest();
|
||||
return this.grpcService.feature.resetInstanceFeatures(req, null);
|
||||
}
|
||||
|
||||
public getOrganizationFeatures(orgId: string, inheritance: boolean): Promise<GetOrganizationFeaturesResponse> {
|
||||
const req = new GetOrganizationFeaturesRequest();
|
||||
req.setOrganizationId(orgId);
|
||||
req.setInheritance(inheritance);
|
||||
return this.grpcService.feature.getOrganizationFeatures(req, null).then((resp) => resp);
|
||||
}
|
||||
|
||||
public getSystemFeatures(): Promise<GetSystemFeaturesResponse> {
|
||||
const req = new GetSystemFeaturesRequest();
|
||||
return this.grpcService.feature.getSystemFeatures(req, null).then((resp) => resp);
|
||||
}
|
||||
|
||||
public getUserFeatures(userId: string, inheritance: boolean): Promise<GetUserFeaturesResponse> {
|
||||
const req = new GetUserFeaturesRequest();
|
||||
req.setInheritance(inheritance);
|
||||
req.setUserId(userId);
|
||||
return this.grpcService.feature.getUserFeatures(req, null).then((resp) => resp);
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,6 @@ import { createFeatureServiceClient, createUserServiceClient } from '@zitadel/cl
|
||||
//@ts-ignore
|
||||
import { createAuthServiceClient, createManagementServiceClient } from '@zitadel/client/v1';
|
||||
import { createGrpcWebTransport } from '@connectrpc/connect-web';
|
||||
import { FeatureServiceClient } from '../proto/generated/zitadel/feature/v2/Feature_serviceServiceClientPb';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@@ -31,7 +30,6 @@ export class GrpcService {
|
||||
public auth!: AuthServiceClient;
|
||||
public mgmt!: ManagementServiceClient;
|
||||
public admin!: AdminServiceClient;
|
||||
public feature!: FeatureServiceClient;
|
||||
public user!: UserServiceClient;
|
||||
public userNew!: ReturnType<typeof createUserServiceClient>;
|
||||
public mgmtNew!: ReturnType<typeof createManagementServiceClient>;
|
||||
@@ -88,12 +86,6 @@ export class GrpcService {
|
||||
// @ts-ignore
|
||||
interceptors,
|
||||
);
|
||||
this.feature = new FeatureServiceClient(
|
||||
env.api,
|
||||
null,
|
||||
// @ts-ignore
|
||||
interceptors,
|
||||
);
|
||||
this.user = new UserServiceClient(
|
||||
env.api,
|
||||
null,
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { GrpcService } from './grpc.service';
|
||||
import { GetInstanceFeaturesResponse } from '@zitadel/proto/zitadel/feature/v2/instance_pb';
|
||||
import {
|
||||
GetInstanceFeaturesResponse,
|
||||
ResetInstanceFeaturesResponse,
|
||||
SetInstanceFeaturesRequest,
|
||||
SetInstanceFeaturesRequestSchema,
|
||||
SetInstanceFeaturesResponse,
|
||||
} from '@zitadel/proto/zitadel/feature/v2/instance_pb';
|
||||
import { MessageInitShape } from '@bufbuild/protobuf';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@@ -11,4 +18,14 @@ export class NewFeatureService {
|
||||
public getInstanceFeatures(): Promise<GetInstanceFeaturesResponse> {
|
||||
return this.grpcService.featureNew.getInstanceFeatures({});
|
||||
}
|
||||
|
||||
public setInstanceFeatures(
|
||||
req: MessageInitShape<typeof SetInstanceFeaturesRequestSchema>,
|
||||
): Promise<SetInstanceFeaturesResponse> {
|
||||
return this.grpcService.featureNew.setInstanceFeatures(req);
|
||||
}
|
||||
|
||||
public resetInstanceFeatures(): Promise<ResetInstanceFeaturesResponse> {
|
||||
return this.grpcService.featureNew.resetInstanceFeatures({});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user