Add Fleetbase UI removal: hide Discord/Docs/Help menu links via CSS, remove Fleetbase Blog + Github Card default widgets from registry
This commit is contained in:
@ -4,6 +4,7 @@ export default {
|
||||
injectBrandStyles();
|
||||
replaceFavicon();
|
||||
overrideAppName(appInstance);
|
||||
removeFleetbaseWidgets(appInstance);
|
||||
|
||||
universe.extensionManager.ensureEngineLoaded('@biibaye/branding');
|
||||
},
|
||||
@ -67,6 +68,10 @@ function injectBrandStyles() {
|
||||
|
||||
/* Dark theme background */
|
||||
body[data-theme="dark"]{background-color:#343538!important}
|
||||
|
||||
/* Hide Fleetbase-branded user menu links */
|
||||
.support-user-nav-item,.docs-user-nav-item{display:none!important}
|
||||
a[href*="discord.gg"]{display:none!important}
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
}
|
||||
@ -129,3 +134,24 @@ function updateMetaTags() {
|
||||
document.head.appendChild(meta);
|
||||
});
|
||||
}
|
||||
|
||||
function removeFleetbaseWidgets(appInstance) {
|
||||
try {
|
||||
const widgetService = appInstance.lookup('service:universe/widget-service');
|
||||
if (!widgetService || !widgetService.registry) return;
|
||||
|
||||
const fleetbaseWidgetKeys = ['dashboard#fleetbase-blog', 'dashboard#fleetbase-github-card'];
|
||||
|
||||
['widget', 'default-widget'].forEach((listName) => {
|
||||
const items = widgetService.registry.getRegistry('dashboard:widgets', listName);
|
||||
const toRemove = items.filter(
|
||||
(item) => item._registryKey && fleetbaseWidgetKeys.includes(item._registryKey)
|
||||
);
|
||||
if (toRemove.length) {
|
||||
items.removeObjects(toRemove);
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
// widget service or registry not available yet
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user