MapStore2 icon indicating copy to clipboard operation
MapStore2 copied to clipboard

MediaEditor has inconsistencies in a specific scenario

Open MV88 opened this issue 3 years ago • 0 comments

Description

When you remove all default sources for each media types and you do not always have a source for each media type when you choose a source for a media type that is not present in otthers and then you select these others media type you enter in a weird situations and the UI shows wrong results

How to reproduce

problem 1

  • start from the mediaEditor reducer state present in addition info
  • open a new geostory
  • open media editor
  • select geostore from service list
  • change media from image to video

problem 2 https://github.com/geosolutions-it/MapStore2/pull/7695#issuecomment-1027740435

Expected Result

problem 1 since the source geostore is not available for video we should default to the first one present among videos ones if a defaultSource value is missing

problem 2 to not crash because it you cannot select wrong resources

Current Result

problem 1 we end up seeing a service selected which does not belong to that media type and also results are not correct

problem 2 crash

  • [x] Not browser related
Browser info (use this site: https://www.whatsmybrowser.org/ for non expert users)
Browser Affected Version
Internet Explorer
Edge
Chrome
Firefox
Safari

Other useful information

export const DEFAULT_STATE = {
    open: false,
    // contains local data (path for data is mediaType, sourceId, e.g. data: {image : { geostory: { resultData: {...}, params: {...}}})
    data: {},
    settings: {
        mediaType: MediaTypes.IMAGE, // current selected media type
        sourceId: GEOSTORY_SOURCE_ID, // current selected service
        // available media types
        mediaTypes: {
            image: {
                sources: [GEOSTORY_SOURCE_ID, "geostoreMap"] // services for the selected media type
            },
            video: {
                sources: [GEOSTORY_SOURCE_ID]
            },
            map: {
                sources: [GEOSTORY_SOURCE_ID, "geostoreMap"]
            }
        },
        // all media sources available, with their type and other parameters
        sources: {
            geostory: {
                name: "geostory.storyResources",
                type: SourceTypes.GEOSTORY, // determines the type related to the API
                addMediaEnabled: {
                    image: true,
                    video: true,
                    map: true
                },
                editMediaEnabled: {
                    image: true,
                    video: true,
                    map: true
                },
                removeMediaEnabled: {
                    image: true,
                    video: true,
                    map: true
                }
            },
            geostoreMap: {
                name: "geostory.geostoreMap", // id for Message comp
                type: SourceTypes.GEOSTORE,
                baseURL: "rest/geostore/",
                category: "MAP",
                addMediaEnabled: {
                    image: true,
                    video: true,
                    map: true
                },
                editMediaEnabled: {
                    image: true,
                    video: true,
                    map: true
                }
            }
        }
    }
};

these condition cannot be saved in a map but you can edit mediaEditorSettings for the Geostory plugin https://mapstore.geosolutionsgroup.com/mapstore/docs/api/plugins#plugins.GeoStory so that we should be able to create a context to be used for testing

MV88 avatar Mar 15 '22 10:03 MV88