Geo Primary Verification Details: Hookup actions 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 Details: Hookup `geo_s... (#538198 - closed) and hooking up the actions that will be supported in the API Geo Primary Verification API: POST api/v4/admin... (#537712 - closed).

These actions will function very similar to how we utilize them in the Geo Replicable Details views: Geo Replicable Details: Add ability to resync f... (#534131 - closed)

Relevant links

Implementation plan

  1. Add commitSingleModelAction to ee/api/data_management_api.js (if it does not already exist)
const DATA_MANAGEMENT_SINGLE_ACTION_PATH = '/api/:version/data_management/:model/:id/:action';

export const commitSingleModelAction = (model, id, action) => {
  const url = buildApiUrl(DATA_MANAGEMENT_SINGLE_ACTION_PATH)
    .replace(':model', model)
    .replace(':id', id)
    .replace(':action', action)

  return axios.post(url);
};
  1. Add checksum button to data_management_item_checksum_info.vue header that emits an event
<template #header>
  <div class="gl-flex gl-items-center">
    <h5 class="gl-my-0">{{ $options.i18n.checksumInformation }}</h5>
    <gl-button class="gl-ml-auto" @click="$emit('checksum')">{{ $options.i18n.checksum }}</gl-button>
  </div>
</template>
  1. Listen for event in app.vue and fire the API method when emitted
<script>
export default {
  // most of existing script omitted for clarity

  methods: {
    async onChecksum() {
      try {
        this.isLoading = true

        await commitSingleModelAction(this.modelClass, this.modelDetails.id, 'checksum')
      } catch (error) {
        createAlert({
          message: this.$options.i18n.checksumError
          captureError: true,
          error,
        });
      } finally {
        this.isLoading = false
      }

    }
  }
}
</script>

<template>
  <!-- most of existing template omitted for clarity -->

  <data-management-item-checksum-info :model-details="modelDetails" @checksum="onChecksum" />
</template>
Edited by 🤖 GitLab Bot 🤖