1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

chore: remove private projects flag (#5743)

This commit is contained in:
Jaanus Sellin 2024-01-02 15:53:26 +02:00 committed by GitHub
parent 049c5b9afa
commit dc0df235dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 89 additions and 143 deletions

View File

@ -14,7 +14,6 @@ const StyledDescription = styled(Typography)(({ theme }) => ({
}));
export const CollaborationModeTooltip: FC = () => {
const privateProjects = useUiFlag('privateProjects');
return (
<HelpIcon
htmlTooltip
@ -33,19 +32,13 @@ export const CollaborationModeTooltip: FC = () => {
requests
</StyledDescription>
</Box>
<ConditionallyRender
condition={Boolean(privateProjects)}
show={
<Box sx={{ mt: 2 }}>
<StyledTitle>private: </StyledTitle>
<StyledDescription>
Only admins, editors and project members can
see and access the project and associated
feature toggles
Only admins, editors and project members can see and
access the project and associated feature toggles
</StyledDescription>
</Box>
}
/>
</>
}
/>

View File

@ -133,22 +133,14 @@ const ProjectEnterpriseSettingsForm: React.FC<IProjectEnterpriseSettingsForm> =
setFeatureNamingDescription,
setProjectMode,
errors,
clearErrors,
}) => {
const privateProjects = useUiFlag('privateProjects');
const { setPreviousPattern, trackPattern } =
useFeatureNamePatternTracking();
const projectModeOptions = privateProjects
? [
const projectModeOptions = [
{ key: 'open', label: 'open' },
{ key: 'protected', label: 'protected' },
{ key: 'private', label: 'private' },
]
: [
{ key: 'open', label: 'open' },
{ key: 'protected', label: 'protected' },
];
useEffect(() => {

View File

@ -103,17 +103,11 @@ const ProjectForm: React.FC<IProjectForm> = ({
clearErrors,
}) => {
const { isEnterprise } = useUiConfig();
const privateProjects = useUiFlag('privateProjects');
const projectModeOptions = privateProjects
? [
const projectModeOptions = [
{ key: 'open', label: 'open' },
{ key: 'protected', label: 'protected' },
{ key: 'private', label: 'private' },
]
: [
{ key: 'open', label: 'open' },
{ key: 'protected', label: 'protected' },
];
return (

View File

@ -62,7 +62,6 @@ export type UiFlags = {
customRootRolesKillSwitch?: boolean;
strategyVariant?: boolean;
doraMetrics?: boolean;
privateProjects?: boolean;
dependentFeatures?: boolean;
scheduledConfigurationChanges?: boolean;
featureSearchAPI?: boolean;

View File

@ -104,7 +104,6 @@ exports[`should create default config 1`] = `
"migrationLock": true,
"newStrategyConfiguration": false,
"personalAccessTokensKillSwitch": false,
"privateProjects": false,
"proPlanAutoCharge": false,
"responseTimeWithAppNameKillSwitch": false,
"scheduledConfigurationChanges": false,

View File

@ -1095,7 +1095,7 @@ class FeatureToggleService {
archived,
);
if (this.flagResolver.isEnabled('privateProjects') && userId) {
if (userId) {
const projectAccess =
await this.privateProjectChecker.getUserAccessibleProjects(
userId,
@ -2053,11 +2053,8 @@ class FeatureToggleService {
): Promise<FeatureToggle[]> {
const features = await this.featureToggleStore.getArchivedFeatures();
if (this.flagResolver.isEnabled('privateProjects')) {
const projectAccess =
await this.privateProjectChecker.getUserAccessibleProjects(
userId,
);
await this.privateProjectChecker.getUserAccessibleProjects(userId);
if (projectAccess.mode === 'all') {
return features;
} else {
@ -2066,8 +2063,6 @@ class FeatureToggleService {
);
}
}
return features;
}
async getArchivedFeaturesByProjectId(
archived: boolean,

View File

@ -19,7 +19,6 @@ beforeAll(async () => {
advancedPlayground: true,
strictSchemaValidation: true,
strategyVariant: true,
privateProjects: true,
},
},
},

View File

@ -102,11 +102,9 @@ export class PlaygroundService {
const segments = await this.segmentService.getActive();
let filteredProjects: typeof projects = projects;
if (this.flagResolver.isEnabled('privateProjects')) {
const projectAccess =
await this.privateProjectChecker.getUserAccessibleProjects(
userId,
);
await this.privateProjectChecker.getUserAccessibleProjects(userId);
if (projectAccess.mode === 'all') {
filteredProjects = projects;
} else if (projects === ALL) {
@ -116,7 +114,6 @@ export class PlaygroundService {
projectAccess.projects.includes(project),
);
}
}
const environmentFeatures = await Promise.all(
environments.map((env) =>

View File

@ -1,10 +1,10 @@
import { IPrivateProjectChecker } from './privateProjectCheckerType';
import { ProjectAccess } from './privateProjectStore';
import { ALL_PROJECT_ACCESS, ProjectAccess } from './privateProjectStore';
export class FakePrivateProjectChecker implements IPrivateProjectChecker {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async getUserAccessibleProjects(userId: number): Promise<ProjectAccess> {
throw new Error('Method not implemented.');
return ALL_PROJECT_ACCESS;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars

View File

@ -160,11 +160,8 @@ export default class ClientInstanceService {
): Promise<IClientApplication[]> {
const applications =
await this.clientApplicationsStore.getAppsForStrategy(query);
if (this.flagResolver.isEnabled('privateProjects')) {
const accessibleProjects =
await this.privateProjectChecker.getUserAccessibleProjects(
userId,
);
await this.privateProjectChecker.getUserAccessibleProjects(userId);
if (accessibleProjects.mode === 'all') {
return applications;
} else {
@ -182,8 +179,6 @@ export default class ClientInstanceService {
});
}
}
return applications;
}
async getApplication(appName: string): Promise<IApplication> {
const [seenToggles, application, instances, strategies, features] =

View File

@ -75,25 +75,18 @@ class ContextService {
): Promise<ContextFieldStrategiesSchema> {
const strategies =
await this.featureStrategiesStore.getStrategiesByContextField(name);
if (this.flagResolver.isEnabled('privateProjects')) {
const accessibleProjects =
await this.privateProjectChecker.getUserAccessibleProjects(
userId,
);
await this.privateProjectChecker.getUserAccessibleProjects(userId);
if (accessibleProjects.mode === 'all') {
return this.mapStrategies(strategies);
} else {
return this.mapStrategies(
strategies.filter((strategy) =>
accessibleProjects.projects.includes(
strategy.projectId,
),
accessibleProjects.projects.includes(strategy.projectId),
),
);
}
}
return this.mapStrategies(strategies);
}
private mapStrategies(strategies: IFeatureStrategy[]) {
return {

View File

@ -180,7 +180,7 @@ export default class ProjectService {
userId,
);
if (this.flagResolver.isEnabled('privateProjects') && userId) {
if (userId) {
const projectAccess =
await this.privateProjectChecker.getUserAccessibleProjects(
userId,

View File

@ -96,11 +96,8 @@ export class SegmentService implements ISegmentService {
userId: number,
): Promise<StrategiesUsingSegment> {
const allStrategies = await this.getAllStrategies(id);
if (this.flagResolver.isEnabled('privateProjects')) {
const accessibleProjects =
await this.privateProjectChecker.getUserAccessibleProjects(
userId,
);
await this.privateProjectChecker.getUserAccessibleProjects(userId);
if (accessibleProjects.mode === 'all') {
return allStrategies;
} else {
@ -113,8 +110,6 @@ export class SegmentService implements ISegmentService {
};
}
}
return allStrategies;
}
async getAllStrategies(id: number): Promise<StrategiesUsingSegment> {
const strategies =

View File

@ -23,7 +23,6 @@ export type IFlagKey =
| 'advancedPlayground'
| 'filterInvalidClientMetrics'
| 'customRootRolesKillSwitch'
| 'privateProjects'
| 'disableMetrics'
| 'featureSearchAPI'
| 'featureSearchFrontend'
@ -112,10 +111,6 @@ const flags: IFlags = {
process.env.UNLEASH_EXPERIMENTAL_CUSTOM_ROOT_ROLES_KILL_SWITCH,
false,
),
privateProjects: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_PRIVATE_PROJECTS,
false,
),
disableMetrics: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_DISABLE_METRICS,
false,

View File

@ -40,7 +40,6 @@ process.nextTick(async () => {
embedProxyFrontend: true,
anonymiseEventLog: false,
responseTimeWithAppNameKillSwitch: false,
privateProjects: true,
featureSearchAPI: true,
featureSearchFrontend: true,
stripClientHeadersOn304: true,

View File

@ -10,13 +10,17 @@ let app: IUnleashTest;
beforeAll(async () => {
db = await dbInit('context_api_serial', getLogger);
app = await setupAppWithCustomConfig(db.stores, {
app = await setupAppWithCustomConfig(
db.stores,
{
experimental: {
flags: {
strictSchemaValidation: true,
},
},
});
},
db.rawDatabase,
);
});
afterAll(async () => {

View File

@ -10,7 +10,7 @@ let db: ITestDb;
beforeAll(async () => {
db = await dbInit('metrics_serial', getLogger, {});
app = await setupAppWithCustomConfig(db.stores, {});
app = await setupAppWithCustomConfig(db.stores, {}, db.rawDatabase);
});
beforeEach(async () => {

View File

@ -61,9 +61,6 @@ beforeAll(async () => {
});
const config = createTestConfig({
getLogger,
experimental: {
flags: { privateProjects: true },
},
});
eventService = new EventService(stores, config);
accessService = createAccessService(db.rawDatabase, config);