2019-09-30 21:07:59 +05:30
|
|
|
<script>
|
2020-10-24 23:57:45 +05:30
|
|
|
import { GlDeprecatedDropdown, GlDeprecatedDropdownItem } from '@gitlab/ui';
|
2019-09-30 21:07:59 +05:30
|
|
|
import { __ } from '~/locale';
|
|
|
|
import Icon from '~/vue_shared/components/icon.vue';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
2020-10-24 23:57:45 +05:30
|
|
|
GlDeprecatedDropdown,
|
|
|
|
GlDeprecatedDropdownItem,
|
2019-09-30 21:07:59 +05:30
|
|
|
Icon,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
projects: {
|
|
|
|
type: Array,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
selectedProject: {
|
|
|
|
type: Object,
|
|
|
|
required: false,
|
|
|
|
default: () => ({}),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
dropdownText() {
|
|
|
|
if (Object.keys(this.selectedProject).length) {
|
|
|
|
return this.selectedProject.name;
|
|
|
|
}
|
|
|
|
|
|
|
|
return __('Select private project');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
selectProject(project) {
|
|
|
|
this.$emit('click', project);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2020-10-24 23:57:45 +05:30
|
|
|
<gl-deprecated-dropdown toggle-class="d-flex align-items-center w-100" class="w-100">
|
2020-05-24 23:13:21 +05:30
|
|
|
<template #button-content>
|
2019-09-30 21:07:59 +05:30
|
|
|
<span class="str-truncated-100 mr-2">
|
|
|
|
<icon name="lock" />
|
|
|
|
{{ dropdownText }}
|
|
|
|
</span>
|
|
|
|
<icon name="chevron-down" class="ml-auto" />
|
|
|
|
</template>
|
2020-10-24 23:57:45 +05:30
|
|
|
<gl-deprecated-dropdown-item
|
|
|
|
v-for="project in projects"
|
|
|
|
:key="project.id"
|
|
|
|
@click="selectProject(project)"
|
|
|
|
>
|
2019-09-30 21:07:59 +05:30
|
|
|
<icon
|
|
|
|
name="mobile-issue-close"
|
|
|
|
:class="{ icon: project.id !== selectedProject.id }"
|
|
|
|
class="js-active-project-check"
|
|
|
|
/>
|
|
|
|
<span class="ml-1">{{ project.name }}</span>
|
2020-10-24 23:57:45 +05:30
|
|
|
</gl-deprecated-dropdown-item>
|
|
|
|
</gl-deprecated-dropdown>
|
2019-09-30 21:07:59 +05:30
|
|
|
</template>
|