diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /app/assets/javascripts/ide | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'app/assets/javascripts/ide')
16 files changed, 153 insertions, 114 deletions
diff --git a/app/assets/javascripts/ide/components/commit_sidebar/editor_header.vue b/app/assets/javascripts/ide/components/commit_sidebar/editor_header.vue index 75f02af28c4..7112c43bab8 100644 --- a/app/assets/javascripts/ide/components/commit_sidebar/editor_header.vue +++ b/app/assets/javascripts/ide/components/commit_sidebar/editor_header.vue @@ -18,6 +18,20 @@ export default { required: true, }, }, + modal: { + actionPrimary: { + text: __('Discard changes'), + attributes: { + variant: 'danger', + }, + }, + actionCancel: { + text: __('Cancel'), + attributes: { + variant: 'default', + }, + }, + }, computed: { discardModalId() { return `discard-file-${this.activeFile.path}`; @@ -43,9 +57,9 @@ export default { </script> <template> - <div class="d-flex ide-commit-editor-header align-items-center"> - <file-icon :file-name="activeFile.name" :size="16" class="mr-2" /> - <strong class="mr-2"> + <div class="gl-display-flex ide-commit-editor-header gl-align-items-center"> + <file-icon :file-name="activeFile.name" :size="16" class="gl-mr-3" /> + <strong class="gl-mr-3"> <template v-if="activeFile.prevPath && activeFile.prevPath !== activeFile.path"> {{ activeFile.prevPath }} → </template> @@ -66,12 +80,11 @@ export default { </div> <gl-modal ref="discardModal" - ok-variant="danger" - cancel-variant="light" - :ok-title="__('Discard changes')" :modal-id="discardModalId" :title="discardModalTitle" - @ok="discardChanges(activeFile.path)" + :action-primary="$options.modal.actionPrimary" + :action-cancel="$options.modal.actionCancel" + @primary="discardChanges(activeFile.path)" > {{ __("You will lose all changes you've made to this file. This action cannot be undone.") }} </gl-modal> diff --git a/app/assets/javascripts/ide/components/commit_sidebar/form.vue b/app/assets/javascripts/ide/components/commit_sidebar/form.vue index cb906374fe1..05a254d3fbf 100644 --- a/app/assets/javascripts/ide/components/commit_sidebar/form.vue +++ b/app/assets/javascripts/ide/components/commit_sidebar/form.vue @@ -154,7 +154,7 @@ export default { <gl-button :disabled="commitButtonDisabled" category="primary" - variant="info" + variant="confirm" block class="qa-begin-commit-button" data-testid="begin-commit-button" diff --git a/app/assets/javascripts/ide/components/commit_sidebar/list.vue b/app/assets/javascripts/ide/components/commit_sidebar/list.vue index 829686ef051..91d78a7c28c 100644 --- a/app/assets/javascripts/ide/components/commit_sidebar/list.vue +++ b/app/assets/javascripts/ide/components/commit_sidebar/list.vue @@ -38,6 +38,20 @@ export default { default: __('No changes'), }, }, + modal: { + actionPrimary: { + text: __('Discard all changes'), + attributes: { + variant: 'danger', + }, + }, + actionCancel: { + text: __('Cancel'), + attributes: { + variant: 'default', + }, + }, + }, computed: { titleText() { if (!this.title) return __('Changes'); @@ -66,10 +80,10 @@ export default { <template> <div class="ide-commit-list-container"> - <header class="multi-file-commit-panel-header d-flex mb-0"> - <div class="d-flex align-items-center flex-fill"> + <header class="multi-file-commit-panel-header gl-display-flex gl-mb-0"> + <div class="gl-display-flex gl-align-items-center flex-fill"> <strong> {{ titleText }} </strong> - <div class="d-flex ml-auto"> + <div class="gl-display-flex gl-ml-auto"> <gl-button v-if="!stagedList" v-gl-tooltip @@ -100,17 +114,17 @@ export default { /> </li> </ul> - <p v-else class="multi-file-commit-list form-text text-muted text-center"> + <p v-else class="multi-file-commit-list form-text gl-text-gray-600 gl-text-center"> {{ emptyStateText }} </p> <gl-modal v-if="!stagedList" ref="discardAllModal" - ok-variant="danger" modal-id="discard-all-changes" - :ok-title="__('Discard all changes')" :title="__('Discard all changes?')" - @ok="unstageAndDiscardAllChanges" + :action-primary="$options.modal.actionPrimary" + :action-cancel="$options.modal.actionCancel" + @primary="unstageAndDiscardAllChanges" > {{ $options.discardModalText }} </gl-modal> diff --git a/app/assets/javascripts/ide/components/commit_sidebar/new_merge_request_option.vue b/app/assets/javascripts/ide/components/commit_sidebar/new_merge_request_option.vue index 43bf2e1a90c..0a8fec49aac 100644 --- a/app/assets/javascripts/ide/components/commit_sidebar/new_merge_request_option.vue +++ b/app/assets/javascripts/ide/components/commit_sidebar/new_merge_request_option.vue @@ -1,5 +1,5 @@ <script> -import { GlTooltipDirective } from '@gitlab/ui'; +import { GlTooltipDirective, GlFormCheckbox } from '@gitlab/ui'; import { createNamespacedHelpers } from 'vuex'; import { s__ } from '~/locale'; @@ -8,19 +8,20 @@ const { mapActions: mapCommitActions, mapGetters: mapCommitGetters } = createNam ); export default { + components: { GlFormCheckbox }, directives: { GlTooltip: GlTooltipDirective, }, + i18n: { + newMrText: s__('IDE|Start a new merge request'), + tooltipText: s__( + 'IDE|This option is disabled because you are not allowed to create merge requests in this project.', + ), + }, computed: { ...mapCommitGetters(['shouldHideNewMrOption', 'shouldDisableNewMrOption', 'shouldCreateMR']), tooltipText() { - if (this.shouldDisableNewMrOption) { - return s__( - 'IDE|This option is disabled because you are not allowed to create merge requests in this project.', - ); - } - - return ''; + return this.shouldDisableNewMrOption ? this.$options.i18n.tooltipText : null; }, }, methods: { @@ -30,22 +31,23 @@ export default { </script> <template> - <fieldset v-if="!shouldHideNewMrOption"> - <hr class="my-2" /> - <label - v-gl-tooltip="tooltipText" - class="mb-0 js-ide-commit-new-mr" - :class="{ 'is-disabled': shouldDisableNewMrOption }" + <fieldset + v-if="!shouldHideNewMrOption" + v-gl-tooltip="tooltipText" + data-testid="new-merge-request-fieldset" + class="js-ide-commit-new-mr" + :class="{ 'is-disabled': shouldDisableNewMrOption }" + > + <hr class="gl-mt-3 gl-mb-4" /> + + <gl-form-checkbox + :disabled="shouldDisableNewMrOption" + :checked="shouldCreateMR" + @change="toggleShouldCreateMR" > - <input - :disabled="shouldDisableNewMrOption" - :checked="shouldCreateMR" - type="checkbox" - @change="toggleShouldCreateMR" - /> - <span class="gl-ml-3 ide-option-label"> - {{ __('Start a new merge request') }} + <span class="ide-option-label"> + {{ $options.i18n.newMrText }} </span> - </label> + </gl-form-checkbox> </fieldset> </template> diff --git a/app/assets/javascripts/ide/components/commit_sidebar/radio_group.vue b/app/assets/javascripts/ide/components/commit_sidebar/radio_group.vue index 870355e884e..bd5d28dbb56 100644 --- a/app/assets/javascripts/ide/components/commit_sidebar/radio_group.vue +++ b/app/assets/javascripts/ide/components/commit_sidebar/radio_group.vue @@ -1,8 +1,20 @@ <script> -import { GlTooltipDirective } from '@gitlab/ui'; +import { + GlTooltipDirective, + GlFormRadio, + GlFormRadioGroup, + GlFormGroup, + GlFormInput, +} from '@gitlab/ui'; import { mapActions, mapState, mapGetters } from 'vuex'; export default { + components: { + GlFormRadio, + GlFormRadioGroup, + GlFormGroup, + GlFormInput, + }, directives: { GlTooltip: GlTooltipDirective, }, @@ -51,35 +63,42 @@ export default { </script> <template> - <fieldset> - <label + <fieldset class="gl-mb-2"> + <gl-form-radio-group v-gl-tooltip="tooltipTitle" + :checked="commitAction" :class="{ 'is-disabled': disabled, }" > - <input + <gl-form-radio :value="value" - :checked="commitAction === value" :disabled="disabled" - type="radio" name="commit-action" data-qa-selector="commit_type_radio" - @change="updateCommitAction($event.target.value)" - /> - <span class="gl-ml-3"> - <span v-if="label" class="ide-option-label"> {{ label }} </span> <slot v-else></slot> - </span> - </label> - <div v-if="commitAction === value && showInput" class="ide-commit-new-branch"> - <input + @change="updateCommitAction(value)" + > + <span v-if="label" class="ide-option-label"> + {{ label }} + </span> + <slot v-else></slot> + </gl-form-radio> + </gl-form-radio-group> + + <gl-form-group + v-if="commitAction === value && showInput" + :label="placeholderBranchName" + :label-sr-only="true" + class="gl-ml-6 gl-mb-0" + > + <gl-form-input :placeholder="placeholderBranchName" :value="newBranchName" + :disabled="disabled" data-testid="ide-new-branch-name" - type="text" - class="form-control monospace" - @input="updateBranchName($event.target.value)" + class="gl-font-monospace" + @input="updateBranchName($event)" /> - </div> + </gl-form-group> </fieldset> </template> diff --git a/app/assets/javascripts/ide/components/ide.vue b/app/assets/javascripts/ide/components/ide.vue index 45bbf93ebc9..d589f56dd7c 100644 --- a/app/assets/javascripts/ide/components/ide.vue +++ b/app/assets/javascripts/ide/components/ide.vue @@ -176,7 +176,7 @@ export default { {{ __('New file') }} </gl-button> </template> - <gl-loading-icon v-else-if="!currentTree || currentTree.loading" size="md" /> + <gl-loading-icon v-else-if="!currentTree || currentTree.loading" size="lg" /> <p v-else> {{ __( diff --git a/app/assets/javascripts/ide/components/ide_side_bar.vue b/app/assets/javascripts/ide/components/ide_side_bar.vue index c3d6494692a..f32d35bf774 100644 --- a/app/assets/javascripts/ide/components/ide_side_bar.vue +++ b/app/assets/javascripts/ide/components/ide_side_bar.vue @@ -1,5 +1,5 @@ <script> -import { GlDeprecatedSkeletonLoading as GlSkeletonLoading } from '@gitlab/ui'; +import { GlSkeletonLoader } from '@gitlab/ui'; import { mapState, mapGetters } from 'vuex'; import { SIDEBAR_INIT_WIDTH, leftSidebarViews } from '../constants'; import ActivityBar from './activity_bar.vue'; @@ -10,7 +10,7 @@ import ResizablePanel from './resizable_panel.vue'; export default { components: { - GlSkeletonLoading, + GlSkeletonLoader, ResizablePanel, ActivityBar, IdeTree, @@ -38,7 +38,7 @@ export default { <template v-if="loading"> <div class="multi-file-commit-panel-inner" data-testid="ide-side-bar-inner"> <div v-for="n in 3" :key="n" class="multi-file-loading-container"> - <gl-skeleton-loading /> + <gl-skeleton-loader /> </div> </div> </template> diff --git a/app/assets/javascripts/ide/components/ide_status_bar.vue b/app/assets/javascripts/ide/components/ide_status_bar.vue index 93ff7e8566f..e0b7ac9b1e1 100644 --- a/app/assets/javascripts/ide/components/ide_status_bar.vue +++ b/app/assets/javascripts/ide/components/ide_status_bar.vue @@ -32,8 +32,11 @@ export default { ...mapState('pipelines', ['latestPipeline']), }, watch: { - lastCommit() { - this.initPipelinePolling(); + lastCommit: { + handler() { + this.initPipelinePolling(); + }, + immediate: true, }, }, mounted() { diff --git a/app/assets/javascripts/ide/components/ide_tree_list.vue b/app/assets/javascripts/ide/components/ide_tree_list.vue index 0fc7337ad26..c9bf84be6ac 100644 --- a/app/assets/javascripts/ide/components/ide_tree_list.vue +++ b/app/assets/javascripts/ide/components/ide_tree_list.vue @@ -1,5 +1,5 @@ <script> -import { GlDeprecatedSkeletonLoading as GlSkeletonLoading } from '@gitlab/ui'; +import { GlSkeletonLoader } from '@gitlab/ui'; import { mapActions, mapGetters, mapState } from 'vuex'; import { WEBIDE_MARK_FILE_CLICKED } from '~/performance/constants'; import { performanceMarkAndMeasure } from '~/performance/utils'; @@ -10,7 +10,7 @@ import NavDropdown from './nav_dropdown.vue'; export default { name: 'IdeTreeList', components: { - GlSkeletonLoading, + GlSkeletonLoader, NavDropdown, FileTree, }, @@ -55,7 +55,7 @@ export default { <div class="ide-file-list qa-file-list"> <template v-if="showLoading"> <div v-for="n in 3" :key="n" class="multi-file-loading-container"> - <gl-skeleton-loading /> + <gl-skeleton-loader /> </div> </template> <template v-else> diff --git a/app/assets/javascripts/ide/components/jobs/detail/description.vue b/app/assets/javascripts/ide/components/jobs/detail/description.vue index 8fd1973267c..c184e25f67f 100644 --- a/app/assets/javascripts/ide/components/jobs/detail/description.vue +++ b/app/assets/javascripts/ide/components/jobs/detail/description.vue @@ -23,7 +23,7 @@ export default { <template> <div class="d-flex align-items-center"> - <ci-icon :status="job.status" :borderless="true" :size="24" class="d-flex" /> + <ci-icon is-borderless :status="job.status" :size="24" class="d-flex" /> <span class="gl-ml-3"> {{ job.name }} <a diff --git a/app/assets/javascripts/ide/components/jobs/stage.vue b/app/assets/javascripts/ide/components/jobs/stage.vue index 7797850f097..2284ffb8480 100644 --- a/app/assets/javascripts/ide/components/jobs/stage.vue +++ b/app/assets/javascripts/ide/components/jobs/stage.vue @@ -27,7 +27,7 @@ export default { }, computed: { collapseIcon() { - return this.stage.isCollapsed ? 'angle-left' : 'angle-down'; + return this.stage.isCollapsed ? 'chevron-lg-left' : 'chevron-lg-down'; }, showLoadingIcon() { return this.stage.isLoading && !this.stage.jobs.length; diff --git a/app/assets/javascripts/ide/components/repo_editor.vue b/app/assets/javascripts/ide/components/repo_editor.vue index f14d86114b8..d71ac766933 100644 --- a/app/assets/javascripts/ide/components/repo_editor.vue +++ b/app/assets/javascripts/ide/components/repo_editor.vue @@ -65,6 +65,8 @@ export default { modelManager: new ModelManager(), isEditorLoading: true, unwatchCiYaml: null, + SELivepreviewExtension: null, + MarkdownLivePreview: null, }; }, computed: { @@ -192,23 +194,6 @@ export default { this.createEditorInstance(); } }, - panelResizing() { - if (!this.panelResizing) { - this.refreshEditorDimensions(); - } - }, - showTabs() { - this.$nextTick(() => this.refreshEditorDimensions()); - }, - rightPaneIsOpen() { - this.refreshEditorDimensions(); - }, - showEditor(val) { - if (val) { - // We need to wait for the editor to actually be rendered. - this.$nextTick(() => this.refreshEditorDimensions()); - } - }, showContentViewer(val) { if (!val) return; @@ -324,17 +309,33 @@ export default { }, ]); - if ( - this.fileType === MARKDOWN_FILE_TYPE && - this.editor?.getEditorType() === EDITOR_TYPE_CODE && - this.previewMarkdownPath - ) { + this.$nextTick(() => { + this.setupEditor(); + }); + } + }, + + setupEditor() { + if (!this.file || !this.editor || this.file.loading) return; + + const useLivePreviewExtension = () => { + this.SELivepreviewExtension = this.editor.use({ + definition: this.MarkdownLivePreview, + setupOptions: { previewMarkdownPath: this.previewMarkdownPath }, + }); + }; + if ( + this.fileType === MARKDOWN_FILE_TYPE && + this.editor?.getEditorType() === EDITOR_TYPE_CODE && + this.previewMarkdownPath + ) { + if (this.MarkdownLivePreview) { + useLivePreviewExtension(); + } else { import('~/editor/extensions/source_editor_markdown_livepreview_ext') - .then(({ EditorMarkdownPreviewExtension: MarkdownLivePreview }) => { - this.editor.use({ - definition: MarkdownLivePreview, - setupOptions: { previewMarkdownPath: this.previewMarkdownPath }, - }); + .then(({ EditorMarkdownPreviewExtension }) => { + this.MarkdownLivePreview = EditorMarkdownPreviewExtension; + useLivePreviewExtension(); }) .catch((e) => createFlash({ @@ -342,15 +343,9 @@ export default { }), ); } - - this.$nextTick(() => { - this.setupEditor(); - }); + } else if (this.SELivepreviewExtension) { + this.editor.unuse(this.SELivepreviewExtension); } - }, - - setupEditor() { - if (!this.file || !this.editor || this.file.loading) return; const head = this.getStagedFile(this.file.path); @@ -396,10 +391,6 @@ export default { fileLanguage: this.model.language, }); - this.$nextTick(() => { - this.editor.updateDimensions(); - }); - this.$emit('editorSetup'); if (performance.getEntriesByName(WEBIDE_MARK_FILE_CLICKED).length) { eventHub.$emit(WEBIDE_MEASURE_FILE_AFTER_INTERACTION); @@ -415,11 +406,6 @@ export default { }); } }, - refreshEditorDimensions() { - if (this.showEditor && this.editor) { - this.editor.updateDimensions(); - } - }, fetchEditorconfigRules() { return getRulesWithTraversal(this.file.path, (path) => { const entry = this.entries[path]; diff --git a/app/assets/javascripts/ide/components/terminal/empty_state.vue b/app/assets/javascripts/ide/components/terminal/empty_state.vue index f4dd83b16c7..623ba719b28 100644 --- a/app/assets/javascripts/ide/components/terminal/empty_state.vue +++ b/app/assets/javascripts/ide/components/terminal/empty_state.vue @@ -55,7 +55,7 @@ export default { <gl-button :disabled="!isValid" category="primary" - variant="info" + variant="confirm" data-qa-selector="start_web_terminal_button" @click="onStart" > diff --git a/app/assets/javascripts/ide/components/terminal/session.vue b/app/assets/javascripts/ide/components/terminal/session.vue index 3a4128b6207..384e27844c6 100644 --- a/app/assets/javascripts/ide/components/terminal/session.vue +++ b/app/assets/javascripts/ide/components/terminal/session.vue @@ -16,7 +16,7 @@ export default { if (isEndingStatus(this.session.status)) { return { action: () => this.restartSession(), - variant: 'info', + variant: 'confirm', category: 'primary', text: __('Restart Terminal'), }; diff --git a/app/assets/javascripts/ide/lib/editor_options.js b/app/assets/javascripts/ide/lib/editor_options.js index 52da9942efe..525afcb2083 100644 --- a/app/assets/javascripts/ide/lib/editor_options.js +++ b/app/assets/javascripts/ide/lib/editor_options.js @@ -8,6 +8,7 @@ export const defaultEditorOptions = { }, wordWrap: 'on', glyphMargin: true, + automaticLayout: true, }; export const defaultDiffOptions = { diff --git a/app/assets/javascripts/ide/utils.js b/app/assets/javascripts/ide/utils.js index ec3630cc5eb..a7e6506b045 100644 --- a/app/assets/javascripts/ide/utils.js +++ b/app/assets/javascripts/ide/utils.js @@ -81,7 +81,7 @@ export function registerLanguages(def, ...defs) { languages.setLanguageConfiguration(languageId, def.conf); } -export function registerSchema(schema) { +export function registerSchema(schema, options = {}) { const defaults = [languages.json.jsonDefaults, languages.yaml.yamlDefaults]; defaults.forEach((d) => d.setDiagnosticsOptions({ @@ -90,6 +90,7 @@ export function registerSchema(schema) { hover: true, completion: true, schemas: [schema], + ...options, }), ); } |