use node 16, bump js libs, use material icons, fix admin/user settings style etc...

Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
This commit is contained in:
Julien Veyssier 2022-08-26 12:35:01 +02:00
Родитель bb6d650632
Коммит bae3ff88a8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4141FEE162030638
16 изменённых файлов: 3298 добавлений и 3364 удалений

Просмотреть файл

@ -1,21 +1,3 @@
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
<svg width="512px" height="512px" enable-background="new 0 0 438.549 438.549" version="1.1" viewBox="0 0 438.55 438.55" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
<path d="m409.13 114.57c-19.608-33.596-46.205-60.194-79.798-79.8-33.598-19.607-70.277-29.408-110.06-29.408-39.781 0-76.472 9.804-110.06 29.408-33.596 19.605-60.192 46.204-79.8 79.8-19.605 33.595-29.408 70.281-29.408 110.06 0 47.78 13.94 90.745 41.827 128.91 27.884 38.164 63.906 64.572 108.06 79.227 5.14 0.954 8.945 0.283 11.419-1.996 2.475-2.282 3.711-5.14 3.711-8.562 0-0.571-0.049-5.708-0.144-15.417-0.098-9.709-0.144-18.179-0.144-25.406l-6.567 1.136c-4.187 0.767-9.469 1.092-15.846 1-6.374-0.089-12.991-0.757-19.842-1.999-6.854-1.231-13.229-4.086-19.13-8.559-5.898-4.473-10.085-10.328-12.56-17.556l-2.855-6.57c-1.903-4.374-4.899-9.233-8.992-14.559-4.093-5.331-8.232-8.945-12.419-10.848l-1.999-1.431c-1.332-0.951-2.568-2.098-3.711-3.429-1.142-1.331-1.997-2.663-2.568-3.997-0.572-1.335-0.098-2.43 1.427-3.289s4.281-1.276 8.28-1.276l5.708 0.853c3.807 0.763 8.516 3.042 14.133 6.851 5.614 3.806 10.229 8.754 13.846 14.842 4.38 7.806 9.657 13.754 15.846 17.847 6.184 4.093 12.419 6.136 18.699 6.136s11.704-0.476 16.274-1.423c4.565-0.952 8.848-2.383 12.847-4.285 1.713-12.758 6.377-22.559 13.988-29.41-10.848-1.14-20.601-2.857-29.264-5.14-8.658-2.286-17.605-5.996-26.835-11.14-9.235-5.137-16.896-11.516-22.985-19.126-6.09-7.614-11.088-17.61-14.987-29.979-3.901-12.374-5.852-26.648-5.852-42.826 0-23.035 7.52-42.637 22.557-58.817-7.044-17.318-6.379-36.732 1.997-58.24 5.52-1.715 13.706-0.428 24.554 3.853 10.85 4.283 18.794 7.952 23.84 10.994 5.046 3.041 9.089 5.618 12.135 7.708 17.705-4.947 35.976-7.421 54.818-7.421s37.117 2.474 54.823 7.421l10.849-6.849c7.419-4.57 16.18-8.758 26.262-12.565 10.088-3.805 17.802-4.853 23.134-3.138 8.562 21.509 9.325 40.922 2.279 58.24 15.036 16.18 22.559 35.787 22.559 58.817 0 16.178-1.958 30.497-5.853 42.966-3.9 12.471-8.941 22.457-15.125 29.979-6.191 7.521-13.901 13.85-23.131 18.986-9.232 5.14-18.182 8.85-26.84 11.136-8.662 2.286-18.415 4.004-29.263 5.146 9.894 8.562 14.842 22.077 14.842 40.539v60.237c0 3.422 1.19 6.279 3.572 8.562 2.379 2.279 6.136 2.95 11.276 1.995 44.163-14.653 80.185-41.062 108.07-79.226 27.88-38.161 41.825-81.126 41.825-128.91-0.01-39.771-9.818-76.454-29.414-110.05z"/>
<svg width="512px" height="512px" enable-background="new 0 0 438.549 438.549" version="1.1" viewBox="0 0 438.55 438.55" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" fill="#000">
<path d="m409.13 114.57c-19.608-33.596-46.205-60.194-79.798-79.8-33.598-19.607-70.277-29.408-110.06-29.408-39.781 0-76.472 9.804-110.06 29.408-33.596 19.605-60.192 46.204-79.8 79.8-19.605 33.595-29.408 70.281-29.408 110.06 0 47.78 13.94 90.745 41.827 128.91 27.884 38.164 63.906 64.572 108.06 79.227 5.14 0.954 8.945 0.283 11.419-1.996 2.475-2.282 3.711-5.14 3.711-8.562 0-0.571-0.049-5.708-0.144-15.417-0.098-9.709-0.144-18.179-0.144-25.406l-6.567 1.136c-4.187 0.767-9.469 1.092-15.846 1-6.374-0.089-12.991-0.757-19.842-1.999-6.854-1.231-13.229-4.086-19.13-8.559-5.898-4.473-10.085-10.328-12.56-17.556l-2.855-6.57c-1.903-4.374-4.899-9.233-8.992-14.559-4.093-5.331-8.232-8.945-12.419-10.848l-1.999-1.431c-1.332-0.951-2.568-2.098-3.711-3.429-1.142-1.331-1.997-2.663-2.568-3.997-0.572-1.335-0.098-2.43 1.427-3.289s4.281-1.276 8.28-1.276l5.708 0.853c3.807 0.763 8.516 3.042 14.133 6.851 5.614 3.806 10.229 8.754 13.846 14.842 4.38 7.806 9.657 13.754 15.846 17.847 6.184 4.093 12.419 6.136 18.699 6.136s11.704-0.476 16.274-1.423c4.565-0.952 8.848-2.383 12.847-4.285 1.713-12.758 6.377-22.559 13.988-29.41-10.848-1.14-20.601-2.857-29.264-5.14-8.658-2.286-17.605-5.996-26.835-11.14-9.235-5.137-16.896-11.516-22.985-19.126-6.09-7.614-11.088-17.61-14.987-29.979-3.901-12.374-5.852-26.648-5.852-42.826 0-23.035 7.52-42.637 22.557-58.817-7.044-17.318-6.379-36.732 1.997-58.24 5.52-1.715 13.706-0.428 24.554 3.853 10.85 4.283 18.794 7.952 23.84 10.994 5.046 3.041 9.089 5.618 12.135 7.708 17.705-4.947 35.976-7.421 54.818-7.421s37.117 2.474 54.823 7.421l10.849-6.849c7.419-4.57 16.18-8.758 26.262-12.565 10.088-3.805 17.802-4.853 23.134-3.138 8.562 21.509 9.325 40.922 2.279 58.24 15.036 16.18 22.559 35.787 22.559 58.817 0 16.178-1.958 30.497-5.853 42.966-3.9 12.471-8.941 22.457-15.125 29.979-6.191 7.521-13.901 13.85-23.131 18.986-9.232 5.14-18.182 8.85-26.84 11.136-8.662 2.286-18.415 4.004-29.263 5.146 9.894 8.562 14.842 22.077 14.842 40.539v60.237c0 3.422 1.19 6.279 3.572 8.562 2.379 2.279 6.136 2.95 11.276 1.995 44.163-14.653 80.185-41.062 108.07-79.226 27.88-38.161 41.825-81.126 41.825-128.91-0.01-39.771-9.818-76.454-29.414-110.05z" />
</svg>

До

Ширина:  |  Высота:  |  Размер: 2.4 KiB

После

Ширина:  |  Высота:  |  Размер: 2.3 KiB

Просмотреть файл

@ -1,21 +1,3 @@
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
<svg width="512px" height="512px" enable-background="new 0 0 438.549 438.549" version="1.1" viewBox="0 0 438.55 438.55" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
<path d="m409.13 114.57c-19.608-33.596-46.205-60.194-79.798-79.8-33.598-19.607-70.277-29.408-110.06-29.408-39.781 0-76.472 9.804-110.06 29.408-33.596 19.605-60.192 46.204-79.8 79.8-19.605 33.595-29.408 70.281-29.408 110.06 0 47.78 13.94 90.745 41.827 128.91 27.884 38.164 63.906 64.572 108.06 79.227 5.14 0.954 8.945 0.283 11.419-1.996 2.475-2.282 3.711-5.14 3.711-8.562 0-0.571-0.049-5.708-0.144-15.417-0.098-9.709-0.144-18.179-0.144-25.406l-6.567 1.136c-4.187 0.767-9.469 1.092-15.846 1-6.374-0.089-12.991-0.757-19.842-1.999-6.854-1.231-13.229-4.086-19.13-8.559-5.898-4.473-10.085-10.328-12.56-17.556l-2.855-6.57c-1.903-4.374-4.899-9.233-8.992-14.559-4.093-5.331-8.232-8.945-12.419-10.848l-1.999-1.431c-1.332-0.951-2.568-2.098-3.711-3.429-1.142-1.331-1.997-2.663-2.568-3.997-0.572-1.335-0.098-2.43 1.427-3.289s4.281-1.276 8.28-1.276l5.708 0.853c3.807 0.763 8.516 3.042 14.133 6.851 5.614 3.806 10.229 8.754 13.846 14.842 4.38 7.806 9.657 13.754 15.846 17.847 6.184 4.093 12.419 6.136 18.699 6.136s11.704-0.476 16.274-1.423c4.565-0.952 8.848-2.383 12.847-4.285 1.713-12.758 6.377-22.559 13.988-29.41-10.848-1.14-20.601-2.857-29.264-5.14-8.658-2.286-17.605-5.996-26.835-11.14-9.235-5.137-16.896-11.516-22.985-19.126-6.09-7.614-11.088-17.61-14.987-29.979-3.901-12.374-5.852-26.648-5.852-42.826 0-23.035 7.52-42.637 22.557-58.817-7.044-17.318-6.379-36.732 1.997-58.24 5.52-1.715 13.706-0.428 24.554 3.853 10.85 4.283 18.794 7.952 23.84 10.994 5.046 3.041 9.089 5.618 12.135 7.708 17.705-4.947 35.976-7.421 54.818-7.421s37.117 2.474 54.823 7.421l10.849-6.849c7.419-4.57 16.18-8.758 26.262-12.565 10.088-3.805 17.802-4.853 23.134-3.138 8.562 21.509 9.325 40.922 2.279 58.24 15.036 16.18 22.559 35.787 22.559 58.817 0 16.178-1.958 30.497-5.853 42.966-3.9 12.471-8.941 22.457-15.125 29.979-6.191 7.521-13.901 13.85-23.131 18.986-9.232 5.14-18.182 8.85-26.84 11.136-8.662 2.286-18.415 4.004-29.263 5.146 9.894 8.562 14.842 22.077 14.842 40.539v60.237c0 3.422 1.19 6.279 3.572 8.562 2.379 2.279 6.136 2.95 11.276 1.995 44.163-14.653 80.185-41.062 108.07-79.226 27.88-38.161 41.825-81.126 41.825-128.91-0.01-39.771-9.818-76.454-29.414-110.05z" fill="#fff"/>
<svg width="512px" height="512px" enable-background="new 0 0 438.549 438.549" version="1.1" viewBox="0 0 438.55 438.55" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" fill="#fff">
<path d="m409.13 114.57c-19.608-33.596-46.205-60.194-79.798-79.8-33.598-19.607-70.277-29.408-110.06-29.408-39.781 0-76.472 9.804-110.06 29.408-33.596 19.605-60.192 46.204-79.8 79.8-19.605 33.595-29.408 70.281-29.408 110.06 0 47.78 13.94 90.745 41.827 128.91 27.884 38.164 63.906 64.572 108.06 79.227 5.14 0.954 8.945 0.283 11.419-1.996 2.475-2.282 3.711-5.14 3.711-8.562 0-0.571-0.049-5.708-0.144-15.417-0.098-9.709-0.144-18.179-0.144-25.406l-6.567 1.136c-4.187 0.767-9.469 1.092-15.846 1-6.374-0.089-12.991-0.757-19.842-1.999-6.854-1.231-13.229-4.086-19.13-8.559-5.898-4.473-10.085-10.328-12.56-17.556l-2.855-6.57c-1.903-4.374-4.899-9.233-8.992-14.559-4.093-5.331-8.232-8.945-12.419-10.848l-1.999-1.431c-1.332-0.951-2.568-2.098-3.711-3.429-1.142-1.331-1.997-2.663-2.568-3.997-0.572-1.335-0.098-2.43 1.427-3.289s4.281-1.276 8.28-1.276l5.708 0.853c3.807 0.763 8.516 3.042 14.133 6.851 5.614 3.806 10.229 8.754 13.846 14.842 4.38 7.806 9.657 13.754 15.846 17.847 6.184 4.093 12.419 6.136 18.699 6.136s11.704-0.476 16.274-1.423c4.565-0.952 8.848-2.383 12.847-4.285 1.713-12.758 6.377-22.559 13.988-29.41-10.848-1.14-20.601-2.857-29.264-5.14-8.658-2.286-17.605-5.996-26.835-11.14-9.235-5.137-16.896-11.516-22.985-19.126-6.09-7.614-11.088-17.61-14.987-29.979-3.901-12.374-5.852-26.648-5.852-42.826 0-23.035 7.52-42.637 22.557-58.817-7.044-17.318-6.379-36.732 1.997-58.24 5.52-1.715 13.706-0.428 24.554 3.853 10.85 4.283 18.794 7.952 23.84 10.994 5.046 3.041 9.089 5.618 12.135 7.708 17.705-4.947 35.976-7.421 54.818-7.421s37.117 2.474 54.823 7.421l10.849-6.849c7.419-4.57 16.18-8.758 26.262-12.565 10.088-3.805 17.802-4.853 23.134-3.138 8.562 21.509 9.325 40.922 2.279 58.24 15.036 16.18 22.559 35.787 22.559 58.817 0 16.178-1.958 30.497-5.853 42.966-3.9 12.471-8.941 22.457-15.125 29.979-6.191 7.521-13.901 13.85-23.131 18.986-9.232 5.14-18.182 8.85-26.84 11.136-8.662 2.286-18.415 4.004-29.263 5.146 9.894 8.562 14.842 22.077 14.842 40.539v60.237c0 3.422 1.19 6.279 3.572 8.562 2.379 2.279 6.136 2.95 11.276 1.995 44.163-14.653 80.185-41.062 108.07-79.226 27.88-38.161 41.825-81.126 41.825-128.91-0.01-39.771-9.818-76.454-29.414-110.05z" />
</svg>

До

Ширина:  |  Высота:  |  Размер: 2.4 KiB

После

Ширина:  |  Высота:  |  Размер: 2.3 KiB

Просмотреть файл

@ -133,7 +133,7 @@ class ConfigController extends Controller {
if ($oauthOrigin === 'settings') {
return new RedirectResponse(
$this->urlGenerator->linkToRoute('settings.PersonalSettings.index', ['section' => 'connected-accounts']) .
'?gitlabToken=success'
'?githubToken=success'
);
} elseif ($oauthOrigin === 'dashboard') {
return new RedirectResponse(

Просмотреть файл

@ -30,10 +30,12 @@ class Admin implements ISettings {
public function getForm(): TemplateResponse {
$clientID = $this->config->getAppValue(Application::APP_ID, 'client_id');
$clientSecret = $this->config->getAppValue(Application::APP_ID, 'client_secret');
$usePopup = $this->config->getAppValue(Application::APP_ID, 'use_popup', '0');
$adminConfig = [
'client_id' => $clientID,
'client_secret' => $clientSecret,
'use_popup' => ($usePopup === '1'),
];
$this->initialStateService->provideInitialState('admin-config', $adminConfig);
return new TemplateResponse(Application::APP_ID, 'adminSettings');

6166
package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -31,21 +31,22 @@
"browserslist": [
"extends @nextcloud/browserslist-config"
],
"engines": {
"node": "^16.0.0",
"npm": "^7.0.0 || ^8.0.0"
},
"dependencies": {
"@nextcloud/auth": "^1.3.0",
"@nextcloud/axios": "^1.6.0",
"@nextcloud/auth": "^2.0.0",
"@nextcloud/axios": "^2.0.0",
"@nextcloud/dialogs": "^3.1.2",
"@nextcloud/initial-state": "^1.1.2",
"@nextcloud/initial-state": "^2.0.0",
"@nextcloud/l10n": "^1.4.0",
"@nextcloud/moment": "^1.1.1",
"@nextcloud/router": "^2.0.0",
"@nextcloud/vue": "^5.3.1",
"@nextcloud/vue-dashboard": "^2.0.1",
"vue": "^2.6.14"
},
"engines": {
"node": "^14.0.0",
"npm": "^7.0.0"
"vue": "^2.6.14",
"vue-material-design-icons": "^5.1.2"
},
"devDependencies": {
"@nextcloud/babel-config": "^1.0.0",

Просмотреть файл

@ -12,8 +12,8 @@
*/
import Vue from 'vue'
import './bootstrap'
import AdminSettings from './components/AdminSettings'
import './bootstrap.js'
import AdminSettings from './components/AdminSettings.vue'
// eslint-disable-next-line
'use strict'

Просмотреть файл

@ -1,61 +1,87 @@
<template>
<div id="github_prefs" class="section">
<h2>
<a class="icon icon-github" />
<GithubIcon class="icon" />
{{ t('integration_github', 'GitHub integration') }}
</h2>
<p class="settings-hint">
{{ t('integration_github', 'If you want to allow your Nextcloud users to use OAuth to authenticate to https://github.com, create an OAuth application in your GitHub settings.') }}
<a href="https://github.com/settings/developers" class="external">{{ t('integration_github', 'GitHub OAuth settings') }}</a>
<br>
</p>
<p class="settings-hint">
{{ t('integration_github', 'Set "Application name", "Homepage URL" and "Application description" to values that will make sense to your Nextcloud users as they will see them when connecting to GitHub using your OAuth app.') }}
<br><br>
<span class="icon icon-details" />
</p>
<br>
<p class="settings-hint">
<InformationOutlineIcon :size="20" class="icon" />
{{ t('integration_github', 'Make sure you set the "Authorization callback URL" to') }}
<b> {{ redirect_uri }} </b>
<br><br>
</p>
<strong>{{ redirect_uri }}</strong>
<br><br>
<p class="settings-hint">
{{ t('integration_github', 'Put the OAuth app "Client ID" and "Client secret" below.') }}
</p>
<p class="settings-hint">
{{ t('integration_github', 'Your Nextcloud users will then see a "Connect to GitHub" button in their personal settings.') }}
</p>
<div class="grid-form">
<label for="github-client-id">
<a class="icon icon-category-auth" />
{{ t('integration_github', 'Client ID') }}
</label>
<input id="github-client-id"
v-model="state.client_id"
type="password"
:readonly="readonly"
:placeholder="t('integration_github', 'Client ID of your GitHub application')"
@focus="readonly = false"
@input="onInput">
<label for="github-client-secret">
<a class="icon icon-category-auth" />
{{ t('integration_github', 'Client secret') }}
</label>
<input id="github-client-secret"
v-model="state.client_secret"
type="password"
:readonly="readonly"
:placeholder="t('integration_github', 'Client secret of your GitHub application')"
@input="onInput"
@focus="readonly = false">
<div id="github-content">
<div class="line">
<label for="github-client-id">
<KeyIcon :size="20" class="icon" />
{{ t('integration_github', 'Client ID') }}
</label>
<input id="github-client-id"
v-model="state.client_id"
type="password"
:readonly="readonly"
:placeholder="t('integration_github', 'Client ID of your GitHub application')"
@focus="readonly = false"
@input="onInput">
</div>
<div class="line">
<label for="github-client-secret">
<KeyIcon :size="20" class="icon" />
{{ t('integration_github', 'Client secret') }}
</label>
<input id="github-client-secret"
v-model="state.client_secret"
type="password"
:readonly="readonly"
:placeholder="t('integration_github', 'Client secret of your GitHub application')"
@input="onInput"
@focus="readonly = false">
</div>
<CheckboxRadioSwitch
:checked="state.use_popup"
@update:checked="onCheckboxChanged($event, 'use_popup')">
{{ t('integration_github', 'Use a popup to authenticate') }}
</CheckboxRadioSwitch>
</div>
</div>
</template>
<script>
import InformationOutlineIcon from 'vue-material-design-icons/InformationOutline.vue'
import KeyIcon from 'vue-material-design-icons/Key.vue'
import GithubIcon from './icons/GithubIcon.vue'
import { loadState } from '@nextcloud/initial-state'
import { generateUrl } from '@nextcloud/router'
import axios from '@nextcloud/axios'
import { delay } from '../utils'
import { delay } from '../utils.js'
import { showSuccess, showError } from '@nextcloud/dialogs'
import '@nextcloud/dialogs/styles/toast.scss'
import CheckboxRadioSwitch from '@nextcloud/vue/dist/Components/CheckboxRadioSwitch.js'
export default {
name: 'AdminSettings',
components: {
GithubIcon,
CheckboxRadioSwitch,
KeyIcon,
InformationOutlineIcon,
},
props: [],
@ -76,9 +102,16 @@ export default {
},
methods: {
onCheckboxChanged(newValue, key) {
this.state[key] = newValue
this.saveOptions({ [key]: this.state[key] ? '1' : '0' })
},
onInput() {
delay(() => {
this.saveOptions({ client_id: this.state.client_id, client_secret: this.state.client_secret })
this.saveOptions({
client_id: this.state.client_id,
client_secret: this.state.client_secret,
})
}, 2000)()
},
saveOptions(values) {
@ -104,41 +137,33 @@ export default {
</script>
<style scoped lang="scss">
.grid-form label {
line-height: 38px;
}
#github_prefs {
#github-content {
margin-left: 40px;
}
h2,
.line,
.settings-hint {
display: flex;
align-items: center;
.icon {
margin-right: 4px;
}
}
.grid-form input {
width: 100%;
}
h2 .icon {
margin-right: 8px;
}
.grid-form {
max-width: 500px;
display: grid;
grid-template: 1fr / 1fr 1fr;
margin-left: 30px;
.line {
> label {
width: 300px;
display: flex;
align-items: center;
}
> input {
width: 250px;
}
}
}
#github_prefs .icon {
display: inline-block;
width: 32px;
}
#github_prefs .grid-form .icon {
margin-bottom: -3px;
}
.icon-github {
background-image: url(./../../img/app-dark.svg);
background-size: 23px 23px;
height: 23px;
margin-bottom: -4px;
filter: var(--background-invert-if-dark);
}
// for NC <= 24
body.theme--dark .icon-github {
background-image: url(./../../img/app.svg);
}
</style>

Просмотреть файл

@ -1,18 +1,9 @@
<template>
<div id="github_prefs" class="section">
<h2>
<a class="icon icon-github-settings" />
<GithubIcon class="icon" />
{{ t('integration_github', 'GitHub integration') }}
</h2>
<div id="toggle-github-navigation-link">
<input id="github-link"
type="checkbox"
class="checkbox"
:checked="state.navigation_enabled"
@input="onNavigationChange">
<label for="github-link">{{ t('integration_github', 'Enable navigation link') }}</label>
</div>
<br><br>
<p v-if="!showOAuth && !connected" class="settings-hint">
{{ t('integration_github', 'When you create a personal access token yourself, give it at least "read:user", "user:email" and "notifications" permissions.') }}
<a href="https://github.com/settings/tokens" target="_blank" class="external">
@ -21,10 +12,15 @@
</a>
</p>
<div id="github-content">
<div class="github-grid-form">
<CheckboxRadioSwitch
:checked="state.navigation_enabled"
@update:checked="onCheckboxChanged($event, 'navigation_enabled')">
{{ t('integration_github', 'Enable navigation link') }}
</CheckboxRadioSwitch>
<div class="line">
<label v-show="!showOAuth"
for="github-token">
<a class="icon icon-category-auth" />
<KeyIcon :size="20" class="icon" />
{{ t('integration_github', 'Personal access token') }}
</label>
<input v-show="!showOAuth"
@ -36,41 +32,41 @@
@input="onInput"
@focus="readonly = false">
</div>
<button v-if="showOAuth && !connected" id="github-oauth" @click="onOAuthClick">
<span class="icon icon-external" />
<NcButton v-if="showOAuth && !connected"
@click="onOAuthClick">
<template #icon>
<OpenInNewIcon :size="20" />
</template>
{{ t('integration_github', 'Connect to GitHub') }}
</button>
<div v-if="connected" class="github-grid-form">
<label class="github-connected">
<a class="icon icon-checkmark-color" />
</NcButton>
<div v-if="connected" class="line">
<label>
<CheckIcon :size="20" class="icon" />
{{ t('integration_github', 'Connected as {user}', { user: state.user_name }) }}
</label>
<button id="github-rm-cred" @click="onLogoutClick">
<span class="icon icon-close" />
<NcButton @click="onLogoutClick">
<template #icon>
<CloseIcon :size="20" />
</template>
{{ t('integration_github', 'Disconnect from GitHub') }}
</button>
</NcButton>
<span />
</div>
<br>
<div v-if="connected" id="github-search-block">
<input
id="search-github-repos"
type="checkbox"
class="checkbox"
<CheckboxRadioSwitch
:checked="state.search_repos_enabled"
@input="onSearchReposChange">
<label for="search-github-repos">{{ t('integration_github', 'Enable searching for repositories') }}</label>
<br><br>
<input
id="search-github-issues"
type="checkbox"
class="checkbox"
@update:checked="onCheckboxChanged($event, 'search_repos_enabled')">
{{ t('integration_github', 'Enable searching for repositories') }}
</CheckboxRadioSwitch>
<CheckboxRadioSwitch
:checked="state.search_issues_enabled"
@input="onSearchIssuesChange">
<label for="search-github-issues">{{ t('integration_github', 'Enable searching for issues and pull requests') }}</label>
<br><br>
@update:checked="onCheckboxChanged($event, 'search_issues_enabled')">
{{ t('integration_github', 'Enable searching for issues and pull requests') }}
</CheckboxRadioSwitch>
<br>
<p v-if="state.search_repos_enabled || state.search_issues_enabled" class="settings-hint">
<span class="icon icon-details" />
<InformationOutlineIcon :size="20" class="icon" />
{{ t('integration_github', 'Warning, everything you type in the search bar will be sent to GitHub.') }}
</p>
</div>
@ -79,17 +75,35 @@
</template>
<script>
import InformationOutlineIcon from 'vue-material-design-icons/InformationOutline.vue'
import OpenInNewIcon from 'vue-material-design-icons/OpenInNew.vue'
import KeyIcon from 'vue-material-design-icons/Key.vue'
import CheckIcon from 'vue-material-design-icons/Check.vue'
import CloseIcon from 'vue-material-design-icons/Close.vue'
import GithubIcon from './icons/GithubIcon.vue'
import { loadState } from '@nextcloud/initial-state'
import { generateUrl } from '@nextcloud/router'
import axios from '@nextcloud/axios'
import { delay } from '../utils'
import { delay } from '../utils.js'
import { showSuccess, showError } from '@nextcloud/dialogs'
import '@nextcloud/dialogs/styles/toast.scss'
import NcButton from '@nextcloud/vue/dist/Components/Button.js'
import CheckboxRadioSwitch from '@nextcloud/vue/dist/Components/CheckboxRadioSwitch.js'
export default {
name: 'PersonalSettings',
components: {
GithubIcon,
CheckboxRadioSwitch,
NcButton,
KeyIcon,
CheckIcon,
CloseIcon,
InformationOutlineIcon,
OpenInNewIcon,
},
props: [],
@ -131,17 +145,9 @@ export default {
this.state.token = ''
this.saveOptions({ token: this.state.token })
},
onSearchIssuesChange(e) {
this.state.search_issues_enabled = e.target.checked
this.saveOptions({ search_issues_enabled: this.state.search_issues_enabled ? '1' : '0' })
},
onSearchReposChange(e) {
this.state.search_repos_enabled = e.target.checked
this.saveOptions({ search_repos_enabled: this.state.search_repos_enabled ? '1' : '0' })
},
onNavigationChange(e) {
this.state.navigation_enabled = e.target.checked
this.saveOptions({ navigation_enabled: this.state.navigation_enabled ? '1' : '0' })
onCheckboxChanged(newValue, key) {
this.state[key] = newValue
this.saveOptions({ [key]: this.state[key] ? '1' : '0' })
},
onInput() {
delay(() => {
@ -207,56 +213,32 @@ export default {
<style scoped lang="scss">
#github_prefs {
.icon {
display: inline-block;
width: 32px;
}
.icon-external {
width: 15px;
margin-bottom: -3px;
}
#github-content {
margin-left: 40px;
#github-search-block .icon {
width: 22px;
}
}
#toggle-github-navigation-link {
margin-left: 40px;
}
.github-grid-form {
max-width: 600px;
display: grid;
grid-template: 1fr / 1fr 1fr;
label {
line-height: 38px;
}
input {
width: 100%;
}
button .icon {
margin-bottom: -1px;
}
h2,
.line,
.settings-hint {
display: flex;
align-items: center;
.icon {
margin-bottom: -3px;
margin-right: 4px;
}
}
}
.icon-github-settings {
background-image: url('./../../img/app-dark.svg');
background-size: 23px 23px;
height: 23px;
margin-bottom: -4px;
filter: var(--background-invert-if-dark);
}
h2 .icon {
margin-right: 8px;
}
// for NC <= 24
body.theme--dark .icon-github-settings {
background-image: url('./../../img/app.svg');
.line {
> label {
width: 300px;
display: flex;
align-items: center;
}
> input {
width: 250px;
}
}
}
</style>

Просмотреть файл

@ -0,0 +1,40 @@
<template>
<span :aria-hidden="!title"
:aria-label="title"
class="material-design-icon github-icon"
role="img"
v-bind="$attrs"
@click="$emit('click', $event)">
<svg
:fill="fillColor"
:width="size"
:height="size"
enable-background="new 0 0 438.549 438.549"
version="1.1"
viewBox="0 0 438.549 438.549"
xml:space="preserve"
xmlns="http://www.w3.org/2000/svg">
<path d="m409.13 114.57c-19.608-33.596-46.205-60.194-79.798-79.8-33.598-19.607-70.277-29.408-110.06-29.408-39.781 0-76.472 9.804-110.06 29.408-33.596 19.605-60.192 46.204-79.8 79.8-19.605 33.595-29.408 70.281-29.408 110.06 0 47.78 13.94 90.745 41.827 128.91 27.884 38.164 63.906 64.572 108.06 79.227 5.14 0.954 8.945 0.283 11.419-1.996 2.475-2.282 3.711-5.14 3.711-8.562 0-0.571-0.049-5.708-0.144-15.417-0.098-9.709-0.144-18.179-0.144-25.406l-6.567 1.136c-4.187 0.767-9.469 1.092-15.846 1-6.374-0.089-12.991-0.757-19.842-1.999-6.854-1.231-13.229-4.086-19.13-8.559-5.898-4.473-10.085-10.328-12.56-17.556l-2.855-6.57c-1.903-4.374-4.899-9.233-8.992-14.559-4.093-5.331-8.232-8.945-12.419-10.848l-1.999-1.431c-1.332-0.951-2.568-2.098-3.711-3.429-1.142-1.331-1.997-2.663-2.568-3.997-0.572-1.335-0.098-2.43 1.427-3.289s4.281-1.276 8.28-1.276l5.708 0.853c3.807 0.763 8.516 3.042 14.133 6.851 5.614 3.806 10.229 8.754 13.846 14.842 4.38 7.806 9.657 13.754 15.846 17.847 6.184 4.093 12.419 6.136 18.699 6.136s11.704-0.476 16.274-1.423c4.565-0.952 8.848-2.383 12.847-4.285 1.713-12.758 6.377-22.559 13.988-29.41-10.848-1.14-20.601-2.857-29.264-5.14-8.658-2.286-17.605-5.996-26.835-11.14-9.235-5.137-16.896-11.516-22.985-19.126-6.09-7.614-11.088-17.61-14.987-29.979-3.901-12.374-5.852-26.648-5.852-42.826 0-23.035 7.52-42.637 22.557-58.817-7.044-17.318-6.379-36.732 1.997-58.24 5.52-1.715 13.706-0.428 24.554 3.853 10.85 4.283 18.794 7.952 23.84 10.994 5.046 3.041 9.089 5.618 12.135 7.708 17.705-4.947 35.976-7.421 54.818-7.421s37.117 2.474 54.823 7.421l10.849-6.849c7.419-4.57 16.18-8.758 26.262-12.565 10.088-3.805 17.802-4.853 23.134-3.138 8.562 21.509 9.325 40.922 2.279 58.24 15.036 16.18 22.559 35.787 22.559 58.817 0 16.178-1.958 30.497-5.853 42.966-3.9 12.471-8.941 22.457-15.125 29.979-6.191 7.521-13.901 13.85-23.131 18.986-9.232 5.14-18.182 8.85-26.84 11.136-8.662 2.286-18.415 4.004-29.263 5.146 9.894 8.562 14.842 22.077 14.842 40.539v60.237c0 3.422 1.19 6.279 3.572 8.562 2.379 2.279 6.136 2.95 11.276 1.995 44.163-14.653 80.185-41.062 108.07-79.226 27.88-38.161 41.825-81.126 41.825-128.91-0.01-39.771-9.818-76.454-29.414-110.05z" />
</svg>
</span>
</template>
<script>
export default {
name: 'GithubIcon',
props: {
title: {
type: String,
default: '',
},
fillColor: {
type: String,
default: 'currentColor',
},
size: {
type: Number,
default: 24,
},
},
}
</script>

Просмотреть файл

@ -12,8 +12,8 @@
*/
import Vue from 'vue'
import './bootstrap'
import Dashboard from './views/Dashboard'
import './bootstrap.js'
import Dashboard from './views/Dashboard.vue'
document.addEventListener('DOMContentLoaded', function() {

Просмотреть файл

@ -12,8 +12,8 @@
*/
import Vue from 'vue'
import './bootstrap'
import PersonalSettings from './components/PersonalSettings'
import './bootstrap.js'
import PersonalSettings from './components/PersonalSettings.vue'
// eslint-disable-next-line
'use strict'

Просмотреть файл

@ -7,23 +7,29 @@
@unsubscribe="onUnsubscribe"
@markRead="onMarkRead">
<template #empty-content>
<EmptyContent v-if="emptyContentMessage"
:icon="emptyContentIcon">
<EmptyContent v-if="emptyContentMessage">
<template #icon>
<component :is="emptyContentIcon" />
</template>
<template #desc>
{{ emptyContentMessage }}
<div v-if="state === 'no-token' || state === 'error'" class="connect-button">
<a v-if="!initialState.oauth_is_possible"
class="button"
:href="settingsUrl">
{{ t('integration_github', 'Connect to GitHub') }}
<NcButton>
<template #icon>
<LoginVariantIcon />
</template>
{{ t('integration_github', 'Connect to GitHub') }}
</NcButton>
</a>
<Button v-else
<NcButton v-else
@click="onOAuthClick">
<template #icon>
<LoginVariantIcon />
</template>
{{ t('integration_github', 'Connect to GitHub') }}
</Button>
</NcButton>
</div>
</template>
</EmptyContent>
@ -32,15 +38,20 @@
</template>
<script>
import LoginVariantIcon from 'vue-material-design-icons/LoginVariant.vue'
import CheckIcon from 'vue-material-design-icons/Check.vue'
import CloseIcon from 'vue-material-design-icons/Close.vue'
import GithubIcon from '../components/icons/GithubIcon.vue'
import axios from '@nextcloud/axios'
import { generateUrl, imagePath } from '@nextcloud/router'
import { showError, showSuccess } from '@nextcloud/dialogs'
import { loadState } from '@nextcloud/initial-state'
import moment from '@nextcloud/moment'
import { DashboardWidget } from '@nextcloud/vue-dashboard'
import EmptyContent from '@nextcloud/vue/dist/Components/EmptyContent'
import LoginVariantIcon from 'vue-material-design-icons/LoginVariant'
import Button from '@nextcloud/vue/dist/Components/Button'
import EmptyContent from '@nextcloud/vue/dist/Components/EmptyContent.js'
import NcButton from '@nextcloud/vue/dist/Components/Button.js'
export default {
name: 'Dashboard',
@ -48,7 +59,7 @@ export default {
components: {
DashboardWidget,
EmptyContent,
Button,
NcButton,
LoginVariantIcon,
},
@ -115,13 +126,13 @@ export default {
},
emptyContentIcon() {
if (this.state === 'no-token') {
return 'icon-github'
return GithubIcon
} else if (this.state === 'error') {
return 'icon-close'
return CloseIcon
} else if (this.state === 'ok') {
return 'icon-checkmark'
return CheckIcon
}
return 'icon-checkmark'
return CheckIcon
},
},

Просмотреть файл

@ -1,5 +1,6 @@
<?php
script(OCA\Github\AppInfo\Application::APP_ID, 'integration_github-adminSettings');
$appId = OCA\Github\AppInfo\Application::APP_ID;
\OCP\Util::addScript($appId, $appId . '-adminSettings');
?>
<div id="github_prefs"></div>
<div id="github_prefs"></div>

Просмотреть файл

@ -1,5 +1,6 @@
<?php
script(OCA\Github\AppInfo\Application::APP_ID, 'integration_github-personalSettings');
$appId = OCA\Github\AppInfo\Application::APP_ID;
\OCP\Util::addScript($appId, $appId . '-personalSettings');
?>
<div id="github_prefs"></div>
<div id="github_prefs"></div>

Просмотреть файл

@ -13,10 +13,11 @@ webpackConfig.stats = {
modules: false,
}
const appId = 'integration_github'
webpackConfig.entry = {
personalSettings: { import: path.join(__dirname, 'src', 'personalSettings.js'), filename: 'integration_github-personalSettings.js' },
adminSettings: { import: path.join(__dirname, 'src', 'adminSettings.js'), filename: 'integration_github-adminSettings.js' },
dashboard: { import: path.join(__dirname, 'src', 'dashboard.js'), filename: 'integration_github-dashboard.js' },
personalSettings: { import: path.join(__dirname, 'src', 'personalSettings.js'), filename: appId + '-personalSettings.js' },
adminSettings: { import: path.join(__dirname, 'src', 'adminSettings.js'), filename: appId + '-adminSettings.js' },
dashboard: { import: path.join(__dirname, 'src', 'dashboard.js'), filename: appId + '-dashboard.js' },
}
webpackConfig.plugins.push(