Merge pull request #563 from kaname-png/rework-home

feat(ui): rework home UI and with responsive design
This commit is contained in:
Andras Bacsai 2022-08-26 10:00:06 +02:00 committed by GitHub
commit 2af65ee946
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 334 additions and 282 deletions

View File

@ -38,6 +38,7 @@
"type": "module",
"dependencies": {
"@sveltejs/adapter-static": "1.0.0-next.39",
"@tailwindcss/typography": "^0.5.4",
"cuid": "2.1.8",
"daisyui": "2.24.0",
"js-cookie": "3.0.1",

View File

@ -50,61 +50,70 @@
});
</script>
<div class="pb-4">
<div class="title">Hardware Details</div>
<div class="text-center p-8 ">
<div>
<div class="stat w-64">
<div class="w-full">
<h1 class="title text-4xl">Hardware details</h1>
<div class="divider" />
<div class="grid grid-flow-col gap-4 grid-rows-3 lg:grid-rows-1">
<div class="stats stats-vertical lg:stats-horizontal shadow w-full mb-5">
<div class="stat">
<div class="stat-title">Total Memory</div>
<div class="stat-value">
{(usage?.memory.totalMemMb).toFixed(0)}<span class="text-sm">MB</span>
</div>
</div>
<div class="stat w-64">
<div class="stat">
<div class="stat-title">Used Memory</div>
<div class="stat-value">
{(usage?.memory.usedMemMb).toFixed(0)}<span class="text-sm">MB</span>
</div>
</div>
<div class="stat w-64">
<div class="stat">
<div class="stat-title">Free Memory</div>
<div class="stat-value">
{usage?.memory.freeMemPercentage}<span class="text-sm">%</span>
</div>
</div>
</div>
<div class="py-10">
<div class="stat w-64">
<div class="stats stats-vertical lg:stats-horizontal shadow w-full mb-5">
<div class="stat">
<div class="stat-title">Total CPUs</div>
<div class="stat-value">
{usage?.cpu.count}
</div>
</div>
<div class="stat w-64">
<div class="stat">
<div class="stat-title">CPU Usage</div>
<div class="stat-value">
{usage?.cpu.usage}<span class="text-sm">%</span>
</div>
</div>
<div class="stat w-64">
<div class="stat">
<div class="stat-title">Load Average (5,10,30mins)</div>
<div class="stat-value">{usage?.cpu.load}</div>
</div>
</div>
<div>
<div class="stat w-64">
<div class="stats stats-vertical lg:stats-horizontal shadow w-full mb-5">
<div class="stat">
<div class="stat-title">Total Disk</div>
<div class="stat-value">
{usage?.disk.totalGb}<span class="text-sm">GB</span>
</div>
</div>
<div class="stat w-64">
<div class="stat">
<div class="stat-title">Used Disk</div>
<div class="stat-value">
{usage?.disk.usedGb}<span class="text-sm">GB</span>
</div>
</div>
<div class="stat w-64">
<div class="stat">
<div class="stat-title">Free Disk</div>
<div class="stat-value">{usage?.disk.freePercentage}<span class="text-sm">%</span></div>
</div>

View File

@ -99,51 +99,42 @@
>
{/if}
</div>
<div class="mt-10 pb-12 sm:pb-16">
<div class="mx-auto px-10">
<div class="flex flex-col justify-center xl:flex-row">
<div class="container lg:mx-auto lg:p-0 p-5">
{#if $appSession.teamId === '0'}
<Usage />
{/if}
{#if applications.length > 0}
<div>
<div class="title">Resources</div>
<div class="flex items-start justify-center p-8">
<table class="rounded-none text-base">
<tbody>
<h1 class="title text-4xl mt-10">Resources</h1>
<div class="divider" />
<div class="grid grid-col gap-4 auto-cols-max grid-cols-1 lg:grid-cols-3">
{#each applications as application}
<tr>
<td class="space-x-2 items-center tracking-tight font-bold">
<div class="w-full rounded p-5 bg-neutral indicator mb-5">
{#await getStatus(application)}
<div class="inline-flex w-2 h-2 bg-yellow-500 rounded-full" />
<span class="indicator-item badge bg-yellow-500" />
{:then status}
{#if status === 'Running'}
<div class="inline-flex w-2 h-2 bg-success rounded-full" />
{#if status === 'Running'}1
<span class="indicator-item badge bg-success" />
{:else}
<div class="inline-flex w-2 h-2 bg-error rounded-full" />
<span class="indicator-item badge bg-error" />
{/if}
{/await}
<div class="inline-flex">{application.name}</div>
</td>
<td class="px-10 inline-flex">
<div class="w-full flex flex-row">
<ApplicationsIcons {application} isAbsolute={false} />
</td>
<td class="px-10">
<div
class="badge badge-outline text-xs border-applications rounded text-white"
>
<div class="w-full flex flex-col ml-5">
<span>
Application
{#if application.settings.isBot}
| BOT
{/if}
</div></td
>
<td class="flex justify-end">
</span>
<h1 class="font-bold text-lg">{application.name}</h1>
<div class="divider" />
<div class="btn-group justify-end">
{#if application.fqdn}
<a
href={application.fqdn}
target="_blank"
class="icons bg-transparent text-sm inline-flex"
><svg
<a href={application.fqdn} target="_blank" class="btn btn-sm">
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6"
class="h-6 w-6 mr-2"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
@ -155,19 +146,19 @@
<path d="M11 7h-5a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-5" />
<line x1="10" y1="14" x2="20" y2="4" />
<polyline points="15 4 20 4 20 9" />
</svg></a
>
</svg>
Website
</a>
{/if}
{#if application.settings.isBot && application.exposePort}
<a
href={`http://${dev ? 'localhost' : settings.ipv4}:${
application.exposePort
}`}
href={`http://${dev ? 'localhost' : settings.ipv4}:${application.exposePort}`}
target="_blank"
class="icons bg-transparent text-sm inline-flex"
><svg
class="btn btn-sm"
>
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6"
class="h-6 w-6 mr-2"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
@ -179,16 +170,14 @@
<path d="M11 7h-5a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-5" />
<line x1="10" y1="14" x2="20" y2="4" />
<polyline points="15 4 20 4 20 9" />
</svg></a
>
</svg>
Server
</a>
{/if}
<a
href={`/applications/${application.id}`}
class="icons bg-transparent text-sm inline-flex"
>
<a class="btn btn-sm btn-active" href={`/applications/${application.id}`}>
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6"
class="h-6 w-6 mr-2"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
@ -207,43 +196,42 @@
<line x1="18" y1="4" x2="18" y2="5" />
<line x1="18" y1="9" x2="18" y2="20" />
</svg>
Manage
</a>
</td>
</tr>
</div>
</div>
</div>
</div>
{/each}
</div>
<h1 class="title text-4xl mt-10">Services</h1>
<div class="divider" />
<div class="grid grid-col gap-4 auto-cols-max grid-cols-1 lg:grid-cols-3">
{#each services as service}
<tr>
<td class="space-x-2 items-center tracking-tight font-bold">
<div class="w-full rounded p-5 bg-neutral indicator mb-5">
{#await getStatus(service)}
<div class="inline-flex w-2 h-2 bg-yellow-500 rounded-full" />
<span class="indicator-item badge bg-yellow-500" />
{:then status}
{#if status === 'Running'}
<div class="inline-flex w-2 h-2 bg-success rounded-full" />
{#if status === 'Running'}1
<span class="indicator-item badge bg-success" />
{:else}
<div class="inline-flex w-2 h-2 bg-error rounded-full" />
<span class="indicator-item badge bg-error" />
{/if}
{/await}
<div class="inline-flex">{service.name}</div>
</td>
<td class="px-10 inline-flex">
<div class="w-full flex flex-row">
<ServiceIcons type={service.type} isAbsolute={false} />
</td>
<td class="px-10"
><div class="badge badge-outline text-xs border-services rounded text-white">
<div class="w-full flex flex-col ml-5">
<span>
Service
</div>
</td>
<td class="flex justify-end">
</span>
<h1 class="font-bold text-lg">{service.name}</h1>
<div class="divider" />
<div class="btn-group justify-end">
{#if service.fqdn}
<a
href={service.fqdn}
target="_blank"
class="icons bg-transparent text-sm inline-flex"
><svg
<a href={service.fqdn} target="_blank" class="btn btn-sm">
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6"
class="h-6 w-6 mr-2"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
@ -255,16 +243,14 @@
<path d="M11 7h-5a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-5" />
<line x1="10" y1="14" x2="20" y2="4" />
<polyline points="15 4 20 4 20 9" />
</svg></a
>
</svg>
Website
</a>
{/if}
<a
href={`/services/${service.id}`}
class="icons bg-transparent text-sm inline-flex"
>
<a class="btn btn-sm btn-active" href={`/services/${service.id}`}>
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6"
class="h-6 w-6 mr-2"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
@ -283,40 +269,41 @@
<line x1="18" y1="4" x2="18" y2="5" />
<line x1="18" y1="9" x2="18" y2="20" />
</svg>
Manage
</a>
</td>
</tr>
</div>
</div>
</div>
</div>
{/each}
</div>
<h1 class="title text-4xl mt-10">Databases</h1>
<div class="divider" />
<div class="grid grid-col gap-4 auto-cols-max grid-cols-1 lg:grid-cols-3">
{#each databases as database}
<tr>
<td class="space-x-2 items-center tracking-tight font-bold">
<div class="w-full rounded p-5 bg-neutral indicator mb-5">
{#await getStatus(database)}
<div class="inline-flex w-2 h-2 bg-yellow-500 rounded-full" />
<span class="indicator-item badge bg-yellow-500" />
{:then status}
{#if status === 'Running'}
<div class="inline-flex w-2 h-2 bg-success rounded-full" />
{#if status === 'Running'}1
<span class="indicator-item badge bg-success" />
{:else}
<div class="inline-flex w-2 h-2 bg-error rounded-full" />
<span class="indicator-item badge bg-error" />
{/if}
{/await}
<div class="inline-flex">{database.name}</div>
</td>
<td class="px-10 inline-flex">
<DatabaseIcons type={database.type} />
</td>
<td class="px-10">
<div class="badge badge-outline text-xs border-databases rounded text-white">
Database
</div>
</td>
<td class="flex justify-end">
<a
href={`/databases/${database.id}`}
class="icons bg-transparent text-sm inline-flex ml-11"
>
<div class="w-full flex flex-row">
<DatabaseIcons type={database.type} isAbsolute={false} />
<div class="w-full flex flex-col ml-5">
<span>
Service
</span>
<h1 class="font-bold text-lg">{database.name}</h1>
<div class="divider" />
<div class="btn-group justify-end">
<a class="btn btn-sm btn-active" href={`/databases/${database.id}`}>
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6"
class="h-6 w-6 mr-2"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
@ -335,20 +322,17 @@
<line x1="18" y1="4" x2="18" y2="5" />
<line x1="18" y1="9" x2="18" y2="20" />
</svg>
Manage
</a>
</td>
</tr>
{/each}
</tbody>
</table>
</div>
</div>
</div>
</div>
{/each}
</div>
{:else if $appSession.teamId !== '0'}
<div class="text-center text-xl font-bold">Nothing is configured yet.</div>
{/if}
{#if $appSession.teamId === '0'}
<Usage />
{/if}
</div>
<div class="text-center text-xl font-bold h-screen w-full flex flex-col justify-center">
<h1 class="text-5xl">Nothing is configured yet.</h1>
</div>
{/if}
</div>

View File

@ -62,5 +62,5 @@ module.exports = {
scrollbar: ['dark'],
extend: {}
},
plugins: [require('tailwindcss-scrollbar'), require('daisyui')]
plugins: [require('tailwindcss-scrollbar'), require('daisyui'), require("@tailwindcss/typography")]
};

View File

@ -122,6 +122,7 @@ importers:
'@playwright/test': 1.25.1
'@sveltejs/adapter-static': 1.0.0-next.39
'@sveltejs/kit': 1.0.0-next.405
'@tailwindcss/typography': ^0.5.4
'@types/js-cookie': 3.0.2
'@typescript-eslint/eslint-plugin': 5.35.1
'@typescript-eslint/parser': 5.35.1
@ -148,6 +149,7 @@ importers:
vite: 3.0.5
dependencies:
'@sveltejs/adapter-static': 1.0.0-next.39
'@tailwindcss/typography': 0.5.4_tailwindcss@3.1.8
cuid: 2.1.8
daisyui: 2.24.0_25hquoklqeoqwmt7fwvvcyxm5e
js-cookie: 3.0.1
@ -170,7 +172,7 @@ importers:
svelte: 3.49.0
svelte-check: 2.8.1_vylzxgme5yisu3bsyvcau4hjtq
svelte-preprocess: 4.10.7_fje22ktja5v2dh6nbkissncqme
tailwindcss: 3.1.8
tailwindcss: 3.1.8_postcss@8.4.16_postcss@8.4.16
tailwindcss-scrollbar: 0.1.0_tailwindcss@3.1.8
tslib: 2.4.0
typescript: 4.7.4
@ -418,8 +420,8 @@ packages:
engines: {node: '>=14'}
hasBin: true
dependencies:
'@types/node': 18.7.13
playwright-core: 1.25.1
'@types/node': 18.6.5
playwright-core: 1.24.2
dev: true
/@prisma/client/3.15.2_prisma@3.15.2:
@ -525,6 +527,17 @@ packages:
defer-to-connect: 2.0.1
dev: false
/@tailwindcss/typography/0.5.4_tailwindcss@3.1.8:
resolution: {integrity: sha512-QEdg40EmGvE7kKoDei8zr5sf4D1pIayHj4R31bH3lX8x2BtTiR+jNejYPOkhbmy3DXgkMF9jC8xqNiGFAuL9Sg==}
peerDependencies:
tailwindcss: '>=3.0.0 || insiders'
dependencies:
lodash.castarray: 4.4.0
lodash.isplainobject: 4.0.6
lodash.merge: 4.6.2
tailwindcss: 3.1.8_postcss@8.4.16
dev: false
/@tsconfig/node10/1.0.8:
resolution: {integrity: sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==}
dev: false
@ -580,8 +593,16 @@ packages:
resolution: {integrity: sha512-XwVteWQx/XkfRPyaGkw8dEbrCAkoRZ73pI3XznUYIpzbCfpQB3UnDlR5TnmdhetlT889tUJGF8QWo9xrgTpsiA==}
dev: true
/@types/node/18.7.13:
resolution: {integrity: sha512-46yIhxSe5xEaJZXWdIBP7GU4HDTG8/eo0qd9atdiL+lFpA03y8KS+lkTN834TWJj5767GbWv4n/P6efyTFt1Dw==}
/@types/node/18.0.3:
resolution: {integrity: sha512-HzNRZtp4eepNitP+BD6k2L6DROIDG4Q0fm4x+dwfsr6LGmROENnok75VGw40628xf+iR24WeMFcHuuBDUAzzsQ==}
dev: true
/@types/node/18.6.5:
resolution: {integrity: sha512-Xjt5ZGUa5WusGZJ4WJPbOT8QOqp6nDynVFRKcUt32bOgvXEoc6o085WNkYTMO7ifAj2isEfQQ2cseE+wT6jsRw==}
dev: true
/@types/node/18.7.11:
resolution: {integrity: sha512-KZhFpSLlmK/sdocfSAjqPETTMd0ug6HIMIAwkwUpU79olnZdQtMxpQP+G1wDzCH7na+FltSIhbaZuKdwZ8RDrw==}
/@types/normalize-package-data/2.4.1:
resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==}
@ -680,19 +701,14 @@ packages:
/@typescript-eslint/types/5.35.1:
resolution: {integrity: sha512-FDaujtsH07VHzG0gQ6NDkVVhi1+rhq0qEvzHdJAQjysN+LHDCKDKCBRlZFFE0ec0jKxiv0hN63SNfExy0KrbQQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dev: true
/@typescript-eslint/typescript-estree/5.35.1_typescript@4.7.4:
resolution: {integrity: sha512-JUqE1+VRTGyoXlDWWjm6MdfpBYVq+hixytrv1oyjYIBEOZhBCwtpp5ZSvBt4wIA1MKWlnaC2UXl2XmYGC3BoQA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
typescript: '*'
peerDependenciesMeta:
typescript:
optional: true
dependencies:
'@typescript-eslint/types': 5.35.1
'@typescript-eslint/visitor-keys': 5.35.1
'@typescript-eslint/types': 5.33.0
'@typescript-eslint/visitor-keys': 5.33.0
debug: 4.3.4
globby: 11.1.0
is-glob: 4.0.3
@ -703,16 +719,55 @@ packages:
- supports-color
dev: true
/@typescript-eslint/utils/5.35.1_4rv7y5c6xz3vfxwhbrcxxi73bq:
resolution: {integrity: sha512-v6F8JNXgeBWI4pzZn36hT2HXXzoBBBJuOYvoQiaQaEEjdi5STzux3Yj8v7ODIpx36i/5s8TdzuQ54TPc5AITQQ==}
/@typescript-eslint/typescript-estree/5.34.0_typescript@4.7.4:
resolution: {integrity: sha512-mXHAqapJJDVzxauEkfJI96j3D10sd567LlqroyCeJaHnu42sDbjxotGb3XFtGPYKPD9IyLjhsoULML1oI3M86A==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
typescript: '*'
peerDependenciesMeta:
typescript:
optional: true
dependencies:
'@typescript-eslint/types': 5.34.0
'@typescript-eslint/visitor-keys': 5.34.0
debug: 4.3.4
globby: 11.1.0
is-glob: 4.0.3
semver: 7.3.7
tsutils: 3.21.0_typescript@4.7.4
typescript: 4.7.4
transitivePeerDependencies:
- supports-color
dev: true
/@typescript-eslint/utils/5.33.0_qugx7qdu5zevzvxaiqyxfiwquq:
resolution: {integrity: sha512-JxOAnXt9oZjXLIiXb5ZIcZXiwVHCkqZgof0O8KPgz7C7y0HS42gi75PdPlqh1Tf109M0fyUw45Ao6JLo7S5AHw==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
dependencies:
'@types/json-schema': 7.0.11
'@typescript-eslint/scope-manager': 5.35.1
'@typescript-eslint/types': 5.35.1
'@typescript-eslint/typescript-estree': 5.35.1_typescript@4.7.4
'@typescript-eslint/scope-manager': 5.33.0
'@typescript-eslint/types': 5.33.0
'@typescript-eslint/typescript-estree': 5.33.0_typescript@4.7.4
eslint: 8.21.0
eslint-scope: 5.1.1
eslint-utils: 3.0.0_eslint@8.21.0
transitivePeerDependencies:
- supports-color
- typescript
dev: true
/@typescript-eslint/utils/5.34.0_4rv7y5c6xz3vfxwhbrcxxi73bq:
resolution: {integrity: sha512-kWRYybU4Rn++7lm9yu8pbuydRyQsHRoBDIo11k7eqBWTldN4xUdVUMCsHBiE7aoEkFzrUEaZy3iH477vr4xHAQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
dependencies:
'@types/json-schema': 7.0.11
'@typescript-eslint/scope-manager': 5.34.0
'@typescript-eslint/types': 5.34.0
'@typescript-eslint/typescript-estree': 5.34.0_typescript@4.7.4
eslint: 8.22.0
eslint-scope: 5.1.1
eslint-utils: 3.0.0_eslint@8.22.0
@ -4066,6 +4121,10 @@ packages:
lodash._basetostring: 4.12.0
dev: false
/lodash.castarray/4.4.0:
resolution: {integrity: sha512-aVx8ztPv7/2ULbArGJ2Y42bG1mEQ5mGjpdvrbJcJFU3TbYybe+QlLS4pst9zV52ymy2in1KpFPiZnAOATxD4+Q==}
dev: false
/lodash.includes/4.3.0:
resolution: {integrity: sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==}
dev: false
@ -4092,7 +4151,6 @@ packages:
/lodash.merge/4.6.2:
resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==}
dev: true
/lodash.omit/4.5.0:
resolution: {integrity: sha512-XeqSp49hNGmlkj2EJlfrQFIzQ6lXdNro9sddtQzcJY8QaoC2GO0DT7xaIokHeyM+mIT0mPMlPvkYzg2xCuHdZg==}