mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-31 00:16:47 +01:00
3a14b97fdd
<!-- Thanks for creating a PR! To make it easier for reviewers and everyone else to understand what your changes relate to, please add some relevant content to the headings below. Feel free to ignore or delete sections that you don't think are relevant. Thank you! ❤️ --> ## About the changes <!-- Describe the changes introduced. What are they and why are they being introduced? Feel free to also add screenshots or steps to view the changes if they're visual. --> Adds a UI that shows current status of version and feature usage collection configuration, and a presence in the configuration menu + menu bar. Configuring these features is done by setting environment variables. The version info collection is an existing feature that we're making more visible, the feature usage collection feature is a new feature that has it's own environment configuration but also depends on version info collection being active to work. When version collection is turned off and the experimental feature flag for feature usage collection is turned off: <img width="1269" alt="image" src="https://github.com/Unleash/unleash/assets/707867/435a07da-d238-4b5b-a150-07e3bd6b816f"> When version collection is turned on and the experimental feature flag is off: <img width="1249" alt="image" src="https://github.com/Unleash/unleash/assets/707867/8d1a76c5-99c9-4551-9a4f-86d477bbbf6f"> When the experimental feature flag is enabled, and version+telemetry is turned off: <img width="1239" alt="image" src="https://github.com/Unleash/unleash/assets/707867/e0bc532b-be94-4076-bee1-faef9bc48a5b"> When version collection is turned on, the experimental feature flag is enabled, and telemetry collection is turned off: <img width="1234" alt="image" src="https://github.com/Unleash/unleash/assets/707867/1bd190c1-08fe-4402-bde3-56f863a33289"> When version collection is turned on, the experimental feature flag is enabled, and telemetry collection is turned on: <img width="1229" alt="image" src="https://github.com/Unleash/unleash/assets/707867/848912cd-30bd-43cf-9b81-c58a4cbad1e4"> When version collection is turned off, the experimental feature flag is enabled, and telemetry collection is turned on: <img width="1241" alt="image" src="https://github.com/Unleash/unleash/assets/707867/d2b981f2-033f-4fae-a115-f93e0653729b"> --------- Co-authored-by: sighphyre <liquidwicked64@gmail.com> Co-authored-by: Nuno Góis <github@nunogois.com> Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
150 lines
5.2 KiB
TypeScript
150 lines
5.2 KiB
TypeScript
import Controller from '../controller';
|
|
import { IUnleashServices, IUnleashConfig } from '../../types';
|
|
import FeatureController from './feature';
|
|
import { FeatureTypeController } from './feature-type';
|
|
import ArchiveController from './archive';
|
|
import StrategyController from './strategy';
|
|
import EventController from './event';
|
|
import PlaygroundController from '../../features/playground/playground';
|
|
import MetricsController from './metrics';
|
|
import UserController from './user/user';
|
|
import ConfigController from './config';
|
|
import { ContextController } from './context';
|
|
import ClientMetricsController from './client-metrics';
|
|
import StateController from './state';
|
|
import TagController from './tag';
|
|
import TagTypeController from './tag-type';
|
|
import AddonController from './addon';
|
|
import { ApiTokenController } from './api-token';
|
|
import UserAdminController from './user-admin';
|
|
import EmailController from './email';
|
|
import UserFeedbackController from './user-feedback';
|
|
import UserSplashController from './user-splash';
|
|
import ProjectApi from './project';
|
|
import { EnvironmentsController } from './environments';
|
|
import ConstraintsController from './constraints';
|
|
import PatController from './user/pat';
|
|
import { PublicSignupController } from './public-signup';
|
|
import InstanceAdminController from './instance-admin';
|
|
import TelemetryController from './telemetry';
|
|
import FavoritesController from './favorites';
|
|
import MaintenanceController from './maintenance';
|
|
import { createKnexTransactionStarter } from '../../db/transaction';
|
|
import { Db } from '../../db/db';
|
|
import ExportImportController from '../../features/export-import-toggles/export-import-controller';
|
|
|
|
class AdminApi extends Controller {
|
|
constructor(config: IUnleashConfig, services: IUnleashServices, db: Db) {
|
|
super(config);
|
|
|
|
this.app.use(
|
|
'/features',
|
|
new FeatureController(config, services).router,
|
|
);
|
|
|
|
this.app.use(
|
|
'/feature-types',
|
|
new FeatureTypeController(config, services).router,
|
|
);
|
|
this.app.use(
|
|
'/archive',
|
|
new ArchiveController(config, services).router,
|
|
);
|
|
this.app.use(
|
|
'/strategies',
|
|
new StrategyController(config, services).router,
|
|
);
|
|
this.app.use('/events', new EventController(config, services).router);
|
|
this.app.use(
|
|
'/playground',
|
|
new PlaygroundController(config, services).router,
|
|
);
|
|
this.app.use(
|
|
'/metrics',
|
|
new MetricsController(config, services).router,
|
|
);
|
|
this.app.use(
|
|
'/client-metrics',
|
|
new ClientMetricsController(config, services).router,
|
|
);
|
|
this.app.use('/user', new UserController(config, services).router);
|
|
this.app.use(
|
|
'/user/tokens',
|
|
new PatController(config, services).router,
|
|
);
|
|
this.app.use(
|
|
'/ui-config',
|
|
new ConfigController(config, services).router,
|
|
);
|
|
this.app.use(
|
|
'/context',
|
|
new ContextController(config, services).router,
|
|
);
|
|
this.app.use('/state', new StateController(config, services).router);
|
|
this.app.use(
|
|
'/features-batch',
|
|
new ExportImportController(
|
|
config,
|
|
services,
|
|
createKnexTransactionStarter(db),
|
|
).router,
|
|
);
|
|
this.app.use('/tags', new TagController(config, services).router);
|
|
this.app.use(
|
|
'/tag-types',
|
|
new TagTypeController(config, services).router,
|
|
);
|
|
this.app.use('/addons', new AddonController(config, services).router);
|
|
this.app.use(
|
|
'/api-tokens',
|
|
new ApiTokenController(config, services).router,
|
|
);
|
|
this.app.use('/email', new EmailController(config, services).router);
|
|
this.app.use(
|
|
'/user-admin',
|
|
new UserAdminController(config, services).router,
|
|
);
|
|
this.app.use(
|
|
'/feedback',
|
|
new UserFeedbackController(config, services).router,
|
|
);
|
|
this.app.use('/projects', new ProjectApi(config, services, db).router);
|
|
this.app.use(
|
|
'/environments',
|
|
new EnvironmentsController(config, services).router,
|
|
);
|
|
this.app.use(
|
|
'/splash',
|
|
new UserSplashController(config, services).router,
|
|
);
|
|
this.app.use(
|
|
'/constraints',
|
|
new ConstraintsController(config, services).router,
|
|
);
|
|
this.app.use(
|
|
'/invite-link',
|
|
new PublicSignupController(config, services).router,
|
|
);
|
|
this.app.use(
|
|
'/instance-admin',
|
|
new InstanceAdminController(config, services).router,
|
|
);
|
|
this.app.use(
|
|
`/projects`,
|
|
new FavoritesController(config, services).router,
|
|
);
|
|
|
|
this.app.use(
|
|
'/maintenance',
|
|
new MaintenanceController(config, services).router,
|
|
);
|
|
|
|
this.app.use(
|
|
'/telemetry',
|
|
new TelemetryController(config, services).router,
|
|
);
|
|
}
|
|
}
|
|
|
|
module.exports = AdminApi;
|