mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	upload limit and import ui tweaks (#2998)
This commit is contained in:
		
							parent
							
								
									527ed5feaf
								
							
						
					
					
						commit
						6b9a242be5
					
				@ -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>
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										11
									
								
								src/lib/middleware/unless-middleware.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								src/lib/middleware/unless-middleware.ts
									
									
									
									
									
										Normal 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);
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
@ -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;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user