Skip to content
Snippets Groups Projects

Add feature flag for CI variables drawer

Merged Mireya Andres requested to merge ma/ci-variable-drawer-ff into master
5 files
+ 182
7
Compare changes
  • Side-by-side
  • Inline
Files
5
<script>
import { GlDrawer } from '@gitlab/ui';
import {
GlButton,
GlDrawer,
GlFormCheckbox,
GlFormCombobox,
GlFormGroup,
GlFormSelect,
GlFormTextarea,
GlSprintf,
} from '@gitlab/ui';
import { s__ } from '~/locale';
import { DRAWER_Z_INDEX } from '~/lib/utils/constants';
import { getContentWrapperHeight } from '~/lib/utils/dom_utils';
import { VARIABLE_ACTIONS } from '../constants';
import {
ENVIRONMENT_SCOPE_LINK_TITLE,
EXPANDED_VARIABLES_NOTE,
VARIABLE_ACTIONS,
variableOptions,
} from '../constants';
import CiEnvironmentsDropdown from './ci_environments_dropdown.vue';
import { awsTokenList } from './ci_variable_autocomplete_tokens';
const i18n = {
header: s__('CiVariables|Add Variable'),
environmentScopeLinkTitle: ENVIRONMENT_SCOPE_LINK_TITLE,
expandedField: s__('CiVariables|Expand variable reference'),
expandedDescription: EXPANDED_VARIABLES_NOTE,
maskedField: s__('CiVariables|Mask variable'),
maskedDescription: s__(
'CiVariables|Variable will be masked in job logs. Requires values to meet regular expression requirements.',
),
protectedField: s__('CiVariables|Protect variable'),
protectedDescription: s__(
'CiVariables|Export variable to pipelines running on protected branches and tags only.',
),
};
export default {
DRAWER_Z_INDEX,
components: {
CiEnvironmentsDropdown,
GlButton,
GlDrawer,
GlFormCheckbox,
GlFormCombobox,
GlFormGroup,
GlFormSelect,
GlFormTextarea,
GlSprintf,
},
props: {
areEnvironmentsLoading: {
type: Boolean,
required: true,
},
hasEnvScopeQuery: {
type: Boolean,
required: true,
},
mode: {
type: String,
required: true,
@@ -23,7 +66,15 @@ export default {
},
},
},
data() {
return {
key: '',
};
},
computed: {
environmentsList() {
return [];
},
getDrawerHeaderHeight() {
return getContentWrapperHeight();
},
@@ -33,7 +84,9 @@ export default {
this.$emit('close-form');
},
},
awsTokenList,
i18n,
variableOptions,
};
</script>
<template>
@@ -46,5 +99,73 @@ export default {
<template #title>
<h2 class="gl-m-0">{{ $options.i18n.header }}</h2>
</template>
<gl-form-group :label="__('Type')" label-for="ci-variable-type" class="gl-border-none gl-mb-n5">
<gl-form-select id="ci-variable-type" :options="$options.variableOptions" />
</gl-form-group>
<gl-form-group
:label="__('Environments')"
class="gl-border-none gl-mb-n8"
label-for="ci-variable-env"
data-testid="environment-scope"
>
<ci-environments-dropdown
class="gl-mb-5"
:are-environments-loading="areEnvironmentsLoading"
:environments="environmentsList"
:has-env-scope-query="hasEnvScopeQuery"
selected-environment-scope=""
/>
<gl-form-checkbox data-testid="ci-variable-protected-checkbox">
{{ $options.i18n.protectedField }}
<p class="gl-text-secondary">
{{ $options.i18n.protectedDescription }}
</p>
</gl-form-checkbox>
<gl-form-checkbox data-testid="ci-variable-masked-checkbox">
{{ $options.i18n.maskedField }}
<p class="gl-text-secondary">{{ $options.i18n.maskedDescription }}</p>
</gl-form-checkbox>
<gl-form-checkbox data-testid="ci-variable-expanded-checkbox">
{{ $options.i18n.expandedField }}
<p class="gl-text-secondary">
<gl-sprintf :message="$options.i18n.expandedDescription" class="gl-text-secondary">
<template #code="{ content }">
<code>{{ content }}</code>
</template>
</gl-sprintf>
</p>
</gl-form-checkbox>
</gl-form-group>
<gl-form-combobox
v-model="key"
:token-list="$options.awsTokenList"
:label-text="__('Key')"
class="gl-border-none gl-mb-n7"
data-testid="pipeline-form-ci-variable-key"
data-qa-selector="ci_variable_key_field"
/>
<gl-form-group
:label="__('Value')"
label-for="ci-variable-value"
class="gl-border-none gl-mb-n5"
>
<gl-form-textarea
id="ci-variable-value"
class="gl-border-none gl-font-monospace!"
rows="3"
max-rows="10"
data-testid="pipeline-form-ci-variable-value"
data-qa-selector="ci_variable_value_field"
spellcheck="false"
/>
</gl-form-group>
<div class="gl-display-flex gl-justify-content-end">
<gl-button category="primary" class="gl-mr-3" data-testid="cancel-button" @click="close"
>{{ __('Cancel') }}
</gl-button>
<gl-button category="primary" variant="confirm" data-testid="confirm-button"
>{{ __('Add Variable') }}
</gl-button>
</div>
</gl-drawer>
</template>
Loading