feat: add docker container table (#520)
* WIP On docker integration * WIP on adding docker support * WIP on adding docker support * chore: Add cacheTime parameter to createCacheChannel function * bugfix: Add node-loader npm dependency for webpack configuration * revert changes * chore: Add node-loader npm dependency for webpack configuration * feat: Add Docker container list to DockerPage * chore: apply pr suggestions * fix: fix printing issue using a Date objext * chore: Update npm dependencies * feat: Create DockerTable component for displaying Docker container list * feat: Refactor DockerPage to use DockerTable component * feat: Refactor DockerPage to use DockerTable component * feat: Add useTimeAgo hook for displaying relative timestamps * feat: Add hooks module to common package * refactor: Update DockerTable component Include container actions and state badges * feat: add information about instance for docker containers * feat: Add OverflowBadge component for displaying overflowed data * feat: Refactor DockerSingleton to use host and instance properties This commit refactors the DockerSingleton class in the `docker.ts` file to use the `host` and `instance` properties instead of the previous `key` and `remoteApi` properties. This change improves clarity and consistency in the codebase. * feat: Add OverflowBadge component for displaying overflowed data * feat: Improve DockerTable component with Avatar and Name column This commit enhances the DockerTable component in the `DockerTable.tsx` file by adding an Avatar and Name column. The Avatar column displays an icon based on the Docker container's image, while the Name column shows the container's name. This improvement provides better visual representation and identification of the containers in the table. * feat: Enhance DockerTable component with Avatar and Name columns * refactor: improve docker table and icon resolution * chore: address pull request feedback * fix: format issues * chore: add missing translations * refactor: remove black background --------- Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
This commit is contained in:
@@ -56,9 +56,10 @@ const cacheClient = createRedisConnection();
|
||||
/**
|
||||
* Creates a new cache channel.
|
||||
* @param name name of the channel
|
||||
* @param cacheDurationMs duration in milliseconds to cache
|
||||
* @returns cache channel object
|
||||
*/
|
||||
export const createCacheChannel = <TData>(name: string, cacheDurationSeconds: number = 5 * 60 * 1000) => {
|
||||
export const createCacheChannel = <TData>(name: string, cacheDurationMs: number = 5 * 60 * 1000) => {
|
||||
const cacheChannelName = `cache:${name}`;
|
||||
|
||||
return {
|
||||
@@ -73,7 +74,7 @@ export const createCacheChannel = <TData>(name: string, cacheDurationSeconds: nu
|
||||
const parsedData = superjson.parse<{ data: TData; timestamp: Date }>(data);
|
||||
const now = new Date();
|
||||
const diff = now.getTime() - parsedData.timestamp.getTime();
|
||||
if (diff > cacheDurationSeconds) return null;
|
||||
if (diff > cacheDurationMs) return null;
|
||||
|
||||
return parsedData;
|
||||
},
|
||||
@@ -102,7 +103,7 @@ export const createCacheChannel = <TData>(name: string, cacheDurationSeconds: nu
|
||||
const now = new Date();
|
||||
const diff = now.getTime() - parsedData.timestamp.getTime();
|
||||
|
||||
if (diff > cacheDurationSeconds) {
|
||||
if (diff > cacheDurationMs) {
|
||||
return await getNewDataAsync();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user