Commit d343105e authored by Kev's avatar Kev Committed by David O'Regan

Use inline copy button for CI variables

parent 60cd1b1f
<script> <script>
import { GlTable, GlButton, GlModalDirective, GlIcon } from '@gitlab/ui'; import { GlTable, GlButton, GlModalDirective, GlIcon, GlTooltipDirective } from '@gitlab/ui';
import { mapState, mapActions } from 'vuex'; import { mapState, mapActions } from 'vuex';
import { s__, __ } from '~/locale'; import { s__, __ } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
...@@ -59,6 +59,7 @@ export default { ...@@ -59,6 +59,7 @@ export default {
}, },
directives: { directives: {
GlModalDirective, GlModalDirective,
GlTooltip: GlTooltipDirective,
}, },
mixins: [glFeatureFlagsMixin()], mixins: [glFeatureFlagsMixin()],
computed: { computed: {
...@@ -102,27 +103,38 @@ export default { ...@@ -102,27 +103,38 @@ export default {
<col v-for="field in scope.fields" :key="field.key" :style="field.customStyle" /> <col v-for="field in scope.fields" :key="field.key" :style="field.customStyle" />
</template> </template>
<template #cell(key)="{ item }"> <template #cell(key)="{ item }">
<div class="d-flex truncated-container"> <div class="gl-display-flex truncated-container gl-align-items-center">
<span :id="`ci-variable-key-${item.id}`" class="d-inline-block mw-100 text-truncate">{{ <span
item.key :id="`ci-variable-key-${item.id}`"
}}</span> class="gl-display-inline-block gl-max-w-full gl-text-truncate"
<ci-variable-popover >{{ item.key }}</span
:target="`ci-variable-key-${item.id}`" >
:value="item.key" <gl-button
:tooltip-text="__('Copy key')" v-gl-tooltip
category="tertiary"
icon="copy-to-clipboard"
:title="__('Copy key')"
:data-clipboard-text="item.key"
:aria-label="__('Copy to clipboard')"
/> />
</div> </div>
</template> </template>
<template #cell(value)="{ item }"> <template #cell(value)="{ item }">
<span v-if="valuesHidden">*********************</span> <div class="gl-display-flex gl-align-items-center truncated-container">
<div v-else class="d-flex truncated-container"> <span v-if="valuesHidden">*********************</span>
<span :id="`ci-variable-value-${item.id}`" class="d-inline-block mw-100 text-truncate">{{ <span
item.value v-else
}}</span> :id="`ci-variable-value-${item.id}`"
<ci-variable-popover class="gl-display-inline-block gl-max-w-full gl-text-truncate"
:target="`ci-variable-value-${item.id}`" >{{ item.value }}</span
:value="item.value" >
:tooltip-text="__('Copy value')" <gl-button
v-gl-tooltip
category="tertiary"
icon="copy-to-clipboard"
:title="__('Copy value')"
:data-clipboard-text="item.value"
:aria-label="__('Copy to clipboard')"
/> />
</div> </div>
</template> </template>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment