Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/pages/projects/forks/new/components')
-rw-r--r--app/assets/javascripts/pages/projects/forks/new/components/app.vue43
-rw-r--r--app/assets/javascripts/pages/projects/forks/new/components/fork_form.vue25
-rw-r--r--app/assets/javascripts/pages/projects/forks/new/components/fork_groups_list.vue93
-rw-r--r--app/assets/javascripts/pages/projects/forks/new/components/fork_groups_list_item.vue148
4 files changed, 8 insertions, 301 deletions
diff --git a/app/assets/javascripts/pages/projects/forks/new/components/app.vue b/app/assets/javascripts/pages/projects/forks/new/components/app.vue
index 7fb41c6e7b7..0995a2118b1 100644
--- a/app/assets/javascripts/pages/projects/forks/new/components/app.vue
+++ b/app/assets/javascripts/pages/projects/forks/new/components/app.vue
@@ -10,38 +10,6 @@ export default {
type: String,
required: true,
},
- endpoint: {
- type: String,
- required: true,
- },
- projectFullPath: {
- type: String,
- required: true,
- },
- projectId: {
- type: String,
- required: true,
- },
- projectName: {
- type: String,
- required: true,
- },
- projectPath: {
- type: String,
- required: true,
- },
- projectDescription: {
- type: String,
- required: true,
- },
- projectVisibility: {
- type: String,
- required: true,
- },
- restrictedVisibilityLevels: {
- type: Array,
- required: true,
- },
},
};
</script>
@@ -62,16 +30,7 @@ export default {
</p>
</div>
<div class="col-lg-9">
- <fork-form
- :endpoint="endpoint"
- :project-full-path="projectFullPath"
- :project-id="projectId"
- :project-name="projectName"
- :project-path="projectPath"
- :project-description="projectDescription"
- :project-visibility="projectVisibility"
- :restricted-visibility-levels="restrictedVisibilityLevels"
- />
+ <fork-form />
</div>
</div>
</template>
diff --git a/app/assets/javascripts/pages/projects/forks/new/components/fork_form.vue b/app/assets/javascripts/pages/projects/forks/new/components/fork_form.vue
index 25b62e6c971..701bf0c1e1d 100644
--- a/app/assets/javascripts/pages/projects/forks/new/components/fork_form.vue
+++ b/app/assets/javascripts/pages/projects/forks/new/components/fork_form.vue
@@ -72,40 +72,29 @@ export default {
visibilityHelpPath: {
default: '',
},
- },
- props: {
endpoint: {
- type: String,
- required: true,
+ default: '',
},
projectFullPath: {
- type: String,
- required: true,
+ default: '',
},
projectId: {
- type: String,
- required: true,
+ default: '',
},
projectName: {
- type: String,
- required: true,
+ default: '',
},
projectPath: {
- type: String,
- required: true,
+ default: '',
},
projectDescription: {
- type: String,
- required: false,
default: '',
},
projectVisibility: {
- type: String,
- required: true,
+ default: '',
},
restrictedVisibilityLevels: {
- type: Array,
- required: true,
+ default: [],
},
},
data() {
diff --git a/app/assets/javascripts/pages/projects/forks/new/components/fork_groups_list.vue b/app/assets/javascripts/pages/projects/forks/new/components/fork_groups_list.vue
deleted file mode 100644
index 10753de6cd0..00000000000
--- a/app/assets/javascripts/pages/projects/forks/new/components/fork_groups_list.vue
+++ /dev/null
@@ -1,93 +0,0 @@
-<script>
-import { GlTabs, GlTab, GlLoadingIcon, GlSearchBoxByType } from '@gitlab/ui';
-import createFlash from '~/flash';
-import axios from '~/lib/utils/axios_utils';
-import { __ } from '~/locale';
-import ForkGroupsListItem from './fork_groups_list_item.vue';
-
-export default {
- components: {
- GlTabs,
- GlTab,
- GlLoadingIcon,
- GlSearchBoxByType,
- ForkGroupsListItem,
- },
- props: {
- endpoint: {
- type: String,
- required: true,
- },
- },
- data() {
- return {
- namespaces: null,
- filter: '',
- };
- },
- computed: {
- filteredNamespaces() {
- return this.namespaces.filter((n) =>
- n.name.toLowerCase().includes(this.filter.toLowerCase()),
- );
- },
- },
-
- mounted() {
- this.loadGroups();
- },
-
- methods: {
- loadGroups() {
- axios
- .get(this.endpoint)
- .then((response) => {
- this.namespaces = response.data.namespaces;
- })
- .catch(() =>
- createFlash({
- message: __('There was a problem fetching groups.'),
- }),
- );
- },
- },
-
- i18n: {
- searchPlaceholder: __('Search by name'),
- },
-};
-</script>
-<template>
- <gl-tabs class="fork-groups">
- <gl-tab :title="__('Groups and subgroups')">
- <gl-loading-icon v-if="!namespaces" size="md" class="gl-mt-3" />
- <template v-else-if="namespaces.length === 0">
- <div class="gl-text-center">
- <div class="h5">{{ __('No available groups to fork the project.') }}</div>
- <p class="gl-mt-5">
- {{ __('You must have permission to create a project in a group before forking.') }}
- </p>
- </div>
- </template>
- <div v-else-if="filteredNamespaces.length === 0" class="gl-text-center gl-mt-3">
- {{ s__('GroupsTree|No groups matched your search') }}
- </div>
- <ul v-else class="groups-list group-list-tree">
- <fork-groups-list-item
- v-for="(namespace, index) in filteredNamespaces"
- :key="index"
- :group="namespace"
- />
- </ul>
- </gl-tab>
- <template #tabs-end>
- <gl-search-box-by-type
- v-if="namespaces && namespaces.length"
- v-model="filter"
- :placeholder="$options.i18n.searchPlaceholder"
- class="gl-align-self-center gl-ml-auto fork-filtered-search"
- data-qa-selector="fork_groups_list_search_field"
- />
- </template>
- </gl-tabs>
-</template>
diff --git a/app/assets/javascripts/pages/projects/forks/new/components/fork_groups_list_item.vue b/app/assets/javascripts/pages/projects/forks/new/components/fork_groups_list_item.vue
deleted file mode 100644
index d41488acf46..00000000000
--- a/app/assets/javascripts/pages/projects/forks/new/components/fork_groups_list_item.vue
+++ /dev/null
@@ -1,148 +0,0 @@
-<script>
-import {
- GlLink,
- GlButton,
- GlIcon,
- GlAvatar,
- GlTooltipDirective,
- GlTooltip,
- GlBadge,
- GlSafeHtmlDirective as SafeHtml,
-} from '@gitlab/ui';
-import { VISIBILITY_TYPE_ICON, GROUP_VISIBILITY_TYPE } from '~/groups/constants';
-import csrf from '~/lib/utils/csrf';
-import UserAccessRoleBadge from '~/vue_shared/components/user_access_role_badge.vue';
-
-export default {
- components: {
- GlIcon,
- GlAvatar,
- GlBadge,
- GlButton,
- GlTooltip,
- GlLink,
- UserAccessRoleBadge,
- },
- directives: {
- GlTooltip: GlTooltipDirective,
- SafeHtml,
- },
- props: {
- group: {
- type: Object,
- required: true,
- },
- },
- data() {
- return { namespaces: null, isForking: false };
- },
-
- computed: {
- rowClass() {
- return {
- 'has-description': this.group.description,
- 'being-removed': this.isGroupPendingRemoval,
- };
- },
- isGroupPendingRemoval() {
- return this.group.marked_for_deletion;
- },
- hasForkedProject() {
- return Boolean(this.group.forked_project_path);
- },
- visibilityIcon() {
- return VISIBILITY_TYPE_ICON[this.group.visibility];
- },
- visibilityTooltip() {
- return GROUP_VISIBILITY_TYPE[this.group.visibility];
- },
- isSelectButtonDisabled() {
- return !this.group.can_create_project;
- },
- },
-
- methods: {
- fork() {
- this.isForking = true;
- this.$refs.form.submit();
- },
- },
-
- csrf,
-};
-</script>
-<template>
- <li :class="rowClass" class="group-row">
- <div class="group-row-contents gl-display-flex gl-align-items-center gl-py-3 gl-pr-5">
- <div
- class="folder-toggle-wrap gl-mr-3 gl-display-flex gl-align-items-center gl-text-gray-500"
- >
- <gl-icon name="folder-o" />
- </div>
- <gl-link
- :href="group.relative_path"
- class="gl-display-none gl-flex-shrink-0 gl-sm-display-flex gl-mr-3"
- >
- <gl-avatar :size="32" shape="rect" :entity-name="group.name" :src="group.avatarUrl" />
- </gl-link>
- <div class="gl-min-w-0 gl-display-flex gl-flex-grow-1 gl-flex-shrink-1 gl-align-items-center">
- <div class="gl-min-w-0 gl-flex-grow-1 flex-shrink-1">
- <div class="title gl-display-flex gl-align-items-center gl-flex-wrap gl-mr-3">
- <gl-link :href="group.relative_path" class="gl-mt-3 gl-mr-3 gl-text-gray-900!">
- {{ group.full_name }}
- </gl-link>
- <gl-icon
- v-gl-tooltip.hover.bottom
- class="gl-display-inline-flex gl-mt-3 gl-mr-3 gl-text-gray-500"
- :name="visibilityIcon"
- :title="visibilityTooltip"
- />
- <gl-badge
- v-if="isGroupPendingRemoval"
- variant="warning"
- class="gl-display-none gl-sm-display-flex gl-mt-3 gl-mr-1"
- >{{ __('pending deletion') }}</gl-badge
- >
- <user-access-role-badge v-if="group.permission" class="gl-mt-3">
- {{ group.permission }}
- </user-access-role-badge>
- </div>
- <div v-if="group.description" class="description gl-line-height-20">
- <span v-safe-html="group.markdown_description"> </span>
- </div>
- </div>
- <div class="gl-display-flex gl-flex-shrink-0">
- <gl-button
- v-if="hasForkedProject"
- class="gl-h-7 gl-text-decoration-none!"
- :href="group.forked_project_path"
- >{{ __('Go to fork') }}</gl-button
- >
- <template v-else>
- <div ref="selectButtonWrapper">
- <form ref="form" method="POST" :action="group.fork_path">
- <input type="hidden" name="authenticity_token" :value="$options.csrf.token" />
- <gl-button
- type="submit"
- class="gl-h-7"
- :data-qa-name="group.full_name"
- category="secondary"
- variant="success"
- :disabled="isSelectButtonDisabled"
- :loading="isForking"
- @click="fork"
- >{{ __('Select') }}</gl-button
- >
- </form>
- </div>
- <gl-tooltip v-if="isSelectButtonDisabled" :target="() => $refs.selectButtonWrapper">
- {{
- __('You must have permission to create a project in a namespace before forking.')
- }}
- </gl-tooltip>
- </template>
- </div>
- </div>
- </div>
- </li>
-</template>