{"size": 3930, "ext": "js", "max_stars_repo_path": "resources/js/plugins/map.js", "max_stars_repo_name": "eScienceCenter/Spacialist", "max_stars_repo_stars_event_min_datetime": "2016-02-17T14:23:26.000Z", "max_stars_repo_stars_event_max_datetime": "2021-04-06T02:57:41.000Z", "max_issues_repo_path": "resources/js/plugins/map.js", "max_issues_repo_name": "eScienceCenter/Spacialist", "max_issues_repo_issues_event_min_datetime": "2016-02-12T14:34:56.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-22T08:33:41.000Z", "max_forks_repo_path": "resources/js/plugins/map.js", "max_forks_repo_name": "eScienceCenter/Spacialist", "max_forks_repo_forks_event_min_datetime": "2016-06-14T10:31:59.000Z", "max_forks_repo_forks_event_max_datetime": "2021-12-12T13:39:34.000Z"}
{"max_stars_count": 21, "max_issues_count": 188, "max_forks_count": 4, "avg_line_length": 33.025210084, "max_line_length": 79, "alphanum_fraction": 0.3699745547}
import de from '../i18n/plugins/map-de.js';
import en from '../i18n/plugins/map-en.js';
import LayerEditor from '../components/plugins/MapLayerEditor.vue';
import LayerEditorDetail from '../components/plugins/MapLayerEditorDetail.vue';
import Gis from '../components/plugins/MapGis.vue';
import MapPlugin from '../components/plugins/Map.vue';
import MapLayerList from '../components/plugins/MapLayerList.vue';

const SpacialistPluginMap = {
    name: 'SpacialistPluginMap',
    install(Vue, options) {
        Vue.component('map-plugin', MapPlugin);
        Vue.component('layer-list', MapLayerList);

        if(Vue.i18n) {
            Vue.prototype.$spacialistAddPluginLanguage('de', de);
            Vue.prototype.$spacialistAddPluginLanguage('en', en);
        }
        if(Vue.router) {
            Vue.router.addRoutes([
                // deprecated pre-0.6 routes
                {
                    path: '/geodata/:id',
                    redirect: to => {
                        return {
                            name: 'geodata',
                            params: {
                                id: to.params.id
                            }
                        }
                    }
                },
                {
                    path: '/editor/layer',
                    redirect: { name: 'layeredit' },
                    children: [{
                        path: 'layer/:id',
                        redirect: to => {
                            return {
                                name: 'ldetail',
                                params: {
                                    id: to.params.id
                                }
                            }
                        }
                    }]
                },
                {
                    path: '/editor/gis',
                    redirect: { name: 'home' } // TODO not home
                },
                // New routes
                // {
                //     path: 'geodata/:id',
                //     name: 'geodata',
                //     component: , // TODO
                //     meta: {
                //         auth: true
                //     }
                // },
                {
                    path: '/editor/layer',
                    name: 'layeredit',
                    component: LayerEditor,
                    children: [
                        {
                            path: 'l/:id',
                            name: 'ldetail',
                            component: LayerEditorDetail,
                        }
                    ],
                    meta: {
                        auth: true
                    }
                },
                {
                    path: '/tool/gis',
                    name: 'gis',
                    component: Gis,
                    meta: {
                        auth: true
                    }
                },
            ]);
        }
        if(!Vue.prototype.$spacialistPluginsEnabled) {
            console.error("Spacialist Plugin System not found!");
            return;
        }
        // Map
        Vue.prototype.$registerSpacialistPlugin({
            label: 'plugins.map.tab.title',
            icon: 'fa-map-marker-alt',
            key: 'map',
            tag: 'map-plugin',
            hook: function(entity) {
            }
        }, 'tab');
        // Layer Editor
        Vue.prototype.$registerSpacialistPlugin({
            label: 'plugins.map.layer-editor.title',
            icon: 'fa-layer-group',
            href: {
                name: 'layeredit'
            }
        }, 'settings');
        // GIS View
        Vue.prototype.$registerSpacialistPlugin({
            label: 'plugins.map.gis.title',
            icon: 'fa-globe-africa',
            href: {
                name: 'gis'
            }
        }, 'tools');
    }
};

export default SpacialistPluginMap;
