Commit 29ed911d authored by Dennis Tang's avatar Dennis Tang

more component cleanup

parent 3daa298d
......@@ -7,12 +7,6 @@ import gkeDropdownMixin from './gke_dropdown_mixin';
export default {
name: 'GkeMachineTypeDropdown',
mixins: [gkeDropdownMixin],
data() {
return {
searchPlaceholderText: s__('ClusterIntegration|Search machine types'),
noSearchResultsText: s__('ClusterIntegration|No machine types matched your search'),
};
},
computed: {
...mapState(['selectedProject', 'selectedZone', 'selectedMachineType']),
...mapState({ items: 'machineTypes' }),
......@@ -87,18 +81,23 @@ export default {
<div class="dropdown-menu dropdown-select">
<dropdown-search-input
v-model="searchQuery"
:placeholder-text="searchPlaceholderText"
:placeholder-text="s__('ClusterIntegration|Search machine types')"
/>
<div class="dropdown-content">
<ul>
<li v-show="!results.length">
<span class="menu-item">{{ noSearchResultsText }}</span>
<span class="menu-item">
{{ s__('ClusterIntegration|No machine types matched your search') }}
</span>
</li>
<li
v-for="result in results"
:key="result.id"
>
<button @click.prevent="setItem(result.name)">
<button
type="button"
@click.prevent="setItem(result.name)"
>
{{ result.name }}
</button>
</li>
......
......@@ -14,12 +14,6 @@ export default {
required: true,
},
},
data() {
return {
searchPlaceholderText: s__('ClusterIntegration|Search projects'),
noSearchResultsText: s__('ClusterIntegration|No projects matched your search'),
};
},
computed: {
...mapState(['selectedProject']),
...mapState({ items: 'projects' }),
......@@ -116,18 +110,23 @@ export default {
<div class="dropdown-menu dropdown-select">
<dropdown-search-input
v-model="searchQuery"
:placeholder-text="searchPlaceholderText"
:placeholder-text="s__('ClusterIntegration|Search projects')"
/>
<div class="dropdown-content">
<ul>
<li v-show="!results.length">
<span class="menu-item">{{ noSearchResultsText }}</span>
<span class="menu-item">
{{ s__('ClusterIntegration|No projects matched your search') }}
</span>
</li>
<li
v-for="result in results"
:key="result.project_number"
>
<button @click.prevent="setItem(result)">
<button
type="button"
@click.prevent="setItem(result)"
>
{{ result.name }}
</button>
</li>
......
......@@ -7,12 +7,6 @@ import gkeDropdownMixin from './gke_dropdown_mixin';
export default {
name: 'GkeZoneDropdown',
mixins: [gkeDropdownMixin],
data() {
return {
searchPlaceholderText: s__('ClusterIntegration|Search zones'),
noSearchResultsText: s__('ClusterIntegration|No zones matched your search'),
};
},
computed: {
...mapState(['selectedProject', 'selectedZone']),
...mapState({ items: 'zones' }),
......@@ -68,18 +62,23 @@ export default {
<div class="dropdown-menu dropdown-select">
<dropdown-search-input
v-model="searchQuery"
:placeholder-text="searchPlaceholderText"
:placeholder-text="s__('ClusterIntegration|Search zones')"
/>
<div class="dropdown-content">
<ul>
<li v-show="!results.length">
<span class="menu-item">{{ noSearchResultsText }}</span>
<span class="menu-item">
{{ s__('ClusterIntegration|No zones matched your search') }}
</span>
</li>
<li
v-for="result in results"
:key="result.id"
>
<button @click.prevent="setItem(result.name)">
<button
type="button"
@click.prevent="setItem(result.name)"
>
{{ result.name }}
</button>
</li>
......
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