Commit dd456683 authored by Jacques Erasmus's avatar Jacques Erasmus

Merge branch...

Merge branch 'Replace-GlDeprecatedDropdown-with-GlDropdown-in-app/assets/javascripts/clusters' into 'master'

Replace deprecated cluster dropdowns with updated dropdowns

See merge request gitlab-org/gitlab!41414
parents 53488ad0 7dfa31d5
<script> <script>
import { GlDeprecatedDropdown, GlDeprecatedDropdownItem, GlIcon } from '@gitlab/ui'; import { GlDropdown, GlDropdownItem, GlIcon } from '@gitlab/ui';
import { s__ } from '../../locale'; import { s__ } from '../../locale';
export default { export default {
name: 'CrossplaneProviderStack', name: 'CrossplaneProviderStack',
components: { components: {
GlDeprecatedDropdown, GlDropdown,
GlDeprecatedDropdownItem, GlDropdownItem,
GlIcon, GlIcon,
}, },
props: { props: {
...@@ -67,21 +67,17 @@ export default { ...@@ -67,21 +67,17 @@ export default {
<label> <label>
{{ s__('ClusterIntegration|Enabled stack') }} {{ s__('ClusterIntegration|Enabled stack') }}
</label> </label>
<gl-deprecated-dropdown <gl-dropdown
:disabled="crossplane.installed" :disabled="crossplane.installed"
:text="dropdownText" :text="dropdownText"
toggle-class="dropdown-menu-toggle gl-field-error-outline" toggle-class="dropdown-menu-toggle gl-field-error-outline"
class="w-100" class="w-100"
:class="{ 'gl-show-field-errors': validationError }" :class="{ 'gl-show-field-errors': validationError }"
> >
<gl-deprecated-dropdown-item <gl-dropdown-item v-for="stack in stacks" :key="stack.code" @click="selectStack(stack)">
v-for="stack in stacks"
:key="stack.code"
@click="selectStack(stack)"
>
<span class="ml-1">{{ stack.name }}</span> <span class="ml-1">{{ stack.name }}</span>
</gl-deprecated-dropdown-item> </gl-dropdown-item>
</gl-deprecated-dropdown> </gl-dropdown>
<span v-if="validationError" class="gl-field-error">{{ validationError }}</span> <span v-if="validationError" class="gl-field-error">{{ validationError }}</span>
<p class="form-text text-muted"> <p class="form-text text-muted">
{{ s__(`You must select a stack for configuring your cloud provider. Learn more about`) }} {{ s__(`You must select a stack for configuring your cloud provider. Learn more about`) }}
......
<script> <script>
import { import { GlAlert, GlButton, GlDropdown, GlDropdownItem, GlFormCheckbox } from '@gitlab/ui';
GlAlert,
GlButton,
GlDeprecatedDropdown,
GlDeprecatedDropdownItem,
GlFormCheckbox,
} from '@gitlab/ui';
import { mapValues } from 'lodash'; import { mapValues } from 'lodash';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { APPLICATION_STATUS, FLUENTD } from '~/clusters/constants'; import { APPLICATION_STATUS, FLUENTD } from '~/clusters/constants';
...@@ -17,8 +11,8 @@ export default { ...@@ -17,8 +11,8 @@ export default {
components: { components: {
GlAlert, GlAlert,
GlButton, GlButton,
GlDeprecatedDropdown, GlDropdown,
GlDeprecatedDropdownItem, GlDropdownItem,
GlFormCheckbox, GlFormCheckbox,
}, },
props: { props: {
...@@ -203,15 +197,15 @@ export default { ...@@ -203,15 +197,15 @@ export default {
<label for="fluentd-protocol"> <label for="fluentd-protocol">
<strong>{{ s__('ClusterIntegration|SIEM Protocol') }}</strong> <strong>{{ s__('ClusterIntegration|SIEM Protocol') }}</strong>
</label> </label>
<gl-deprecated-dropdown :text="protocolName" class="w-100"> <gl-dropdown :text="protocolName" class="w-100">
<gl-deprecated-dropdown-item <gl-dropdown-item
v-for="(value, index) in protocols" v-for="(value, index) in protocols"
:key="index" :key="index"
@click="selectProtocol(value.toLowerCase())" @click="selectProtocol(value.toLowerCase())"
> >
{{ value }} {{ value }}
</gl-deprecated-dropdown-item> </gl-dropdown-item>
</gl-deprecated-dropdown> </gl-dropdown>
</div> </div>
<div class="form-group flex flex-wrap"> <div class="form-group flex flex-wrap">
<gl-form-checkbox :checked="wafLogEnabled" @input="wafLogChanged"> <gl-form-checkbox :checked="wafLogEnabled" @input="wafLogChanged">
......
...@@ -6,8 +6,8 @@ import { ...@@ -6,8 +6,8 @@ import {
GlLink, GlLink,
GlToggle, GlToggle,
GlButton, GlButton,
GlDeprecatedDropdown, GlDropdown,
GlDeprecatedDropdownItem, GlDropdownItem,
GlIcon, GlIcon,
} from '@gitlab/ui'; } from '@gitlab/ui';
import modSecurityLogo from 'images/cluster_app_logos/gitlab.png'; import modSecurityLogo from 'images/cluster_app_logos/gitlab.png';
...@@ -26,8 +26,8 @@ export default { ...@@ -26,8 +26,8 @@ export default {
GlLink, GlLink,
GlToggle, GlToggle,
GlButton, GlButton,
GlDeprecatedDropdown, GlDropdown,
GlDeprecatedDropdownItem, GlDropdownItem,
GlIcon, GlIcon,
}, },
props: { props: {
...@@ -221,15 +221,11 @@ export default { ...@@ -221,15 +221,11 @@ export default {
</strong> </strong>
</p> </p>
</div> </div>
<gl-deprecated-dropdown :text="modSecurityModeName" :disabled="saveButtonDisabled"> <gl-dropdown :text="modSecurityModeName" :disabled="saveButtonDisabled">
<gl-deprecated-dropdown-item <gl-dropdown-item v-for="(mode, key) in modes" :key="key" @click="selectMode(key)">
v-for="(mode, key) in modes"
:key="key"
@click="selectMode(key)"
>
{{ mode.name }} {{ mode.name }}
</gl-deprecated-dropdown-item> </gl-dropdown-item>
</gl-deprecated-dropdown> </gl-dropdown>
</div> </div>
</div> </div>
<div v-if="showButtons" class="gl-mt-5 gl-display-flex"> <div v-if="showButtons" class="gl-mt-5 gl-display-flex">
......
<script> <script>
import { import {
GlDeprecatedDropdown, GlDropdown,
GlDeprecatedDropdownDivider, GlDropdownDivider,
GlDeprecatedDropdownItem, GlDropdownItem,
GlLoadingIcon, GlLoadingIcon,
GlSearchBoxByType, GlSearchBoxByType,
GlSprintf, GlSprintf,
...@@ -20,9 +20,9 @@ export default { ...@@ -20,9 +20,9 @@ export default {
GlButton, GlButton,
ClipboardButton, ClipboardButton,
GlLoadingIcon, GlLoadingIcon,
GlDeprecatedDropdown, GlDropdown,
GlDeprecatedDropdownDivider, GlDropdownDivider,
GlDeprecatedDropdownItem, GlDropdownItem,
GlSearchBoxByType, GlSearchBoxByType,
GlSprintf, GlSprintf,
}, },
...@@ -121,7 +121,7 @@ export default { ...@@ -121,7 +121,7 @@ export default {
<strong>{{ s__('ClusterIntegration|Knative Domain Name:') }}</strong> <strong>{{ s__('ClusterIntegration|Knative Domain Name:') }}</strong>
</label> </label>
<gl-deprecated-dropdown <gl-dropdown
v-if="showDomainsDropdown" v-if="showDomainsDropdown"
:text="domainDropdownText" :text="domainDropdownText"
toggle-class="dropdown-menu-toggle" toggle-class="dropdown-menu-toggle"
...@@ -132,16 +132,16 @@ export default { ...@@ -132,16 +132,16 @@ export default {
:placeholder="s__('ClusterIntegration|Search domains')" :placeholder="s__('ClusterIntegration|Search domains')"
class="gl-m-3" class="gl-m-3"
/> />
<gl-deprecated-dropdown-item <gl-dropdown-item
v-for="domain in filteredDomains" v-for="domain in filteredDomains"
:key="domain.id" :key="domain.id"
@click="selectDomain(domain)" @click="selectDomain(domain)"
> >
<span class="ml-1">{{ domain.domain }}</span> <span class="ml-1">{{ domain.domain }}</span>
</gl-deprecated-dropdown-item> </gl-dropdown-item>
<template v-if="searchQuery"> <template v-if="searchQuery">
<gl-deprecated-dropdown-divider /> <gl-dropdown-divider />
<gl-deprecated-dropdown-item key="custom-domain" @click="selectCustomDomain(searchQuery)"> <gl-dropdown-item key="custom-domain" @click="selectCustomDomain(searchQuery)">
<span class="ml-1"> <span class="ml-1">
<gl-sprintf :message="s__('ClusterIntegration|Use %{query}')"> <gl-sprintf :message="s__('ClusterIntegration|Use %{query}')">
<template #query> <template #query>
...@@ -149,9 +149,9 @@ export default { ...@@ -149,9 +149,9 @@ export default {
</template> </template>
</gl-sprintf> </gl-sprintf>
</span> </span>
</gl-deprecated-dropdown-item> </gl-dropdown-item>
</template> </template>
</gl-deprecated-dropdown> </gl-dropdown>
<input <input
v-else v-else
......
---
title: Replace deprecated cluster dropdowns with updated dropdowns
merge_request: 41414
author: nuwe1
type: other
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { GlAlert, GlDeprecatedDropdown, GlFormCheckbox } from '@gitlab/ui'; import { GlAlert, GlDropdown, GlFormCheckbox } from '@gitlab/ui';
import FluentdOutputSettings from '~/clusters/components/fluentd_output_settings.vue'; import FluentdOutputSettings from '~/clusters/components/fluentd_output_settings.vue';
import { APPLICATION_STATUS, FLUENTD } from '~/clusters/constants'; import { APPLICATION_STATUS, FLUENTD } from '~/clusters/constants';
import eventHub from '~/clusters/event_hub'; import eventHub from '~/clusters/event_hub';
...@@ -36,7 +36,7 @@ describe('FluentdOutputSettings', () => { ...@@ -36,7 +36,7 @@ describe('FluentdOutputSettings', () => {
}; };
const findSaveButton = () => wrapper.find({ ref: 'saveBtn' }); const findSaveButton = () => wrapper.find({ ref: 'saveBtn' });
const findCancelButton = () => wrapper.find({ ref: 'cancelBtn' }); const findCancelButton = () => wrapper.find({ ref: 'cancelBtn' });
const findProtocolDropdown = () => wrapper.find(GlDeprecatedDropdown); const findProtocolDropdown = () => wrapper.find(GlDropdown);
const findCheckbox = name => const findCheckbox = name =>
wrapper.findAll(GlFormCheckbox).wrappers.find(x => x.text() === name); wrapper.findAll(GlFormCheckbox).wrappers.find(x => x.text() === name);
const findHost = () => wrapper.find('#fluentd-host'); const findHost = () => wrapper.find('#fluentd-host');
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { GlAlert, GlToggle, GlDeprecatedDropdown } from '@gitlab/ui'; import { GlAlert, GlToggle, GlDropdown } from '@gitlab/ui';
import IngressModsecuritySettings from '~/clusters/components/ingress_modsecurity_settings.vue'; import IngressModsecuritySettings from '~/clusters/components/ingress_modsecurity_settings.vue';
import { APPLICATION_STATUS, INGRESS } from '~/clusters/constants'; import { APPLICATION_STATUS, INGRESS } from '~/clusters/constants';
import eventHub from '~/clusters/event_hub'; import eventHub from '~/clusters/event_hub';
...@@ -33,7 +33,7 @@ describe('IngressModsecuritySettings', () => { ...@@ -33,7 +33,7 @@ describe('IngressModsecuritySettings', () => {
const findCancelButton = () => const findCancelButton = () =>
wrapper.find('[data-qa-selector="cancel_ingress_modsecurity_settings"]'); wrapper.find('[data-qa-selector="cancel_ingress_modsecurity_settings"]');
const findModSecurityToggle = () => wrapper.find(GlToggle); const findModSecurityToggle = () => wrapper.find(GlToggle);
const findModSecurityDropdown = () => wrapper.find(GlDeprecatedDropdown); const findModSecurityDropdown = () => wrapper.find(GlDropdown);
describe('when ingress is installed', () => { describe('when ingress is installed', () => {
beforeEach(() => { beforeEach(() => {
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { GlDeprecatedDropdownItem, GlButton } from '@gitlab/ui'; import { GlDropdownItem, GlButton } from '@gitlab/ui';
import KnativeDomainEditor from '~/clusters/components/knative_domain_editor.vue'; import KnativeDomainEditor from '~/clusters/components/knative_domain_editor.vue';
import { APPLICATION_STATUS } from '~/clusters/constants'; import { APPLICATION_STATUS } from '~/clusters/constants';
...@@ -112,7 +112,7 @@ describe('KnativeDomainEditor', () => { ...@@ -112,7 +112,7 @@ describe('KnativeDomainEditor', () => {
createComponent({ knative: { ...knative, availableDomains: [newDomain] } }); createComponent({ knative: { ...knative, availableDomains: [newDomain] } });
jest.spyOn(wrapper.vm, 'selectDomain'); jest.spyOn(wrapper.vm, 'selectDomain');
wrapper.find(GlDeprecatedDropdownItem).vm.$emit('click'); wrapper.find(GlDropdownItem).vm.$emit('click');
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(wrapper.vm.selectDomain).toHaveBeenCalledWith(newDomain); expect(wrapper.vm.selectDomain).toHaveBeenCalledWith(newDomain);
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { GlDeprecatedDropdownItem, GlIcon } from '@gitlab/ui'; import { GlDropdownItem, GlIcon } from '@gitlab/ui';
import CrossplaneProviderStack from '~/clusters/components/crossplane_provider_stack.vue'; import CrossplaneProviderStack from '~/clusters/components/crossplane_provider_stack.vue';
describe('CrossplaneProviderStack component', () => { describe('CrossplaneProviderStack component', () => {
...@@ -37,7 +37,7 @@ describe('CrossplaneProviderStack component', () => { ...@@ -37,7 +37,7 @@ describe('CrossplaneProviderStack component', () => {
createComponent({ crossplane }); createComponent({ crossplane });
}); });
const findDropdownElements = () => wrapper.findAll(GlDeprecatedDropdownItem); const findDropdownElements = () => wrapper.findAll(GlDropdownItem);
const findFirstDropdownElement = () => findDropdownElements().at(0); const findFirstDropdownElement = () => findDropdownElements().at(0);
afterEach(() => { afterEach(() => {
......
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