1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-20 00:08:02 +01:00

upload limit and import ui tweaks (#2998)

This commit is contained in:
Mateusz Kwasniewski 2023-01-26 12:36:45 +01:00 committed by GitHub
parent 527ed5feaf
commit 6b9a242be5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 12 deletions

View File

@ -159,12 +159,16 @@ export const ValidationStage: FC<{
the import, they will be overwritten with the
configuration from this import file
</WarningHeader>
{validationResult.warnings.map(error => (
<Box sx={{ p: 2 }}>
<WarningMessage>{error.message}</WarningMessage>
{validationResult.warnings.map(warning => (
<Box key={warning.message} sx={{ p: 2 }}>
<WarningMessage>
{warning.message}
</WarningMessage>
<StyledItems>
{error.affectedItems.map(item => (
<StyledItem>{item}</StyledItem>
{warning.affectedItems.map(item => (
<StyledItem key={item}>
{item}
</StyledItem>
))}
</StyledItems>
</Box>

View File

@ -26,6 +26,7 @@ import { conditionalMiddleware } from './middleware/conditional-middleware';
import patMiddleware from './middleware/pat-middleware';
import { Knex } from 'knex';
import maintenanceMiddleware from './middleware/maintenance-middleware';
import { unless } from './middleware/unless-middleware';
export default async function getApp(
config: IUnleashConfig,
@ -62,7 +63,17 @@ export default async function getApp(
app.use(compression());
app.use(cookieParser());
app.use(express.json({ strict: false }));
app.use(
`${baseUriPath}/api/admin/features-batch`,
express.json({ strict: false, limit: '500kB' }),
);
app.use(
unless(
`${baseUriPath}/api/admin/features-batch`,
express.json({ strict: false }),
),
);
if (unleashSession) {
app.use(unleashSession);
}

View File

@ -0,0 +1,11 @@
import { RequestHandler } from 'express';
export const unless =
(path: string, middleware: RequestHandler): RequestHandler =>
(req, res, next) => {
if (path === req.path) {
return next();
} else {
return middleware(req, res, next);
}
};

View File

@ -18,12 +18,6 @@ import { ExportQuerySchema } from '../openapi/spec/export-query-schema';
import { FEATURES_EXPORTED, IFlagResolver, IUnleashServices } from '../types';
import { ExportResultSchema } from '../openapi';
export interface IImportDTO {
data: ExportResultSchema;
project: string;
environment: string;
}
export default class ExportImportService {
private logger: Logger;