mirror of
https://github.com/unraid/api.git
synced 2026-01-02 22:50:02 -06:00
refactor: update my servers include file to handle CSS values
This commit updates the `myservers1.php` file in the `dynamix.my.servers` plugin. It adds functionality to handle CSS values in addition to the existing file handling logic. The code now checks for CSS values in the local manifest and includes them in the rendered HTML if found.
This commit is contained in:
@@ -46,17 +46,25 @@ $localManifest = json_decode(file_get_contents($localManifestFile), true);
|
||||
|
||||
$searchText = 'unraid-components.client.mjs';
|
||||
$fileValue = null;
|
||||
$cssValues = [];
|
||||
|
||||
foreach ($localManifest as $key => $value) {
|
||||
if (strpos($key, $searchText) !== false && isset($value["file"])) {
|
||||
$fileValue = $value["file"];
|
||||
break;
|
||||
}
|
||||
|
||||
if (strpos($key, $searchText) !== false && isset($value["css"])) {
|
||||
$cssValues = $value["css"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($fileValue !== null) {
|
||||
$prefixedPath = '/plugins/dynamix.my.servers/unraid-components/';
|
||||
echo '<script src="' . $prefixedPath . $fileValue . '"></script>';
|
||||
|
||||
echo '<link rel="stylesheet" href="' . $prefixedPath . '_nuxt/unraid-components-DNhg-Rqp.css">' . PHP_EOL;
|
||||
} else {
|
||||
echo '<script>console.error("%cNo matching key containing \'' . $searchText . '\' found.", "font-weight: bold; color: white; background-color: red");</script>';
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
const visible = ref<boolean>(false);
|
||||
|
||||
const showSidebar = () => {
|
||||
console.log('showSidebar');
|
||||
visible.value = true;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -7,6 +12,6 @@ const visible = ref<boolean>(false);
|
||||
<Drawer v-model:visible="visible" header="Drawers" position="right" class="!w-full md:!w-80 lg:!w-[30rem]">
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
|
||||
</Drawer>
|
||||
<Button label="Open" class="p-button-rounded p-button-outlined" @click="visible = true" />
|
||||
<Button label="Open" class="p-button-rounded p-button-outlined" @click="showSidebar" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -129,7 +129,6 @@ onBeforeMount(() => {
|
||||
|
||||
<NotificationsSidebar />
|
||||
|
||||
|
||||
<OnClickOutside class="flex items-center justify-end h-full" :options="{ ignore: [clickOutsideIgnoreTarget] }" @trigger="outsideDropdown">
|
||||
<UpcDropdownTrigger ref="clickOutsideIgnoreTarget" :t="t" />
|
||||
<UpcDropdown ref="clickOutsideTarget" :t="t" />
|
||||
|
||||
Reference in New Issue
Block a user