diff --git a/app/assets/javascripts/ide/init_gitlab_web_ide.js b/app/assets/javascripts/ide/init_gitlab_web_ide.js index 4581b508fe8b6f462e86a39916dc940a20dabc39..beb79d027c4cee8f42cf4c08f07344618846f36e 100644 --- a/app/assets/javascripts/ide/init_gitlab_web_ide.js +++ b/app/assets/javascripts/ide/init_gitlab_web_ide.js @@ -46,6 +46,7 @@ export const initGitlabWebIDE = async (el) => { forkInfo: forkInfoJSON, editorFont: editorFontJSON, codeSuggestionsEnabled, + extensionsGallerySettings: extensionsGallerySettingsJSON, } = el.dataset; const rootEl = setupRootElement(el); @@ -53,6 +54,9 @@ export const initGitlabWebIDE = async (el) => { ? convertObjectPropsToCamelCase(JSON.parse(editorFontJSON), { deep: true }) : null; const forkInfo = forkInfoJSON ? JSON.parse(forkInfoJSON) : null; + const extensionsGallerySettings = extensionsGallerySettingsJSON + ? convertObjectPropsToCamelCase(JSON.parse(extensionsGallerySettingsJSON), { deep: true }) + : undefined; const oauthConfig = getOAuthConfig(el.dataset); const httpHeaders = oauthConfig @@ -85,6 +89,7 @@ export const initGitlabWebIDE = async (el) => { settingsSync: true, }, editorFont, + extensionsGallerySettings, codeSuggestionsEnabled, handleTracking, // See https://gitlab.com/gitlab-org/gitlab-web-ide/-/blob/main/packages/web-ide-types/src/config.ts#L86 diff --git a/app/assets/javascripts/profile/preferences/components/extensions_marketplace_warning.vue b/app/assets/javascripts/profile/preferences/components/extensions_marketplace_warning.vue new file mode 100644 index 0000000000000000000000000000000000000000..1dd7bc8352da549836eed1aa063990acefc580a6 --- /dev/null +++ b/app/assets/javascripts/profile/preferences/components/extensions_marketplace_warning.vue @@ -0,0 +1,130 @@ + + + diff --git a/app/assets/javascripts/profile/preferences/components/integration_view.vue b/app/assets/javascripts/profile/preferences/components/integration_view.vue index 9924f248b891ab892e51d009e28c544bdc3622d3..06f8459e637cc36d315ef160cc4e6604f956c278 100644 --- a/app/assets/javascripts/profile/preferences/components/integration_view.vue +++ b/app/assets/javascripts/profile/preferences/components/integration_view.vue @@ -2,6 +2,8 @@ import { GlIcon, GlLink, GlFormGroup, GlFormCheckbox } from '@gitlab/ui'; import IntegrationHelpText from '~/vue_shared/components/integrations_help_text.vue'; +const toCheckboxValue = (bool) => (bool ? '1' : false); + export default { name: 'IntegrationView', components: { @@ -11,7 +13,6 @@ export default { GlFormCheckbox, IntegrationHelpText, }, - inject: ['userFields'], props: { helpLink: { type: String, @@ -29,10 +30,14 @@ export default { type: Object, required: true, }, + value: { + type: Boolean, + required: true, + }, }, data() { return { - isEnabled: this.userFields[this.config.formName] ? '1' : '0', + checkboxValue: toCheckboxValue(this.value), }; }, computed: { @@ -43,6 +48,17 @@ export default { return `user_${this.config.formName}`; }, }, + watch: { + value(val) { + this.checkboxValue = toCheckboxValue(val); + }, + checkboxValue(val) { + // note: When checked we get '1' since we set `value` prop. Unchecked is `false` as expected. + // This value="1" needs to be set to properly handle the Rails form. + // https://bootstrap-vue.org/docs/components/form-checkbox#comp-ref-b-form-checkbox-props + this.$emit('input', Boolean(val)); + }, + }, }; @@ -61,7 +77,7 @@ export default { value="0" data-testid="profile-preferences-integration-hidden-field" /> - {{ config.label }}