cdd-cli 3.1.7 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +1 -1
- package/.github/workflows/ci.yml +3 -0
- package/.github/workflows/docs.yml +8 -1
- package/CHANGELOG.md +40 -0
- package/CONTRIBUTING.md +28 -15
- package/README.md +56 -88
- package/babel.config.cjs +18 -1
- package/coverage/clover.xml +604 -0
- package/coverage/coverage-final.json +17 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/helpers/constants.js.html +235 -0
- package/coverage/lcov-report/helpers/containerOptionsBuilder.js.html +211 -0
- package/coverage/lcov-report/helpers/dockerService/serviceComponents/containerActions.js.html +853 -0
- package/coverage/lcov-report/helpers/dockerService/serviceComponents/containerList.js.html +289 -0
- package/coverage/lcov-report/helpers/dockerService/serviceComponents/index.html +131 -0
- package/coverage/lcov-report/helpers/index.html +176 -0
- package/coverage/lcov-report/helpers/logger.js.html +424 -0
- package/coverage/lcov-report/helpers/safeCall.js.html +139 -0
- package/coverage/lcov-report/helpers/validationHelpers.js.html +394 -0
- package/coverage/lcov-report/hooks/creation/index.html +146 -0
- package/coverage/lcov-report/hooks/creation/useContainerActions.js.html +292 -0
- package/coverage/lcov-report/hooks/creation/useContainerCreation.js.html +478 -0
- package/coverage/lcov-report/hooks/creation/useLogsViewer.js.html +238 -0
- package/coverage/lcov-report/hooks/debug/index.html +116 -0
- package/coverage/lcov-report/hooks/debug/useDebugLogs.js.html +172 -0
- package/coverage/lcov-report/hooks/index.html +161 -0
- package/coverage/lcov-report/hooks/navigation/index.html +116 -0
- package/coverage/lcov-report/hooks/navigation/useContainerSelection.js.html +160 -0
- package/coverage/lcov-report/hooks/useContainerCommandRouter.js.html +415 -0
- package/coverage/lcov-report/hooks/useControls.js.html +685 -0
- package/coverage/lcov-report/hooks/useEraseConfirmation.js.html +202 -0
- package/coverage/lcov-report/hooks/useExitHandler.js.html +283 -0
- package/coverage/lcov-report/index.html +191 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov.info +1216 -0
- package/dist/components/ContainerRow.js +5 -78
- package/dist/components/LogViewer.js +4 -9
- package/dist/helpers/containerOptionsBuilder.js +58 -0
- package/dist/hooks/creation/useContainerCreation.js +16 -1
- package/dist/hooks/debug/useDebugLogs.js +46 -0
- package/dist/hooks/navigation/useContainerSelection.js +36 -0
- package/dist/hooks/useContainerCommandRouter.js +151 -0
- package/dist/{helpers/actionHelpers.js → hooks/useContainerStats.js} +76 -78
- package/dist/hooks/useControls.js +83 -342
- package/dist/hooks/useEraseConfirmation.js +47 -0
- package/dist/hooks/useExitHandler.js +68 -0
- package/jest.config.cjs +1 -1
- package/package.json +2 -3
- package/src/components/ContainerRow.jsx +3 -38
- package/src/components/LogViewer.jsx +4 -10
- package/src/helpers/constants.js +20 -0
- package/src/helpers/containerOptionsBuilder.js +42 -0
- package/src/helpers/dockerService/serviceComponents/containerActions.js +55 -8
- package/src/helpers/validationHelpers.js +75 -18
- package/src/hooks/creation/useContainerCreation.js +34 -4
- package/src/hooks/debug/useDebugLogs.js +29 -0
- package/src/hooks/navigation/useContainerSelection.js +25 -0
- package/src/hooks/useContainerCommandRouter.js +110 -0
- package/src/hooks/useContainerStats.js +44 -0
- package/src/hooks/useControls.js +75 -274
- package/src/hooks/useEraseConfirmation.js +39 -0
- package/src/hooks/useExitHandler.js +66 -0
- package/test/containerActions.test.js +104 -13
- package/test/containerOptionsBuilder.test.js +36 -0
- package/test/useContainerCreation.dom.test.js +46 -2
- package/test/useControls.dom.test.js +117 -0
- package/test/validationHelpers.test.js +51 -0
- package/.babelrc +0 -6
- package/FIXES_APPLIED.md +0 -419
- package/SECURITY.md +0 -5
- package/dist/hooks/useLogsStream.js +0 -41
- package/docs/_config.yml +0 -13
- package/docs/components_ContainerCreationPrompt.jsx.html +0 -114
- package/docs/components_ContainerRow.jsx.html +0 -151
- package/docs/components_ContainerSection.jsx.html +0 -75
- package/docs/components_Footer.jsx.html +0 -66
- package/docs/components_Header.jsx.html +0 -84
- package/docs/components_LogViewer.jsx.html +0 -91
- package/docs/components_MessageFeedback.jsx.html +0 -76
- package/docs/components_PromptField.jsx.html +0 -99
- package/docs/components_StatsBar.jsx.html +0 -105
- package/docs/components_UsageMenu.jsx.html +0 -73
- package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Bold-webfont.svg +0 -1830
- package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
- package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Italic-webfont.svg +0 -1830
- package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Light-webfont.svg +0 -1831
- package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
- package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Regular-webfont.svg +0 -1831
- package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/docs/global.html +0 -6145
- package/docs/helpers_actionHelpers.js.html +0 -94
- package/docs/helpers_constants.js.html +0 -81
- package/docs/helpers_dockerService_dockerService.js.html +0 -79
- package/docs/helpers_dockerService_serviceComponents_containerActions.js.html +0 -153
- package/docs/helpers_dockerService_serviceComponents_containerList.js.html +0 -81
- package/docs/helpers_dockerService_serviceComponents_containerLogs.js.html +0 -85
- package/docs/helpers_dockerService_serviceComponents_containerStats.js.html +0 -107
- package/docs/helpers_dockerService_serviceComponents_imageUtils.js.html +0 -82
- package/docs/helpers_exitWithMessage.js.html +0 -77
- package/docs/helpers_safeCall.js.html +0 -68
- package/docs/helpers_validationHelpers.js.html +0 -96
- package/docs/hooks_creation_useContainerActions.js.html +0 -120
- package/docs/hooks_creation_useContainerCreation.js.html +0 -152
- package/docs/hooks_creation_useLogsViewer.js.html +0 -102
- package/docs/hooks_useControls.js.html +0 -298
- package/docs/hooks_useLogsStream.js.html +0 -82
- package/docs/index.html +0 -65
- package/docs/index.js.html +0 -65
- package/docs/module-index.html +0 -171
- package/docs/scripts/linenumber.js +0 -25
- package/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/docs/scripts/prettify/lang-css.js +0 -2
- package/docs/scripts/prettify/prettify.js +0 -28
- package/docs/styles/jsdoc-default.css +0 -358
- package/docs/styles/prettify-jsdoc.css +0 -111
- package/docs/styles/prettify-tomorrow.css +0 -132
- package/esbuild.config.cjs +0 -11
- package/src/helpers/actionHelpers.js +0 -52
- package/src/hooks/useLogsStream.js +0 -31
- package/test/actionHelpers.test.js +0 -106
package/SECURITY.md
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
2
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
|
-
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
5
|
-
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
6
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
7
|
-
import React, { useRef, useCallback } from "react";
|
|
8
|
-
import { getLogsStream } from "../helpers/dockerService/serviceComponents/containerLogs.js";
|
|
9
|
-
import { safeCall } from "../helpers/safeCall.js";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Hook that manages opening and closing a logs stream for a container.
|
|
13
|
-
*
|
|
14
|
-
* @returns {Object} { openLogs, closeLogs }
|
|
15
|
-
*/
|
|
16
|
-
export function useLogsStream() {
|
|
17
|
-
var logsStreamRef = useRef(null);
|
|
18
|
-
var openLogs = useCallback(function (containerId, setLogs) {
|
|
19
|
-
setLogs([]);
|
|
20
|
-
logsStreamRef.current = getLogsStream(containerId, function (data) {
|
|
21
|
-
return setLogs(function (prev) {
|
|
22
|
-
return [].concat(_toConsumableArray(prev), _toConsumableArray(data.split("\n").filter(Boolean)));
|
|
23
|
-
});
|
|
24
|
-
}, function () {}, function (err) {
|
|
25
|
-
return setLogs(function (prev) {
|
|
26
|
-
return [].concat(_toConsumableArray(prev), ["Error: ".concat(err.message)]);
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
}, []);
|
|
30
|
-
var closeLogs = useCallback(function () {
|
|
31
|
-
if (logsStreamRef.current) {
|
|
32
|
-
var _logsStreamRef$curren;
|
|
33
|
-
safeCall((_logsStreamRef$curren = logsStreamRef.current.destroy) === null || _logsStreamRef$curren === void 0 ? void 0 : _logsStreamRef$curren.bind(logsStreamRef.current));
|
|
34
|
-
logsStreamRef.current = null;
|
|
35
|
-
}
|
|
36
|
-
}, []);
|
|
37
|
-
return {
|
|
38
|
-
openLogs: openLogs,
|
|
39
|
-
closeLogs: closeLogs
|
|
40
|
-
};
|
|
41
|
-
}
|
package/docs/_config.yml
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
title: CDD Documentation
|
|
2
|
-
# Disable the default GitHub Pages theme so Jekyll just copies our static output
|
|
3
|
-
# (the static HTML is generated by JSDoc and already styled).
|
|
4
|
-
theme: null
|
|
5
|
-
|
|
6
|
-
# Explicitly include asset folders that Jekyll might otherwise ignore.
|
|
7
|
-
include:
|
|
8
|
-
- fonts
|
|
9
|
-
- scripts
|
|
10
|
-
- styles
|
|
11
|
-
|
|
12
|
-
# No Jekyll plugins are required for this pre-rendered site.
|
|
13
|
-
plugins: []
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>JSDoc: Source: components/ContainerCreationPrompt.jsx</title>
|
|
6
|
-
|
|
7
|
-
<script src="scripts/prettify/prettify.js"> </script>
|
|
8
|
-
<script src="scripts/prettify/lang-css.js"> </script>
|
|
9
|
-
<!--[if lt IE 9]>
|
|
10
|
-
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
11
|
-
<![endif]-->
|
|
12
|
-
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
13
|
-
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
14
|
-
</head>
|
|
15
|
-
|
|
16
|
-
<body>
|
|
17
|
-
|
|
18
|
-
<div id="main">
|
|
19
|
-
|
|
20
|
-
<h1 class="page-title">Source: components/ContainerCreationPrompt.jsx</h1>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<section>
|
|
28
|
-
<article>
|
|
29
|
-
<pre class="prettyprint source linenums"><code>import React from "react";
|
|
30
|
-
import { Box, Text } from "ink";
|
|
31
|
-
import { PromptField, PromptMessage } from "./PromptField.jsx";
|
|
32
|
-
import PropTypes from 'prop-types';
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Prompt UI shown when creating a new container.
|
|
36
|
-
* Presents a step-by-step form (image, name, ports, env) and displays
|
|
37
|
-
* a contextual message provided by the creation hook.
|
|
38
|
-
*
|
|
39
|
-
* @param {Object} props
|
|
40
|
-
* @param {number} props.step - Current step index (0..3)
|
|
41
|
-
* @param {string} props.imageName - Value for the image name field
|
|
42
|
-
* @param {string} props.containerName - Value for the container name field
|
|
43
|
-
* @param {string} props.portInput - Value for the ports input field
|
|
44
|
-
* @param {string} props.envInput - Value for the environment variables field
|
|
45
|
-
* @param {string} props.message - Contextual message to display (errors/hints)
|
|
46
|
-
* @param {string} props.messageColor - Color for the contextual message
|
|
47
|
-
* @returns {JSX.Element}
|
|
48
|
-
*/
|
|
49
|
-
export default function ContainerCreationPrompt(props) {
|
|
50
|
-
const { step, imageName, containerName, portInput, envInput, message, messageColor } = props;
|
|
51
|
-
const prompts = [
|
|
52
|
-
{
|
|
53
|
-
label: "Name of the image to create (e.g., nginx:latest):",
|
|
54
|
-
value: imageName,
|
|
55
|
-
required: true,
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
label: "Name of the container (optional):",
|
|
59
|
-
value: containerName,
|
|
60
|
-
required: false,
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
label: "Ports (optional, format 8080:80,443:443):",
|
|
64
|
-
value: portInput,
|
|
65
|
-
required: false,
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
label: "Environment variables (optional, format VAR1=val1,VAR2=val2):",
|
|
69
|
-
value: envInput,
|
|
70
|
-
required: false,
|
|
71
|
-
},
|
|
72
|
-
];
|
|
73
|
-
const { label, value, required } = prompts[step] || {};
|
|
74
|
-
return (
|
|
75
|
-
<Box flexDirection="column" borderStyle="round" borderColor="yellow" padding={1}>
|
|
76
|
-
<PromptField label={label} value={value} required={required} />
|
|
77
|
-
<PromptMessage message={message} color={messageColor} />
|
|
78
|
-
<Text dimColor>Press Enter to continue, Escape to cancel</Text>
|
|
79
|
-
</Box>
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
ContainerCreationPrompt.propTypes = {
|
|
84
|
-
step: PropTypes.number.isRequired,
|
|
85
|
-
imageName: PropTypes.string,
|
|
86
|
-
containerName: PropTypes.string,
|
|
87
|
-
portInput: PropTypes.string,
|
|
88
|
-
envInput: PropTypes.string,
|
|
89
|
-
message: PropTypes.string,
|
|
90
|
-
messageColor: PropTypes.string,
|
|
91
|
-
};
|
|
92
|
-
</code></pre>
|
|
93
|
-
</article>
|
|
94
|
-
</section>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
</div>
|
|
100
|
-
|
|
101
|
-
<nav>
|
|
102
|
-
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-index.html">index</a></li></ul><h3>Global</h3><ul><li><a href="global.html#EXIT_DELAY">EXIT_DELAY</a></li><li><a href="global.html#MESSAGE_TIMEOUTS">MESSAGE_TIMEOUTS</a></li><li><a href="global.html#PromptField">PromptField</a></li><li><a href="global.html#PromptMessage">PromptMessage</a></li><li><a href="global.html#REFRESH_INTERVALS">REFRESH_INTERVALS</a></li><li><a href="global.html#TIMEOUTS">TIMEOUTS</a></li><li><a href="global.html#colorize">colorize</a></li><li><a href="global.html#createContainer">createContainer</a></li><li><a href="global.html#docker">docker</a></li><li><a href="global.html#exitWithMessage">exitWithMessage</a></li><li><a href="global.html#getContainers">getContainers</a></li><li><a href="global.html#getLogsStream">getLogsStream</a></li><li><a href="global.html#getStats">getStats</a></li><li><a href="global.html#handleAction">handleAction</a></li><li><a href="global.html#imageExists">imageExists</a></li><li><a href="global.html#makeBar">makeBar</a></li><li><a href="global.html#pullImage">pullImage</a></li><li><a href="global.html#removeContainer">removeContainer</a></li><li><a href="global.html#restartContainer">restartContainer</a></li><li><a href="global.html#safeCall">safeCall</a></li><li><a href="global.html#startContainer">startContainer</a></li><li><a href="global.html#stopContainer">stopContainer</a></li><li><a href="global.html#useContainerActions">useContainerActions</a></li><li><a href="global.html#useContainerCreation">useContainerCreation</a></li><li><a href="global.html#useControls">useControls</a></li><li><a href="global.html#useLogsStream">useLogsStream</a></li><li><a href="global.html#useLogsViewer">useLogsViewer</a></li><li><a href="global.html#validateEnvVars">validateEnvVars</a></li><li><a href="global.html#validatePorts">validatePorts</a></li><li><a href="global.html#withTimeout">withTimeout</a></li></ul>
|
|
103
|
-
</nav>
|
|
104
|
-
|
|
105
|
-
<br class="clear">
|
|
106
|
-
|
|
107
|
-
<footer>
|
|
108
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.5</a> on Fri Oct 17 2025 16:07:18 GMT-0500 (hora estándar de Colombia)
|
|
109
|
-
</footer>
|
|
110
|
-
|
|
111
|
-
<script> prettyPrint(); </script>
|
|
112
|
-
<script src="scripts/linenumber.js"> </script>
|
|
113
|
-
</body>
|
|
114
|
-
</html>
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>JSDoc: Source: components/ContainerRow.jsx</title>
|
|
6
|
-
|
|
7
|
-
<script src="scripts/prettify/prettify.js"> </script>
|
|
8
|
-
<script src="scripts/prettify/lang-css.js"> </script>
|
|
9
|
-
<!--[if lt IE 9]>
|
|
10
|
-
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
11
|
-
<![endif]-->
|
|
12
|
-
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
13
|
-
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
14
|
-
</head>
|
|
15
|
-
|
|
16
|
-
<body>
|
|
17
|
-
|
|
18
|
-
<div id="main">
|
|
19
|
-
|
|
20
|
-
<h1 class="page-title">Source: components/ContainerRow.jsx</h1>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<section>
|
|
28
|
-
<article>
|
|
29
|
-
<pre class="prettyprint source linenums"><code>import React, { useState, useEffect } from "react";
|
|
30
|
-
import { Box, Text } from "ink";
|
|
31
|
-
import { getStats } from "../helpers/dockerService/serviceComponents/containerStats";
|
|
32
|
-
import { REFRESH_INTERVALS } from "../helpers/constants";
|
|
33
|
-
import StatsBar from "./StatsBar.jsx";
|
|
34
|
-
import PropTypes from 'prop-types';
|
|
35
|
-
|
|
36
|
-
const stateText = (state) => {
|
|
37
|
-
if (state === "running") return { text: "🟢 RUNNING", color: "green" };
|
|
38
|
-
if (state === "exited") return { text: "🔴 EXITED", color: "red" };
|
|
39
|
-
if (state === "paused") return { text: "🟠 PAUSED", color: "yellow" };
|
|
40
|
-
return { text: state.toUpperCase(), color: "gray" };
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Row component that renders information and live stats for a container.
|
|
45
|
-
*
|
|
46
|
-
* @param {Object} props
|
|
47
|
-
* @param {Object} props.container - Container object with id, name, image, state and ports
|
|
48
|
-
* @returns {JSX.Element}
|
|
49
|
-
*/
|
|
50
|
-
export default function ContainerRow({ container }) {
|
|
51
|
-
const { id, name, image, state } = container;
|
|
52
|
-
const [stats, setStats] = useState({
|
|
53
|
-
cpuPercent: 0,
|
|
54
|
-
memPercent: 0,
|
|
55
|
-
netIO: { rx: 0, tx: 0 },
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
// Format ports for display
|
|
59
|
-
const formatPorts = (ports) => {
|
|
60
|
-
if (!ports || ports.length === 0) return "";
|
|
61
|
-
if (Array.isArray(ports)) {
|
|
62
|
-
return ports.map((p, _i) => ` 🔗 ${p}`).join(" ");
|
|
63
|
-
}
|
|
64
|
-
return ` 🔗 ${ports}`;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const [statsError, setStatsError] = useState("");
|
|
68
|
-
useEffect(() => {
|
|
69
|
-
if (state !== "running") return;
|
|
70
|
-
|
|
71
|
-
let isMounted = true;
|
|
72
|
-
|
|
73
|
-
const fetchStats = async () => {
|
|
74
|
-
try {
|
|
75
|
-
const s = await getStats(id);
|
|
76
|
-
if (isMounted) {
|
|
77
|
-
setStats(s);
|
|
78
|
-
setStatsError("");
|
|
79
|
-
}
|
|
80
|
-
} catch (err) {
|
|
81
|
-
if (isMounted) {
|
|
82
|
-
setStats({ cpuPercent: 0, memPercent: 0, netIO: { rx: 0, tx: 0 } });
|
|
83
|
-
setStatsError("Error fetching stats");
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
fetchStats();
|
|
89
|
-
const timer = setInterval(fetchStats, REFRESH_INTERVALS.CONTAINER_STATS);
|
|
90
|
-
|
|
91
|
-
return () => {
|
|
92
|
-
isMounted = false;
|
|
93
|
-
clearInterval(timer);
|
|
94
|
-
};
|
|
95
|
-
}, [id, state]);
|
|
96
|
-
|
|
97
|
-
const stateInfo = stateText(state);
|
|
98
|
-
return (
|
|
99
|
-
<Box flexDirection="column" marginBottom={1}>
|
|
100
|
-
<Box>
|
|
101
|
-
<Text color="cyan">{name.padEnd(20)}</Text>
|
|
102
|
-
<Text color="gray">{image.padEnd(20)}</Text>
|
|
103
|
-
<Text color={stateInfo.color}>{stateInfo.text}</Text>
|
|
104
|
-
<Text color="yellow">{formatPorts(container.ports)}</Text>
|
|
105
|
-
{state === "running" && <Text> </Text>}
|
|
106
|
-
{state === "running" && (
|
|
107
|
-
<StatsBar
|
|
108
|
-
cpu={parseFloat(stats.cpuPercent)}
|
|
109
|
-
mem={parseFloat(stats.memPercent)}
|
|
110
|
-
/>
|
|
111
|
-
)}
|
|
112
|
-
{state === "running" && statsError && (
|
|
113
|
-
<Text color="red">{statsError}</Text>
|
|
114
|
-
)}
|
|
115
|
-
</Box>
|
|
116
|
-
</Box>
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
ContainerRow.propTypes = {
|
|
121
|
-
container: PropTypes.shape({
|
|
122
|
-
id: PropTypes.string.isRequired,
|
|
123
|
-
name: PropTypes.string.isRequired,
|
|
124
|
-
image: PropTypes.string,
|
|
125
|
-
state: PropTypes.string,
|
|
126
|
-
ports: PropTypes.oneOfType([PropTypes.array, PropTypes.string])
|
|
127
|
-
}).isRequired,
|
|
128
|
-
};
|
|
129
|
-
</code></pre>
|
|
130
|
-
</article>
|
|
131
|
-
</section>
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
</div>
|
|
137
|
-
|
|
138
|
-
<nav>
|
|
139
|
-
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-index.html">index</a></li></ul><h3>Global</h3><ul><li><a href="global.html#EXIT_DELAY">EXIT_DELAY</a></li><li><a href="global.html#MESSAGE_TIMEOUTS">MESSAGE_TIMEOUTS</a></li><li><a href="global.html#PromptField">PromptField</a></li><li><a href="global.html#PromptMessage">PromptMessage</a></li><li><a href="global.html#REFRESH_INTERVALS">REFRESH_INTERVALS</a></li><li><a href="global.html#TIMEOUTS">TIMEOUTS</a></li><li><a href="global.html#colorize">colorize</a></li><li><a href="global.html#createContainer">createContainer</a></li><li><a href="global.html#docker">docker</a></li><li><a href="global.html#exitWithMessage">exitWithMessage</a></li><li><a href="global.html#getContainers">getContainers</a></li><li><a href="global.html#getLogsStream">getLogsStream</a></li><li><a href="global.html#getStats">getStats</a></li><li><a href="global.html#handleAction">handleAction</a></li><li><a href="global.html#imageExists">imageExists</a></li><li><a href="global.html#makeBar">makeBar</a></li><li><a href="global.html#pullImage">pullImage</a></li><li><a href="global.html#removeContainer">removeContainer</a></li><li><a href="global.html#restartContainer">restartContainer</a></li><li><a href="global.html#safeCall">safeCall</a></li><li><a href="global.html#startContainer">startContainer</a></li><li><a href="global.html#stopContainer">stopContainer</a></li><li><a href="global.html#useContainerActions">useContainerActions</a></li><li><a href="global.html#useContainerCreation">useContainerCreation</a></li><li><a href="global.html#useControls">useControls</a></li><li><a href="global.html#useLogsStream">useLogsStream</a></li><li><a href="global.html#useLogsViewer">useLogsViewer</a></li><li><a href="global.html#validateEnvVars">validateEnvVars</a></li><li><a href="global.html#validatePorts">validatePorts</a></li><li><a href="global.html#withTimeout">withTimeout</a></li></ul>
|
|
140
|
-
</nav>
|
|
141
|
-
|
|
142
|
-
<br class="clear">
|
|
143
|
-
|
|
144
|
-
<footer>
|
|
145
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.5</a> on Fri Oct 17 2025 16:07:18 GMT-0500 (hora estándar de Colombia)
|
|
146
|
-
</footer>
|
|
147
|
-
|
|
148
|
-
<script> prettyPrint(); </script>
|
|
149
|
-
<script src="scripts/linenumber.js"> </script>
|
|
150
|
-
</body>
|
|
151
|
-
</html>
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>JSDoc: Source: components/ContainerSection.jsx</title>
|
|
6
|
-
|
|
7
|
-
<script src="scripts/prettify/prettify.js"> </script>
|
|
8
|
-
<script src="scripts/prettify/lang-css.js"> </script>
|
|
9
|
-
<!--[if lt IE 9]>
|
|
10
|
-
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
11
|
-
<![endif]-->
|
|
12
|
-
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
13
|
-
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
14
|
-
</head>
|
|
15
|
-
|
|
16
|
-
<body>
|
|
17
|
-
|
|
18
|
-
<div id="main">
|
|
19
|
-
|
|
20
|
-
<h1 class="page-title">Source: components/ContainerSection.jsx</h1>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<section>
|
|
28
|
-
<article>
|
|
29
|
-
<pre class="prettyprint source linenums"><code>import React from "react";
|
|
30
|
-
import { Text } from "ink";
|
|
31
|
-
import ContainerList from "./ContainerList.jsx";
|
|
32
|
-
import PropTypes from 'prop-types';
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Section that displays the list of containers or a message when none exist.
|
|
36
|
-
*
|
|
37
|
-
* @param {Object} props
|
|
38
|
-
* @param {Array<Object>} props.containers - Array of container objects to display
|
|
39
|
-
* @param {number} [props.selected] - Index of the currently selected container
|
|
40
|
-
* @returns {JSX.Element}
|
|
41
|
-
*/
|
|
42
|
-
export default function ContainerSection({ containers, selected }) {
|
|
43
|
-
if (!containers || containers.length === 0) {
|
|
44
|
-
return <Text>No containers found</Text>;
|
|
45
|
-
}
|
|
46
|
-
return <ContainerList containers={containers} selected={selected} />;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
ContainerSection.propTypes = {
|
|
50
|
-
containers: PropTypes.array.isRequired,
|
|
51
|
-
selected: PropTypes.number,
|
|
52
|
-
};
|
|
53
|
-
</code></pre>
|
|
54
|
-
</article>
|
|
55
|
-
</section>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
</div>
|
|
61
|
-
|
|
62
|
-
<nav>
|
|
63
|
-
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-index.html">index</a></li></ul><h3>Global</h3><ul><li><a href="global.html#EXIT_DELAY">EXIT_DELAY</a></li><li><a href="global.html#MESSAGE_TIMEOUTS">MESSAGE_TIMEOUTS</a></li><li><a href="global.html#PromptField">PromptField</a></li><li><a href="global.html#PromptMessage">PromptMessage</a></li><li><a href="global.html#REFRESH_INTERVALS">REFRESH_INTERVALS</a></li><li><a href="global.html#TIMEOUTS">TIMEOUTS</a></li><li><a href="global.html#colorize">colorize</a></li><li><a href="global.html#createContainer">createContainer</a></li><li><a href="global.html#docker">docker</a></li><li><a href="global.html#exitWithMessage">exitWithMessage</a></li><li><a href="global.html#getContainers">getContainers</a></li><li><a href="global.html#getLogsStream">getLogsStream</a></li><li><a href="global.html#getStats">getStats</a></li><li><a href="global.html#handleAction">handleAction</a></li><li><a href="global.html#imageExists">imageExists</a></li><li><a href="global.html#makeBar">makeBar</a></li><li><a href="global.html#pullImage">pullImage</a></li><li><a href="global.html#removeContainer">removeContainer</a></li><li><a href="global.html#restartContainer">restartContainer</a></li><li><a href="global.html#safeCall">safeCall</a></li><li><a href="global.html#startContainer">startContainer</a></li><li><a href="global.html#stopContainer">stopContainer</a></li><li><a href="global.html#useContainerActions">useContainerActions</a></li><li><a href="global.html#useContainerCreation">useContainerCreation</a></li><li><a href="global.html#useControls">useControls</a></li><li><a href="global.html#useLogsStream">useLogsStream</a></li><li><a href="global.html#useLogsViewer">useLogsViewer</a></li><li><a href="global.html#validateEnvVars">validateEnvVars</a></li><li><a href="global.html#validatePorts">validatePorts</a></li><li><a href="global.html#withTimeout">withTimeout</a></li></ul>
|
|
64
|
-
</nav>
|
|
65
|
-
|
|
66
|
-
<br class="clear">
|
|
67
|
-
|
|
68
|
-
<footer>
|
|
69
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.5</a> on Fri Oct 17 2025 16:07:18 GMT-0500 (hora estándar de Colombia)
|
|
70
|
-
</footer>
|
|
71
|
-
|
|
72
|
-
<script> prettyPrint(); </script>
|
|
73
|
-
<script src="scripts/linenumber.js"> </script>
|
|
74
|
-
</body>
|
|
75
|
-
</html>
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>JSDoc: Source: components/Footer.jsx</title>
|
|
6
|
-
|
|
7
|
-
<script src="scripts/prettify/prettify.js"> </script>
|
|
8
|
-
<script src="scripts/prettify/lang-css.js"> </script>
|
|
9
|
-
<!--[if lt IE 9]>
|
|
10
|
-
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
11
|
-
<![endif]-->
|
|
12
|
-
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
13
|
-
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
14
|
-
</head>
|
|
15
|
-
|
|
16
|
-
<body>
|
|
17
|
-
|
|
18
|
-
<div id="main">
|
|
19
|
-
|
|
20
|
-
<h1 class="page-title">Source: components/Footer.jsx</h1>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<section>
|
|
28
|
-
<article>
|
|
29
|
-
<pre class="prettyprint source linenums"><code>import React from "react";
|
|
30
|
-
import { Box, Text } from "ink";
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Simple footer displayed at the bottom of the interface.
|
|
34
|
-
*
|
|
35
|
-
* @returns {JSX.Element}
|
|
36
|
-
*/
|
|
37
|
-
export default function Footer() {
|
|
38
|
-
return (
|
|
39
|
-
<Box justifyContent="flex-end" width="100%">
|
|
40
|
-
<Text dimColor>Crafted by Carlos Cochero 2025</Text>
|
|
41
|
-
</Box>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
</code></pre>
|
|
45
|
-
</article>
|
|
46
|
-
</section>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
</div>
|
|
52
|
-
|
|
53
|
-
<nav>
|
|
54
|
-
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-index.html">index</a></li></ul><h3>Global</h3><ul><li><a href="global.html#EXIT_DELAY">EXIT_DELAY</a></li><li><a href="global.html#MESSAGE_TIMEOUTS">MESSAGE_TIMEOUTS</a></li><li><a href="global.html#PromptField">PromptField</a></li><li><a href="global.html#PromptMessage">PromptMessage</a></li><li><a href="global.html#REFRESH_INTERVALS">REFRESH_INTERVALS</a></li><li><a href="global.html#TIMEOUTS">TIMEOUTS</a></li><li><a href="global.html#colorize">colorize</a></li><li><a href="global.html#createContainer">createContainer</a></li><li><a href="global.html#docker">docker</a></li><li><a href="global.html#exitWithMessage">exitWithMessage</a></li><li><a href="global.html#getContainers">getContainers</a></li><li><a href="global.html#getLogsStream">getLogsStream</a></li><li><a href="global.html#getStats">getStats</a></li><li><a href="global.html#handleAction">handleAction</a></li><li><a href="global.html#imageExists">imageExists</a></li><li><a href="global.html#makeBar">makeBar</a></li><li><a href="global.html#pullImage">pullImage</a></li><li><a href="global.html#removeContainer">removeContainer</a></li><li><a href="global.html#restartContainer">restartContainer</a></li><li><a href="global.html#safeCall">safeCall</a></li><li><a href="global.html#startContainer">startContainer</a></li><li><a href="global.html#stopContainer">stopContainer</a></li><li><a href="global.html#useContainerActions">useContainerActions</a></li><li><a href="global.html#useContainerCreation">useContainerCreation</a></li><li><a href="global.html#useControls">useControls</a></li><li><a href="global.html#useLogsStream">useLogsStream</a></li><li><a href="global.html#useLogsViewer">useLogsViewer</a></li><li><a href="global.html#validateEnvVars">validateEnvVars</a></li><li><a href="global.html#validatePorts">validatePorts</a></li><li><a href="global.html#withTimeout">withTimeout</a></li></ul>
|
|
55
|
-
</nav>
|
|
56
|
-
|
|
57
|
-
<br class="clear">
|
|
58
|
-
|
|
59
|
-
<footer>
|
|
60
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.5</a> on Fri Oct 17 2025 16:07:18 GMT-0500 (hora estándar de Colombia)
|
|
61
|
-
</footer>
|
|
62
|
-
|
|
63
|
-
<script> prettyPrint(); </script>
|
|
64
|
-
<script src="scripts/linenumber.js"> </script>
|
|
65
|
-
</body>
|
|
66
|
-
</html>
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>JSDoc: Source: components/Header.jsx</title>
|
|
6
|
-
|
|
7
|
-
<script src="scripts/prettify/prettify.js"> </script>
|
|
8
|
-
<script src="scripts/prettify/lang-css.js"> </script>
|
|
9
|
-
<!--[if lt IE 9]>
|
|
10
|
-
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
11
|
-
<![endif]-->
|
|
12
|
-
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
13
|
-
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
14
|
-
</head>
|
|
15
|
-
|
|
16
|
-
<body>
|
|
17
|
-
|
|
18
|
-
<div id="main">
|
|
19
|
-
|
|
20
|
-
<h1 class="page-title">Source: components/Header.jsx</h1>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<section>
|
|
28
|
-
<article>
|
|
29
|
-
<pre class="prettyprint source linenums"><code>import React from "react";
|
|
30
|
-
import { Box, Text } from "ink";
|
|
31
|
-
import chalk from "chalk";
|
|
32
|
-
import PropTypes from 'prop-types';
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Header component displayed at the top of the CLI UI.
|
|
36
|
-
*
|
|
37
|
-
* @component
|
|
38
|
-
* @param {Object} props
|
|
39
|
-
* @param {number} props.count - Number of containers currently detected
|
|
40
|
-
* @returns {JSX.Element}
|
|
41
|
-
* @example
|
|
42
|
-
* <Header count={3} />
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
export default function Header({ count }) {
|
|
46
|
-
return (
|
|
47
|
-
<Box justifyContent="space-between">
|
|
48
|
-
<Text color="cyanBright">
|
|
49
|
-
🐳 {chalk.bold("CDD")}
|
|
50
|
-
<Text color="gray"> — CLI Docker Dashboard</Text>
|
|
51
|
-
</Text>
|
|
52
|
-
<Text color="gray">
|
|
53
|
-
{count} container{count === 1 ? "" : "s"} found
|
|
54
|
-
</Text>
|
|
55
|
-
</Box>
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
Header.propTypes = {
|
|
60
|
-
count: PropTypes.number.isRequired,
|
|
61
|
-
};
|
|
62
|
-
</code></pre>
|
|
63
|
-
</article>
|
|
64
|
-
</section>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
</div>
|
|
70
|
-
|
|
71
|
-
<nav>
|
|
72
|
-
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-index.html">index</a></li></ul><h3>Global</h3><ul><li><a href="global.html#EXIT_DELAY">EXIT_DELAY</a></li><li><a href="global.html#MESSAGE_TIMEOUTS">MESSAGE_TIMEOUTS</a></li><li><a href="global.html#PromptField">PromptField</a></li><li><a href="global.html#PromptMessage">PromptMessage</a></li><li><a href="global.html#REFRESH_INTERVALS">REFRESH_INTERVALS</a></li><li><a href="global.html#TIMEOUTS">TIMEOUTS</a></li><li><a href="global.html#colorize">colorize</a></li><li><a href="global.html#createContainer">createContainer</a></li><li><a href="global.html#docker">docker</a></li><li><a href="global.html#exitWithMessage">exitWithMessage</a></li><li><a href="global.html#getContainers">getContainers</a></li><li><a href="global.html#getLogsStream">getLogsStream</a></li><li><a href="global.html#getStats">getStats</a></li><li><a href="global.html#handleAction">handleAction</a></li><li><a href="global.html#imageExists">imageExists</a></li><li><a href="global.html#makeBar">makeBar</a></li><li><a href="global.html#pullImage">pullImage</a></li><li><a href="global.html#removeContainer">removeContainer</a></li><li><a href="global.html#restartContainer">restartContainer</a></li><li><a href="global.html#safeCall">safeCall</a></li><li><a href="global.html#startContainer">startContainer</a></li><li><a href="global.html#stopContainer">stopContainer</a></li><li><a href="global.html#useContainerActions">useContainerActions</a></li><li><a href="global.html#useContainerCreation">useContainerCreation</a></li><li><a href="global.html#useControls">useControls</a></li><li><a href="global.html#useLogsStream">useLogsStream</a></li><li><a href="global.html#useLogsViewer">useLogsViewer</a></li><li><a href="global.html#validateEnvVars">validateEnvVars</a></li><li><a href="global.html#validatePorts">validatePorts</a></li><li><a href="global.html#withTimeout">withTimeout</a></li></ul>
|
|
73
|
-
</nav>
|
|
74
|
-
|
|
75
|
-
<br class="clear">
|
|
76
|
-
|
|
77
|
-
<footer>
|
|
78
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.5</a> on Fri Oct 17 2025 16:07:18 GMT-0500 (hora estándar de Colombia)
|
|
79
|
-
</footer>
|
|
80
|
-
|
|
81
|
-
<script> prettyPrint(); </script>
|
|
82
|
-
<script src="scripts/linenumber.js"> </script>
|
|
83
|
-
</body>
|
|
84
|
-
</html>
|