[go: up one dir, main page]

Skip to content

Geo Primary Verification List: Hookup API to UI

Why are we doing this work

This work will be behind feature flag geo_primary_verification_view

This work is focused on taking the UI added as as part of Geo Primary Verification List: Hookup `geo_shar... (#538023 - closed) and hooking up the API implemented as part of Geo Primary Verification API: GET `api/v4/admin... (#537707 - closed)

Relevant links

Implementation plan

  1. Add fetchModelList to ee/api/data_management_api.js (if not created, create it and import it to ee/rest_api.js)
const DATA_MANAGEMENT_PATH = '/api/:version/data_management/:model';

export const fetchModelList = (model, options = {}) => {
  const url = buildApiUrl(DATA_MANAGEMENT_PATH).replace(':model', model);

  return axios.get(url, {
    params: {
      ...options,
    },
  });
};
  1. Call fetchModelList from app.vue on mount after getFiltersFromQuery and ensure to pass activeFilters to the query.
<script>
export default {
  created() {
    this.getFiltersFromQuery();
    this.getModelList();
  },
  methods: {
    async getModelList() {
      try {
        this.isLoading = true

        const { query } = processFilters(this.activeFilters)

        const { data } = await fetchModelList(this.activeModel, query);
        this.modelItems = data
      } catch (error) {
        createAlert({
          message: this.$options.i18n.modelListFetchError,
          captureError: true,
          error,
        });
      } finally {
        this.isLoading = false
      }
    },
  }
}
</script>
  1. Add list as raw data to template for MVC in app.vue
<template>
  <geo-list :is-loading="isLoading" :has-items="Boolean(modelItems.length)" :empty-state="emptyState">
    {{ modelItems }}
  </geo-list>
</template>
Edited by 🤖 GitLab Bot 🤖