2019-12-26 22:10:19 +05:30
|
|
|
<script>
|
2020-10-24 23:57:45 +05:30
|
|
|
import { GlDeprecatedDropdown, GlDeprecatedDropdownItem, GlIcon } from '@gitlab/ui';
|
2019-12-26 22:10:19 +05:30
|
|
|
import { s__ } from '../../locale';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'CrossplaneProviderStack',
|
|
|
|
components: {
|
2020-10-24 23:57:45 +05:30
|
|
|
GlDeprecatedDropdown,
|
|
|
|
GlDeprecatedDropdownItem,
|
2020-01-01 13:55:28 +05:30
|
|
|
GlIcon,
|
2019-12-26 22:10:19 +05:30
|
|
|
},
|
|
|
|
props: {
|
|
|
|
stacks: {
|
|
|
|
type: Array,
|
|
|
|
required: false,
|
|
|
|
default: () => [
|
|
|
|
{
|
|
|
|
name: s__('Google Cloud Platform'),
|
|
|
|
code: 'gcp',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: s__('Amazon Web Services'),
|
|
|
|
code: 'aws',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: s__('Microsoft Azure'),
|
|
|
|
code: 'azure',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: s__('Rook'),
|
|
|
|
code: 'rook',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
crossplane: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
dropdownText() {
|
|
|
|
const result = this.stacks.reduce((map, obj) => {
|
|
|
|
// eslint-disable-next-line no-param-reassign
|
|
|
|
map[obj.code] = obj.name;
|
|
|
|
return map;
|
|
|
|
}, {});
|
|
|
|
const { stack } = this.crossplane;
|
|
|
|
if (stack !== '') {
|
|
|
|
return result[stack];
|
|
|
|
}
|
|
|
|
return s__('Select Stack');
|
|
|
|
},
|
|
|
|
validationError() {
|
|
|
|
return this.crossplane.validationError;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
selectStack(stack) {
|
|
|
|
this.$emit('set', stack);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<label>
|
|
|
|
{{ s__('ClusterIntegration|Enabled stack') }}
|
|
|
|
</label>
|
2020-10-24 23:57:45 +05:30
|
|
|
<gl-deprecated-dropdown
|
2019-12-26 22:10:19 +05:30
|
|
|
:disabled="crossplane.installed"
|
|
|
|
:text="dropdownText"
|
|
|
|
toggle-class="dropdown-menu-toggle gl-field-error-outline"
|
|
|
|
class="w-100"
|
|
|
|
:class="{ 'gl-show-field-errors': validationError }"
|
|
|
|
>
|
2020-10-24 23:57:45 +05:30
|
|
|
<gl-deprecated-dropdown-item
|
|
|
|
v-for="stack in stacks"
|
|
|
|
:key="stack.code"
|
|
|
|
@click="selectStack(stack)"
|
|
|
|
>
|
2019-12-26 22:10:19 +05:30
|
|
|
<span class="ml-1">{{ stack.name }}</span>
|
2020-10-24 23:57:45 +05:30
|
|
|
</gl-deprecated-dropdown-item>
|
|
|
|
</gl-deprecated-dropdown>
|
2019-12-26 22:10:19 +05:30
|
|
|
<span v-if="validationError" class="gl-field-error">{{ validationError }}</span>
|
|
|
|
<p class="form-text text-muted">
|
|
|
|
{{ s__(`You must select a stack for configuring your cloud provider. Learn more about`) }}
|
|
|
|
<a
|
|
|
|
href="https://crossplane.io/docs/master/stacks-guide.html"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
2020-01-01 13:55:28 +05:30
|
|
|
>{{ __('Crossplane') }}
|
|
|
|
<gl-icon name="external-link" class="vertical-align-middle" />
|
|
|
|
</a>
|
2019-12-26 22:10:19 +05:30
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</template>
|