summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/admin/users/components/actions
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/admin/users/components/actions')
-rw-r--r--app/assets/javascripts/admin/users/components/actions/activate.vue31
-rw-r--r--app/assets/javascripts/admin/users/components/actions/approve.vue41
-rw-r--r--app/assets/javascripts/admin/users/components/actions/ban.vue69
-rw-r--r--app/assets/javascripts/admin/users/components/actions/block.vue21
-rw-r--r--app/assets/javascripts/admin/users/components/actions/deactivate.vue23
-rw-r--r--app/assets/javascripts/admin/users/components/actions/index.js4
-rw-r--r--app/assets/javascripts/admin/users/components/actions/reject.vue51
-rw-r--r--app/assets/javascripts/admin/users/components/actions/unban.vue53
-rw-r--r--app/assets/javascripts/admin/users/components/actions/unblock.vue20
-rw-r--r--app/assets/javascripts/admin/users/components/actions/unlock.vue18
10 files changed, 289 insertions, 42 deletions
diff --git a/app/assets/javascripts/admin/users/components/actions/activate.vue b/app/assets/javascripts/admin/users/components/actions/activate.vue
index 99c260bf11e..74e9c60a57b 100644
--- a/app/assets/javascripts/admin/users/components/actions/activate.vue
+++ b/app/assets/javascripts/admin/users/components/actions/activate.vue
@@ -1,6 +1,16 @@
<script>
import { GlDropdownItem } from '@gitlab/ui';
-import { sprintf, s__ } from '~/locale';
+import { sprintf, s__, __ } from '~/locale';
+import { I18N_USER_ACTIONS } from '../../constants';
+
+// TODO: To be replaced with <template> content in https://gitlab.com/gitlab-org/gitlab/-/issues/320922
+const messageHtml = `
+ <p>${s__('AdminUsers|Reactivating a user will:')}</p>
+ <ul>
+ <li>${s__('AdminUsers|Restore user access to the account, including web, Git and API.')}</li>
+ </ul>
+ <p>${s__('AdminUsers|You can always deactivate their account again if needed.')}</p>
+`;
export default {
components: {
@@ -25,9 +35,14 @@ export default {
title: sprintf(s__('AdminUsers|Activate user %{username}?'), {
username: this.username,
}),
- message: s__('AdminUsers|You can always deactivate their account again if needed.'),
- okVariant: 'confirm',
- okTitle: s__('AdminUsers|Activate'),
+ messageHtml,
+ actionCancel: {
+ text: __('Cancel'),
+ },
+ actionPrimary: {
+ text: I18N_USER_ACTIONS.activate,
+ attributes: [{ variant: 'confirm' }],
+ },
}),
};
},
@@ -36,9 +51,7 @@ export default {
</script>
<template>
- <div class="js-confirm-modal-button" v-bind="{ ...modalAttributes }">
- <gl-dropdown-item>
- <slot></slot>
- </gl-dropdown-item>
- </div>
+ <gl-dropdown-item button-class="js-confirm-modal-button" v-bind="{ ...modalAttributes }">
+ <slot></slot>
+ </gl-dropdown-item>
</template>
diff --git a/app/assets/javascripts/admin/users/components/actions/approve.vue b/app/assets/javascripts/admin/users/components/actions/approve.vue
index 6fc43c246ea..77a9be8eec2 100644
--- a/app/assets/javascripts/admin/users/components/actions/approve.vue
+++ b/app/assets/javascripts/admin/users/components/actions/approve.vue
@@ -1,21 +1,60 @@
<script>
import { GlDropdownItem } from '@gitlab/ui';
+import { sprintf, s__, __ } from '~/locale';
+import { I18N_USER_ACTIONS } from '../../constants';
+
+// TODO: To be replaced with <template> content in https://gitlab.com/gitlab-org/gitlab/-/issues/320922
+const messageHtml = `
+ <p>${s__('AdminUsers|Approved users can:')}</p>
+ <ul>
+ <li>${s__('AdminUsers|Log in')}</li>
+ <li>${s__('AdminUsers|Access Git repositories')}</li>
+ <li>${s__('AdminUsers|Access the API')}</li>
+ <li>${s__('AdminUsers|Be added to groups and projects')}</li>
+ </ul>
+`;
export default {
components: {
GlDropdownItem,
},
props: {
+ username: {
+ type: String,
+ required: true,
+ },
path: {
type: String,
required: true,
},
},
+ computed: {
+ attributes() {
+ return {
+ 'data-path': this.path,
+ 'data-method': 'put',
+ 'data-modal-attributes': JSON.stringify({
+ title: sprintf(s__('AdminUsers|Approve user %{username}?'), {
+ username: this.username,
+ }),
+ actionCancel: {
+ text: __('Cancel'),
+ },
+ actionPrimary: {
+ text: I18N_USER_ACTIONS.approve,
+ attributes: [{ variant: 'confirm', 'data-qa-selector': 'approve_user_confirm_button' }],
+ },
+ messageHtml,
+ }),
+ 'data-qa-selector': 'approve_user_button',
+ };
+ },
+ },
};
</script>
<template>
- <gl-dropdown-item :href="path" data-method="put">
+ <gl-dropdown-item button-class="js-confirm-modal-button" v-bind="{ ...attributes }">
<slot></slot>
</gl-dropdown-item>
</template>
diff --git a/app/assets/javascripts/admin/users/components/actions/ban.vue b/app/assets/javascripts/admin/users/components/actions/ban.vue
new file mode 100644
index 00000000000..4e9cefbfdd7
--- /dev/null
+++ b/app/assets/javascripts/admin/users/components/actions/ban.vue
@@ -0,0 +1,69 @@
+<script>
+import { GlDropdownItem } from '@gitlab/ui';
+import { helpPagePath } from '~/helpers/help_page_helper';
+import { sprintf, s__, __ } from '~/locale';
+import { I18N_USER_ACTIONS } from '../../constants';
+
+// TODO: To be replaced with <template> content in https://gitlab.com/gitlab-org/gitlab/-/issues/320922
+const messageHtml = `
+ <p>${s__('AdminUsers|When banned, users:')}</p>
+ <ul>
+ <li>${s__("AdminUsers|Can't log in.")}</li>
+ <li>${s__("AdminUsers|Can't access Git repositories.")}</li>
+ </ul>
+ <p>${s__('AdminUsers|You can unban their account in the future. Their data remains intact.')}</p>
+ <p>${sprintf(
+ s__('AdminUsers|Learn more about %{link_start}banned users.%{link_end}'),
+ {
+ link_start: `<a href="${helpPagePath('user/admin_area/moderate_users', {
+ anchor: 'ban-a-user',
+ })}" target="_blank">`,
+ link_end: '</a>',
+ },
+ false,
+ )}</p>
+`;
+
+export default {
+ components: {
+ GlDropdownItem,
+ },
+ props: {
+ username: {
+ type: String,
+ required: true,
+ },
+ path: {
+ type: String,
+ required: true,
+ },
+ },
+ computed: {
+ modalAttributes() {
+ return {
+ 'data-path': this.path,
+ 'data-method': 'put',
+ 'data-modal-attributes': JSON.stringify({
+ title: sprintf(s__('AdminUsers|Ban user %{username}?'), {
+ username: this.username,
+ }),
+ actionCancel: {
+ text: __('Cancel'),
+ },
+ actionPrimary: {
+ text: I18N_USER_ACTIONS.ban,
+ attributes: [{ variant: 'confirm' }],
+ },
+ messageHtml,
+ }),
+ };
+ },
+ },
+};
+</script>
+
+<template>
+ <gl-dropdown-item button-class="js-confirm-modal-button" v-bind="{ ...modalAttributes }">
+ <slot></slot>
+ </gl-dropdown-item>
+</template>
diff --git a/app/assets/javascripts/admin/users/components/actions/block.vue b/app/assets/javascripts/admin/users/components/actions/block.vue
index 68dfefe14c2..03557008a89 100644
--- a/app/assets/javascripts/admin/users/components/actions/block.vue
+++ b/app/assets/javascripts/admin/users/components/actions/block.vue
@@ -1,6 +1,7 @@
<script>
import { GlDropdownItem } from '@gitlab/ui';
-import { sprintf, s__ } from '~/locale';
+import { sprintf, s__, __ } from '~/locale';
+import { I18N_USER_ACTIONS } from '../../constants';
// TODO: To be replaced with <template> content in https://gitlab.com/gitlab-org/gitlab/-/issues/320922
const messageHtml = `
@@ -11,6 +12,7 @@ const messageHtml = `
<li>${s__('AdminUsers|Personal projects will be left')}</li>
<li>${s__('AdminUsers|Owned groups will be left')}</li>
</ul>
+ <p>${s__('AdminUsers|You can always unblock their account, their data will remain intact.')}</p>
`;
export default {
@@ -34,8 +36,13 @@ export default {
'data-method': 'put',
'data-modal-attributes': JSON.stringify({
title: sprintf(s__('AdminUsers|Block user %{username}?'), { username: this.username }),
- okVariant: 'confirm',
- okTitle: s__('AdminUsers|Block'),
+ actionCancel: {
+ text: __('Cancel'),
+ },
+ actionPrimary: {
+ text: I18N_USER_ACTIONS.block,
+ attributes: [{ variant: 'confirm' }],
+ },
messageHtml,
}),
};
@@ -45,9 +52,7 @@ export default {
</script>
<template>
- <div class="js-confirm-modal-button" v-bind="{ ...modalAttributes }">
- <gl-dropdown-item>
- <slot></slot>
- </gl-dropdown-item>
- </div>
+ <gl-dropdown-item button-class="js-confirm-modal-button" v-bind="{ ...modalAttributes }">
+ <slot></slot>
+ </gl-dropdown-item>
</template>
diff --git a/app/assets/javascripts/admin/users/components/actions/deactivate.vue b/app/assets/javascripts/admin/users/components/actions/deactivate.vue
index 7e0c17ba296..640c8fefc20 100644
--- a/app/assets/javascripts/admin/users/components/actions/deactivate.vue
+++ b/app/assets/javascripts/admin/users/components/actions/deactivate.vue
@@ -1,6 +1,7 @@
<script>
import { GlDropdownItem } from '@gitlab/ui';
-import { sprintf, s__ } from '~/locale';
+import { sprintf, s__, __ } from '~/locale';
+import { I18N_USER_ACTIONS } from '../../constants';
// TODO: To be replaced with <template> content in https://gitlab.com/gitlab-org/gitlab/-/issues/320922
const messageHtml = `
@@ -16,6 +17,9 @@ const messageHtml = `
)}</li>
<li>${s__('AdminUsers|Personal projects, group and user history will be left intact')}</li>
</ul>
+ <p>${s__(
+ 'AdminUsers|You can always re-activate their account, their data will remain intact.',
+ )}</p>
`;
export default {
@@ -41,8 +45,13 @@ export default {
title: sprintf(s__('AdminUsers|Deactivate user %{username}?'), {
username: this.username,
}),
- okVariant: 'confirm',
- okTitle: s__('AdminUsers|Deactivate'),
+ actionCancel: {
+ text: __('Cancel'),
+ },
+ actionPrimary: {
+ text: I18N_USER_ACTIONS.deactivate,
+ attributes: [{ variant: 'confirm' }],
+ },
messageHtml,
}),
};
@@ -52,9 +61,7 @@ export default {
</script>
<template>
- <div class="js-confirm-modal-button" v-bind="{ ...modalAttributes }">
- <gl-dropdown-item>
- <slot></slot>
- </gl-dropdown-item>
- </div>
+ <gl-dropdown-item button-class="js-confirm-modal-button" v-bind="{ ...modalAttributes }">
+ <slot></slot>
+ </gl-dropdown-item>
</template>
diff --git a/app/assets/javascripts/admin/users/components/actions/index.js b/app/assets/javascripts/admin/users/components/actions/index.js
index e34b01346b9..4e63a85df89 100644
--- a/app/assets/javascripts/admin/users/components/actions/index.js
+++ b/app/assets/javascripts/admin/users/components/actions/index.js
@@ -1,20 +1,24 @@
import Activate from './activate.vue';
import Approve from './approve.vue';
+import Ban from './ban.vue';
import Block from './block.vue';
import Deactivate from './deactivate.vue';
import Delete from './delete.vue';
import DeleteWithContributions from './delete_with_contributions.vue';
import Reject from './reject.vue';
+import Unban from './unban.vue';
import Unblock from './unblock.vue';
import Unlock from './unlock.vue';
export default {
Activate,
Approve,
+ Ban,
Block,
Deactivate,
Delete,
DeleteWithContributions,
+ Unban,
Unblock,
Unlock,
Reject,
diff --git a/app/assets/javascripts/admin/users/components/actions/reject.vue b/app/assets/javascripts/admin/users/components/actions/reject.vue
index a80c1ff5458..901306455fa 100644
--- a/app/assets/javascripts/admin/users/components/actions/reject.vue
+++ b/app/assets/javascripts/admin/users/components/actions/reject.vue
@@ -1,21 +1,70 @@
<script>
import { GlDropdownItem } from '@gitlab/ui';
+import { helpPagePath } from '~/helpers/help_page_helper';
+import { sprintf, s__, __ } from '~/locale';
+import { I18N_USER_ACTIONS } from '../../constants';
+
+// TODO: To be replaced with <template> content in https://gitlab.com/gitlab-org/gitlab/-/issues/320922
+const messageHtml = `
+ <p>${s__('AdminUsers|Rejected users:')}</p>
+ <ul>
+ <li>${s__('AdminUsers|Cannot sign in or access instance information')}</li>
+ <li>${s__('AdminUsers|Will be deleted')}</li>
+ </ul>
+ <p>${sprintf(
+ s__(
+ 'AdminUsers|For more information, please refer to the %{link_start}user account deletion documentation.%{link_end}',
+ ),
+ {
+ link_start: `<a href="${helpPagePath('user/profile/account/delete_account', {
+ anchor: 'associated-records',
+ })}" target="_blank">`,
+ link_end: '</a>',
+ },
+ false,
+ )}</p>
+`;
export default {
components: {
GlDropdownItem,
},
props: {
+ username: {
+ type: String,
+ required: true,
+ },
path: {
type: String,
required: true,
},
},
+ computed: {
+ modalAttributes() {
+ return {
+ 'data-path': this.path,
+ 'data-method': 'delete',
+ 'data-modal-attributes': JSON.stringify({
+ title: sprintf(s__('AdminUsers|Reject user %{username}?'), {
+ username: this.username,
+ }),
+ actionCancel: {
+ text: __('Cancel'),
+ },
+ actionPrimary: {
+ text: I18N_USER_ACTIONS.reject,
+ attributes: [{ variant: 'danger' }],
+ },
+ messageHtml,
+ }),
+ };
+ },
+ },
};
</script>
<template>
- <gl-dropdown-item :href="path" data-method="delete">
+ <gl-dropdown-item button-class="js-confirm-modal-button" v-bind="{ ...modalAttributes }">
<slot></slot>
</gl-dropdown-item>
</template>
diff --git a/app/assets/javascripts/admin/users/components/actions/unban.vue b/app/assets/javascripts/admin/users/components/actions/unban.vue
new file mode 100644
index 00000000000..8083e26177e
--- /dev/null
+++ b/app/assets/javascripts/admin/users/components/actions/unban.vue
@@ -0,0 +1,53 @@
+<script>
+import { GlDropdownItem } from '@gitlab/ui';
+import { sprintf, s__, __ } from '~/locale';
+import { I18N_USER_ACTIONS } from '../../constants';
+
+// TODO: To be replaced with <template> content in https://gitlab.com/gitlab-org/gitlab/-/issues/320922
+const messageHtml = `<p>${s__(
+ 'AdminUsers|You can ban their account in the future if necessary.',
+)}</p>`;
+
+export default {
+ components: {
+ GlDropdownItem,
+ },
+ props: {
+ username: {
+ type: String,
+ required: true,
+ },
+ path: {
+ type: String,
+ required: true,
+ },
+ },
+ computed: {
+ modalAttributes() {
+ return {
+ 'data-path': this.path,
+ 'data-method': 'put',
+ 'data-modal-attributes': JSON.stringify({
+ title: sprintf(s__('AdminUsers|Unban user %{username}?'), {
+ username: this.username,
+ }),
+ actionCancel: {
+ text: __('Cancel'),
+ },
+ actionPrimary: {
+ text: I18N_USER_ACTIONS.unban,
+ attributes: [{ variant: 'confirm' }],
+ },
+ messageHtml,
+ }),
+ };
+ },
+ },
+};
+</script>
+
+<template>
+ <gl-dropdown-item button-class="js-confirm-modal-button" v-bind="{ ...modalAttributes }">
+ <slot></slot>
+ </gl-dropdown-item>
+</template>
diff --git a/app/assets/javascripts/admin/users/components/actions/unblock.vue b/app/assets/javascripts/admin/users/components/actions/unblock.vue
index d4c0f900c94..7de6653e0cd 100644
--- a/app/assets/javascripts/admin/users/components/actions/unblock.vue
+++ b/app/assets/javascripts/admin/users/components/actions/unblock.vue
@@ -1,6 +1,7 @@
<script>
import { GlDropdownItem } from '@gitlab/ui';
-import { sprintf, s__ } from '~/locale';
+import { sprintf, s__, __ } from '~/locale';
+import { I18N_USER_ACTIONS } from '../../constants';
export default {
components: {
@@ -24,8 +25,13 @@ export default {
'data-modal-attributes': JSON.stringify({
title: sprintf(s__('AdminUsers|Unblock user %{username}?'), { username: this.username }),
message: s__('AdminUsers|You can always block their account again if needed.'),
- okVariant: 'confirm',
- okTitle: s__('AdminUsers|Unblock'),
+ actionCancel: {
+ text: __('Cancel'),
+ },
+ actionPrimary: {
+ text: I18N_USER_ACTIONS.unblock,
+ attributes: [{ variant: 'confirm' }],
+ },
}),
};
},
@@ -34,9 +40,7 @@ export default {
</script>
<template>
- <div class="js-confirm-modal-button" v-bind="{ ...modalAttributes }">
- <gl-dropdown-item>
- <slot></slot>
- </gl-dropdown-item>
- </div>
+ <gl-dropdown-item button-class="js-confirm-modal-button" v-bind="{ ...modalAttributes }">
+ <slot></slot>
+ </gl-dropdown-item>
</template>
diff --git a/app/assets/javascripts/admin/users/components/actions/unlock.vue b/app/assets/javascripts/admin/users/components/actions/unlock.vue
index 294aaade7c1..10d4fb06d61 100644
--- a/app/assets/javascripts/admin/users/components/actions/unlock.vue
+++ b/app/assets/javascripts/admin/users/components/actions/unlock.vue
@@ -1,6 +1,7 @@
<script>
import { GlDropdownItem } from '@gitlab/ui';
import { sprintf, s__, __ } from '~/locale';
+import { I18N_USER_ACTIONS } from '../../constants';
export default {
components: {
@@ -24,8 +25,13 @@ export default {
'data-modal-attributes': JSON.stringify({
title: sprintf(s__('AdminUsers|Unlock user %{username}?'), { username: this.username }),
message: __('Are you sure?'),
- okVariant: 'confirm',
- okTitle: s__('AdminUsers|Unlock'),
+ actionCancel: {
+ text: __('Cancel'),
+ },
+ actionPrimary: {
+ text: I18N_USER_ACTIONS.unlock,
+ attributes: [{ variant: 'confirm' }],
+ },
}),
};
},
@@ -34,9 +40,7 @@ export default {
</script>
<template>
- <div class="js-confirm-modal-button" v-bind="{ ...modalAttributes }">
- <gl-dropdown-item>
- <slot></slot>
- </gl-dropdown-item>
- </div>
+ <gl-dropdown-item button-class="js-confirm-modal-button" v-bind="{ ...modalAttributes }">
+ <slot></slot>
+ </gl-dropdown-item>
</template>