Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically show oC10 apps in app switcher menu #5996

Merged
merged 8 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/unreleased/enhancement-oc10-apps-in-app-switcher
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enhancement: Automatically show oC 10 apps in the app switcher menu

When using the ownCloud 10 app of web the configuration automatically gets augmented with all menu items / apps from the classic UI. They open in a new tab in the classic UI and have a generic icon.

https://github.com/owncloud/web/issues/5980
https://github.com/owncloud/web/pull/5996
8 changes: 5 additions & 3 deletions changelog/unreleased/enhancement-update-ods
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
Enhancement: Update ODS to v11.2.1
Enhancement: Update ODS to v11.2.2

We updated the ownCloud Design System to version 11.2.1. Please refer to the full changelog in the ODS release (linked) for more details. Summary:
We updated the ownCloud Design System to version 11.2.2. Please refer to the full changelog in the ODS release (linked) for more details. Summary:

- Bugfix - Limit select event in OcTableFiles: https://github.com/owncloud/owncloud-design-system/pull/1753
- Bugfix - Add word-break rule to OcNotificationMessage component: https://github.com/owncloud/owncloud-design-system/issues/1712
- Bugfix - OcTable sorting case sensitivity: https://github.com/owncloud/owncloud-design-system/issues/1698
- Bugfix - Drag and Drop triggers wrong actions: https://github.com/owncloud/web/issues/5808
- Bugfix - Fix files table event: https://github.com/owncloud/web/issues/1777
- Bugfix - Fix extension icon rendering: https://github.com/owncloud/web/issues/1779
- Enhancement - Make OcDatepicker themable: https://github.com/owncloud/owncloud-design-system/issues/1679
- Enhancement - Streamline OcTextInput: https://github.com/owncloud/owncloud-design-system/pull/1636
- Enhancement - Add accentuated class for OcTable: https://github.com/owncloud/owncloud-design-system/pull/5967
Expand All @@ -15,4 +17,4 @@ We updated the ownCloud Design System to version 11.2.1. Please refer to the ful
- Enhancement - Reduce filename text weight: https://github.com/owncloud/owncloud-design-system/pull/1759

https://github.com/owncloud/web/pull/6009
https://github.com/owncloud/owncloud-design-system/releases/tag/v11.2.1
https://github.com/owncloud/owncloud-design-system/releases/tag/v11.2.2
6 changes: 5 additions & 1 deletion docs/deployments/oc10-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ If you use OpenID Connect you need to replace the `"auth"` part with following c

## Integrate ownCloud Classic features in ownCloud Web
### Add links to the app switcher
ownCloud Classic features that are not deeply integrated with the Classic UI (e.g., full screen apps) can be added to the ownCloud Web app switcher so that users can easily access them from ownCloud Web. You can use the following example and customize it according to your needs.
ownCloud Classic features that are not deeply integrated with the Classic UI (e.g., full screen apps) can be added to the ownCloud Web app switcher so that users can easily access them from ownCloud Web. You can use the following example and customize it according to your needs.

{{< hint info >}}
All apps that are listed in the ownCloud Classic app switcher will be added as links to the app switcher of the new ownCloud Web automatically. All of those links will open in a new browser tab on click.
{{< /hint >}}

To add new elements in the app switcher, paste the following into the `applications` section of `config.json`:

Expand Down
53 changes: 51 additions & 2 deletions packages/web-integration-oc10/lib/Controller/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
namespace OCA\Web\Controller;

use OC\AppFramework\Http;
use OCP\App\IAppManager;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\JSONResponse;
use OCP\ILogger;
Expand All @@ -39,16 +40,23 @@ class ConfigController extends Controller {
*/
private $logger;

/**
* @var IAppManager
*/
private $appManager;

/**
* ConfigController constructor.
*
* @param string $appName
* @param IRequest $request
* @param ILogger $logger
* @param IAppManager $appManager
*/
public function __construct(string $appName, IRequest $request, ILogger $logger) {
public function __construct(string $appName, IRequest $request, ILogger $logger, IAppManager $appManager) {
parent::__construct($appName, $request);
$this->logger = $logger;
$this->appManager = $appManager;
}

/**
Expand All @@ -64,7 +72,8 @@ public function getConfig(): JSONResponse {
$configFile = \OC::$SERVERROOT . '/config/config.json';
$configContent = \file_get_contents($configFile);
$configAssoc = \json_decode($configContent, true);
$response = new JSONResponse($configAssoc);
$extendedConfig = $this->addOC10AppsToConfig($configAssoc);
$response = new JSONResponse($extendedConfig);
$response->addHeader('Cache-Control', 'max-age=0, no-cache, no-store, must-revalidate');
$response->addHeader('Pragma', 'no-cache');
$response->addHeader('Expires', 'Wed, 11 Jan 1984 05:00:00 GMT');
Expand All @@ -75,4 +84,44 @@ public function getConfig(): JSONResponse {
return new JSONResponse(["message" => $e->getMessage()], Http::STATUS_NOT_FOUND);
}
}

/**
* Add enabled OC10 apps to the loaded config. This ensures that they are
* listed in the app switcher menu.
*
* @param array $config
* @return array
*/
private function addOC10AppsToConfig(array $config): array {
$apps = $config['applications'] ?? [];

$oc10NavigationEntries = \OC::$server->getNavigationManager()->getAll();
$serverUrl = $this->request->getServerProtocol() . '://' . $this->request->getServerHost();

$ignoredApps = ['files', 'web'];
$supportedLanguages = ['en', 'fr', 'de', 'es', 'it', 'cs', 'gl'];

foreach ($oc10NavigationEntries as $navigationEntry) {
if (\in_array($navigationEntry['id'], $ignoredApps)) {
continue;
}

$appInfo = $this->appManager->getAppInfo($navigationEntry['id']);

$titles = [];
foreach ($supportedLanguages as $lang) {
$l10n = \OC::$server->getL10N($appInfo['id'], $lang);
$titles[$lang] = $l10n->t($appInfo['name']);
}

$apps[] = [
'title' => $titles,
'url' => $serverUrl . $navigationEntry['href'],
'icon' => 'extension',
];
}

$config['applications'] = $apps;
return $config;
}
}
2 changes: 1 addition & 1 deletion packages/web-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"lodash-es": "^4.17.21",
"luxon": "^2.0.0",
"oidc-client": "1.11.5",
"owncloud-design-system": "^11.2.1",
"owncloud-design-system": "^11.2.2",
"owncloud-sdk": "1.0.0-2296",
"p-queue": "^6.1.1",
"popper-max-size-modifier": "^0.2.0",
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10945,9 +10945,9 @@ __metadata:
languageName: node
linkType: hard

"owncloud-design-system@npm:^11.2.1":
version: 11.2.1
resolution: "owncloud-design-system@npm:11.2.1"
"owncloud-design-system@npm:^11.2.2":
version: 11.2.2
resolution: "owncloud-design-system@npm:11.2.2"
peerDependencies:
"@popperjs/core": ^2.4.0
filesize: ^8.0.0
Expand All @@ -10957,14 +10957,14 @@ __metadata:
luxon: ^2.0.2
postcss-import: ^12.0.1
postcss-url: ^9.0.0
tippy.js: ^6.3.1
tippy.js: ^6.3.7
uikit: 3.5.16
v-calendar: ^2.3.2
vue: ^2.6.11
vue-inline-svg: ^2.0.0
vue-select: ^3.12.0
webfontloader: ^1.6.28
checksum: 00cc424a2f8bd3611cc5263bae73e099f0ffebd0bd5c26c69c4119837a2ffc2a17b8907b07e069591c7ffffc701c7bbddeb4bec09b7c5939008f3984baf2fdcd
checksum: be4730cbc76c49ee9fa9b90d3155211cfdbf0c5564eaaee2ce0b6185b4ef50348a768fbc5f65dccb411c658551c7a9c7062c8b261de899de1982fca9158cb778
languageName: node
linkType: hard

Expand Down Expand Up @@ -15290,7 +15290,7 @@ typescript@^4.3.2:
lodash-es: ^4.17.21
luxon: ^2.0.0
oidc-client: 1.11.5
owncloud-design-system: ^11.2.1
owncloud-design-system: ^11.2.2
owncloud-sdk: 1.0.0-2296
p-queue: ^6.1.1
popper-max-size-modifier: ^0.2.0
Expand Down