));
if (dh) {
- const isTcp6 = dh.startsWith('tcp6://');
+ // const isTcp6 = dh.startsWith('tcp6://');
const protocol = dh.includes(':2376') ? 'https://' : 'http://';
dockerHost = dh.replace(/^(tcp|inet)6?:\/\//, protocol);
const host = dockerHost;
const onChunk = options.onChunk || null; // Optional callback for streaming NDJSON
const api_ver = uci.get('dockerd', 'globals', 'api_version') || '';
- const api_ver_str = api_ver ? `/${version}` : '';
+ const api_ver_str = api_ver ? `/${api_ver}` : '';
if (!host) {
events: { args: { query: { 'since': '', 'until': `${Date.now()}`, 'filters': '' } }, call: (request) => call_docker('GET', '/events', { query: request?.query, onChunk: request?.onChunk }) },
};
-
+/*
const exec_methods = {
start: { args: { id: '', body: '' }, call: (request) => call_docker('POST', `/exec/${request?.id}/start`, { payload: request?.body }) },
resize: { args: { id: '', query: { 'h': 0, 'w': 0 } }, call: (request) => call_docker('POST', `/exec/${request?.id}/resize`, { query: request?.query }) },
inspect: { args: { id: '' }, call: (request) => call_docker('GET', `/exec/${request?.id}/json`) },
};
-
+*/
const container_methods = {
list: { args: { query: { 'all': false, 'limit': false, 'size': false, 'filters': '' } }, call: (request) => call_docker('GET', '/containers/json', { query: request?.query }) },
// Track progressive response progress
let lastIndex = 0;
- let title = _('Progress');
+ // let title = _('Progress');
xhr.onprogress = (upd) => {
const chunk = xhr.responseText.slice(lastIndex);
lastIndex = xhr.responseText.length;
// These include cursor positioning, screen clearing, etc.
text = text
// Strip CSI sequences (cursor movement, screen clearing, etc.)
+ // eslint-disable-next-line no-control-regex
.replace(/\x1B\[[0-9;?]*[A-Za-z]/g, (match) => {
// Keep only SGR (Select Graphic Rendition) sequences ending in 'm'
if (match.endsWith('m')) {
return '';
})
// Strip OSC sequences (window title, etc.)
+ // eslint-disable-next-line no-control-regex
.replace(/\x1B\][^\x07]*\x07/g, '')
// Strip other escape sequences
+ // eslint-disable-next-line no-control-regex
.replace(/\x1B[><=]/g, '')
// Strip bell character
+ // eslint-disable-next-line no-control-regex
.replace(/\x07/g, '');
// ANSI color codes mapping
};
// Split by ANSI escape sequences and process
+ // eslint-disable-next-line no-control-regex
const ansiRegex = /\x1B\[([\d;]*)m/g;
let html = '';
let currentStyle = {};
s.nodescriptions = true;
s.addremove = false;
- let o, t, ss;
+ let o, ss;
- t = s.tab('info', _('Info'));
+ s.tab('info', _('Info'));
o = s.taboption('info', form.Value, 'Name', _('Name'));
};
// NETWORKS TAB
- t = s.tab('network', _('Networks'));
+ s.tab('network', _('Networks'));
o = s.taboption('network', form.SectionValue, '__net__', form.TableSection, 'nets', null);
ss = o.subsection;
- t = s.tab('resources', _('Resources'));
+ s.tab('resources', _('Resources'));
o = s.taboption('resources', form.SectionValue, '__hcfg__', form.TypedSection, 'hostcfg', null);
ss = o.subsection;
};
// STATS TAB
- t = s.tab('stats', _('Stats'));
+ s.tab('stats', _('Stats'));
function updateStats(stats_data) {
const status = view.getContainerStatus(this_container);
o.render = L.bind(() => { return updateStats(stats_data)}, this);
// PROCESS TAB
- t = s.tab('ps', _('Processes'));
+ s.tab('ps', _('Processes'));
// Create custom table for processes using L.ui.Table
o = s.taboption('ps', form.DummyValue, '_ps_table', _('Running Processes'));
}, this);
// CHANGES TAB
- t = s.tab('changes', _('Changes'));
+ s.tab('changes', _('Changes'));
// Create custom table for changes using L.ui.Table
o = s.taboption('changes', form.DummyValue, '_changes_table', _('Filesystem Changes'));
// FILE TAB
- t = s.tab('file', _('File'));
+ s.tab('file', _('File'));
let fileDiv = null;
o = s.taboption('file', form.DummyValue, 'json', '_file');
// INSPECT TAB
- t = s.tab('inspect', _('Inspect'));
+ s.tab('inspect', _('Inspect'));
let inspectDiv = null;
o = s.taboption('inspect', form.Button, 'json', _('Container Inspect'));
// TERMINAL TAB
- t = s.tab('console', _('Console'));
+ s.tab('console', _('Console'));
o = s.taboption('console', form.DummyValue, 'console_controls', _('Console Connection'));
o.render = L.bind(() => {
}, this);
// WEBSOCKET TAB
- t = s.tab('wsconsole', _('WebSocket'));
+ s.tab('wsconsole', _('WebSocket'));
dm2.js_api_ready.then(([apiAvailable, host]) => {
// Wait for JS API availability check to complete
});
// LOGS TAB
- t = s.tab('logs', _('Logs'));
+ s.tab('logs', _('Logs'));
let logsDiv = null;
let logsLoaded = false;
if (!map)
return Promise.reject(new Error(_('Form is not ready yet.')));
- const listToKv = view.listToKv;
+ // const listToKv = view.listToKv;
const get = (opt) => map.data.get('json', 'cont', opt);
- const getn = (opt) => map.data.get('json', 'nets', opt);
+ // const getn = (opt) => map.data.get('json', 'nets', opt);
const gethc = (opt) => map.data.get('json', 'hostcfg', opt);
const toBool = (val) => (val === 1 || val === '1' || val === true);
const toInt = (val) => val ? Number.parseInt(val) : undefined;
- const toFloat = (val) => val ? Number.parseFloat(val) : undefined;
+ // const toFloat = (val) => val ? Number.parseFloat(val) : undefined;
// First: update properties
map.parse()
'click': () => {
const selectedNetwork = networkSelect.value;
const ip4Address = ip4Input.value || '';
- const ip6Address = ip6Input.value || '';
+ // const ip6Address = ip6Input.value || '';
if (!selectedNetwork) {
view.showNotification(_('Error'), [_('No network selected')], 5000, 'error');
if (builtInNetworks.has(netnames[0])) return '';
return (nets && (nets.length > 0)) ? nets[0]?.GlobalIPv6Address || '' : '';
})(),
- ipv6: (() => {
+ ipv6_lla: (() => {
if (builtInNetworks.has(netnames[0])) return '';
return (nets && (nets.length > 0)) ? nets[0]?.LinkLocalIPv6Address || '' : '';
})(),
.then(() => {
const get = (opt) => map.data.get('json', 'container', opt);
const name = get('name');
- const pull = toBool(get('pull'));
+ // const pull = toBool(get('pull'));
const network = get('network');
const publish = get('publish');
const command = get('command');
- const publish_all = toBool(get('publish_all'));
+ // const publish_all = toBool(get('publish_all'));
const device = get('device');
const tmpfs = get('tmpfs');
const sysctl = get('sysctl');
const volumeIds = new Set((view.volumes || []).map(v => v.Id));
const mounts = [];
for (const entry of volumeEntries) {
- let [source, target, options] = (typeof entry === 'string' ? entry : '')?.split(':')?.map(e => e && e.trim() || '');
+ let e = typeof entry === 'string' ? entry : '';
+ let f = e.split(':')?.map(e => e && e.trim() || '');
+ let source = f[0];
+ let target = f[1];
+ let options = f[2];
+
if (!options) options = '';
// Validate source and target are not empty
return Promise.all([
dm2.docker_events({ query: { since: `0`, until: `${now}` } }),
- dm2.js_api_ready.then(([ok, host]) => this.js_api = ok),
+ dm2.js_api_ready.then(([ok, ]) => this.js_api = ok),
]);
},
s.addremove = false;
s.nodescriptions = true;
- let o, t, ss;
+ let o, ss;
// INFO TAB
- t = s.tab('info', _('Info'));
+ s.tab('info', _('Info'));
o = s.taboption('info', form.DummyValue, 'Name', _('Network Name'));
o = s.taboption('info', form.DummyValue, 'Id', _('ID'));
o.cfgvalue = view.objectCfgValueTT;
// CONFIGS TAB
- t = s.tab('detail', _('Detail'));
+ s.tab('detail', _('Detail'));
o = s.taboption('detail', form.DummyValue, 'Driver', _('IPAM Driver'));
// INSPECT TAB
- t = s.tab('inspect', _('Inspect'));
+ s.tab('inspect', _('Inspect'));
o = s.taboption('inspect', form.SectionValue, '__ins__', form.NamedSection, '_inspect', null);
ss = o.subsection;
]);
},
- render([]) {
+ render() {
// stuff JSONMap with {network: {}} to prime it with a new empty entry
const m = new form.JSONMap({network: {}}, _('Docker - New Network'));
getNetworksTable(networks, containers) {
const data = [];
- for (const [i, net] of (networks || []).entries()) {
+ for (const [ , net] of (networks || []).entries()) {
const n = net.Name;
const _shortId = (net.Id || '').substring(0, 12);
const shortLink = E('a', {
return dm2.dv.extend({
load() {
- const now = Math.floor(Date.now() / 1000);
+ // const now = Math.floor(Date.now() / 1000);
return Promise.all([
dm2.docker_version(),
m.readonly = true;
m.tabbed = false;
- let s, o, v;
+ let s;
// Add Version and Environment tables
s = m.section(form.TableSection, 'vb', _('Version'));
s.anonymous = true;
- o = s.option(form.DummyValue, 'entry', _('Name'));
- o = s.option(form.DummyValue, 'value', _('Value'));
+ s.option(form.DummyValue, 'entry', _('Name'));
+ s.option(form.DummyValue, 'value', _('Value'));
s = m.section(form.TableSection, 'ib', _('Environment'));
s.anonymous = true;
s.filterrow = true;
- o = s.option(form.DummyValue, 'entry', _('Entry'));
- o = s.option(form.DummyValue, 'value', _('Value'));
+ s.option(form.DummyValue, 'entry', _('Entry'));
+ s.option(form.DummyValue, 'value', _('Value'));
// Render the form sections and append them
return m.render()
getVolumesTable(volumes) {
const data = [];
- for (const [i, vol] of (volumes?.Volumes || []).entries()) {
- const n = vol.Name;
+ for (const [ , vol] of (volumes?.Volumes || []).entries()) {
const labels = vol?.Labels || {};
// Just push plain data objects without UCI metadata