]> source.dussan.org Git - nextcloud-server.git/commitdiff
AI admin settings: lint:fix
authorMarcel Klehr <mklehr@gmx.net>
Tue, 25 Jul 2023 12:47:27 +0000 (14:47 +0200)
committerJulien Veyssier <julien-nc@posteo.net>
Wed, 2 Aug 2023 10:37:35 +0000 (12:37 +0200)
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
20 files changed:
apps/settings/src/admin.js
apps/settings/src/components/AdminAI.vue
apps/settings/src/components/AdminDelegation/GroupSelect.vue
apps/settings/src/components/AdminTwoFactor.vue
apps/settings/src/components/AuthTokenSection.vue
apps/settings/src/components/Markdown.vue
apps/settings/src/components/PersonalInfo/AvatarSection.vue
apps/settings/src/components/PersonalInfo/DetailsSection.vue
apps/settings/src/components/PersonalInfo/DisplayNameSection.vue
apps/settings/src/components/PersonalInfo/EmailSection/EmailSection.vue
apps/settings/src/components/PersonalInfo/LanguageSection/Language.vue
apps/settings/src/components/PersonalInfo/LocaleSection/Locale.vue
apps/settings/src/components/PersonalInfo/shared/AccountPropertySection.vue
apps/settings/src/components/PersonalInfo/shared/HeaderBar.vue
apps/settings/src/components/UserList.vue
apps/settings/src/components/Users/NewUserModal.vue
apps/settings/src/components/Users/UserRow.vue
apps/settings/src/main-admin-ai.js [new file with mode: 0644]
apps/settings/src/main-admin-security.js
apps/settings/src/utils/userUtils.ts

index 3bbfb564763ad9d891fc62ba2380b6a1a90bc87e..c8d04049ded06500f003bd00fd6af6eda3028511 100644 (file)
@@ -242,7 +242,7 @@ window.addEventListener('DOMContentLoaded', () => {
                        OC.SetupChecks.checkSetup(),
                        OC.SetupChecks.checkGeneric(),
                        OC.SetupChecks.checkWOFF2Loading(OC.filePath('core', '', 'fonts/NotoSans-Regular-latin.woff2'), OC.theme.docPlaceholderUrl),
-                       OC.SetupChecks.checkDataProtected()
+                       OC.SetupChecks.checkDataProtected(),
                ).then((check1, check2, check3, check4, check5, check6, check7, check8, check9, check10, check11) => {
                        const messages = [].concat(check1, check2, check3, check4, check5, check6, check7, check8, check9, check10, check11)
                        const $el = $('#postsetupchecks')
index 5461e3f69d8d8420ee2dc8c316bd6e19fced1902..05175bb798801130b9002c686da6250567472092 100644 (file)
@@ -88,7 +88,7 @@ export default {
        methods: {
                async saveChanges() {
                        this.loading = true
-                       const data = {settings: this.settings}
+                       const data = { settings: this.settings }
                        try {
                                await axios.put(generateUrl('/settings/api/admin/ai'), data)
                        } catch (err) {
index 82b5e51fb45022768f71763ecd6fad2c0e1b0fb9..915935167604aac887cc74e7ddf0c7033c8651f4 100644 (file)
@@ -1,6 +1,6 @@
 <template>
-       <NcSelect :input-id="setting.id"
-               v-model="selected"
+       <NcSelect v-model="selected"
+               :input-id="setting.id"
                class="group-select"
                :placeholder="t('settings', 'None')"
                label="displayName"
index 27e1b2f4e84442dbb2ca237590a0cc19eb96f14e..d45e7f7f6ff38328cf75275c86bb882cd73475bf 100644 (file)
@@ -22,8 +22,8 @@
                                <label for="enforcedGroups">
                                        <span>{{ t('settings', 'Enforced groups') }}</span>
                                </label>
-                               <NcSelect input-id="enforcedGroups"
-                                       v-model="enforcedGroups"
+                               <NcSelect v-model="enforcedGroups"
+                                       input-id="enforcedGroups"
                                        :options="groups"
                                        :disabled="loading"
                                        :multiple="true"
@@ -38,8 +38,8 @@
                                <label for="excludedGroups">
                                        <span>{{ t('settings', 'Excluded groups') }}</span>
                                </label>
-                               <NcSelect input-id="excludedGroups"
-                                       v-model="excludedGroups"
+                               <NcSelect v-model="excludedGroups"
+                                       input-id="excludedGroups"
                                        :options="groups"
                                        :disabled="loading"
                                        :multiple="true"
index 01a85f4ae1b2d06763ee679fcb621c43f5bd5aa6..bb9bd3fb065137589d1b026e2d220b33259f476e 100644 (file)
@@ -49,7 +49,7 @@ const confirm = () => {
                        t('settings', 'Do you really want to wipe your data from this device?'),
                        t('settings', 'Confirm wipe'),
                        resolve,
-                       true
+                       true,
                )
        })
 }
index fbbbf7456a179435647ea4bcb1d8074265f728ce..dcbd44b186bab0c9cfb48a78c609134e726b9c4a 100644 (file)
@@ -100,7 +100,7 @@ export default {
                                                'del',
                                                'blockquote',
                                        ],
-                               }
+                               },
                        )
                },
        },
index a69cf368d9f5e321cc3cf3f981e9ec886345b248..d6fa8d52367bff5e337ecb2aba72a03291c92651 100644 (file)
@@ -22,7 +22,9 @@
 
 <template>
        <section id="vue-avatar-section">
-               <h3 class="hidden-visually"> {{ t('settings', 'Your profile information') }} </h3>
+               <h3 class="hidden-visually">
+                       {{ t('settings', 'Your profile information') }}
+               </h3>
                <HeaderBar :input-id="avatarChangeSupported ? inputId : null"
                        :readable="avatar.readable"
                        :scope.sync="avatar.scope" />
                <div v-if="!showCropper" class="avatar__container">
                        <div class="avatar__preview">
                                <NcAvatar v-if="!loading"
+                                       :key="version"
                                        :user="userId"
                                        :aria-label="t('settings', 'Your profile picture')"
                                        :disabled-menu="true"
                                        :disabled-tooltip="true"
                                        :show-user-status="false"
-                                       :size="180"
-                                       :key="version" />
+                                       :size="180" />
                                <div v-else class="icon-loading" />
                        </div>
                        <template v-if="avatarChangeSupported">
@@ -62,8 +64,8 @@
                                        </NcButton>
                                </div>
                                <span>{{ t('settings', 'The file must be a PNG or JPG') }}</span>
-                               <input ref="input"
-                                       :id="inputId"
+                               <input :id="inputId"
+                                       ref="input"
                                        type="file"
                                        :accept="validMimeTypes.join(',')"
                                        @change="onChange">
index 10f9b757220d3533c2876e68d497afa12ce1de87..075ed6f71e2b6b8109512a60d7b3b01740565dea 100644 (file)
@@ -29,7 +29,9 @@
                                <Account :size="20" />
                                <div class="details__groups-info">
                                        <p>{{ t('settings', 'You are a member of the following groups:') }}</p>
-                                       <p class="details__groups-list">{{ groups.join(', ') }}</p>
+                                       <p class="details__groups-list">
+                                               {{ groups.join(', ') }}
+                                       </p>
                                </div>
                        </div>
                        <div class="details__quota">
@@ -69,6 +71,13 @@ export default {
                NcProgressBar,
        },
 
+       data() {
+               return {
+                       groups,
+                       usageRelative,
+               }
+       },
+
        computed: {
                quotaText() {
                        if (quota === SPACE_UNLIMITED) {
@@ -79,14 +88,7 @@ export default {
                                'You are using <strong>{usage}</strong> of <strong>{totalSpace}</strong> (<strong>{usageRelative}%</strong>)',
                                { usage, totalSpace, usageRelative },
                        )
-               }
-       },
-
-       data() {
-               return {
-                       groups,
-                       usageRelative,
-               }
+               },
        },
 }
 </script>
index b88f52e0df4c695e1174bdc2038adb38a940faad..00a629c4d5443b31a044e29827b08f43b20787dd 100644 (file)
@@ -66,6 +66,6 @@ export default {
                        }
                        emit('settings:display-name:updated', value)
                },
-       }
+       },
 }
 </script>
index 613b90356c3d7d718ef0954b09fc63a4ea547ec5..980af3e62b0cb658b39c506f999efd3e794f13e2 100644 (file)
@@ -153,7 +153,7 @@ export default {
                                this.handleResponse(
                                        'error',
                                        t('settings', 'Unable to update primary email address'),
-                                       e
+                                       e,
                                )
                        }
                },
@@ -166,7 +166,7 @@ export default {
                                this.handleResponse(
                                        'error',
                                        t('settings', 'Unable to delete additional email address'),
-                                       e
+                                       e,
                                )
                        }
                },
@@ -178,7 +178,7 @@ export default {
                                this.handleResponse(
                                        'error',
                                        t('settings', 'Unable to delete additional email address'),
-                                       {}
+                                       {},
                                )
                        }
                },
index 959e7153e17bea5ae0da77143b5cb6821832955a..bacc687c58eb2c3aab66fabe72fa441aaa5f750a 100644 (file)
@@ -88,7 +88,7 @@ export default {
                allLanguages() {
                        return Object.freeze(
                                [...this.commonLanguages, ...this.otherLanguages]
-                                       .reduce((acc, { code, name }) => ({ ...acc, [code]: name }), {})
+                                       .reduce((acc, { code, name }) => ({ ...acc, [code]: name }), {}),
                        )
                },
        },
index 7bb78f74cc2d32f297d32e2c644404e4e0dde414..6f296a6c124bbd99b3a1bca912cf0f9dd1bebdbb 100644 (file)
@@ -50,7 +50,7 @@
                                        <span>{{ example.time }}</span>
                                </p>
                                <p>
-                                       {{ t('settings', 'Week starts on {firstDayOfWeek}', { firstDayOfWeek: this.example.firstDayOfWeek }) }}
+                                       {{ t('settings', 'Week starts on {firstDayOfWeek}', { firstDayOfWeek: example.firstDayOfWeek }) }}
                                </p>
                        </div>
                </div>
@@ -107,7 +107,7 @@ export default {
                allLocales() {
                        return Object.freeze(
                                [...this.localesForLanguage, ...this.otherLocales]
-                                       .reduce((acc, { code, name }) => ({ ...acc, [code]: name }), {})
+                                       .reduce((acc, { code, name }) => ({ ...acc, [code]: name }), {}),
                        )
                },
        },
index 2329cf123f580ae1db4aa5a0c04f976d5077eccf..59cccc547148668d86debcdb2d7d2188b01f907d 100644 (file)
@@ -38,8 +38,8 @@
                                autocorrect="off"
                                @input="onPropertyChange" />
                        <input v-else
-                               ref="input"
                                :id="inputId"
+                               ref="input"
                                :placeholder="placeholder"
                                :type="type"
                                :value="value"
index 8db2a43f6bca148a1d63b23e0fb1c019e9e69738..b149d8405f4e127367bffcdb4c844165791fc851 100644 (file)
@@ -100,7 +100,7 @@ export default {
                isHeading: {
                        type: Boolean,
                        default: false,
-               }
+               },
        },
 
        data() {
index d79d695f771a605189910953b5349f850d19fe36..9fcf4d4e5261613cd97e1cec9c92e5eab03a9b5c 100644 (file)
@@ -42,9 +42,9 @@
                </NcEmptyContent>
 
                <RecycleScroller v-else
+                       ref="scroller"
                        class="user-list"
                        :style="style"
-                       ref="scroller"
                        :items="filteredUsers"
                        key-field="id"
                        role="table"
@@ -55,7 +55,6 @@
                        :item-size="rowHeight"
                        @hook:mounted="handleMounted"
                        @scroll-end="handleScrollEnd">
-
                        <template #before>
                                <caption class="hidden-visually">
                                        {{ t('settings', 'List of users. This list is not fully rendered for performance reasons. The users will be rendered as you navigate through the list.') }}
@@ -79,7 +78,6 @@
                                <UserListFooter :loading="loading.users"
                                        :filtered-users="filteredUsers" />
                        </template>
-
                </RecycleScroller>
        </Fragment>
 </template>
index d8a9eb64a3ea9a3a56174422885d2ccc91e77b37..00ce7c92600dd3f1eef206509dbf10886990c043 100644 (file)
@@ -29,8 +29,8 @@
                        :disabled="loading.all"
                        @submit.prevent="createUser">
                        <h2>{{ t('settings', 'New user') }}</h2>
-                       <NcTextField class="modal__item"
-                               ref="username"
+                       <NcTextField ref="username"
+                               class="modal__item"
                                data-test="username"
                                :value.sync="newUser.id"
                                :disabled="settings.newUserGenerateUserID"
                                autocomplete="off"
                                autocorrect="off" />
                        <span v-if="!settings.newUserRequireEmail"
-                               class="modal__hint"
-                               id="password-email-hint">
+                               id="password-email-hint"
+                               class="modal__hint">
                                {{ t('settings', 'Either password or email is required') }}
                        </span>
-                       <NcPasswordField class="modal__item"
-                               ref="password"
+                       <NcPasswordField ref="password"
+                               class="modal__item"
                                data-test="password"
                                :value.sync="newUser.password"
                                :minlength="minPasswordLength"
@@ -81,8 +81,8 @@
                        <div class="modal__item">
                                <!-- hidden input trick for vanilla html5 form validation -->
                                <NcTextField v-if="!settings.isAdmin"
-                                       tabindex="-1"
                                        id="new-user-groups-input"
+                                       tabindex="-1"
                                        :class="{ 'icon-loading-small': loading.groups }"
                                        :value="newUser.groups"
                                        :required="!settings.isAdmin" />
                                        for="new-user-sub-admin">
                                        {{ t('settings', 'Administered groups') }}
                                </label>
-                               <NcSelect class="modal__select"
+                               <NcSelect v-model="newUser.subAdminsGroups"
+                                       class="modal__select"
                                        input-id="new-user-sub-admin"
                                        :placeholder="t('settings', 'Set user as admin for …')"
                                        :options="subAdminsGroups"
-                                       v-model="newUser.subAdminsGroups"
                                        :close-on-select="false"
                                        :multiple="true"
                                        label="name" />
                                        for="new-user-quota">
                                        {{ t('settings', 'Quota') }}
                                </label>
-                               <NcSelect class="modal__select"
+                               <NcSelect v-model="newUser.quota"
+                                       class="modal__select"
                                        input-id="new-user-quota"
                                        :placeholder="t('settings', 'Set user quota')"
                                        :options="quotaOptions"
-                                       v-model="newUser.quota"
                                        :clearable="false"
                                        :taggable="true"
                                        :create-option="validateQuota" />
                                        for="new-user-language">
                                        {{ t('settings', 'Language') }}
                                </label>
-                               <NcSelect       class="modal__select"
+                               <NcSelect       v-model="newUser.language"
+                                       class="modal__select"
                                        input-id="new-user-language"
                                        :placeholder="t('settings', 'Set default language')"
                                        :clearable="false"
                                        :selectable="option => !option.languages"
                                        :filter-by="languageFilterBy"
                                        :options="languages"
-                                       v-model="newUser.language"
                                        label="name" />
                        </div>
                        <div :class="['modal__item managers', { 'icon-loading-small': loading.manager }]">
                                        <!-- TRANSLATORS This string describes a manager in the context of an organization -->
                                        {{ t('settings', 'Manager') }}
                                </label>
-                               <NcSelect class="modal__select"
+                               <NcSelect v-model="newUser.manager"
+                                       class="modal__select"
                                        input-id="new-user-manager"
                                        :placeholder="managerLabel"
                                        :options="possibleManagers"
-                                       v-model="newUser.manager"
                                        :user-select="true"
                                        label="displayname"
                                        @search="searchUserManager" />
@@ -366,7 +366,7 @@ export default {
                        // Show group header of the language
                        if (option.languages) {
                                return option.languages.some(
-                                       ({ name }) => name.toLocaleLowerCase().includes(search.toLocaleLowerCase())
+                                       ({ name }) => name.toLocaleLowerCase().includes(search.toLocaleLowerCase()),
                                )
                        }
 
index fcd9829db1eb5dad28498176e230b97bfb223fea..b230e9a9bf8ef86e1d40543948d2e34e3a57e2e3 100644 (file)
@@ -44,8 +44,8 @@
                                        {{ t('settings', 'Edit display name') }}
                                </label>
                                <NcTextField :id="'displayName' + uniqueId"
-                                       data-test="displayNameField"
                                        ref="displayNameField"
+                                       data-test="displayNameField"
                                        :show-trailing-button="true"
                                        class="user-row-text-field"
                                        :class="{ 'icon-loading-small': idState.loading.displayName }"
                        </template>
                        <template v-else-if="!isObfuscated">
                                <label :for="'quota-progress' + uniqueId">{{ userQuota }} ({{ usedSpace }})</label>
-                               <NcProgressBar class="row__progress"
-                                       :id="'quota-progress' + uniqueId"
+                               <NcProgressBar :id="'quota-progress' + uniqueId"
+                                       class="row__progress"
                                        :class="{
                                                'row__progress--warn': usedQuota > 80,
                                        }"
diff --git a/apps/settings/src/main-admin-ai.js b/apps/settings/src/main-admin-ai.js
new file mode 100644 (file)
index 0000000..485b219
--- /dev/null
@@ -0,0 +1,39 @@
+/**
+ * @copyright Copyright (c) 2016 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author Christoph Wurst <christoph@winzerhof-wurst.at>
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @license AGPL-3.0-or-later
+ *
+ * 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 ArtificialIntelligence from './components/AdminAI.vue'
+
+// eslint-disable-next-line camelcase
+__webpack_nonce__ = btoa(OC.requestToken)
+
+Vue.prototype.t = t
+
+// Not used here but required for legacy templates
+window.OC = window.OC || {}
+window.OC.Settings = window.OC.Settings || {}
+
+const View = Vue.extend(ArtificialIntelligence)
+new View().$mount('#ai-settings')
index f3279f45c939257c599daaf10c44f3ad4469ee1a..a5c239683e7d761d9a6122a5bdd34da114a0d954 100644 (file)
@@ -39,7 +39,7 @@ window.OC = window.OC || {}
 window.OC.Settings = window.OC.Settings || {}
 
 store.replaceState(
-       loadState('settings', 'mandatory2FAState')
+       loadState('settings', 'mandatory2FAState'),
 )
 
 const View = Vue.extend(AdminTwoFactor)
index eff8315b693d9261ca45861411c0f2b53e04a73e..b6c96624139618a71fd9208b0275a335848c9db1 100644 (file)
@@ -33,6 +33,8 @@ export const defaultQuota = {
 /**
  * Return `true` if the logged in user does not have permissions to view the
  * data of `user`
+ * @param user
+ * @param user.id
  */
 export const isObfuscated = (user: { id: string, [key: string]: any }) => {
        const keys = Object.keys(user)