Merge branch 'feature/exporters-page' into develop

This commit is contained in:
weryques 2018-11-22 08:16:16 -02:00
commit 916ebdb622
13 changed files with 310 additions and 60 deletions

View File

@ -0,0 +1,85 @@
<template>
<div class="repository-level-page page-container">
<tainacan-title
:bread-crumb-items="[
{ path: $routerHelper.getAvailableExportersPath(), label: $i18n.get('exporters') },
{ path: '', label: exporterType != undefined ? exporterType : $i18n.get('title_exporter_page') }
]"/>
<form class="tainacan-form">
<div class="columns">
<div class="column">
<div v-html="exporterSession.options_form" />
</div>
<div class="column">
<b-field :label="$i18n.get('label_origin_collection')">
<b-select
:loading="isFetchingCollections"
:placeholder="$i18n.get('instruction_select_a_collection')">
<option
v-for="collection in collections"
:value="collection.id"
:key="collection.id">
{{ collection.name }}
</option>
</b-select>
</b-field>
</div>
</div>
</form>
</div>
</template>
<script>
import { mapActions, mapGetters } from 'vuex';
export default {
name: "ExporterEditionForm",
data(){
return {
exporterType: '',
collections: [],
isFetchingCollections: false,
}
},
methods: {
...mapActions('exporter', [
'createExporterSession'
]),
...mapGetters('exporter', [
'getExporterSession'
]),
...mapActions('collection', [
'fetchCollectionsForParent'
]),
},
computed: {
exporterSession(){
let ex = this.getExporterSession();
console.log(ex);
return ex;
},
},
created(){
this.exporterType = this.$route.params.exporterSlug;
this.createExporterSession(this.exporterType);
this.isFetchingCollections = true;
this.fetchCollectionsForParent()
.then(collections => {
this.collections = collections;
this.isFetchingCollections = false;
})
.catch(error => {
this.isFetchingCollections = false;
console.error(error);
});
}
}
</script>
<style scoped>
</style>

View File

@ -91,6 +91,18 @@
<span class="menu-text menu-text-import">{{ $i18n.get('importers') }}</span>
</router-link>
</li>
<!--<li>-->
<!--<router-link-->
<!--tag="a"-->
<!--to="/exporters"-->
<!--:class="(-->
<!--activeRoute == 'ExportersPage' ) ? 'is-active':''">-->
<!--<span class="icon">-->
<!--<i class="tainacan-icon tainacan-icon-20px tainacan-icon-export"/>-->
<!--</span>-->
<!--<span class="menu-text">{{ $i18n.get('exporters') }}</span>-->
<!--</router-link>-->
<!--</li>-->
</ul>
</aside>
</nav>

View File

@ -13,6 +13,8 @@ import FiltersPage from '../pages/lists/filters-page.vue'
import Page from '../pages/lists/taxonomies-page.vue'
import EventsPage from '../pages/lists/events-page.vue'
import EventPage from '../pages/singles/event-page.vue'
import AvailableExportersPage from '../pages/lists/available-exporters-page.vue'
import AvailableImportersPage from '../pages/lists/available-importers-page.vue'
import ExportPage from '../pages/singles/export-page.vue'
// Edition Form Components
@ -23,7 +25,7 @@ import ItemEditionForm from '../components/edition/item-edition-form.vue'
import ItemBulkEditionForm from '../components/edition/item-bulk-edition-form.vue'
import ItemMetadataBulkEditionForm from '../components/edition/item-metadata-bulk-edition-form.vue'
import TaxonomyEditionForm from '../components/edition/taxonomy-edition-form.vue'
import AvailableImportersPage from '../pages/lists/available-importers-page.vue'
import ExporterEditionForm from '../components/edition/exporter-edition-form.vue'
// Listing components
import FiltersList from '../components/lists/filters-list.vue'
@ -83,9 +85,11 @@ const routes = [
{ path: '/importers/:importerSlug/:sessionId', name: 'ImporterCreationForm', component: ImporterEditionForm, meta: { title: i18nGet('title_importer_page'), icon: 'import' } },
{ path: '/importers/:importerType/:sessionId/mapping/:collectionId', name: 'ImporterMappingForm', component: ImporterMappingForm, meta: {title: i18nGet('title_importer_mapping_page'), icon: 'import'} },
{ path: '/export/collection/:collectionId', name: 'ExportCollection', component: ExportPage, meta: {title: i18nGet('title_export_collection_page'), icon: 'export'} },
{ path: '/export/item/:itemId', name: 'ExportItem', component: ExportPage, meta: {title: i18nGet('title_export_item_page'), icon: 'export'} },
{ path: '/export', name: 'Export', component: ExportPage, meta: {title: i18nGet('title_export_page'), icon: 'export'} },
{ path: '/exporters/collection/:collectionId', name: 'ExportCollection', component: ExportPage, meta: {title: i18nGet('title_export_collection_page'), icon: 'export'} },
{ path: '/exporters/item/:itemId', name: 'ExportItem', component: ExportPage, meta: {title: i18nGet('title_export_item_page'), icon: 'export'} },
{ path: '/exporters', name: 'ExportersPage', component: AvailableExportersPage, meta: {title: i18nGet('title_exporters_page'), icon: 'export'} },
{ path: '/exporters/:exporterSlug', name: 'ExporterEditionForm', component: ExporterEditionForm, meta: {title: i18nGet('title_exporter_page'), icon: 'export'}},
{ path: '*', redirect: '/'}
];

View File

@ -301,6 +301,12 @@ RouterHelperPlugin.install = function (Vue, options = {}) {
getItemMetadataBulkAddPath(collectionId, groupId) {
return '/collections/' + collectionId + '/bulk-add/' + groupId;
},
getExporterEditionPath(exporterType) {
return '/exporters/' + exporterType;
},
getAvailableExportersPath(){
return '/exporters';
},
}
}

View File

@ -94,6 +94,16 @@
<span class="menu-text menu-text-import">{{ $i18n.get('importers') }}</span>
</router-link>
</li>
<!--<li>-->
<!--<router-link-->
<!--tag="a"-->
<!--to="/exporters">-->
<!--<span class="icon is-medium">-->
<!--<i class="tainacan-icon tainacan-icon-36px tainacan-icon-export"/>-->
<!--</span>-->
<!--<span class="menu-text">{{ $i18n.get('exporters') }}</span>-->
<!--</router-link>-->
<!--</li>-->
</ul>
</nav>
</section>

View File

@ -0,0 +1,79 @@
<template>
<div class="repository-level-page page-container">
<tainacan-title
:bread-crumb-items="[{ path: '', label: $i18n.get('exporters') }]" />
<h3>{{ $i18n.get('label_available_exporters') }}</h3>
<p>{{ $i18n.get('info_available_exporters_helper') }}</p>
<p>{{ $i18n.get('instruction_select_an_exporter_type') }}</p>
<div class="exporter-types-container">
<div
class="exporter-type"
v-for="exporterType in availableExporters"
:key="exporterType.slug"
@click="onSelectExporter(exporterType)">
<h4>{{ exporterType.name }}</h4>
<p>{{ exporterType.description }}</p>
</div>
</div>
<b-loading
:active.sync="isLoading"
:can-cancel="false"/>
</div>
</template>
<script>
import { mapActions } from 'vuex';
export default {
name: 'AvailableExportersPage',
data(){
return {
availableExporters: [],
isLoading: false
}
},
methods: {
...mapActions('exporter', [
'fetchAvailableExporters'
]),
onSelectExporter(exporterType) {
this.$router.push(this.$routerHelper.getExporterEditionPath(exporterType.slug));
}
},
created() {
this.isLoading = true;
this.fetchAvailableExporters()
.then((res) => {
this.availableExporters = res;
this.isLoading = false;
}).catch((error) => {
this.$console.log(error);
this.isLoading = false;
});
}
}
</script>
<style lang="scss" scoped>
@import "../../scss/_variables.scss";
.exporter-types-container {
display: flex;
flex-wrap: wrap;
.exporter-type {
border: 1px solid $gray2;
padding: 15px;
margin: 20px;
cursor: pointer;
}
}
</style>

View File

@ -28,7 +28,7 @@ export default {
created(){
this.collectionId = parseInt(this.$route.params.collectionId);
this.itemId = parseInt(this.$route.params.itemId);
this.selectedList = [],
this.selectedList = [];
this.$eventBusSearch.setCollectionId(this.collectionId);
}

View File

@ -32,6 +32,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'importers' => __( 'Importers', 'tainacan' ),
'processes' => __( 'Processes', 'tainacan' ),
'sequence' => __( 'Sequence', 'tainacan' ),
'exporters' => __( 'Exporters', 'tainacan' ),
// Actions
'close' => __( 'Close', 'tainacan' ),
@ -74,7 +75,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'finish' => __( 'Finish', 'tainacan' ),
'select_to_create' => __( 'select to create', 'tainacan' ),
'new_action' => __( 'New action', 'tainacan' ),
'clear_radio' => __( 'Clear selected radio', 'tainacan'),
'clear_radio' => __( 'Clear selected radio', 'tainacan' ),
// Wordpress Status
'publish' => __( 'Publish', 'tainacan' ),
@ -118,9 +119,10 @@ return apply_filters( 'tainacan-admin-i18n', [
'title_importers_page' => __( 'Importers', 'tainacan' ),
'title_export_collection_page' => __( 'Export Collection Page', 'tainacan' ),
'title_export_item_page' => __( 'Export Item', 'tainacan' ),
'title_export_page' => __( 'Export', 'tainacan' ),
'title_exporters_page' => __( 'Exporters', 'tainacan' ),
'title_processes_page' => __( 'Processes', 'tainacan' ),
'title_item_bulk_add' => __( 'Bulk Add Items', 'tainacan' ),
'title_exporter_page' => __( 'Exporter', 'tainacan'),
// Labels (used mainly on Aria Labels and Inputs)
'label_clean' => __( 'Clear', 'tainacan' ),
@ -147,7 +149,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'label_button_view' => __( 'Button View', 'tainacan' ),
'label_button_edit' => __( 'Button Edit', 'tainacan' ),
'label_button_delete' => __( 'Button Delete', 'tainacan' ),
'label_button_untrash' => __( 'Button Remove from Trash', 'tainacan'),
'label_button_untrash' => __( 'Button Remove from Trash', 'tainacan' ),
'label_button_delete_header_image' => __( 'Button Delete Header Image', 'tainacan' ),
'label_button_edit_thumb' => __( 'Button Edit Thumbnail', 'tainacan' ),
'label_button_edit_header_image' => __( 'Button Edit Header Image', 'tainacan' ),
@ -319,17 +321,19 @@ return apply_filters( 'tainacan-admin-i18n', [
'label_hide_metadata' => __( 'Hide metadata', 'tainacan' ),
'label_show_metadata' => __( 'Show metadata', 'tainacan' ),
'label_all_terms' => __( 'All terms', 'tainacan' ),
'label_selected_terms' => __( 'Selected terms', 'tainacan'),
'label_editing_item_number' => __( 'Editing item n.', 'tainacan'),
'label_sequence_editing_item' => __( 'Sequence editing: Item', 'tainacan'),
'label_files_remaining' => __( 'files remaining.', 'tainacan'),
'label_file_remaining' => __( 'file remaining.', 'tainacan'),
'label_upload_file_prepare_items' => __( 'Uploading files and preparing items', 'tainacan'),
'label_bulk_edit_items' => __( 'Bulk edit items', 'tainacan'),
'label_sequence_edit_items' => __( 'Sequence edit items', 'tainacan'),
'label_documents_upload' => __( 'Documents upload', 'tainacan'),
'label_added_items' => __( 'Added items', 'tainacan'),
'label_filters_from' => __( 'Filters from', 'tainacan'),
'label_selected_terms' => __( 'Selected terms', 'tainacan' ),
'label_editing_item_number' => __( 'Editing item n.', 'tainacan' ),
'label_sequence_editing_item' => __( 'Sequence editing: Item', 'tainacan' ),
'label_files_remaining' => __( 'files remaining.', 'tainacan' ),
'label_file_remaining' => __( 'file remaining.', 'tainacan' ),
'label_upload_file_prepare_items' => __( 'Uploading files and preparing items', 'tainacan' ),
'label_bulk_edit_items' => __( 'Bulk edit items', 'tainacan' ),
'label_sequence_edit_items' => __( 'Sequence edit items', 'tainacan' ),
'label_documents_upload' => __( 'Documents upload', 'tainacan' ),
'label_added_items' => __( 'Added items', 'tainacan' ),
'label_filters_from' => __( 'Filters from', 'tainacan' ),
'label_available_exporters' => __( 'Available Exporters', 'tainacan' ),
'label_origin_collection' => __( 'Origin collection', 'tainacan'),
// Instructions. More complex sentences to guide user and placeholders
'instruction_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ),
@ -362,10 +366,12 @@ return apply_filters( 'tainacan-admin-i18n', [
'instruction_configure_new_metadatum' => __( 'Configure new metadatum.', 'tainacan' ),
'instruction_insert_mapper_metadatum_info' => __( 'Insert the new mapper\'s metadatum info', 'tainacan' ),
'instruction_select_max_options_to_show' => __( 'Select max options to show', 'tainacan' ),
'instruction_select_collection_fetch_items' => __( 'Select a collection to fecth items', 'tainacan' ),
'instruction_select_collection_fetch_items' => __( 'Select a collection to fetch items', 'tainacan' ),
'instruction_select_a_action' => __( 'Select a action', 'tainacan' ),
'instruction_parent_term' => __( 'Type to search a Parent Term to choose.', 'tainacan' ),
'instruction_type_existing_term' => __( 'Type to add an existing term...', 'tainacan' ),
'instruction_select_an_exporter_type' => __( 'Select an exporter type from the options above:', 'tainacan'),
'instruction_select_a_collection' => __( 'Select a collection', 'tainacan' ),
// Info. Other feedback to user.
'info_error_invalid_date' => __( 'Invalid date', 'tainacan' ),
@ -414,7 +420,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'info_showing_taxonomies' => __( 'Showing taxonomies ', 'tainacan' ),
'info_showing_events' => __( 'Showing events ', 'tainacan' ),
'info_showing_processes' => __( 'Showing processes ', 'tainacan' ),
'info_warning_remove_from_trash_first' => __( 'Remove this item from trash first'),
'info_warning_remove_from_trash_first' => __( 'Remove this item from trash first' ),
'info_to' => __( ' to ', 'tainacan' ),
'info_of' => __( ' of ', 'tainacan' ),
'info_created_by' => __( 'Created by: ', 'tainacan' ),
@ -474,22 +480,22 @@ return apply_filters( 'tainacan-admin-i18n', [
'info_by_inner' => __( 'by', 'tainacan' ),
'info_items_selected' => __( 'items selected', 'tainacan' ),
'info_items_affected' => __( 'items affected', 'tainacan' ),
'info_item_affected' => __( 'item affected', 'tainacan'),
'info_item_affected' => __( 'item affected', 'tainacan' ),
'info_no_parent_term_found' => __( 'No valid parent term was found with this name.', 'tainacan' ),
'info_warning_changing_parent_term' => __( 'Warning! Changing parent term will reload the terms list, thus uncheking any selection.', 'tainacan' ),
'info_warning_selected_items_remove_from_trash' => __( 'Do you really want to remove from trash the selected items?', 'tainacan'),
'info_no_options_avialable_filtering' => __( 'No options for this filtering.', 'tainacan'),
'info_no_options_found' => __( 'No options found.', 'tainacan'),
'info_all_files_uploaded' => __( 'All files uploaded.', 'tainacan'),
'info_there_are' => __( 'There are', 'tainacan'),
'info_items_being_edited' => __( 'items being edited', 'tainacan'),
'info_there_is' => __( 'There is', 'tainacan'),
'info_item_being_edited' => __( 'item being edited', 'tainacan'),
'info_no_preview_found' => __( 'No preview was found.', 'tainacan'),
'info_leaving_bulk_edition' => __( 'You are leaving the bulk edition now.', 'tainacan'),
'info_leaving_bulk_edition' => __( 'You are leaving the bulk edition now.', 'tainacan'),
'info_current_view_mode_metadata_not_allowed' => __( 'Current view mode does not allow displayed metadata selection.', 'tainacan'),
'info_cant_select_metadata_without_items' => __( 'Can not select displayed metadata without items on list.', 'tainacan'),
'info_warning_selected_items_remove_from_trash' => __( 'Do you really want to remove from trash the selected items?', 'tainacan' ),
'info_no_options_avialable_filtering' => __( 'No options for this filtering.', 'tainacan' ),
'info_no_options_found' => __( 'No options found.', 'tainacan' ),
'info_all_files_uploaded' => __( 'All files uploaded.', 'tainacan' ),
'info_there_are' => __( 'There are', 'tainacan' ),
'info_items_being_edited' => __( 'items being edited', 'tainacan' ),
'info_there_is' => __( 'There is', 'tainacan' ),
'info_item_being_edited' => __( 'item being edited', 'tainacan' ),
'info_no_preview_found' => __( 'No preview was found.', 'tainacan' ),
'info_leaving_bulk_edition' => __( 'You are leaving the bulk edition now.', 'tainacan' ),
'info_current_view_mode_metadata_not_allowed' => __( 'Current view mode does not allow displayed metadata selection.', 'tainacan' ),
'info_cant_select_metadata_without_items' => __( 'Can not select displayed metadata without items on list.', 'tainacan' ),
'info_available_exporters_helper' => __( '?', 'tainacan' ),
// Tainacan Metadatum Types
'tainacan-text' => __( 'Text', 'tainacan' ),

View File

@ -0,0 +1,25 @@
import { tainacan } from '../../../axios/axios.js';
export const fetchAvailableExporters = ({commit}) => {
return tainacan.get('/exporters/available')
.then(response => {
return response.data;
})
.catch(error => {
console.error(error.response.data);
})
};
export const createExporterSession = ({commit}, slug) => {
return tainacan.post('/exporters/session', { exporter_slug: slug })
.then(response => {
commit('setExporterSession', response.data);
return response.data;
})
.catch(error => {
console.error(error.response.data);
})
};

View File

@ -0,0 +1,3 @@
export const getExporterSession = state => {
return state.exporterSession;
};

View File

@ -0,0 +1,15 @@
import * as actions from './actions.js';
import * as mutations from './mutations.js';
import * as getters from './getters.js';
const state = {
exporterSession: {}
};
export default {
namespaced: true,
state,
actions,
mutations,
getters,
}

View File

@ -0,0 +1,3 @@
export const setExporterSession = (state, exporterSession) => {
state.exporterSession = exporterSession;
};

View File

@ -11,6 +11,7 @@ import event from './modules/event';
import importer from './modules/importer';
import bgprocess from './modules/bgprocess';
import bulkedition from './modules/bulk-edition';
import exporter from './modules/exporter';
Vue.use(Vuex);
@ -33,6 +34,7 @@ export default new Vuex.Store({
event,
importer,
bgprocess,
bulkedition
bulkedition,
exporter
}
})