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')
-rw-r--r--app/assets/javascripts/pages/projects/activity/index.js3
-rw-r--r--app/assets/javascripts/pages/projects/artifacts/browse/index.js3
-rw-r--r--app/assets/javascripts/pages/projects/artifacts/file/index.js3
-rw-r--r--app/assets/javascripts/pages/projects/boards/index.js3
-rw-r--r--app/assets/javascripts/pages/projects/commit/show/index.js3
-rw-r--r--app/assets/javascripts/pages/projects/commits/show/index.js3
-rw-r--r--app/assets/javascripts/pages/projects/find_file/show/index.js3
-rw-r--r--app/assets/javascripts/pages/projects/forks/new/components/fork_form.vue5
-rw-r--r--app/assets/javascripts/pages/projects/forks/new/components/project_namespace.vue3
-rw-r--r--app/assets/javascripts/pages/projects/index.js3
-rw-r--r--app/assets/javascripts/pages/projects/init_blob.js7
-rw-r--r--app/assets/javascripts/pages/projects/issues/index/index.js3
-rw-r--r--app/assets/javascripts/pages/projects/merge_requests/index/index.js3
-rw-r--r--app/assets/javascripts/pages/projects/merge_requests/init_merge_request.js3
-rw-r--r--app/assets/javascripts/pages/projects/merge_requests/init_merge_request_show.js3
-rw-r--r--app/assets/javascripts/pages/projects/ml/model_versions/show/index.js2
-rw-r--r--app/assets/javascripts/pages/projects/network/show/index.js4
-rw-r--r--app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/interval_pattern_input.vue39
-rw-r--r--app/assets/javascripts/pages/projects/shared/permissions/components/ci_catalog_settings.vue107
-rw-r--r--app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue35
-rw-r--r--app/assets/javascripts/pages/projects/shared/permissions/constants.js2
-rw-r--r--app/assets/javascripts/pages/projects/shared/permissions/graphql/mutations/catalog_resources_destroy.mutation.graphql5
-rw-r--r--app/assets/javascripts/pages/projects/shared/web_ide_link/index.js3
-rw-r--r--app/assets/javascripts/pages/projects/show/index.js8
-rw-r--r--app/assets/javascripts/pages/projects/tree/show/index.js3
25 files changed, 164 insertions, 95 deletions
diff --git a/app/assets/javascripts/pages/projects/activity/index.js b/app/assets/javascripts/pages/projects/activity/index.js
index 03fbad0f1ec..3138026e1db 100644
--- a/app/assets/javascripts/pages/projects/activity/index.js
+++ b/app/assets/javascripts/pages/projects/activity/index.js
@@ -1,5 +1,6 @@
import Activities from '~/activities';
+import { addShortcutsExtension } from '~/behaviors/shortcuts';
import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
new Activities(); // eslint-disable-line no-new
-new ShortcutsNavigation(); // eslint-disable-line no-new
+addShortcutsExtension(ShortcutsNavigation);
diff --git a/app/assets/javascripts/pages/projects/artifacts/browse/index.js b/app/assets/javascripts/pages/projects/artifacts/browse/index.js
index 60680ec7d1d..47cf348eb4d 100644
--- a/app/assets/javascripts/pages/projects/artifacts/browse/index.js
+++ b/app/assets/javascripts/pages/projects/artifacts/browse/index.js
@@ -1,5 +1,6 @@
+import { addShortcutsExtension } from '~/behaviors/shortcuts';
import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
import BuildArtifacts from '~/build_artifacts';
-new ShortcutsNavigation(); // eslint-disable-line no-new
+addShortcutsExtension(ShortcutsNavigation);
new BuildArtifacts(); // eslint-disable-line no-new
diff --git a/app/assets/javascripts/pages/projects/artifacts/file/index.js b/app/assets/javascripts/pages/projects/artifacts/file/index.js
index 07ee4d686cc..3bc3b9dabbc 100644
--- a/app/assets/javascripts/pages/projects/artifacts/file/index.js
+++ b/app/assets/javascripts/pages/projects/artifacts/file/index.js
@@ -1,5 +1,6 @@
+import { addShortcutsExtension } from '~/behaviors/shortcuts';
import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
import { BlobViewer } from '~/blob/viewer/index';
-new ShortcutsNavigation(); // eslint-disable-line no-new
+addShortcutsExtension(ShortcutsNavigation);
new BlobViewer(); // eslint-disable-line no-new
diff --git a/app/assets/javascripts/pages/projects/boards/index.js b/app/assets/javascripts/pages/projects/boards/index.js
index 23f5b083589..a591fed3d9b 100644
--- a/app/assets/javascripts/pages/projects/boards/index.js
+++ b/app/assets/javascripts/pages/projects/boards/index.js
@@ -1,5 +1,6 @@
+import { addShortcutsExtension } from '~/behaviors/shortcuts';
import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
import initBoards from '~/boards';
-new ShortcutsNavigation(); // eslint-disable-line no-new
+addShortcutsExtension(ShortcutsNavigation);
initBoards();
diff --git a/app/assets/javascripts/pages/projects/commit/show/index.js b/app/assets/javascripts/pages/projects/commit/show/index.js
index c9f5895c7a3..d875f28433e 100644
--- a/app/assets/javascripts/pages/projects/commit/show/index.js
+++ b/app/assets/javascripts/pages/projects/commit/show/index.js
@@ -2,6 +2,7 @@
import $ from 'jquery';
import Vue from 'vue';
import loadAwardsHandler from '~/awards_handler';
+import { addShortcutsExtension } from '~/behaviors/shortcuts';
import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
import Diff from '~/diff';
import { createAlert } from '~/alert';
@@ -20,7 +21,7 @@ import { initReportAbuse } from '~/projects/report_abuse';
initDiffStatsDropdown();
new ZenMode();
-new ShortcutsNavigation();
+addShortcutsExtension(ShortcutsNavigation);
initCommitBoxInfo();
diff --git a/app/assets/javascripts/pages/projects/commits/show/index.js b/app/assets/javascripts/pages/projects/commits/show/index.js
index f5ecf9be591..e3b22bbfee0 100644
--- a/app/assets/javascripts/pages/projects/commits/show/index.js
+++ b/app/assets/javascripts/pages/projects/commits/show/index.js
@@ -1,10 +1,11 @@
+import { addShortcutsExtension } from '~/behaviors/shortcuts';
import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
import CommitsList from '~/commits';
import GpgBadges from '~/gpg_badges';
import { mountCommits, initCommitsRefSwitcher } from '~/projects/commits';
new CommitsList(document.querySelector('.js-project-commits-show').dataset.commitsLimit); // eslint-disable-line no-new
-new ShortcutsNavigation(); // eslint-disable-line no-new
+addShortcutsExtension(ShortcutsNavigation);
GpgBadges.fetch();
mountCommits(document.getElementById('js-author-dropdown'));
initCommitsRefSwitcher();
diff --git a/app/assets/javascripts/pages/projects/find_file/show/index.js b/app/assets/javascripts/pages/projects/find_file/show/index.js
index 22c21430e8b..4df84ac167c 100644
--- a/app/assets/javascripts/pages/projects/find_file/show/index.js
+++ b/app/assets/javascripts/pages/projects/find_file/show/index.js
@@ -1,4 +1,5 @@
import $ from 'jquery';
+import { addShortcutsExtension } from '~/behaviors/shortcuts';
import ShortcutsFindFile from '~/behaviors/shortcuts/shortcuts_find_file';
import ProjectFindFile from '~/projects/project_find_file';
import InitBlobRefSwitcher from '../ref_switcher';
@@ -11,4 +12,4 @@ const projectFindFile = new ProjectFindFile($('.file-finder-holder'), {
refType: findElement.dataset.refType,
});
projectFindFile.load(findElement.dataset.fileFindUrl);
-new ShortcutsFindFile(projectFindFile); // eslint-disable-line no-new
+addShortcutsExtension(ShortcutsFindFile, projectFindFile);
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 e3d50e900ca..bfa2f2cc14f 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
@@ -423,7 +423,7 @@ export default {
>
<div>
<gl-icon
- data-qa-selector="fork_privacy_button"
+ data-testid="fork-privacy-button"
:name="icon"
:data-qa-privacy-level="`${value}`"
/>
@@ -440,8 +440,7 @@ export default {
category="primary"
variant="confirm"
class="js-no-auto-disable"
- data-testid="submit-button"
- data-qa-selector="fork_project_button"
+ data-testid="fork-project-button"
:loading="isSaving"
>
{{ s__('ForkProject|Fork project') }}
diff --git a/app/assets/javascripts/pages/projects/forks/new/components/project_namespace.vue b/app/assets/javascripts/pages/projects/forks/new/components/project_namespace.vue
index 84796954cf1..b4bb2176e26 100644
--- a/app/assets/javascripts/pages/projects/forks/new/components/project_namespace.vue
+++ b/app/assets/javascripts/pages/projects/forks/new/components/project_namespace.vue
@@ -90,8 +90,7 @@ export default {
}}</gl-button>
<gl-collapsible-listbox
class="gl-flex-grow-1"
- data-qa-selector="select_namespace_dropdown"
- data-testid="select_namespace_dropdown"
+ data-testid="select-namespace-dropdown"
:items="namespaceItems"
:header-text="__('Namespaces')"
:no-results-text="__('No matches found')"
diff --git a/app/assets/javascripts/pages/projects/index.js b/app/assets/javascripts/pages/projects/index.js
index 1075241e172..dc00036864f 100644
--- a/app/assets/javascripts/pages/projects/index.js
+++ b/app/assets/javascripts/pages/projects/index.js
@@ -1,5 +1,6 @@
+import { addShortcutsExtension } from '~/behaviors/shortcuts';
import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
import Project from './project';
new Project(); // eslint-disable-line no-new
-new ShortcutsNavigation(); // eslint-disable-line no-new
+addShortcutsExtension(ShortcutsNavigation);
diff --git a/app/assets/javascripts/pages/projects/init_blob.js b/app/assets/javascripts/pages/projects/init_blob.js
index 244d1d5590e..6e3e1a35bd2 100644
--- a/app/assets/javascripts/pages/projects/init_blob.js
+++ b/app/assets/javascripts/pages/projects/init_blob.js
@@ -1,3 +1,4 @@
+import { addShortcutsExtension } from '~/behaviors/shortcuts';
import ShortcutsBlob from '~/behaviors/shortcuts/shortcuts_blob';
import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
import BlobForkSuggestion from '~/blob/blob_fork_suggestion';
@@ -18,10 +19,8 @@ export default () => {
const fileBlobPermalinkUrl =
fileBlobPermalinkUrlElement && fileBlobPermalinkUrlElement.getAttribute('href');
- new ShortcutsNavigation(); // eslint-disable-line no-new
-
- // eslint-disable-next-line no-new
- new ShortcutsBlob({
+ addShortcutsExtension(ShortcutsNavigation);
+ addShortcutsExtension(ShortcutsBlob, {
fileBlobPermalinkUrl,
fileBlobPermalinkUrlElement,
});
diff --git a/app/assets/javascripts/pages/projects/issues/index/index.js b/app/assets/javascripts/pages/projects/issues/index/index.js
index b320d8a61c2..322eaa845ec 100644
--- a/app/assets/javascripts/pages/projects/issues/index/index.js
+++ b/app/assets/javascripts/pages/projects/issues/index/index.js
@@ -1,6 +1,7 @@
+import { addShortcutsExtension } from '~/behaviors/shortcuts';
import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
import { mountIssuesListApp, mountJiraIssuesListApp } from '~/issues/list';
mountIssuesListApp();
mountJiraIssuesListApp();
-new ShortcutsNavigation(); // eslint-disable-line no-new
+addShortcutsExtension(ShortcutsNavigation);
diff --git a/app/assets/javascripts/pages/projects/merge_requests/index/index.js b/app/assets/javascripts/pages/projects/merge_requests/index/index.js
index 3ae8018714a..a37c18e41ab 100644
--- a/app/assets/javascripts/pages/projects/merge_requests/index/index.js
+++ b/app/assets/javascripts/pages/projects/merge_requests/index/index.js
@@ -1,4 +1,5 @@
import addExtraTokensForMergeRequests from 'ee_else_ce/filtered_search/add_extra_tokens_for_merge_requests';
+import { addShortcutsExtension } from '~/behaviors/shortcuts';
import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered_search_token_keys';
import { FILTERED_SEARCH } from '~/filtered_search/constants';
@@ -16,7 +17,7 @@ initFilteredSearch({
useDefaultState: true,
});
-new ShortcutsNavigation(); // eslint-disable-line no-new
+addShortcutsExtension(ShortcutsNavigation);
initIssuableByEmail();
initCsvImportExportButtons();
diff --git a/app/assets/javascripts/pages/projects/merge_requests/init_merge_request.js b/app/assets/javascripts/pages/projects/merge_requests/init_merge_request.js
index 599fd225de9..0e66c3521dd 100644
--- a/app/assets/javascripts/pages/projects/merge_requests/init_merge_request.js
+++ b/app/assets/javascripts/pages/projects/merge_requests/init_merge_request.js
@@ -3,12 +3,13 @@
import $ from 'jquery';
import IssuableForm from 'ee_else_ce/issuable/issuable_form';
import IssuableLabelSelector from '~/issuable/issuable_label_selector';
+import { addShortcutsExtension } from '~/behaviors/shortcuts';
import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
import LabelsSelect from '~/labels/labels_select';
import { mountMilestoneDropdown } from '~/sidebar/mount_sidebar';
export default () => {
- new ShortcutsNavigation();
+ addShortcutsExtension(ShortcutsNavigation);
new IssuableForm($('.merge-request-form'));
IssuableLabelSelector();
new LabelsSelect();
diff --git a/app/assets/javascripts/pages/projects/merge_requests/init_merge_request_show.js b/app/assets/javascripts/pages/projects/merge_requests/init_merge_request_show.js
index af1635221ab..1cac330520f 100644
--- a/app/assets/javascripts/pages/projects/merge_requests/init_merge_request_show.js
+++ b/app/assets/javascripts/pages/projects/merge_requests/init_merge_request_show.js
@@ -1,6 +1,7 @@
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import { s__ } from '~/locale';
+import { addShortcutsExtension } from '~/behaviors/shortcuts';
import ShortcutsIssuable from '~/behaviors/shortcuts/shortcuts_issuable';
import { initPipelineCountListener } from '~/commit/pipelines/utils';
import { initIssuableSidebar } from '~/issuable';
@@ -18,7 +19,7 @@ import getStateQuery from './queries/get_state.query.graphql';
export default function initMergeRequestShow(store) {
new ZenMode(); // eslint-disable-line no-new
initPipelineCountListener(document.querySelector('#commit-pipeline-table-view'));
- new ShortcutsIssuable(true); // eslint-disable-line no-new
+ addShortcutsExtension(ShortcutsIssuable);
initSourcegraph();
initIssuableSidebar();
initAwardsApp(document.getElementById('js-vue-awards-block'));
diff --git a/app/assets/javascripts/pages/projects/ml/model_versions/show/index.js b/app/assets/javascripts/pages/projects/ml/model_versions/show/index.js
index 1a2b85d7e16..7202dcccd31 100644
--- a/app/assets/javascripts/pages/projects/ml/model_versions/show/index.js
+++ b/app/assets/javascripts/pages/projects/ml/model_versions/show/index.js
@@ -1,4 +1,4 @@
import { initSimpleApp } from '~/helpers/init_simple_app_helper';
import { ShowMlModelVersion } from '~/ml/model_registry/apps';
-initSimpleApp('#js-mount-show-ml-model-version', ShowMlModelVersion);
+initSimpleApp('#js-mount-show-ml-model-version', ShowMlModelVersion, { withApolloProvider: true });
diff --git a/app/assets/javascripts/pages/projects/network/show/index.js b/app/assets/javascripts/pages/projects/network/show/index.js
index a669ea5baaf..58b703bdfda 100644
--- a/app/assets/javascripts/pages/projects/network/show/index.js
+++ b/app/assets/javascripts/pages/projects/network/show/index.js
@@ -1,6 +1,7 @@
import $ from 'jquery';
import Vue from 'vue';
import { visitUrl, joinPaths } from '~/lib/utils/url_utility';
+import { addShortcutsExtension } from '~/behaviors/shortcuts';
import ShortcutsNetwork from '~/behaviors/shortcuts/shortcuts_network';
import RefSelector from '~/ref/components/ref_selector.vue';
import Network from '../network';
@@ -44,6 +45,5 @@ initRefSwitcher();
commit_id: $('.network-graph').attr('data-commit-id'),
});
- // eslint-disable-next-line no-new
- new ShortcutsNetwork(networkGraph.branch_graph);
+ addShortcutsExtension(ShortcutsNetwork, networkGraph.branch_graph);
})();
diff --git a/app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/interval_pattern_input.vue b/app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/interval_pattern_input.vue
index 9c4582ece21..ff2ece99f87 100644
--- a/app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/interval_pattern_input.vue
+++ b/app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/interval_pattern_input.vue
@@ -2,7 +2,6 @@
import { GlFormRadio, GlFormRadioGroup, GlIcon, GlLink, GlTooltipDirective } from '@gitlab/ui';
import { getWeekdayNames } from '~/lib/utils/datetime_utility';
import { __, s__, sprintf } from '~/locale';
-import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { DOCS_URL_IN_EE_DIR } from 'jh_else_ce/lib/utils/url_utility';
const KEY_EVERY_DAY = 'everyDay';
@@ -10,6 +9,12 @@ const KEY_EVERY_WEEK = 'everyWeek';
const KEY_EVERY_MONTH = 'everyMonth';
const KEY_CUSTOM = 'custom';
+const MINUTE = 60; // minute between 0-59
+const HOUR = 24; // hour between 0-23
+const WEEKDAY_INDEX = 7; // week index Sun-Sat
+const DAY = 29; // day between 0-28
+const getRandomCronValue = (max) => Math.floor(Math.random() * max);
+
export default {
components: {
GlFormRadio,
@@ -20,7 +25,6 @@ export default {
directives: {
GlTooltip: GlTooltipDirective,
},
- mixins: [glFeatureFlagMixin()],
props: {
initialCronInterval: {
type: String,
@@ -41,9 +45,10 @@ export default {
data() {
return {
isEditingCustom: false,
- randomHour: this.generateRandomHour(),
- randomWeekDayIndex: this.generateRandomWeekDayIndex(),
- randomDay: this.generateRandomDay(),
+ randomMinute: getRandomCronValue(MINUTE),
+ randomHour: getRandomCronValue(HOUR),
+ randomWeekDayIndex: getRandomCronValue(WEEKDAY_INDEX),
+ randomDay: getRandomCronValue(DAY),
inputNameAttribute: 'schedule[cron]',
radioValue: this.initialCronInterval ? KEY_CUSTOM : KEY_EVERY_DAY,
cronInterval: this.initialCronInterval,
@@ -53,19 +58,22 @@ export default {
computed: {
cronIntervalPresets() {
return {
- [KEY_EVERY_DAY]: `0 ${this.randomHour} * * *`,
- [KEY_EVERY_WEEK]: `0 ${this.randomHour} * * ${this.randomWeekDayIndex}`,
- [KEY_EVERY_MONTH]: `0 ${this.randomHour} ${this.randomDay} * *`,
+ [KEY_EVERY_DAY]: `${this.randomMinute} ${this.randomHour} * * *`,
+ [KEY_EVERY_WEEK]: `${this.randomMinute} ${this.randomHour} * * ${this.randomWeekDayIndex}`,
+ [KEY_EVERY_MONTH]: `${this.randomMinute} ${this.randomHour} ${this.randomDay} * *`,
};
},
+ formattedMinutes() {
+ return String(this.randomMinute).padStart(2, '0');
+ },
formattedTime() {
if (this.randomHour > 12) {
- return `${this.randomHour - 12}:00pm`;
+ return `${this.randomHour - 12}:${this.formattedMinutes}pm`;
}
if (this.randomHour === 12) {
- return `12:00pm`;
+ return `12:${this.formattedMinutes}pm`;
}
- return `${this.randomHour}:00am`;
+ return `${this.randomHour}:${this.formattedMinutes}am`;
},
radioOptions() {
return [
@@ -133,15 +141,6 @@ export default {
onCustomInput() {
this.radioValue = KEY_CUSTOM;
},
- generateRandomHour() {
- return Math.floor(Math.random() * 23);
- },
- generateRandomWeekDayIndex() {
- return Math.floor(Math.random() * 6);
- },
- generateRandomDay() {
- return Math.floor(Math.random() * 28);
- },
showDailyLimitMessage({ value }) {
return value === KEY_CUSTOM && this.dailyLimit;
},
diff --git a/app/assets/javascripts/pages/projects/shared/permissions/components/ci_catalog_settings.vue b/app/assets/javascripts/pages/projects/shared/permissions/components/ci_catalog_settings.vue
index ed5ba3c2653..32775ac553c 100644
--- a/app/assets/javascripts/pages/projects/shared/permissions/components/ci_catalog_settings.vue
+++ b/app/assets/javascripts/pages/projects/shared/permissions/components/ci_catalog_settings.vue
@@ -1,50 +1,58 @@
<script>
-import { GlBadge, GlLink, GlLoadingIcon, GlModal, GlSprintf, GlToggle } from '@gitlab/ui';
-import { createAlert, VARIANT_INFO } from '~/alert';
+import { GlLink, GlLoadingIcon, GlModal, GlSprintf, GlToggle } from '@gitlab/ui';
+import { createAlert } from '~/alert';
import { __, s__ } from '~/locale';
import { helpPagePath } from '~/helpers/help_page_helper';
+import BetaBadge from '~/vue_shared/components/badges/beta_badge.vue';
import getCiCatalogSettingsQuery from '../graphql/queries/get_ci_catalog_settings.query.graphql';
import catalogResourcesCreate from '../graphql/mutations/catalog_resources_create.mutation.graphql';
+import catalogResourcesDestroy from '../graphql/mutations/catalog_resources_destroy.mutation.graphql';
-export const i18n = {
- badgeText: __('Experiment'),
+const i18n = {
catalogResourceQueryError: s__(
'CiCatalog|There was a problem fetching the CI/CD Catalog setting.',
),
- catalogResourceMutationError: s__(
- 'CiCatalog|There was a problem marking the project as a CI/CD Catalog resource.',
+ setCatalogResourceMutationError: s__(
+ 'CiCatalog|Unable to set project as a CI/CD Catalog resource.',
+ ),
+ removeCatalogResourceMutationError: s__(
+ 'CiCatalog|Unable to remove project as a CI/CD Catalog resource.',
+ ),
+ setCatalogResourceMutationSuccess: s__('CiCatalog|This project is now a CI/CD Catalog resource.'),
+ removeCatalogResourceMutationSuccess: s__(
+ 'CiCatalog|This project is no longer a CI/CD Catalog resource.',
),
- catalogResourceMutationSuccess: s__('CiCatalog|This project is now a CI/CD Catalog resource.'),
ciCatalogLabel: s__('CiCatalog|CI/CD Catalog resource'),
ciCatalogHelpText: s__(
- 'CiCatalog|Mark project as a CI/CD Catalog resource. %{linkStart}What is the CI/CD Catalog?%{linkEnd}',
+ 'CiCatalog|Set project as a CI/CD Catalog resource. %{linkStart}What is the CI/CD Catalog?%{linkEnd}',
),
modal: {
actionPrimary: {
- text: s__('CiCatalog|Mark project as a CI/CD Catalog resource'),
+ text: s__('CiCatalog|Remove from the CI/CD catalog'),
},
actionCancel: {
text: __('Cancel'),
},
body: s__(
- 'CiCatalog|This project will be marked as a CI/CD Catalog resource and will be visible in the CI/CD Catalog. This action is not reversible.',
+ "CiCatalog|The project and any released versions will be removed from the CI/CD Catalog. If you re-enable this toggle, the project's existing releases are not re-added to the catalog. You must %{linkStart}create a new release%{linkEnd}.",
),
- title: s__('CiCatalog|Mark project as a CI/CD Catalog resource'),
+ title: s__('CiCatalog|Remove project from the CI/CD Catalog?'),
},
readMeHelpText: s__(
- 'CiCatalog|The project must contain a README.md file and a template.yml file. When enabled, the repository is available in the CI/CD Catalog.',
+ 'CiCatalog|The project will be findable in the CI/CD Catalog after the project has at least one release.',
),
};
-export const ciCatalogHelpPath = helpPagePath('ci/components/index', {
+const ciCatalogHelpPath = helpPagePath('ci/components/index', {
anchor: 'components-catalog',
});
+const releasesHelpPath = helpPagePath('user/project/releases/release_cicd_examples');
+
export default {
- i18n,
components: {
- GlBadge,
+ BetaBadge,
GlLink,
GlLoadingIcon,
GlModal,
@@ -59,7 +67,6 @@ export default {
},
data() {
return {
- ciCatalogHelpPath,
isCatalogResource: false,
showCatalogResourceModal: false,
};
@@ -81,19 +88,34 @@ export default {
},
},
computed: {
+ successMessage() {
+ return this.isCatalogResource
+ ? this.$options.i18n.setCatalogResourceMutationSuccess
+ : this.$options.i18n.removeCatalogResourceMutationSuccess;
+ },
+ errorMessage() {
+ return this.isCatalogResource
+ ? this.$options.i18n.removeCatalogResourceMutationError
+ : this.$options.i18n.setCatalogResourceMutationError;
+ },
isLoading() {
return this.$apollo.queries.isCatalogResource.loading;
},
},
methods: {
- async markProjectAsCatalogResource() {
+ async toggleCatalogResourceMutation({ isCreating }) {
+ this.showCatalogResourceModal = false;
+
+ const mutation = isCreating ? catalogResourcesCreate : catalogResourcesDestroy;
+ const mutationInput = isCreating ? 'catalogResourcesCreate' : 'catalogResourcesDestroy';
+
try {
const {
data: {
- catalogResourcesCreate: { errors },
+ [mutationInput]: { errors },
},
} = await this.$apollo.mutate({
- mutation: catalogResourcesCreate,
+ mutation,
variables: { input: { projectPath: this.fullPath } },
});
@@ -101,23 +123,30 @@ export default {
throw new Error(errors[0]);
}
- this.isCatalogResource = true;
- createAlert({
- message: this.$options.i18n.catalogResourceMutationSuccess,
- variant: VARIANT_INFO,
- });
+ this.isCatalogResource = !this.isCatalogResource;
+ this.$toast.show(this.successMessage);
} catch (error) {
- const message = error.message || this.$options.i18n.catalogResourceMutationError;
+ const message = error.message || this.errorMessage;
createAlert({ message });
}
},
- onCatalogResourceEnabledToggled() {
- this.showCatalogResourceModal = true;
- },
onModalCanceled() {
this.showCatalogResourceModal = false;
},
+ onToggleCatalogResource() {
+ if (this.isCatalogResource) {
+ this.showCatalogResourceModal = true;
+ } else {
+ this.toggleCatalogResourceMutation({ isCreating: true });
+ }
+ },
+ unlistCatalogResource() {
+ this.toggleCatalogResourceMutation({ isCreating: false });
+ },
},
+ i18n,
+ ciCatalogHelpPath,
+ releasesHelpPath,
};
</script>
@@ -125,40 +154,44 @@ export default {
<div>
<gl-loading-icon v-if="isLoading" />
<div v-else data-testid="ci-catalog-settings">
- <div>
- <label class="gl-mb-1 gl-mr-2">
+ <div class="gl-display-flex">
+ <label class="gl-mb-1 gl-mr-3">
{{ $options.i18n.ciCatalogLabel }}
</label>
- <gl-badge size="sm" variant="info"> {{ $options.i18n.badgeText }} </gl-badge>
+ <beta-badge size="sm" />
</div>
<gl-sprintf :message="$options.i18n.ciCatalogHelpText">
<template #link="{ content }">
- <gl-link :href="ciCatalogHelpPath" target="_blank">{{ content }}</gl-link>
+ <gl-link :href="$options.ciCatalogHelpPath" target="_blank">{{ content }}</gl-link>
</template>
</gl-sprintf>
<gl-toggle
class="gl-my-2"
- :disabled="isCatalogResource"
:value="isCatalogResource"
:label="$options.i18n.ciCatalogLabel"
label-position="hidden"
name="ci_resource_enabled"
- @change="onCatalogResourceEnabledToggled"
+ data-testid="catalog-resource-toggle"
+ @change="onToggleCatalogResource"
/>
<div class="gl-text-secondary">
{{ $options.i18n.readMeHelpText }}
</div>
<gl-modal
:visible="showCatalogResourceModal"
- modal-id="mark-as-catalog-resource"
+ modal-id="unlist-catalog-resource"
size="sm"
:title="$options.i18n.modal.title"
:action-cancel="$options.i18n.modal.actionCancel"
:action-primary="$options.i18n.modal.actionPrimary"
@canceled="onModalCanceled"
- @primary="markProjectAsCatalogResource"
+ @primary="unlistCatalogResource"
>
- {{ $options.i18n.modal.body }}
+ <gl-sprintf :message="$options.i18n.modal.body">
+ <template #link="{ content }">
+ <gl-link :href="$options.releasesHelpPath" target="_blank">{{ content }}</gl-link>
+ </template>
+ </gl-sprintf>
</gl-modal>
</div>
</div>
diff --git a/app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue b/app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue
index 6ff48b7de95..a7f685ea8a8 100644
--- a/app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue
+++ b/app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue
@@ -16,6 +16,7 @@ import {
CVE_ID_REQUEST_BUTTON_I18N,
featureAccessLevelDescriptions,
modelExperimentsHelpPath,
+ modelRegistryHelpPath,
} from '../constants';
import { toggleHiddenClassBySelector } from '../external';
import ProjectFeatureSetting from './project_feature_setting.vue';
@@ -63,6 +64,8 @@ export default {
modelExperimentsHelpText: s__(
'ProjectSettings|Track machine learning model experiments and artifacts.',
),
+ modelRegistryLabel: s__('ProjectSettings|Model registry'),
+ modelRegistryHelpText: s__('ProjectSettings|Manage machine learning models.'),
pagesLabel: s__('ProjectSettings|Pages'),
repositoryLabel: s__('ProjectSettings|Repository'),
requirementsLabel: s__('ProjectSettings|Requirements'),
@@ -83,7 +86,7 @@ export default {
VISIBILITY_LEVEL_INTERNAL_INTEGER,
VISIBILITY_LEVEL_PUBLIC_INTEGER,
modelExperimentsHelpPath,
-
+ modelRegistryHelpPath,
components: {
CiCatalogSettings,
ProjectFeatureSetting,
@@ -259,6 +262,7 @@ export default {
mergeRequestsAccessLevel: featureAccessLevel.EVERYONE,
packageRegistryAccessLevel: featureAccessLevel.EVERYONE,
modelExperimentsAccessLevel: featureAccessLevel.EVERYONE,
+ modelRegistryAccessLevel: featureAccessLevel.EVERYONE,
buildsAccessLevel: featureAccessLevel.EVERYONE,
wikiAccessLevel: featureAccessLevel.EVERYONE,
snippetsAccessLevel: featureAccessLevel.EVERYONE,
@@ -411,6 +415,10 @@ export default {
featureAccessLevel.PROJECT_MEMBERS,
this.modelExperimentsAccessLevel,
);
+ this.modelRegistryAccessLevel = Math.min(
+ featureAccessLevel.PROJECT_MEMBERS,
+ this.modelRegistryAccessLevel,
+ );
this.wikiAccessLevel = Math.min(featureAccessLevel.PROJECT_MEMBERS, this.wikiAccessLevel);
this.snippetsAccessLevel = Math.min(
featureAccessLevel.PROJECT_MEMBERS,
@@ -475,6 +483,8 @@ export default {
this.wikiAccessLevel = featureAccessLevel.EVERYONE;
if (this.modelExperimentsAccessLevel > featureAccessLevel.NOT_ENABLED)
this.modelExperimentsAccessLevel = featureAccessLevel.EVERYONE;
+ if (this.modelRegistryAccessLevel > featureAccessLevel.NOT_ENABLED)
+ this.modelRegistryAccessLevel = featureAccessLevel.EVERYONE;
if (this.snippetsAccessLevel > featureAccessLevel.NOT_ENABLED)
this.snippetsAccessLevel = featureAccessLevel.EVERYONE;
if (this.pagesAccessLevel === featureAccessLevel.PROJECT_MEMBERS)
@@ -571,7 +581,7 @@ export default {
:disabled="!canChangeVisibilityLevel"
name="project[visibility_level]"
class="form-control select-control"
- data-qa-selector="project_visibility_dropdown"
+ data-testid="project-visibility-dropdown"
>
<option
:value="$options.VISIBILITY_LEVEL_PRIVATE_INTEGER"
@@ -914,6 +924,19 @@ export default {
/>
</project-setting-row>
<project-setting-row
+ ref="model-registry-settings"
+ :label="$options.i18n.modelRegistryLabel"
+ :help-text="$options.i18n.modelRegistryHelpText"
+ :help-path="$options.modelRegistryHelpPath"
+ >
+ <project-feature-setting
+ v-model="modelRegistryAccessLevel"
+ :label="$options.i18n.modelRegistryLabel"
+ :options="featureAccessLevelOptions"
+ name="project[project_feature_attributes][model_registry_access_level]"
+ />
+ </project-setting-row>
+ <project-setting-row
v-if="pagesAvailable && pagesAccessControlEnabled"
ref="pages-settings"
:help-path="pagesHelpPath"
@@ -1060,13 +1083,7 @@ export default {
data-testid="project-features-save-button"
@confirm="$emit('confirm')"
/>
- <gl-button
- v-else
- type="submit"
- variant="confirm"
- data-testid="project-features-save-button"
- data-qa-selector="visibility_features_permissions_save_button"
- >
+ <gl-button v-else type="submit" variant="confirm" data-testid="project-features-save-button">
{{ $options.i18n.confirmButtonText }}
</gl-button>
</div>
diff --git a/app/assets/javascripts/pages/projects/shared/permissions/constants.js b/app/assets/javascripts/pages/projects/shared/permissions/constants.js
index 522cc7cfc1a..125fc279240 100644
--- a/app/assets/javascripts/pages/projects/shared/permissions/constants.js
+++ b/app/assets/javascripts/pages/projects/shared/permissions/constants.js
@@ -48,3 +48,5 @@ export const CVE_ID_REQUEST_BUTTON_I18N = {
export const modelExperimentsHelpPath = helpPagePath(
'user/project/ml/experiment_tracking/index.md',
);
+
+export const modelRegistryHelpPath = helpPagePath('user/project/ml/model_registry/index.md');
diff --git a/app/assets/javascripts/pages/projects/shared/permissions/graphql/mutations/catalog_resources_destroy.mutation.graphql b/app/assets/javascripts/pages/projects/shared/permissions/graphql/mutations/catalog_resources_destroy.mutation.graphql
new file mode 100644
index 00000000000..fa42b081a5f
--- /dev/null
+++ b/app/assets/javascripts/pages/projects/shared/permissions/graphql/mutations/catalog_resources_destroy.mutation.graphql
@@ -0,0 +1,5 @@
+mutation catalogResourcesDestroy($input: CatalogResourcesDestroyInput!) {
+ catalogResourcesDestroy(input: $input) {
+ errors
+ }
+}
diff --git a/app/assets/javascripts/pages/projects/shared/web_ide_link/index.js b/app/assets/javascripts/pages/projects/shared/web_ide_link/index.js
index 8ceea37b701..e4a4e2c00eb 100644
--- a/app/assets/javascripts/pages/projects/shared/web_ide_link/index.js
+++ b/app/assets/javascripts/pages/projects/shared/web_ide_link/index.js
@@ -18,7 +18,7 @@ export default ({ el, router }) => {
const { projectPath, ref, isBlob, webIdeUrl, ...options } = convertObjectPropsToCamelCase(
JSON.parse(el.dataset.options),
);
- const { webIdePromoPopoverImg } = el.dataset;
+ const { webIdePromoPopoverImg, cssClasses } = el.dataset;
// eslint-disable-next-line no-new
new Vue({
@@ -40,6 +40,7 @@ export default ({ el, router }) => {
joinPaths('/', projectPath, 'edit', ref, '-', this.$route?.params.path || '', '/'),
),
projectPath,
+ cssClasses,
...options,
},
});
diff --git a/app/assets/javascripts/pages/projects/show/index.js b/app/assets/javascripts/pages/projects/show/index.js
index 98c58515d24..150c702f1fe 100644
--- a/app/assets/javascripts/pages/projects/show/index.js
+++ b/app/assets/javascripts/pages/projects/show/index.js
@@ -1,3 +1,4 @@
+import { addShortcutsExtension } from '~/behaviors/shortcuts';
import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
import initClustersDeprecationAlert from '~/projects/clusters_deprecation_alert';
import leaveByUrl from '~/namespaces/leave_by_url';
@@ -8,6 +9,7 @@ import { initUploadFileTrigger } from '~/projects/upload_file';
import initReadMore from '~/read_more';
import initForksButton from '~/forks/init_forks_button';
import initAmbiguousRefModal from '~/ref/init_ambiguous_ref_modal';
+import InitMoreActionsDropdown from '~/groups_projects/init_more_actions_dropdown';
// Project show page loads different overview content based on user preferences
if (document.getElementById('js-tree-list')) {
@@ -34,11 +36,9 @@ if (document.querySelector('.project-show-activity')) {
.catch(() => {});
}
-leaveByUrl('project');
-
initVueNotificationsDropdown();
-new ShortcutsNavigation(); // eslint-disable-line no-new
+addShortcutsExtension(ShortcutsNavigation);
initUploadFileTrigger();
initClustersDeprecationAlert();
@@ -61,3 +61,5 @@ if (document.querySelector('.js-autodevops-banner')) {
}
initForksButton();
+InitMoreActionsDropdown();
+leaveByUrl('project');
diff --git a/app/assets/javascripts/pages/projects/tree/show/index.js b/app/assets/javascripts/pages/projects/tree/show/index.js
index d87f8898c63..edecb798686 100644
--- a/app/assets/javascripts/pages/projects/tree/show/index.js
+++ b/app/assets/javascripts/pages/projects/tree/show/index.js
@@ -1,5 +1,6 @@
import $ from 'jquery';
import initTree from 'ee_else_ce/repository';
+import { addShortcutsExtension } from '~/behaviors/shortcuts';
import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
import NewCommitForm from '~/new_commit_form';
import initAmbiguousRefModal from '~/ref/init_ambiguous_ref_modal';
@@ -7,4 +8,4 @@ import initAmbiguousRefModal from '~/ref/init_ambiguous_ref_modal';
new NewCommitForm($('.js-create-dir-form')); // eslint-disable-line no-new
initTree();
initAmbiguousRefModal();
-new ShortcutsNavigation(); // eslint-disable-line no-new
+addShortcutsExtension(ShortcutsNavigation);