2019-09-30 21:07:59 +05:30
|
|
|
<script>
|
2021-01-03 14:25:43 +05:30
|
|
|
import { GlDropdown, GlDropdownItem } from '@gitlab/ui';
|
2019-09-30 21:07:59 +05:30
|
|
|
import { __ } from '~/locale';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
2021-01-03 14:25:43 +05:30
|
|
|
GlDropdown,
|
|
|
|
GlDropdownItem,
|
2019-09-30 21:07:59 +05:30
|
|
|
},
|
|
|
|
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>
|
2021-01-03 14:25:43 +05:30
|
|
|
<gl-dropdown block icon="lock" :text="dropdownText">
|
|
|
|
<gl-dropdown-item
|
2020-10-24 23:57:45 +05:30
|
|
|
v-for="project in projects"
|
|
|
|
:key="project.id"
|
2022-10-11 01:57:18 +05:30
|
|
|
is-check-item
|
2021-01-03 14:25:43 +05:30
|
|
|
:is-checked="project.id === selectedProject.id"
|
2020-10-24 23:57:45 +05:30
|
|
|
@click="selectProject(project)"
|
|
|
|
>
|
2021-01-03 14:25:43 +05:30
|
|
|
{{ project.name }}
|
|
|
|
</gl-dropdown-item>
|
|
|
|
</gl-dropdown>
|
2019-09-30 21:07:59 +05:30
|
|
|
</template>
|