integrated sys info api

This commit is contained in:
Chirag Bhalotia 2023-06-25 01:28:56 +05:30
parent 3fe8be6725
commit f6f612e899
No known key found for this signature in database
GPG Key ID: F7F1F1FBFFD40427
3 changed files with 22 additions and 20 deletions

View File

@ -15,8 +15,11 @@ export class Settings {
return res
}
async getInstanceInfo(){
}
const res = await this.axios.get('/info/sys');
delete res.data.data.cpuUsage
delete res.data.data.memoryUsage
return res.data.data as ISysSettings
}
}
export default Settings;

View File

@ -1,13 +1,9 @@
import api from '@/api';
import React from 'react';
function Page() {
const urls = [
{
id: 'afdas',
originalURL: 'https://www.google.com',
shortenedURL: 'https://www.google.com',
},
];
async function Page() {
const res = await api.settings.getInstanceInfo();
const data = Object.entries(res);
return (
<div>
@ -29,19 +25,13 @@ function Page() {
</tr>
</thead>
<tbody className="divide-y p-2">
{urls.map(({ originalURL, shortenedURL, id }) => (
{data.map((val, id) => (
<tr className="bg-gray-900 rounded" key={id}>
<td className="whitespace-nowrap py-5 pl-4 pr-20 text-sm font-medium text-white">
<div className="flex items-center gap-3">
{originalURL}
</div>
<div className="flex items-center gap-3">{val[0]}</div>
</td>
<td className="whitespace-nowrap pl-4 text-sm font-medium text-white">
<div className="flex items-center gap-3">
{shortenedURL}
</div>
<div className="flex items-center gap-3">{val[1]}</div>
</td>
</tr>
))}

View File

@ -3,4 +3,13 @@ interface ISettings {
language: string;
imageExtensions: string[];
fileExtensions: string[];
}
}
interface ISysSettings {
platform: string;
arch: string;
nodeVersion: string;
uptime: string;
kernelVersion: string;
hostname: string;
}