All files / app/assets/javascripts/environments/folder environments_folder_view.vue

100% Statements 7/7
100% Branches 2/2
100% Functions 2/2
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75  2x 2x 2x 2x 2x                                                           13x         241x                                                                    
<script>
import { GlBadge, GlTab, GlTabs } from '@gitlab/ui';
import DeleteEnvironmentModal from '../components/delete_environment_modal.vue';
import StopEnvironmentModal from '../components/stop_environment_modal.vue';
import environmentsMixin from '../mixins/environments_mixin';
import EnvironmentsPaginationApiMixin from '../mixins/environments_pagination_api_mixin';
 
export default {
  components: {
    DeleteEnvironmentModal,
    GlBadge,
    GlTab,
    GlTabs,
    StopEnvironmentModal,
  },
 
  mixins: [environmentsMixin, EnvironmentsPaginationApiMixin],
 
  props: {
    endpoint: {
      type: String,
      required: true,
    },
    folderName: {
      type: String,
      required: true,
    },
    cssContainerClass: {
      type: String,
      required: false,
      default: '',
    },
  },
  methods: {
    successCallback(resp) {
      this.saveData(resp);
    },
  },
};
</script>
<template>
  <div :class="cssContainerClass">
    <stop-environment-modal :environment="environmentInStopModal" />
    <delete-environment-modal :environment="environmentInDeleteModal" />
 
    <h4 class="gl-font-weight-normal" data-testid="folder-name">
      {{ s__('Environments|Environments') }} /
      <b>{{ folderName }}</b>
    </h4>
 
    <gl-tabs v-if="!isLoading" scope="environments" content-class="gl-display-none">
      <gl-tab
        v-for="(tab, i) in tabs"
        :key="`${tab.name}-${i}`"
        :active="tab.isActive"
        :title-item-class="tab.isActive ? 'gl-outline-none' : ''"
        :title-link-attributes="{ 'data-testid': `environments-tab-${tab.scope}` }"
        @click="onChangeTab(tab.scope)"
      >
        <template #title>
          <span>{{ tab.name }}</span>
          <gl-badge size="sm" class="gl-tab-counter-badge">{{ tab.count }}</gl-badge>
        </template>
      </gl-tab>
    </gl-tabs>
 
    <container
      :is-loading="isLoading"
      :environments="state.environments"
      :pagination="state.paginationInformation"
      @onChangePage="onChangePage"
    />
  </div>
</template>