Use SettingsSection in workflowengine settings

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
This commit is contained in:
Carl Schwan 2022-05-19 18:35:32 +02:00 committed by nextcloud-command
parent cf9660fdf0
commit 30d7763edc
4 changed files with 26 additions and 24 deletions

View file

@ -37,6 +37,7 @@ use OCP\AppFramework\Services\IInitialState;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\Settings\ISettings;
use OCP\WorkflowEngine\Events\LoadSettingsScriptsEvent;
use OCP\WorkflowEngine\ICheck;
@ -47,23 +48,13 @@ use OCP\WorkflowEngine\IOperation;
use OCP\WorkflowEngine\ISpecificOperation;
abstract class ASettings implements ISettings {
/** @var IL10N */
private $l10n;
/** @var string */
private $appName;
/** @var IEventDispatcher */
private $eventDispatcher;
/** @var Manager */
protected $manager;
/** @var IInitialState */
private $initialStateService;
/** @var IConfig */
private $config;
private IL10N $l10n;
private string $appName;
private IEventDispatcher $eventDispatcher;
protected Manager $manager;
private IInitialState $initialStateService;
private IConfig $config;
private IURLGenerator $urlGenerator;
public function __construct(
string $appName,
@ -71,7 +62,8 @@ abstract class ASettings implements ISettings {
IEventDispatcher $eventDispatcher,
Manager $manager,
IInitialState $initialStateService,
IConfig $config
IConfig $config,
IURLGenerator $urlGenerator
) {
$this->appName = $appName;
$this->l10n = $l;
@ -79,6 +71,7 @@ abstract class ASettings implements ISettings {
$this->manager = $manager;
$this->initialStateService = $initialStateService;
$this->config = $config;
$this->urlGenerator = $urlGenerator;
}
abstract public function getScope(): int;
@ -122,6 +115,11 @@ abstract class ASettings implements ISettings {
$this->config->getSystemValueBool('appstoreenabled', true)
);
$this->initialStateService->provideInitialState(
'doc-url',
$this->urlGenerator->linkToDocs('admin-workflowengine')
);
return new TemplateResponse(Application::APP_ID, 'settings', [], 'blank');
}

View file

@ -1,7 +1,7 @@
<template>
<div id="workflowengine">
<div class="section">
<h2>{{ t('workflowengine', 'Available flows') }}</h2>
<SettingsSection :title="t('workflowengine', 'Available flows')"
:doc-url="workflowDocUrl">
<p v-if="scope === 0" class="settings-hint">
<a href="https://nextcloud.com/developer/">{{ t('workflowengine', 'For details on how to write your own flow, check out the development documentation.') }}</a>
@ -39,7 +39,7 @@
<h2 v-else class="configured-flows">
{{ t('workflowengine', 'Your flows') }}
</h2>
</div>
</SettingsSection>
<transition-group v-if="rules.length > 0" name="slide">
<Rule v-for="rule in rules" :key="rule.id" :rule="rule" />
@ -50,8 +50,10 @@
<script>
import Rule from './Rule'
import Operation from './Operation'
import SettingsSection from '@nextcloud/vue/dist/Components/SettingsSection'
import { mapGetters, mapState } from 'vuex'
import { generateUrl } from '@nextcloud/router'
import { loadState } from '@nextcloud/initial-state'
const ACTION_LIMIT = 3
@ -60,11 +62,13 @@ export default {
components: {
Operation,
Rule,
SettingsSection,
},
data() {
return {
showMoreOperations: false,
appstoreUrl: generateUrl('settings/apps/workflow'),
workflowDocUrl: loadState('workflowengine', 'doc-url'),
}
},
computed: {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long