Merge pull request #19968 from nextcloud/enh/noid/hide-apps-store-if-disabled
Hide card for apps store if disabled
This commit is contained in:
commit
b53a484d20
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -27,6 +27,7 @@ namespace OCA\WorkflowEngine\Settings;
|
||||||
use OCA\WorkflowEngine\AppInfo\Application;
|
use OCA\WorkflowEngine\AppInfo\Application;
|
||||||
use OCA\WorkflowEngine\Manager;
|
use OCA\WorkflowEngine\Manager;
|
||||||
use OCP\AppFramework\Http\TemplateResponse;
|
use OCP\AppFramework\Http\TemplateResponse;
|
||||||
|
use OCP\IConfig;
|
||||||
use OCP\IInitialStateService;
|
use OCP\IInitialStateService;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\Settings\ISettings;
|
use OCP\Settings\ISettings;
|
||||||
|
@ -54,23 +55,31 @@ abstract class ASettings implements ISettings {
|
||||||
/** @var IInitialStateService */
|
/** @var IInitialStateService */
|
||||||
private $initialStateService;
|
private $initialStateService;
|
||||||
|
|
||||||
|
/** @var IConfig */
|
||||||
|
private $config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $appName
|
* @param string $appName
|
||||||
* @param IL10N $l
|
* @param IL10N $l
|
||||||
* @param EventDispatcherInterface $eventDispatcher
|
* @param EventDispatcherInterface $eventDispatcher
|
||||||
|
* @param Manager $manager
|
||||||
|
* @param IInitialStateService $initialStateService
|
||||||
|
* @param IConfig $config
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
$appName,
|
$appName,
|
||||||
IL10N $l,
|
IL10N $l,
|
||||||
EventDispatcherInterface $eventDispatcher,
|
EventDispatcherInterface $eventDispatcher,
|
||||||
Manager $manager,
|
Manager $manager,
|
||||||
IInitialStateService $initialStateService
|
IInitialStateService $initialStateService,
|
||||||
|
IConfig $config
|
||||||
) {
|
) {
|
||||||
$this->appName = $appName;
|
$this->appName = $appName;
|
||||||
$this->l10n = $l;
|
$this->l10n = $l;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
$this->manager = $manager;
|
$this->manager = $manager;
|
||||||
$this->initialStateService = $initialStateService;
|
$this->initialStateService = $initialStateService;
|
||||||
|
$this->config = $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract function getScope(): int;
|
abstract function getScope(): int;
|
||||||
|
@ -108,6 +117,12 @@ abstract class ASettings implements ISettings {
|
||||||
$this->getScope()
|
$this->getScope()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->initialStateService->provideInitialState(
|
||||||
|
Application::APP_ID,
|
||||||
|
'appstoreenabled',
|
||||||
|
$this->config->getSystemValueBool('appstoreenabled', true)
|
||||||
|
);
|
||||||
|
|
||||||
return new TemplateResponse(Application::APP_ID, 'settings', [], 'blank');
|
return new TemplateResponse(Application::APP_ID, 'settings', [], 'blank');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,6 @@
|
||||||
import Rule from './Rule'
|
import Rule from './Rule'
|
||||||
import Operation from './Operation'
|
import Operation from './Operation'
|
||||||
import { mapGetters, mapState } from 'vuex'
|
import { mapGetters, mapState } from 'vuex'
|
||||||
import { loadState } from '@nextcloud/initial-state'
|
|
||||||
import { generateUrl } from '@nextcloud/router'
|
import { generateUrl } from '@nextcloud/router'
|
||||||
|
|
||||||
const ACTION_LIMIT = 3
|
const ACTION_LIMIT = 3
|
||||||
|
@ -66,7 +65,6 @@ export default {
|
||||||
return {
|
return {
|
||||||
showMoreOperations: false,
|
showMoreOperations: false,
|
||||||
appstoreUrl: generateUrl('settings/apps/workflow'),
|
appstoreUrl: generateUrl('settings/apps/workflow'),
|
||||||
scope: loadState('workflowengine', 'scope'),
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -74,6 +72,8 @@ export default {
|
||||||
rules: 'getRules',
|
rules: 'getRules',
|
||||||
}),
|
}),
|
||||||
...mapState({
|
...mapState({
|
||||||
|
appstoreEnabled: 'appstoreEnabled',
|
||||||
|
scope: 'scope',
|
||||||
operations: 'operations',
|
operations: 'operations',
|
||||||
}),
|
}),
|
||||||
hasMoreOperations() {
|
hasMoreOperations() {
|
||||||
|
@ -86,7 +86,7 @@ export default {
|
||||||
return Object.values(this.operations).slice(0, ACTION_LIMIT)
|
return Object.values(this.operations).slice(0, ACTION_LIMIT)
|
||||||
},
|
},
|
||||||
showAppStoreHint() {
|
showAppStoreHint() {
|
||||||
return this.scope === 0 && OC.isUserAdmin()
|
return this.scope === 0 && this.appstoreEnabled && OC.isUserAdmin()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
|
@ -33,6 +33,7 @@ const store = new Vuex.Store({
|
||||||
state: {
|
state: {
|
||||||
rules: [],
|
rules: [],
|
||||||
scope: loadState('workflowengine', 'scope'),
|
scope: loadState('workflowengine', 'scope'),
|
||||||
|
appstoreEnabled: loadState('workflowengine', 'appstoreenabled'),
|
||||||
operations: loadState('workflowengine', 'operators'),
|
operations: loadState('workflowengine', 'operators'),
|
||||||
|
|
||||||
plugins: Vue.observable({
|
plugins: Vue.observable({
|
||||||
|
|
Loading…
Reference in New Issue