Browse Source

Remove UI draft

For now we will keep the existing UI and only change the API behind it

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/32550/head
Côme Chilliet 2 years ago
parent
commit
968b82cacc
No known key found for this signature in database GPG Key ID: A3E2F658B28C760A
  1. 123
      apps/settings/src/components/SetupCheck.vue
  2. 43
      apps/settings/src/main-admin-setup-check.js
  3. 3
      apps/settings/templates/settings/admin/overview.php
  4. 1
      webpack.modules.js

123
apps/settings/src/components/SetupCheck.vue

@ -1,123 +0,0 @@
<template>
<NcSettingsSection :title="t('settings', 'Setup Checks')"
:description="t('settings', `It's important for the security and performance of your instance that everything is configured correctly. To help you with that we are doing some automatic checks. Please see the linked documentation for more information.`)">
<div v-for="(checks, category) in results"
:key="category"
class="check-card">
<div class="check-card__header" @click="toggleCollapse(category)">
<h3>{{ category }}</h3>
<Check v-if="stats[category].successes === stats[category].total"
:size="20"
:fill-color="'var(--color-success)'" />
<Check v-else-if="stats[category].errors > 0"
:size="20"
:fill-color="'var(--color-error)'" />
<Check v-else-if="stats[category].warnings > 0"
:size="20"
:fill-color="'var(--color-warning)'" />
<span>
{{ stats[category].successes }} / {{ stats[category].total }}
</span>
</div>
<div class="card__body" v-if="!collapsed[category]">
<div v-for="(check, name) in checks"
:key="name"
class="row-check"
:class="['row-check__' + check.severity]">
<template v-if="check.severity === 'success'">
<Check :size="20" :fill-color="'var(--color-success)'" />
</template>
{{ name }}
</div>
</div>
</div>
</NcSettingsSection>
</template>
<script>
import NcSettingsSection from '@nextcloud/vue/dist/Components/NcSettingsSection.js'
import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router'
import Check from 'vue-material-design-icons/Check.vue'
export default {
name: 'SetupCheck',
components: {
NcSettingsSection,
Check,
},
data() {
return {
results: [],
collapsed: {},
stats: {},
}
},
mounted() {
this.loadSetupChecks()
},
methods: {
toggleCollapse(category) {
this.collapsed[category] = !this.collapsed[category]
},
async loadSetupChecks() {
const { data } = await axios.get(generateUrl('/settings/setupcheck'))
const collapsed = {}
const stats = {}
for (const [category, checks] of Object.entries(data)) {
const values = Object.values(checks)
stats[category] = {
total: values.length,
successes: values.filter((check) => check.severity === 'success').length,
warnings: values.filter((check) => check.severity === 'warning').length,
errors: values.filter((check) => check.severity === 'errors').length,
}
collapsed[category] = stats[category].errors > 0
}
this.collapsed = collapsed
this.stats = stats
this.results = data
},
},
}
</script>
<style lang="scss" scoped>
.check-card {
border: 1px solid var(--color-border);
border-radius: var(--border-radius);
&__header {
padding: 0.5rem 1rem;
display: flex;
align-items: center;
h3 {
margin: 0;
}
.material-design-icon {
margin-left: auto;
margin-right: 0.5rem;
}
}
}
.row-check {
color: var(--color-text-light);
background-color: var(--note-background);
box-shadow: rgba(43, 42, 51, 0.05) 0 1px 2px 0;
margin: 0;
padding: 0.5rem 1rem;
display: flex;
align-items: center;
&__success {
--note-background: rgba(var(--color-success-rgb), 0.2);
--note-theme: var(--color-success);
}
&__error {
--note-background: rgba(var(--color-error-rgb), 0.2);
--note-theme: var(--color-error);
}
&__warning {
--note-background: rgba(var(--color-warning-rgb), 0.2);
--note-theme: var(--color-warning);
}
}
</style>

43
apps/settings/src/main-admin-setup-check.js

@ -1,43 +0,0 @@
/**
* @copyright 2022 Christopher Ng <chrng8@gmail.com>
*
* @author Christopher Ng <chrng8@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
import Vue from 'vue'
import { getRequestToken } from '@nextcloud/auth'
import { translate as t } from '@nextcloud/l10n'
import logger from './logger.js'
import SetupCheck from './components/SetupCheck.vue'
__webpack_nonce__ = btoa(getRequestToken())
Vue.mixin({
props: {
logger,
},
methods: {
t,
},
})
const SetupCheckView = Vue.extend(SetupCheck)
new SetupCheckView().$mount('#vue-admin-setup-check')

3
apps/settings/templates/settings/admin/overview.php

@ -25,7 +25,6 @@
/** @var array $_ */
/** @var \OCP\Defaults $theme */
\OCP\Util::addScript('settings', 'vue-settings-admin-setup-check');
?>
<div id="security-warning" class="section">
@ -67,8 +66,6 @@
</div>
<div id="vue-admin-setup-check"></div>
<div id="version" class="section">
<!-- should be the last part, so Updater can follow if enabled (it has no heading therefore). -->
<h2><?php p($l->t('Version'));?></h2>

1
webpack.modules.js

@ -90,7 +90,6 @@ module.exports = {
'vue-settings-admin-ai': path.join(__dirname, 'apps/settings/src', 'main-admin-ai.js'),
'vue-settings-admin-delegation': path.join(__dirname, 'apps/settings/src', 'main-admin-delegation.js'),
'vue-settings-admin-security': path.join(__dirname, 'apps/settings/src', 'main-admin-security.js'),
'vue-settings-admin-setup-check': path.join(__dirname, 'apps/settings/src', 'main-admin-setup-check.js'),
'vue-settings-apps-users-management': path.join(__dirname, 'apps/settings/src', 'main-apps-users-management.js'),
'vue-settings-nextcloud-pdf': path.join(__dirname, 'apps/settings/src', 'main-nextcloud-pdf.js'),
'vue-settings-personal-info': path.join(__dirname, 'apps/settings/src', 'main-personal-info.js'),

Loading…
Cancel
Save