Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(settings): Provide visual feedback 4 encryption toggle #49200

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions apps/settings/src/components/Encryption.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
{{ t('settings', 'Enable server-side encryption') }}
</NcCheckboxRadioSwitch>

<div v-if="!hasEncryptionModules || !encryptionReady" class="notecard warning" role="alert">
<p>{{ t('settings', 'Encryption is not available. Please enable the Encryption app or an encryption module.') }}</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

</div>

<div v-if="shouldDisplayWarning && !encryptionEnabled" class="notecard warning" role="alert">
<p>{{ t('settings', 'Please read carefully before activating server-side encryption:') }}</p>
<ul>
Expand All @@ -34,7 +38,7 @@

<div v-if="encryptionEnabled">
<div v-if="encryptionReady">
<p v-if="encryptionModules.length === 0">
<p v-if="!hasEncryptionModules">
{{ t('settings', 'No encryption module loaded, please enable an encryption module in the app menu.') }}
</p>
<template v-else>
Expand Down Expand Up @@ -89,15 +93,26 @@ export default {
},
data() {
const encryptionModules = loadState('settings', 'encryption-modules')
const hasEncryptionModules = encryptionModules instanceof Array && encryptionModules.length > 0
let defaultCheckedModule = ''
if (hasEncryptionModules) {
const defaultModule = Object.entries(encryptionModules).find((module) => module[1].default)
if (defaultModule) {
defaultCheckedModule = foundModule[0]
}
} else {
logger.debug('No encryption module loaded or enabled')
}
return {
encryptionReady: loadState('settings', 'encryption-ready'),
encryptionEnabled: loadState('settings', 'encryption-enabled'),
encryptionReady: loadState('settings', 'encryption-ready', false),
encryptionEnabled: loadState('settings', 'encryption-enabled', false),
externalBackendsEnabled: loadState('settings', 'external-backends-enabled'),
encryptionAdminDoc: loadState('settings', 'encryption-admin-doc'),
encryptionModules,
shouldDisplayWarning: false,
migrating: false,
defaultCheckedModule: Object.entries(encryptionModules).find((module) => module[1].default)[0],
defaultCheckedModule,
hasEncryptionModules,
}
},
methods: {
Expand Down
Loading