mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-04 07:05:41 +00:00 
			
		
		
		
	made StatusRenderer less strict to allow usage of custom states (#6008)
This commit is contained in:
		@@ -69,7 +69,7 @@ export const StatusRenderer = ({
 | 
			
		||||
  options
 | 
			
		||||
}: {
 | 
			
		||||
  status: string;
 | 
			
		||||
  type: ModelType;
 | 
			
		||||
  type: ModelType | string;
 | 
			
		||||
  options?: renderStatusLabelOptionsInterface;
 | 
			
		||||
}) => {
 | 
			
		||||
  const statusCodeList = useServerApiState.getState().status;
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ import { ApiPaths } from '../enums/ApiEndpoints';
 | 
			
		||||
import { ModelType } from '../enums/ModelType';
 | 
			
		||||
import { ServerAPIProps } from './states';
 | 
			
		||||
 | 
			
		||||
type StatusLookup = Record<ModelType, StatusCodeListInterface>;
 | 
			
		||||
type StatusLookup = Record<ModelType | string, StatusCodeListInterface>;
 | 
			
		||||
 | 
			
		||||
interface ServerApiStateProps {
 | 
			
		||||
  server: ServerAPIProps;
 | 
			
		||||
@@ -35,7 +35,8 @@ export const useServerApiState = create<ServerApiStateProps>()(
 | 
			
		||||
        await api.get(apiUrl(ApiPaths.global_status)).then((response) => {
 | 
			
		||||
          const newStatusLookup: StatusLookup = {} as StatusLookup;
 | 
			
		||||
          for (const key in response.data) {
 | 
			
		||||
            newStatusLookup[statusCodeList[key]] = response.data[key].values;
 | 
			
		||||
            newStatusLookup[statusCodeList[key] || key] =
 | 
			
		||||
              response.data[key].values;
 | 
			
		||||
          }
 | 
			
		||||
          set({ status: newStatusLookup });
 | 
			
		||||
        });
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user