Skip to content

Commit

Permalink
Add latest changes from gitlab-org/gitlab@master
Browse files Browse the repository at this point in the history
  • Loading branch information
GitLab Bot committed Oct 10, 2024
1 parent b1cfb65 commit 1252510
Show file tree
Hide file tree
Showing 90 changed files with 1,572 additions and 277 deletions.
2 changes: 1 addition & 1 deletion .rubocop_todo/gitlab/bounded_contexts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3768,7 +3768,7 @@ Gitlab/BoundedContexts:
- 'ee/lib/quality/seeders/dependencies.rb'
- 'ee/lib/quality/seeders/insights/issues.rb'
- 'ee/lib/quality/seeders/vulnerabilities.rb'
- 'ee/lib/sidebars/admin/menus/ai_powered_features_menu.rb'
- 'ee/lib/sidebars/admin/menus/self_hosted_models_menu.rb'
- 'ee/lib/sidebars/admin/menus/code_suggestions_menu.rb'
- 'ee/lib/sidebars/admin/menus/credentials_menu.rb'
- 'ee/lib/sidebars/admin/menus/geo_menu.rb'
Expand Down
1 change: 0 additions & 1 deletion .rubocop_todo/layout/line_length.yml
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ Layout/LineLength:
- 'app/models/namespace.rb'
- 'app/models/namespace/package_setting.rb'
- 'app/models/namespace_setting.rb'
- 'app/models/namespace_statistics.rb'
- 'app/models/namespaces/traversal/linear.rb'
- 'app/models/notification_setting.rb'
- 'app/models/oauth_access_token.rb'
Expand Down
1 change: 0 additions & 1 deletion .rubocop_todo/performance/string_identifier_argument.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ Performance/StringIdentifierArgument:
- 'spec/support/shared_examples/models/concerns/cascading_namespace_setting_shared_examples.rb'
- 'spec/support/shared_examples/models/concerns/cascading_project_setting_shared_examples.rb'
- 'spec/support/shared_examples/models/concerns/integrations/reset_secret_fields_shared_examples.rb'
- 'spec/support/shared_examples/models/concerns/update_namespace_statistics_shared_examples.rb'
- 'spec/support/shared_examples/models/email_format_shared_examples.rb'
- 'spec/support/shared_examples/models/project_ci_cd_settings_shared_examples.rb'
- 'spec/support/shared_examples/policies/project_policy_shared_examples.rb'
Expand Down
1 change: 0 additions & 1 deletion .rubocop_todo/rspec/expect_in_hook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,6 @@ RSpec/ExpectInHook:
- 'spec/support/shared_examples/lib/wikis_api_examples.rb'
- 'spec/support/shared_examples/metrics/sampler_shared_examples.rb'
- 'spec/support/shared_examples/models/concerns/has_wiki_shared_examples.rb'
- 'spec/support/shared_examples/models/concerns/update_namespace_statistics_shared_examples.rb'
- 'spec/support/shared_examples/models/mentionable_shared_examples.rb'
- 'spec/support/shared_examples/quick_actions/issuable/close_quick_action_shared_examples.rb'
- 'spec/support/shared_examples/requests/api/helm_packages_shared_examples.rb'
Expand Down
19 changes: 19 additions & 0 deletions app/assets/javascripts/access_level/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,25 @@ export const ACCESS_LEVEL_MAINTAINER_INTEGER = 40;
export const ACCESS_LEVEL_OWNER_INTEGER = 50;
export const ACCESS_LEVEL_ADMIN_INTEGER = 60;

// Matches `app/graphql/types/access_level_enum.rb`
export const ACCESS_LEVEL_NO_ACCESS_STRING = 'NO_ACCESS';
export const ACCESS_LEVEL_MINIMAL_ACCESS_STRING = 'MINIMAL_ACCESS';
export const ACCESS_LEVEL_GUEST_STRING = 'GUEST';
export const ACCESS_LEVEL_REPORTER_STRING = 'REPORTER';
export const ACCESS_LEVEL_DEVELOPER_STRING = 'DEVELOPER';
export const ACCESS_LEVEL_MAINTAINER_STRING = 'MAINTAINER';
export const ACCESS_LEVEL_OWNER_STRING = 'OWNER';

export const ACCESS_LEVELS_INTEGER_TO_STRING = {
[ACCESS_LEVEL_NO_ACCESS_INTEGER]: ACCESS_LEVEL_NO_ACCESS_STRING,
[ACCESS_LEVEL_MINIMAL_ACCESS_INTEGER]: ACCESS_LEVEL_MINIMAL_ACCESS_STRING,
[ACCESS_LEVEL_GUEST_INTEGER]: ACCESS_LEVEL_GUEST_STRING,
[ACCESS_LEVEL_REPORTER_INTEGER]: ACCESS_LEVEL_REPORTER_STRING,
[ACCESS_LEVEL_DEVELOPER_INTEGER]: ACCESS_LEVEL_DEVELOPER_STRING,
[ACCESS_LEVEL_MAINTAINER_INTEGER]: ACCESS_LEVEL_MAINTAINER_STRING,
[ACCESS_LEVEL_OWNER_INTEGER]: ACCESS_LEVEL_OWNER_STRING,
};

const ACCESS_LEVEL_NO_ACCESS = __('No access');
const ACCESS_LEVEL_MINIMAL_ACCESS = __('Minimal Access');
const ACCESS_LEVEL_GUEST = __('Guest');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { GlFilteredSearchToken, GlButton, GlLink, GlIcon, GlTooltipDirective } from '@gitlab/ui';
import { isEmpty } from 'lodash';
import ApprovalCount from 'ee_else_ce/merge_requests/components/approval_count.vue';
import { sprintf, __ } from '~/locale';
import Api from '~/api';
import * as Sentry from '~/sentry/sentry_browser_wrapper';
import { STATUS_ALL, STATUS_CLOSED, STATUS_OPEN, STATUS_MERGED } from '~/issues/constants';
Expand Down Expand Up @@ -129,6 +130,7 @@ export default {
canBulkUpdate: { default: false },
environmentNamesPath: { default: '' },
mergeTrainsPath: { default: undefined },
defaultBranch: { default: '' },
},
data() {
return {
Expand Down Expand Up @@ -676,6 +678,11 @@ export default {
issuableEventHub.$emit('issuables:updateBulkEdit');
});
},
targetBranchTooltip(mergeRequest) {
return sprintf(__('Target branch: %{target_branch}'), {
target_branch: mergeRequest.targetBranch,
});
},
},
STATUS_OPEN,
};
Expand Down Expand Up @@ -758,6 +765,23 @@ export default {
<issuable-milestone v-if="issuable.milestone" :milestone="issuable.milestone" />
</template>
<template #target-branch="{ issuable = {} }">
<span
v-if="issuable.targetBranch !== defaultBranch"
class="project-ref-path gl-inline-block gl-max-w-26 gl-truncate gl-align-bottom"
data-testid="target-branch"
>
<gl-link
v-gl-tooltip
:href="issuable.targetBranchPath"
:title="targetBranchTooltip(issuable)"
class="ref-name !gl-text-gray-500"
>
<gl-icon name="branch" :size="12" class="gl-mr-2" />{{ issuable.targetBranch }}
</gl-link>
</span>
</template>
<template #statistics="{ issuable = {} }">
<merge-request-statistics :merge-request="issuable" />
</template>
Expand Down
2 changes: 2 additions & 0 deletions app/assets/javascripts/merge_requests/list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export async function mountMergeRequestListsApp() {
canBulkUpdate,
environmentNamesPath,
mergeTrainsPath,
defaultBranch,
} = el.dataset;

return new Vue({
Expand Down Expand Up @@ -67,6 +68,7 @@ export async function mountMergeRequestListsApp() {
canBulkUpdate: parseBoolean(canBulkUpdate),
environmentNamesPath,
mergeTrainsPath,
defaultBranch,
},
render: (createComponent) => createComponent(MergeRequestsListApp),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ fragment MergeRequestFragment on MergeRequest {
commitCount
sourceBranchExists
targetBranchExists
targetBranch
targetBranchPath
taskCompletionStatus {
completedCount
count
Expand Down
30 changes: 25 additions & 5 deletions app/assets/javascripts/projects/your_work/components/app.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script>
import { GlTabs, GlTab, GlBadge, GlFilteredSearchToken } from '@gitlab/ui';
import { isEqual } from 'lodash';
import { isEqual, pick } from 'lodash';
import { __ } from '~/locale';
import { TIMESTAMP_TYPE_UPDATED_AT } from '~/vue_shared/components/resource_lists/constants';
import { QUERY_PARAM_END_CURSOR, QUERY_PARAM_START_CURSOR } from '~/graphql_shared/constants';
Expand All @@ -23,6 +23,8 @@ import {
CONTRIBUTED_TAB,
CUSTOM_DASHBOARD_ROUTE_NAMES,
PROJECT_DASHBOARD_TABS,
FILTERED_SEARCH_TOKEN_LANGUAGE,
FILTERED_SEARCH_TOKEN_MIN_ACCESS_LEVEL,
} from '../constants';
import projectCountsQuery from '../graphql/queries/project_counts.query.graphql';
import TabView from './tab_view.vue';
Expand Down Expand Up @@ -90,7 +92,7 @@ export default {
filteredSearchTokens() {
return [
{
type: 'language',
type: FILTERED_SEARCH_TOKEN_LANGUAGE,
icon: 'lock',
title: __('Language'),
token: GlFilteredSearchToken,
Expand All @@ -103,7 +105,7 @@ export default {
})),
},
{
type: 'min_access_level',
type: FILTERED_SEARCH_TOKEN_MIN_ACCESS_LEVEL,
icon: 'user',
title: __('Role'),
token: GlFilteredSearchToken,
Expand Down Expand Up @@ -141,6 +143,22 @@ export default {
endCursor() {
return this.$route.query[QUERY_PARAM_END_CURSOR];
},
routeQueryWithoutPagination() {
const {
[QUERY_PARAM_START_CURSOR]: startCursor,
[QUERY_PARAM_END_CURSOR]: endCursor,
...routeQuery
} = this.$route.query;
return routeQuery;
},
filters() {
return pick(this.routeQueryWithoutPagination, [
FILTERED_SEARCH_TOKEN_LANGUAGE,
FILTERED_SEARCH_TOKEN_MIN_ACCESS_LEVEL,
FILTERED_SEARCH_TERM_KEY,
]);
},
},
methods: {
numberToMetricPrefix,
Expand Down Expand Up @@ -178,12 +196,12 @@ export default {
onSortDirectionChange(isAscending) {
const sort = this.createSortQuery({ sortBy: this.activeSortOption.value, isAscending });
this.pushQuery({ ...this.$route.query, sort });
this.pushQuery({ ...this.routeQueryWithoutPagination, sort });
},
onSortByChange(sortBy) {
const sort = this.createSortQuery({ sortBy, isAscending: this.isAscending });
this.pushQuery({ ...this.$route.query, sort });
this.pushQuery({ ...this.routeQueryWithoutPagination, sort });
},
onFilter(filters) {
const { sort } = this.$route.query;
Expand Down Expand Up @@ -219,6 +237,8 @@ export default {
:tab="tab"
:start-cursor="startCursor"
:end-cursor="endCursor"
:sort="sort"
:filters="filters"
@page-change="onPageChange"
/>
<template v-else>{{ tab.text }}</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ import { __ } from '~/locale';
import { createAlert } from '~/alert';
import { formatGraphQLProjects } from '~/vue_shared/components/projects_list/utils';
import { TIMESTAMP_TYPE_UPDATED_AT } from '~/vue_shared/components/resource_lists/constants';
import { FILTERED_SEARCH_TERM_KEY } from '~/projects/filtered_search_and_sort/constants';
import { ACCESS_LEVELS_INTEGER_TO_STRING } from '~/access_level/constants';
import {
FILTERED_SEARCH_TOKEN_LANGUAGE,
FILTERED_SEARCH_TOKEN_MIN_ACCESS_LEVEL,
} from '../constants';
export default {
name: 'YourWorkProjectsTabView',
Expand All @@ -21,6 +27,7 @@ export default {
GlKeysetPagination,
ProjectsList,
},
inject: ['programmingLanguages'],
props: {
tab: {
required: true,
Expand All @@ -36,6 +43,14 @@ export default {
required: false,
default: null,
},
sort: {
type: String,
required: true,
},
filters: {
type: Object,
required: true,
},
},
data() {
return {
Expand All @@ -47,7 +62,21 @@ export default {
return {
query: this.tab.query,
variables() {
return { ...this.pagination, ...this.tab.variables };
const { transformVariables } = this.tab;
const variables = {
...this.pagination,
...this.tab.variables,
sort: this.sort,
programmingLanguageName: this.programmingLanguageName,
minAccessLevel: this.minAccessLevel,
search: this.search,
};
const transformedVariables = transformVariables
? transformVariables(variables)
: variables;
return transformedVariables;
},
update(response) {
const { nodes, pageInfo } = get(response, this.tab.queryPath);
Expand Down Expand Up @@ -90,6 +119,22 @@ export default {
isLoading() {
return this.$apollo.queries.projects.loading;
},
search() {
return this.filters[FILTERED_SEARCH_TERM_KEY];
},
minAccessLevel() {
const { [FILTERED_SEARCH_TOKEN_MIN_ACCESS_LEVEL]: minAccessLevelInteger } = this.filters;
return minAccessLevelInteger && ACCESS_LEVELS_INTEGER_TO_STRING[minAccessLevelInteger];
},
programmingLanguageName() {
const { [FILTERED_SEARCH_TOKEN_LANGUAGE]: programmingLanguageId } = this.filters;
return (
programmingLanguageId &&
this.programmingLanguages.find(({ id }) => id === parseInt(programmingLanguageId, 10))?.name
);
},
},
methods: {
onDeleteComplete() {
Expand Down
9 changes: 9 additions & 0 deletions app/assets/javascripts/projects/your_work/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@ import { __ } from '~/locale';
import projectsQuery from './graphql/queries/projects.query.graphql';
import userProjectsQuery from './graphql/queries/user_projects.query.graphql';

const transformSortToUpperCase = (variables) => ({
...variables,
sort: variables.sort.toUpperCase(),
});

export const CONTRIBUTED_TAB = {
text: __('Contributed'),
value: 'contributed',
query: userProjectsQuery,
variables: { contributed: true },
queryPath: 'currentUser.contributedProjects',
transformVariables: transformSortToUpperCase,
};

export const STARRED_TAB = {
Expand All @@ -16,6 +22,7 @@ export const STARRED_TAB = {
query: userProjectsQuery,
variables: { starred: true },
queryPath: 'currentUser.starredProjects',
transformVariables: transformSortToUpperCase,
};

export const PERSONAL_TAB = {
Expand Down Expand Up @@ -66,3 +73,5 @@ export const CUSTOM_DASHBOARD_ROUTE_NAMES = [

export const FILTERED_SEARCH_NAMESPACE = 'dashboard';
export const FILTERED_SEARCH_TERM_KEY = 'name';
export const FILTERED_SEARCH_TOKEN_LANGUAGE = 'language';
export const FILTERED_SEARCH_TOKEN_MIN_ACCESS_LEVEL = 'min_access_level';
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ query getYourWorkProjects(
$last: Int
$before: String
$after: String
$sort: String
$search: String
$minAccessLevel: AccessLevelEnum
$programmingLanguageName: String
) {
projects(
archived: $archived
Expand All @@ -18,6 +22,10 @@ query getYourWorkProjects(
last: $last
before: $before
after: $after
sort: $sort
search: $search
minAccessLevel: $minAccessLevel
programmingLanguageName: $programmingLanguageName
) {
nodes {
...Project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,40 @@ query getYourWorkUserProjects(
$last: Int
$before: String
$after: String
$sort: ProjectSort
$search: String
$minAccessLevel: AccessLevelEnum
$programmingLanguageName: String
) {
currentUser {
id
contributedProjects(first: $first, last: $last, before: $before, after: $after)
@include(if: $contributed) {
contributedProjects(
first: $first
last: $last
before: $before
after: $after
sort: $sort
search: $search
minAccessLevel: $minAccessLevel
programmingLanguageName: $programmingLanguageName
) @include(if: $contributed) {
nodes {
...Project
}
pageInfo {
...PageInfo
}
}
starredProjects(first: $first, last: $last, before: $before, after: $after)
@include(if: $starred) {
starredProjects(
first: $first
last: $last
before: $before
after: $after
sort: $sort
search: $search
minAccessLevel: $minAccessLevel
programmingLanguageName: $programmingLanguageName
) @include(if: $starred) {
nodes {
...Project
}
Expand Down
Loading

0 comments on commit 1252510

Please sign in to comment.