Hide card for apps store if disabled

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
This commit is contained in:
Daniel Kesselberg 2020-03-15 17:32:50 +01:00 committed by npmbuildbot[bot]
parent 48bdd322a2
commit e44b58ed8b
5 changed files with 30 additions and 14 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -27,6 +27,7 @@ namespace OCA\WorkflowEngine\Settings;
use OCA\WorkflowEngine\AppInfo\Application;
use OCA\WorkflowEngine\Manager;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use OCP\IInitialStateService;
use OCP\IL10N;
use OCP\Settings\ISettings;
@ -54,23 +55,31 @@ abstract class ASettings implements ISettings {
/** @var IInitialStateService */
private $initialStateService;
/** @var IConfig */
private $config;
/**
* @param string $appName
* @param IL10N $l
* @param EventDispatcherInterface $eventDispatcher
* @param Manager $manager
* @param IInitialStateService $initialStateService
* @param IConfig $config
*/
public function __construct(
$appName,
IL10N $l,
EventDispatcherInterface $eventDispatcher,
Manager $manager,
IInitialStateService $initialStateService
IInitialStateService $initialStateService,
IConfig $config
) {
$this->appName = $appName;
$this->l10n = $l;
$this->eventDispatcher = $eventDispatcher;
$this->manager = $manager;
$this->initialStateService = $initialStateService;
$this->config = $config;
}
abstract function getScope(): int;
@ -108,6 +117,12 @@ abstract class ASettings implements ISettings {
$this->getScope()
);
$this->initialStateService->provideInitialState(
Application::APP_ID,
'appstoreenabled',
$this->config->getSystemValueBool('appstoreenabled', true)
);
return new TemplateResponse(Application::APP_ID, 'settings', [], 'blank');
}

View File

@ -51,7 +51,6 @@
import Rule from './Rule'
import Operation from './Operation'
import { mapGetters, mapState } from 'vuex'
import { loadState } from '@nextcloud/initial-state'
import { generateUrl } from '@nextcloud/router'
const ACTION_LIMIT = 3
@ -66,7 +65,6 @@ export default {
return {
showMoreOperations: false,
appstoreUrl: generateUrl('settings/apps/workflow'),
scope: loadState('workflowengine', 'scope'),
}
},
computed: {
@ -74,6 +72,8 @@ export default {
rules: 'getRules',
}),
...mapState({
appstoreEnabled: 'appstoreEnabled',
scope: 'scope',
operations: 'operations',
}),
hasMoreOperations() {
@ -86,7 +86,7 @@ export default {
return Object.values(this.operations).slice(0, ACTION_LIMIT)
},
showAppStoreHint() {
return this.scope === 0 && OC.isUserAdmin()
return this.scope === 0 && this.appstoreEnabled && OC.isUserAdmin()
},
},
mounted() {

View File

@ -33,6 +33,7 @@ const store = new Vuex.Store({
state: {
rules: [],
scope: loadState('workflowengine', 'scope'),
appstoreEnabled: loadState('workflowengine', 'appstoreenabled'),
operations: loadState('workflowengine', 'operators'),
plugins: Vue.observable({