index.vue 946 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
<script>
import { GlLoadingIcon } from '@gitlab/ui';
import DesignList from '../components/list/index.vue';
import allDesignsQuery from '../queries/allDesigns.graphql';

export default {
  components: {
    GlLoadingIcon,
    DesignList,
  },
  apollo: {
    designs: {
      query: allDesignsQuery,
      error() {
        this.error = true;
      },
    },
  },
  data() {
    return {
      designs: [],
      error: false,
    };
  },
  computed: {
    isLoading() {
      return this.$apollo.queries.designs.loading;
    },
  },
};
</script>

33 34
<template>
  <div>
35 36 37
    <div class="mt-4">
      <gl-loading-icon v-if="isLoading" :size="2" />
      <div v-else-if="error" class="alert alert-danger">
38
        {{ __('An error occurred while loading designs. Please try again.') }}
39 40 41 42
      </div>
      <design-list v-else-if="designs.length" :designs="designs" />
      <div v-else>{{ __('No designs found.') }}</div>
    </div>
43 44
  </div>
</template>