diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/static_site_editor/components/app.vue | 3 | ||||
-rw-r--r-- | app/assets/javascripts/static_site_editor/index.js | 11 | ||||
-rw-r--r-- | app/assets/javascripts/static_site_editor/pages/home.vue (renamed from app/assets/javascripts/static_site_editor/components/static_site_editor.vue) | 12 | ||||
-rw-r--r-- | app/assets/javascripts/static_site_editor/router/constants.js | 2 | ||||
-rw-r--r-- | app/assets/javascripts/static_site_editor/router/index.js | 15 | ||||
-rw-r--r-- | app/assets/javascripts/static_site_editor/router/routes.js | 10 | ||||
-rw-r--r-- | app/assets/javascripts/vue_shared/components/clone_dropdown.vue | 14 | ||||
-rw-r--r-- | app/models/concerns/has_user_type.rb | 5 | ||||
-rw-r--r-- | app/models/user.rb | 10 | ||||
-rw-r--r-- | app/policies/global_policy.rb | 6 | ||||
-rw-r--r-- | app/views/profiles/keys/_form.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/static_site_editor/show.html.haml | 5 |
12 files changed, 72 insertions, 23 deletions
diff --git a/app/assets/javascripts/static_site_editor/components/app.vue b/app/assets/javascripts/static_site_editor/components/app.vue new file mode 100644 index 00000000000..98240aef810 --- /dev/null +++ b/app/assets/javascripts/static_site_editor/components/app.vue @@ -0,0 +1,3 @@ +<template> + <router-view /> +</template> diff --git a/app/assets/javascripts/static_site_editor/index.js b/app/assets/javascripts/static_site_editor/index.js index fe5d11f1bd9..b53d461f5a9 100644 --- a/app/assets/javascripts/static_site_editor/index.js +++ b/app/assets/javascripts/static_site_editor/index.js @@ -1,10 +1,11 @@ import Vue from 'vue'; import { parseBoolean } from '~/lib/utils/common_utils'; -import StaticSiteEditor from './components/static_site_editor.vue'; +import App from './components/app.vue'; import createStore from './store'; +import createRouter from './router'; const initStaticSiteEditor = el => { - const { isSupportedContent, projectId, path: sourcePath, returnUrl } = el.dataset; + const { isSupportedContent, projectId, path: sourcePath, returnUrl, baseUrl } = el.dataset; const store = createStore({ initialState: { @@ -15,15 +16,17 @@ const initStaticSiteEditor = el => { username: window.gon.current_username, }, }); + const router = createRouter(baseUrl); return new Vue({ el, store, + router, components: { - StaticSiteEditor, + App, }, render(createElement) { - return createElement('static-site-editor', StaticSiteEditor); + return createElement('app'); }, }); }; diff --git a/app/assets/javascripts/static_site_editor/components/static_site_editor.vue b/app/assets/javascripts/static_site_editor/pages/home.vue index 79e4b4a4581..3de4a4a27cf 100644 --- a/app/assets/javascripts/static_site_editor/components/static_site_editor.vue +++ b/app/assets/javascripts/static_site_editor/pages/home.vue @@ -2,12 +2,12 @@ import { mapState, mapGetters, mapActions } from 'vuex'; import { GlSkeletonLoader } from '@gitlab/ui'; -import EditArea from './edit_area.vue'; -import EditHeader from './edit_header.vue'; -import SavedChangesMessage from './saved_changes_message.vue'; -import PublishToolbar from './publish_toolbar.vue'; -import InvalidContentMessage from './invalid_content_message.vue'; -import SubmitChangesError from './submit_changes_error.vue'; +import EditArea from '../components/edit_area.vue'; +import EditHeader from '../components/edit_header.vue'; +import SavedChangesMessage from '../components/saved_changes_message.vue'; +import PublishToolbar from '../components/publish_toolbar.vue'; +import InvalidContentMessage from '../components/invalid_content_message.vue'; +import SubmitChangesError from '../components/submit_changes_error.vue'; export default { components: { diff --git a/app/assets/javascripts/static_site_editor/router/constants.js b/app/assets/javascripts/static_site_editor/router/constants.js new file mode 100644 index 00000000000..b835d0b8867 --- /dev/null +++ b/app/assets/javascripts/static_site_editor/router/constants.js @@ -0,0 +1,2 @@ +// eslint-disable-next-line import/prefer-default-export +export const HOME_ROUTE_NAME = 'home'; diff --git a/app/assets/javascripts/static_site_editor/router/index.js b/app/assets/javascripts/static_site_editor/router/index.js new file mode 100644 index 00000000000..12692612bbc --- /dev/null +++ b/app/assets/javascripts/static_site_editor/router/index.js @@ -0,0 +1,15 @@ +import Vue from 'vue'; +import VueRouter from 'vue-router'; +import routes from './routes'; + +Vue.use(VueRouter); + +export default function createRouter(base) { + const router = new VueRouter({ + base, + mode: 'history', + routes, + }); + + return router; +} diff --git a/app/assets/javascripts/static_site_editor/router/routes.js b/app/assets/javascripts/static_site_editor/router/routes.js new file mode 100644 index 00000000000..72d944fb36d --- /dev/null +++ b/app/assets/javascripts/static_site_editor/router/routes.js @@ -0,0 +1,10 @@ +import Home from '../pages/home.vue'; +import { HOME_ROUTE_NAME } from './constants'; + +export default [ + { + name: HOME_ROUTE_NAME, + path: '/', + component: Home, + }, +]; diff --git a/app/assets/javascripts/vue_shared/components/clone_dropdown.vue b/app/assets/javascripts/vue_shared/components/clone_dropdown.vue index 7826c179889..8ebcebb9758 100644 --- a/app/assets/javascripts/vue_shared/components/clone_dropdown.vue +++ b/app/assets/javascripts/vue_shared/components/clone_dropdown.vue @@ -4,7 +4,6 @@ import { GlNewDropdownHeader, GlFormInputGroup, GlButton, - GlIcon, GlTooltipDirective, } from '@gitlab/ui'; import { __, sprintf } from '~/locale'; @@ -16,7 +15,6 @@ export default { GlNewDropdownHeader, GlFormInputGroup, GlButton, - GlIcon, }, directives: { GlTooltip: GlTooltipDirective, @@ -59,9 +57,9 @@ export default { v-gl-tooltip.hover :title="$options.copyURLTooltip" :data-clipboard-text="sshLink" - > - <gl-icon name="copy-to-clipboard" :title="$options.copyURLTooltip" /> - </gl-button> + icon="copy-to-clipboard" + class="d-inline-flex" + /> </template> </gl-form-input-group> </div> @@ -77,9 +75,9 @@ export default { v-gl-tooltip.hover :title="$options.copyURLTooltip" :data-clipboard-text="httpLink" - > - <gl-icon name="copy-to-clipboard" :title="$options.copyURLTooltip" /> - </gl-button> + icon="copy-to-clipboard" + class="d-inline-flex" + /> </template> </gl-form-input-group> </div> diff --git a/app/models/concerns/has_user_type.rb b/app/models/concerns/has_user_type.rb index 9b78233e6c6..1347e0be637 100644 --- a/app/models/concerns/has_user_type.rb +++ b/app/models/concerns/has_user_type.rb @@ -10,10 +10,11 @@ module HasUserType visual_review_bot: 3, service_user: 4, ghost: 5, - project_bot: 6 + project_bot: 6, + migration_bot: 7 }.with_indifferent_access.freeze - BOT_USER_TYPES = %w[alert_bot project_bot support_bot visual_review_bot].freeze + BOT_USER_TYPES = %w[alert_bot project_bot support_bot visual_review_bot migration_bot].freeze NON_INTERNAL_USER_TYPES = %w[human project_bot service_user].freeze INTERNAL_USER_TYPES = (USER_TYPES.keys - NON_INTERNAL_USER_TYPES).freeze diff --git a/app/models/user.rb b/app/models/user.rb index 69ca42071fb..942bcf75a88 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -636,6 +636,16 @@ class User < ApplicationRecord end end + def migration_bot + email_pattern = "noreply+gitlab-migration-bot%s@#{Settings.gitlab.host}" + + unique_internal(where(user_type: :migration_bot), 'migration-bot', email_pattern) do |u| + u.bio = 'The GitLab migration bot' + u.name = 'GitLab Migration Bot' + u.confirmed_at = Time.zone.now + end + end + # Return true if there is only single non-internal user in the deployment, # ghost user is ignored. def single_user? diff --git a/app/policies/global_policy.rb b/app/policies/global_policy.rb index b6cf945bf5a..03f5a863421 100644 --- a/app/policies/global_policy.rb +++ b/app/policies/global_policy.rb @@ -18,6 +18,7 @@ class GlobalPolicy < BasePolicy condition(:private_instance_statistics, score: 0) { Gitlab::CurrentSettings.instance_statistics_visibility_private? } condition(:project_bot, scope: :user) { @user&.project_bot? } + condition(:migration_bot, scope: :user) { @user&.migration_bot? } rule { admin | (~private_instance_statistics & ~anonymous) } .enable :read_instance_statistics @@ -48,11 +49,14 @@ class GlobalPolicy < BasePolicy rule { blocked | internal }.policy do prevent :log_in prevent :access_api - prevent :access_git prevent :receive_notifications prevent :use_slash_commands end + rule { blocked | (internal & ~migration_bot) }.policy do + prevent :access_git + end + rule { project_bot }.policy do prevent :log_in prevent :receive_notifications diff --git a/app/views/profiles/keys/_form.html.haml b/app/views/profiles/keys/_form.html.haml index 34e81285328..7709aa8f4b9 100644 --- a/app/views/profiles/keys/_form.html.haml +++ b/app/views/profiles/keys/_form.html.haml @@ -14,7 +14,7 @@ .col.form-group = f.label :expires_at, s_('Profiles|Expires at'), class: 'label-bold' - = f.date_field :expires_at, class: "form-control input-lg qa-key-expiry-field", min: Date.tomorrow + = f.date_field :expires_at, class: "form-control input-lg", min: Date.tomorrow, data: { qa_selector: 'key_expiry_date_field' } .js-add-ssh-key-validation-warning.hide .bs-callout.bs-callout-warning{ role: 'alert', aria_live: 'assertive' } diff --git a/app/views/projects/static_site_editor/show.html.haml b/app/views/projects/static_site_editor/show.html.haml index 8d2649be588..88c5378fc35 100644 --- a/app/views/projects/static_site_editor/show.html.haml +++ b/app/views/projects/static_site_editor/show.html.haml @@ -1 +1,4 @@ -#static-site-editor{ data: @config.payload } +-# TODO: Remove after base URL is included in the model !30735 +- data = @config.payload.merge({ base_url: namespace_project_show_sse_path }) + +#static-site-editor{ data: data } |