Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix(dashboard): Use the widget icon URL when it was provided
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen authored and backportbot[bot] committed Jul 19, 2024
commit acc2571a0d0c76071f0da3cef33fda804f963118
2 changes: 2 additions & 0 deletions apps/dashboard/lib/Controller/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\Dashboard\IIconWidget;
use OCP\Dashboard\IManager;
use OCP\Dashboard\IWidget;
use OCP\EventDispatcher\IEventDispatcher;
Expand Down Expand Up @@ -75,6 +76,7 @@ public function index(): TemplateResponse {
'id' => $widget->getId(),
'title' => $widget->getTitle(),
'iconClass' => $widget->getIconClass(),
'iconUrl' => $widget instanceof IIconWidget ? $widget->getIconUrl() : '',
'url' => $widget->getUrl()
];
}, $this->dashboardManager->getWidgets());
Expand Down
24 changes: 22 additions & 2 deletions apps/dashboard/src/DashboardApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
class="panel">
<div class="panel--header">
<h2>
<span :aria-labelledby="`panel-${panels[panelId].id}--header--icon--description`"
<img v-if="apiWidgets[panels[panelId].id].icon_url"
:alt="apiWidgets[panels[panelId].id].title + ' icon'"
:src="apiWidgets[panels[panelId].id].icon_url"
aria-hidden="true">
<span v-else
:aria-labelledby="`panel-${panels[panelId].id}--header--icon--description`"
aria-hidden="true"
:class="apiWidgets[panels[panelId].id].icon_class"
role="img" />
Expand Down Expand Up @@ -93,7 +98,11 @@
:checked="isActive(panel)"
@input="updateCheckbox(panel, $event.target.checked)">
<label :for="'panel-checkbox-' + panel.id" :class="{ draggable: isActive(panel) }">
<span :class="panel.iconClass" aria-hidden="true" />
<img v-if="panel.iconUrl"
:alt="panel.title + ' icon'"
:src="panel.iconUrl"
aria-hidden="true">
<span v-else :class="panel.iconClass" aria-hidden="true" />
{{ panel.title }}
</label>
</li>
Expand Down Expand Up @@ -546,6 +555,8 @@ export default {
overflow: hidden;
text-overflow: ellipsis;
cursor: grab;

img,
span {
background-size: 32px;
width: 32px;
Expand All @@ -556,6 +567,10 @@ export default {
margin-top: -6px;
margin-left: 6px;
}

img {
filter: var(--background-invert-if-dark);
}
}
}

Expand Down Expand Up @@ -643,6 +658,7 @@ export default {
text-overflow: ellipsis;
white-space: nowrap;

img,
span {
position: absolute;
top: 16px;
Expand All @@ -651,6 +667,10 @@ export default {
background-size: 24px;
}

img {
filter: var(--background-invert-if-dark);
}

&:hover {
border-color: var(--color-primary-element);
}
Expand Down