diff --git a/app/assets/javascripts/gfm_auto_complete.js b/app/assets/javascripts/gfm_auto_complete.js index 566b8c09ca1410415ad90369e48c125a2e18b516..ae8979e0968f5079ad8e6ebe28802ee704c7cad8 100644 --- a/app/assets/javascripts/gfm_auto_complete.js +++ b/app/assets/javascripts/gfm_auto_complete.js @@ -977,9 +977,7 @@ class GfmAutoComplete { } else if (dataSource) { AjaxCache.retrieve(dataSource, true) .then((data) => { - if (data.some((c) => c.name === 'submit_review')) { - this.setSubmitReviewStates($input); - } + this.loadSubcommands($input, data); this.loadData($input, at, data); }) .catch(() => { @@ -990,6 +988,12 @@ class GfmAutoComplete { } } + loadSubcommands($input, data) { + if (data.some((c) => c.name === 'submit_review')) { + this.setSubmitReviewStates($input); + } + } + // eslint-disable-next-line max-params loadData($input, at, data, { search } = {}) { this.isLoadingData[at] = false; 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 8b4e12b4339fa2cd253d92be4165deafa98a7ebf..e1d25219677541643f69fc6476895ee666732964 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 @@ -21,6 +21,7 @@ import { modelExperimentsHelpPath, modelRegistryHelpPath, duoHelpPath, + amazonQHelpPath, pipelineExecutionPoliciesHelpPath, } from '../constants'; import { toggleHiddenClassBySelector } from '../external'; @@ -78,8 +79,6 @@ export default { releasesHelpText: s__( 'ProjectSettings|Combine git tags with release notes, release evidence, and assets to create a release.', ), - duoLabel: s__('ProjectSettings|GitLab Duo'), - duoHelpText: s__('ProjectSettings|Use AI-powered features in this project.'), securityAndComplianceLabel: s__('ProjectSettings|Security and compliance'), snippetsLabel: s__('ProjectSettings|Snippets'), wikiLabel: s__('ProjectSettings|Wiki'), @@ -106,7 +105,6 @@ export default { VISIBILITY_LEVEL_PUBLIC_INTEGER, modelExperimentsHelpPath, modelRegistryHelpPath, - duoHelpPath, pipelineExecutionPoliciesHelpPath, components: { CiCatalogSettings, @@ -197,6 +195,11 @@ export default { required: false, default: false, }, + amazonQAvailable: { + type: Boolean, + required: false, + default: false, + }, duoFeaturesLocked: { type: Boolean, required: false, @@ -452,6 +455,25 @@ export default { Object.keys(this.cascadingSettingsData).length ); }, + duoEnabledSetting() { + // TODO(Q): What if both Amazon Q and Duo are available?? + if (this.amazonQAvailable) { + return { + label: s__('ProjectSettings|Amazon Q'), + helpText: s__('ProjectSettings|This project can use Amazon Q.'), + helpPath: amazonQHelpPath, + }; + } + if (this.licensedAiFeaturesAvailable) { + return { + label: s__('ProjectSettings|GitLab Duo'), + helpText: s__('ProjectSettings|Use AI-powered features in this project.'), + helpPath: duoHelpPath, + }; + } + + return null; + }, }, watch: { visibilityLevel(value, oldValue) { @@ -1072,11 +1094,11 @@ export default { />