All files / ee/app/assets/javascripts/geo_nodes/components/details geo_node_core_details.vue

100% Statements 1/1
100% Branches 0/0
100% Functions 1/1
100% Lines 1/1

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                                                                                48x                                                                
<script>
import { GlLink, GlIcon } from '@gitlab/ui';
import { mapState } from 'vuex';
import { __, s__ } from '~/locale';
 
export default {
  name: 'GeoNodeCoreDetails',
  i18n: {
    url: __('URL'),
    internalUrl: s__('Geo|Internal URL'),
    gitlabVersion: __('GitLab version'),
    unknown: __('Unknown'),
  },
  components: {
    GlLink,
    GlIcon,
  },
  props: {
    node: {
      type: Object,
      required: true,
    },
  },
  computed: {
    ...mapState(['primaryVersion', 'primaryRevision']),
    nodeVersion() {
      if (!this.node.version || !this.node.revision) {
        return this.$options.i18n.unknown;
      }
      return `${this.node.version} (${this.node.revision})`;
    },
    versionMismatch() {
      return (
        this.node.version !== this.primaryVersion || this.node.revision !== this.primaryRevision
      );
    },
  },
};
</script>
 
<template>
  <div class="gl-display-grid gl-lg-display-block! geo-node-core-details-grid-columns">
    <div class="gl-display-flex gl-flex-direction-column gl-lg-mb-5">
      <span>{{ $options.i18n.url }}</span>
      <gl-link
        class="gl-text-gray-900 gl-font-weight-bold gl-text-decoration-underline"
        :href="node.url"
        target="_blank"
        rel="noopener noreferrer"
      >
        {{ node.url }}
        <gl-icon name="external-link" class="gl-ml-1" />
      </gl-link>
    </div>
    <div class="gl-display-flex gl-flex-direction-column gl-lg-my-5">
      <span>{{ $options.i18n.internalUrl }}</span>
      <span class="gl-font-weight-bold" data-testid="node-internal-url">{{
        node.internalUrl
      }}</span>
    </div>
    <div class="gl-display-flex gl-flex-direction-column gl-lg-mt-5">
      <span>{{ $options.i18n.gitlabVersion }}</span>
      <span
        :class="{ 'gl-text-red-500': versionMismatch }"
        class="gl-font-weight-bold"
        data-testid="node-version"
      >
        {{ nodeVersion }}
      </span>
    </div>
  </div>
</template>