diff options
Diffstat (limited to 'app/assets/javascripts/packages/list/stores/state.js')
-rw-r--r-- | app/assets/javascripts/packages/list/stores/state.js | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/app/assets/javascripts/packages/list/stores/state.js b/app/assets/javascripts/packages/list/stores/state.js new file mode 100644 index 00000000000..18ab2390b87 --- /dev/null +++ b/app/assets/javascripts/packages/list/stores/state.js @@ -0,0 +1,57 @@ +import { PACKAGE_REGISTRY_TABS } from '../constants'; + +export default () => ({ + /** + * Determine if the component is loading data from the API + */ + isLoading: false, + /** + * configuration object, set once at store creation with the following structure + * { + * resourceId: String, + * pageType: String, + * emptyListIllustration: String, + * emptyListHelpUrl: String, + * comingSoon: { projectPath: String, suggestedContributions : String } | null; + * } + */ + config: {}, + /** + * Each object in `packages` has the following structure: + * { + * id: String + * name: String, + * version: String, + * package_type: String // endpoint to request the list + * } + */ + packages: [], + /** + * Pagination object has the following structure: + * { + * perPage: Number, + * page: Number + * total: Number + * } + */ + pagination: {}, + /** + * Sorting object has the following structure: + * { + * sort: String, + * orderBy: String + * } + */ + sorting: { + sort: 'desc', + orderBy: 'created_at', + }, + /** + * The search query that is used to filter packages by name + */ + filterQuery: '', + /** + * The selected TAB of the package types tabs + */ + selectedType: PACKAGE_REGISTRY_TABS[0], +}); |