@@ -14,10 +14,11 @@ import {
1414 getAssetUploadOptions ,
1515 getEventMetadata ,
1616 getExtendedEventMetadata ,
17+ getSourceUploadOptions ,
1718} from "../../../../selectors/eventSelectors" ;
1819import { useAppDispatch , useAppSelector } from "../../../../store" ;
1920import { getOrgProperties , getUserInformation } from "../../../../selectors/userInfoSelectors" ;
20- import { MetadataCatalog , UploadAssetOption , postNewEvent } from "../../../../slices/eventSlice" ;
21+ import { MetadataCatalog , UploadOption , postNewEvent } from "../../../../slices/eventSlice" ;
2122import { UserInfoState } from "../../../../slices/userInfoSlice" ;
2223import { removeNotificationWizardForm } from "../../../../slices/notificationSlice" ;
2324import NewMetadataCommonPage from "../ModalTabsAndPages/NewMetadataCommonPage" ;
@@ -34,7 +35,8 @@ const NewEventWizard: React.FC<{
3435} ) => {
3536 const dispatch = useAppDispatch ( ) ;
3637
37- const uploadAssetOptions = useAppSelector ( state => getAssetUploadOptions ( state ) ) ;
38+ const uploadSourceOptions = useAppSelector ( state => getSourceUploadOptions ( state ) ) ;
39+ const assetUploadOptions = useAppSelector ( state => getAssetUploadOptions ( state ) ) ;
3840 const metadataFields = useAppSelector ( state => getEventMetadata ( state ) ) ;
3941 const extendedMetadata = useAppSelector ( state => getExtendedEventMetadata ( state ) ) ;
4042 const user = useAppSelector ( state => getUserInformation ( state ) ) ;
@@ -56,7 +58,7 @@ const NewEventWizard: React.FC<{
5658 const initialValues = getInitialValues (
5759 metadataFields ,
5860 extendedMetadata ,
59- uploadAssetOptions ,
61+ uploadSourceOptions ,
6062 user ,
6163 ) ;
6264
@@ -88,9 +90,7 @@ const NewEventWizard: React.FC<{
8890 {
8991 translation : "EVENTS.EVENTS.NEW.UPLOAD_ASSET.CAPTION" ,
9092 name : "upload-asset" ,
91- hidden :
92- uploadAssetOptions . filter ( ( asset ) => asset . type !== "track" ) . length ===
93- 0 ,
93+ hidden : assetUploadOptions . length === 0 ,
9494 } ,
9595 {
9696 translation : "EVENTS.EVENTS.NEW.PROCESSING.CAPTION" ,
@@ -250,7 +250,7 @@ const NewEventWizard: React.FC<{
250250const getInitialValues = (
251251 metadataFields : MetadataCatalog ,
252252 extendedMetadata : MetadataCatalog [ ] ,
253- uploadAssetOptions : UploadAssetOption [ ] ,
253+ uploadSourceOptions : UploadOption [ ] ,
254254 user : UserInfoState
255255) => {
256256 let initialValues = initialFormValuesNewEvents ;
@@ -289,20 +289,16 @@ const getInitialValues = (
289289 }
290290
291291 // Add possible files that can be uploaded in source step
292- if ( ! ! uploadAssetOptions ) {
292+ if ( ! ! uploadSourceOptions ) {
293293 initialValues . uploadAssetsTrack = [ ] ;
294294 // Sort by displayOrder
295- uploadAssetOptions = uploadAssetOptions . slice ( ) . sort ( ( a , b ) => a . displayOrder - b . displayOrder )
295+ uploadSourceOptions = uploadSourceOptions . slice ( ) . sort ( ( a , b ) => a . displayOrder - b . displayOrder )
296296 // initial value of upload asset needs to be null, because object (file) is saved there
297- for ( const option of uploadAssetOptions ) {
298- if ( option . type === "track" ) {
299- initialValues . uploadAssetsTrack . push ( {
300- ...option ,
301- file : undefined ,
302- } ) ;
303- } else {
304- initialValues [ option . id ] = null ;
305- }
297+ for ( const option of uploadSourceOptions ) {
298+ initialValues . uploadAssetsTrack . push ( {
299+ ...option ,
300+ file : undefined ,
301+ } ) ;
306302 } ;
307303 }
308304
0 commit comments