diff --git a/.gitignore b/.gitignore index 36d2f9777d09fd8fb202125904d3aa3284eb00c5..1e5317bb4eaa9d0903bef68f53702f224de3bfdd 100755 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ translationtool.phar .php-cs-fixer.cache .phpunit.result.cache junit.xml +css diff --git a/appinfo/info.xml b/appinfo/info.xml index 9d8723d798792c534521e40f2ee41f98119209b5..299c05fc817e89a9f3bbf5c89adaf86bcf3acda0 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -5,7 +5,7 @@ Murena Dashboard Murena Dashboard - 2.0.0 + 2.0.1 agpl Murena MurenaDashboard diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 70712711a8230ba883e2a21bf1dd3051082181cf..ef909ac1627e9bd39ef8baa0218491257fed6f9e 100755 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -8,7 +8,7 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Services\IInitialState; use OCP\IConfig; use OCP\IUserSession; -use OCA\MurenaDashboard\Util; +use OCA\MurenaDashboard\Service\AppsService; class PageController extends Controller { /** @var IInitialState */ @@ -20,13 +20,14 @@ class PageController extends Controller { /** @var IUserSession */ private $userSession; - private $util; + private AppsService $appsService; - public function __construct($appName, IRequest $request, IInitialState $initialState, IConfig $config, IUserSession $userSession, Util $util) { + + public function __construct($appName, IRequest $request, IInitialState $initialState, IConfig $config, IUserSession $userSession, AppsService $appsService) { $this->initialState = $initialState; $this->config = $config; - $this->util = $util; $this->userSession = $userSession; + $this->appsService = $appsService; parent::__construct($appName, $request); } @@ -37,9 +38,8 @@ class PageController extends Controller { public function index() { $referralUrl = $this->config->getSystemValue('shop_referral_program_url', ''); $storageUrl = $this->config->getAppValue('increasestoragebutton', 'link', ''); - $entries = $this->util->getAppEntries(); + $entries = $this->appsService->getAppEntries(); $displayName = $this->userSession->getUser()->getDisplayName(); - $this->initialState->provideInitialState('shopReferralProgramUrl', $referralUrl); $this->initialState->provideInitialState('increaseStorageUrl', $storageUrl); $this->initialState->provideInitialState('entries', $entries); diff --git a/lib/Util.php b/lib/Service/AppsService.php old mode 100755 new mode 100644 similarity index 67% rename from lib/Util.php rename to lib/Service/AppsService.php index 2cf484ed9020626cc510a9f07816b6c124ae5afe..84f511f070c48f7b97a256d5d23f83ef0f1b866c --- a/lib/Util.php +++ b/lib/Service/AppsService.php @@ -1,75 +1,71 @@ appName = $appName; $this->userId = $userId; $this->config = $config; $this->navigationManager = $navigationManager; - $this->groupManager = $groupManager; - $this->userManager = $userManager; $this->appManager = $appManager; $this->l10nFac = $l10nFac; $this->userSession = $userSession; + $this->groupManager = $groupManager; + $this->urlGenerator = $urlGenerator; } - private function getOnlyOfficeEntries() { + public function getOnlyOfficeEntries() { $l = $this->l10nFac->get("onlyoffice"); $onlyOfficeEntries = array( array( "id" => "onlyoffice_docx", - "icon" => "/svg/core/filetypes/x-office-document", + "icon" => $this->urlGenerator->imagePath('core', 'filetypes/x-office-document.svg'), "name" => $l->t("Document"), ), array( "id" => "onlyoffice_xlsx", - "icon" => "/svg/core/filetypes/x-office-spreadsheet", + "icon" => $this->urlGenerator->imagePath('core', 'filetypes/x-office-spreadsheet.svg'), "name" => $l->t("Spreadsheet"), ), array( "id" => "onlyoffice_pptx", - "icon" => "/svg/core/filetypes/x-office-presentation", + "icon" => $this->urlGenerator->imagePath('core', 'filetypes/x-office-presentation.svg'), "name" => $l->t("Presentation"), ), ); $onlyOfficeEntries = array_map(function ($entry) { - $entry["type"] = "onlyoffice"; + $entry["type"] = "link"; $entry["active"] = false; $entry["href"] = "/apps/onlyoffice/ajax/new?id=".$entry["id"]; return $entry; @@ -77,8 +73,9 @@ class Util { return $onlyOfficeEntries; } - public function getOrder() { - $order_raw = $this->config->getUserValue($this->userId, 'murena_launcher', 'order'); + + public function getAppOrder() { + $order_raw = $this->config->getUserValue($this->userId, $this->appName, 'order'); // If order raw empty try to get from 'apporder' app config $order_raw = !$order_raw ? $this->config->getUserValue($this->userId, 'apporder', 'order') : $order_raw; // If order raw is still empty, return empty array @@ -87,9 +84,10 @@ class Util { } return json_decode($order_raw); } + public function getAppEntries() { $entries = array_values($this->navigationManager->getAll()); - $order = $this->getOrder(); + $order = $this->getAppOrder(); $entriesByHref = array(); if ($this->appManager->isEnabledForUser("onlyoffice")) { $office_entries = $this->getOnlyOfficeEntries(); @@ -98,14 +96,20 @@ class Util { $betaGroupName = $this->config->getSystemValue("beta_group_name"); $isBeta = $this->isBetaUser(); foreach ($entries as &$entry) { + try { + $entry["icon"] = $this->urlGenerator->imagePath($entry["id"], 'app-color.svg'); + } catch (\Throwable $th) { + //exception - continue execution + } if (strpos($entry["id"], "external_index") !== 0) { - $entry["style"] = ""; $entry["target"] = ""; } else { - $entry["style"] = "background-image: url('". $entry["icon"] ."')"; $entry["target"] = "_blank"; } - + $entry["class"] = ""; + if (strpos($entry["icon"], "/custom_apps/") === 0) { + $entry["class"] = "icon-invert"; + } $entry["iconOffsetY"] = 0; $entry["is_beta"] = 0; $appEnabledGroups = $this->config->getAppValue($entry['id'], 'enabled', 'no'); @@ -131,28 +135,17 @@ class Util { unset($entriesByHref['/apps/dashboard/']); unset($entriesByHref['/apps/murena-dashboard/']); unset($entriesByHref['']); - $entries = array_values($entriesByHref); - return $entries; + return array_values($entriesByHref); } - /** - * returns a sorted list of the user's group GIDs - * - * @param IUser $user - * @return array - */ - public function getGroups(): array { - $user = $this->userSession->getUser(); - if (!$user) { - return []; - } - return $this->groupManager->getUserGroupIds($user); + public function updateOrder(string $order) { + $this->config->setUserValue($this->userId, $this->appName, 'order', $order); } private function isBetaUser() { $uid = $this->userSession->getUser()->getUID(); - $betaGroupName = $this->config->getSystemValue("beta_group_name"); - return $this->groupManager->isInGroup($uid, $betaGroupName); + $gid = $this->config->getSystemValue("beta_group_name"); + return $this->groupManager->isInGroup($uid, $gid); } } diff --git a/package-lock.json b/package-lock.json index 927f2112642b07a257aa978549c01a0234f59997..e1f1f5783c2d4197bfc6649c869b92074ea1438d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "murena-dashboard", - "version": "2.0.0", + "version": "2.0.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "murena-dashboard", - "version": "2.0.0", + "version": "2.0.1", "license": "AGPL-3.0-or-later", "dependencies": { "@nextcloud/axios": "2.1.0", diff --git a/package.json b/package.json index 09b691de97ed11676e9684954615ada1172423bc..95ba9cbb24f4db79d5e70137babb237d16c82fb5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "murena-dashboard", - "version": "2.0.0", + "version": "2.0.1", "private": true, "description": "Place this app in **nextcloud/custom_apps/**", "main": "js/main.js", @@ -11,8 +11,8 @@ "watch": "NODE_ENV=development webpack --progress --watch", "lint": "eslint --ext .js,.vue src", "lint:fix": "eslint --ext .js,.vue src --fix", - "stylelint": "stylelint {src,css}/**/{*.scss,*.css}", - "stylelint:fix": "stylelint {src,css}/**/{*.scss,*.css} --fix" + "stylelint": "stylelint {src,css}/**/{*.scss,*.css} --allow-empty-input", + "stylelint:fix": "stylelint {src,css}/**/{*.scss,*.css} --fix --allow-empty-input" }, "homepage": "https://gitlab.e.foundation/e/infra/ecloud/nextcloud-apps/murena-dashboard", "author": "Murena", @@ -26,7 +26,7 @@ "@nextcloud/vue": "^5.4.0", "vue": "^2.7.0" }, - "browserslist": [ + "browserslist": [ "extends @nextcloud/browserslist-config" ], "engines": { diff --git a/scss/murena-dashboard.scss b/scss/murena-dashboard.scss index 551651fea37da5e9cc465014ddbcc2f4da8ca95c..65a186ba05054112652ea0c7e8d54e87ae3063fc 100644 --- a/scss/murena-dashboard.scss +++ b/scss/murena-dashboard.scss @@ -1,3 +1,4 @@ #content.app-murena-dashboard { - overflow: scroll; + overflow: scroll; + background-color: var(--color-main-background); } diff --git a/src/components/AllApps.vue b/src/components/AllApps.vue index 28ec48cad3c2a0a035860d0df54c10ad683b08ee..63b2f27881f3064bf8a72cda4367c093041ab676 100755 --- a/src/components/AllApps.vue +++ b/src/components/AllApps.vue @@ -39,7 +39,13 @@ :href="entry.href" :target="entry.target" @click="handleOfficeClick(entry, $event)"> -
+
+ +
{{ entry.name }}
@@ -50,7 +56,13 @@ :href="entry.href" :target="entry.target" @click="handleOfficeClick(entry, $event)"> -
+
+ +
{{ entry.name }}
@@ -250,4 +262,8 @@ a.item.beta-app { padding: 2px 10px; font-weight: 800; } +.icon-invert +{ + filter: var(--app-icon-filter); +}