halbritter-lab / gene-curator

Gene Curator is an open-source platform for managing and curating genetic data. It facilitates gene data analysis, entry, and reporting, serving genetics researchers with tools for efficient data handling.
MIT License
4 stars 1 forks source link

Feature Request: Implement Pagination in Stores with Database Counter #67

Open berntpopp opened 8 months ago

berntpopp commented 8 months ago

Summary

Introduce pagination functionality in the Gene-Curator web app's data stores. This enhancement requires implementing a counter file or mechanism in the database for each collection, to effectively manage large datasets.

Description

Currently, our data stores in the Gene-Curator app lack pagination, leading to potential performance issues when handling large datasets. To address this, we propose adding pagination capabilities. This will involve computing and maintaining a counter for each database collection, allowing for efficient data retrieval and display.

Acceptance Criteria

User Stories

Implementation Details

Potential Challenges

Code Snippet

// Vuex store example for fetching paginated data
export default new Vuex.Store({
  state: {
    items: [],
    totalItemCount: 0,
    currentPage: 1,
    itemsPerPage: 10
  },
  actions: {
    async fetchItems({ commit, state }) {
      const { currentPage, itemsPerPage } = state;
      const data = await getPaginatedItems(currentPage, itemsPerPage); // Implement this function
      commit('setItems', data.items);
      commit('setTotalItemCount', data.totalCount);
    },
  },
  mutations: {
    setItems(state, items) {
      state.items = items;
    },
    setTotalItemCount(state, count) {
      state.totalItemCount = count;
},
setCurrentPage(state, page) {
state.currentPage = page;
},
setItemsPerPage(state, number) {
state.itemsPerPage = number;
}
}
});