diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-15 09:09:46 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-15 09:09:46 +0000 |
commit | 221b529789f4090341a825695aeb49b8df6dd11d (patch) | |
tree | c8843e4ca5ef1034752eb68712fcf338b24950db /app | |
parent | 00a8c64ffd18e74df4b1cdeda7776b5221fddafe (diff) | |
download | gitlab-ce-221b529789f4090341a825695aeb49b8df6dd11d.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
10 files changed, 77 insertions, 13 deletions
diff --git a/app/assets/javascripts/static_site_editor/components/edit_header.vue b/app/assets/javascripts/static_site_editor/components/edit_header.vue new file mode 100644 index 00000000000..5660bfbe5ae --- /dev/null +++ b/app/assets/javascripts/static_site_editor/components/edit_header.vue @@ -0,0 +1,23 @@ +<script> +import { DEFAULT_HEADING } from '../constants'; + +export default { + props: { + title: { + type: String, + required: false, + default: '', + }, + }, + computed: { + heading() { + return this.title || DEFAULT_HEADING; + }, + }, +}; +</script> +<template> + <div> + <h3 ref="sseHeading">{{ heading }}</h3> + </div> +</template> diff --git a/app/assets/javascripts/static_site_editor/components/publish_toolbar.vue b/app/assets/javascripts/static_site_editor/components/publish_toolbar.vue index 7f00fb71b04..efb442d4d09 100644 --- a/app/assets/javascripts/static_site_editor/components/publish_toolbar.vue +++ b/app/assets/javascripts/static_site_editor/components/publish_toolbar.vue @@ -7,6 +7,11 @@ export default { GlLoadingIcon, }, props: { + returnUrl: { + type: String, + required: false, + default: '', + }, saveable: { type: Boolean, required: false, @@ -23,12 +28,17 @@ export default { <template> <div class="d-flex bg-light border-top justify-content-between align-items-center py-3 px-4"> <gl-loading-icon :class="{ invisible: !savingChanges }" size="md" /> - <gl-new-button - variant="success" - :disabled="!saveable || savingChanges" - @click="$emit('submit')" - > - {{ __('Submit Changes') }} - </gl-new-button> + <div> + <gl-new-button v-if="returnUrl" ref="returnUrlLink" :href="returnUrl">{{ + s__('StaticSiteEditor|Return to site') + }}</gl-new-button> + <gl-new-button + variant="success" + :disabled="!saveable || savingChanges" + @click="$emit('submit')" + > + {{ __('Submit Changes') }} + </gl-new-button> + </div> </div> </template> diff --git a/app/assets/javascripts/static_site_editor/components/static_site_editor.vue b/app/assets/javascripts/static_site_editor/components/static_site_editor.vue index 8deae2f2c8a..4d912f5c0b5 100644 --- a/app/assets/javascripts/static_site_editor/components/static_site_editor.vue +++ b/app/assets/javascripts/static_site_editor/components/static_site_editor.vue @@ -3,16 +3,25 @@ import { mapState, mapGetters, mapActions } from 'vuex'; import { GlSkeletonLoader } from '@gitlab/ui'; import EditArea from './edit_area.vue'; +import EditHeader from './edit_header.vue'; import Toolbar from './publish_toolbar.vue'; export default { components: { EditArea, + EditHeader, GlSkeletonLoader, Toolbar, }, computed: { - ...mapState(['content', 'isLoadingContent', 'isSavingChanges', 'isContentLoaded']), + ...mapState([ + 'content', + 'isLoadingContent', + 'isSavingChanges', + 'isContentLoaded', + 'returnUrl', + 'title', + ]), ...mapGetters(['contentChanged']), }, mounted() { @@ -24,7 +33,7 @@ export default { }; </script> <template> - <div class="d-flex justify-content-center h-100 pt-2"> + <div class="d-flex justify-content-center h-100 pt-2"> <div v-if="isLoadingContent" class="w-50 h-50"> <gl-skeleton-loader :width="500" :height="102"> <rect width="500" height="16" rx="4" /> @@ -36,12 +45,14 @@ export default { </gl-skeleton-loader> </div> <div v-if="isContentLoaded" class="d-flex flex-grow-1 flex-column"> + <edit-header class="w-75 align-self-center py-2" :title="title" /> <edit-area class="w-75 h-100 shadow-none align-self-center" :value="content" @input="setContent" /> <toolbar + :return-url="returnUrl" :saveable="contentChanged" :saving-changes="isSavingChanges" @submit="submitChanges" diff --git a/app/assets/javascripts/static_site_editor/constants.js b/app/assets/javascripts/static_site_editor/constants.js index 5081d467016..d7ce2a93a56 100644 --- a/app/assets/javascripts/static_site_editor/constants.js +++ b/app/assets/javascripts/static_site_editor/constants.js @@ -10,3 +10,5 @@ export const SUBMIT_CHANGES_COMMIT_ERROR = s__( export const SUBMIT_CHANGES_MERGE_REQUEST_ERROR = s__( 'StaticSiteEditor|Could not create merge request.', ); + +export const DEFAULT_HEADING = s__('StaticSiteEditor|Static site editor'); diff --git a/app/assets/javascripts/static_site_editor/index.js b/app/assets/javascripts/static_site_editor/index.js index 3d40f3918a4..c6a883c659a 100644 --- a/app/assets/javascripts/static_site_editor/index.js +++ b/app/assets/javascripts/static_site_editor/index.js @@ -3,10 +3,10 @@ import StaticSiteEditor from './components/static_site_editor.vue'; import createStore from './store'; const initStaticSiteEditor = el => { - const { projectId, path: sourcePath } = el.dataset; + const { projectId, returnUrl, path: sourcePath } = el.dataset; const store = createStore({ - initialState: { projectId, sourcePath, username: window.gon.current_username }, + initialState: { projectId, returnUrl, sourcePath, username: window.gon.current_username }, }); return new Vue({ diff --git a/app/assets/javascripts/static_site_editor/store/state.js b/app/assets/javascripts/static_site_editor/store/state.js index d48cc8ed1a4..98a84d9f75d 100644 --- a/app/assets/javascripts/static_site_editor/store/state.js +++ b/app/assets/javascripts/static_site_editor/store/state.js @@ -1,6 +1,7 @@ const createState = (initialState = {}) => ({ username: null, projectId: null, + returnUrl: null, sourcePath: null, isLoadingContent: false, diff --git a/app/assets/javascripts/vue_shared/components/stacked_progress_bar.vue b/app/assets/javascripts/vue_shared/components/stacked_progress_bar.vue index 82b3c784f96..a0c161a335a 100644 --- a/app/assets/javascripts/vue_shared/components/stacked_progress_bar.vue +++ b/app/assets/javascripts/vue_shared/components/stacked_progress_bar.vue @@ -1,4 +1,5 @@ <script> +import { __ } from '~/locale'; import { roundOffFloat } from '~/lib/utils/common_utils'; import tooltip from '~/vue_shared/directives/tooltip'; @@ -27,6 +28,11 @@ export default { required: false, default: 'neutral', }, + unavailableLabel: { + type: String, + required: false, + default: __('Not available'), + }, successCount: { type: Number, required: true, @@ -103,7 +109,7 @@ export default { <template> <div :class="cssClass" class="stacked-progress-bar"> - <span v-if="!totalCount" class="status-unavailable"> {{ __('Not available') }} </span> + <span v-if="!totalCount" class="status-unavailable">{{ unavailableLabel }}</span> <span v-if="successPercent" v-tooltip diff --git a/app/controllers/groups/registry/repositories_controller.rb b/app/controllers/groups/registry/repositories_controller.rb index 0240c87e699..16aa6e50320 100644 --- a/app/controllers/groups/registry/repositories_controller.rb +++ b/app/controllers/groups/registry/repositories_controller.rb @@ -9,7 +9,7 @@ module Groups respond_to do |format| format.html format.json do - @images = group.container_repositories.with_api_entity_associations + @images = ContainerRepositoriesFinder.new(user: current_user, subject: group).execute.with_api_entity_associations track_event(:list_repositories) diff --git a/app/controllers/projects/static_site_editor_controller.rb b/app/controllers/projects/static_site_editor_controller.rb index 98ec2335899..74f28c3da67 100644 --- a/app/controllers/projects/static_site_editor_controller.rb +++ b/app/controllers/projects/static_site_editor_controller.rb @@ -2,10 +2,13 @@ class Projects::StaticSiteEditorController < Projects::ApplicationController include ExtractsPath + include CreatesCommit + layout 'fullscreen' prepend_before_action :authenticate_user!, only: [:show] before_action :assign_ref_and_path, only: [:show] + before_action :authorize_edit_tree!, only: [:show] def show @config = Gitlab::StaticSiteEditor::Config.new(@repository, @ref, @path, params[:return_url]) diff --git a/app/finders/users_finder.rb b/app/finders/users_finder.rb index d5650c6828d..ebb686c2aa7 100644 --- a/app/finders/users_finder.rb +++ b/app/finders/users_finder.rb @@ -14,6 +14,7 @@ # active: boolean # blocked: boolean # external: boolean +# without_projects: boolean # class UsersFinder include CreatedAtFilter @@ -36,6 +37,7 @@ class UsersFinder users = by_external(users) users = by_2fa(users) users = by_created_at(users) + users = by_without_projects(users) users = by_custom_attributes(users) users @@ -94,6 +96,12 @@ class UsersFinder users end end + + def by_without_projects(users) + return users unless params[:without_projects] + + users.without_projects + end end UsersFinder.prepend_if_ee('EE::UsersFinder') |