feat(console): поле зависимостей для функций из кода (deps → zip)
- UI: textarea 'Зависимости' в формах создания и редактирования - плейсхолдер меняется по языку (requirements.txt / package.json / Gemfile / composer.json) - Python: если deps заполнен → zip(main.py + requirements.txt), иначе raw bytes - PHP: если deps → zip(main.php + composer.json) - Ruby: если deps → zip(handler.rb + Gemfile) - Node.js: пока без изменений (сложная структура package.json) - runtime: BuildPythonZip, BuildScriptZipWithDeps, buildZipTwo - model: Deps string в CreateFunctionRequest и UpdateCodeRequest - v1.3.89
This commit is contained in:
+14
-2
@@ -103,7 +103,7 @@
|
||||
<div class="nubes">NUBES</div>
|
||||
<div class="product">FISSION CONSOLE</div>
|
||||
</div>
|
||||
<div style="font-size:0.65rem; color:var(--text-secondary); margin-left:10px; align-self:center; opacity:0.7;">v1.3.88</div>
|
||||
<div style="font-size:0.65rem; color:var(--text-secondary); margin-left:10px; align-self:center; opacity:0.7;">v1.3.89</div>
|
||||
</div>
|
||||
<div class="row" style="margin:0;">
|
||||
<button class="btn ghost" onclick="reloadAll()">Refresh</button>
|
||||
@@ -306,6 +306,12 @@
|
||||
<button class="btn ghost" id="cc-gen-btn" onclick="showGenPrompt('cc')">✨ Сгенерировать код LLM</button>
|
||||
<button class="btn ghost" id="cc-exp-btn" onclick="aiExplain('cc-code','cc-lang','cc-ai-result')">📖 LLM: Что делает?</button>
|
||||
</div>
|
||||
<div style="margin-top:10px;">
|
||||
<label id="cc-deps-label" style="font-size:12px; color:var(--text-secondary); margin-bottom:4px; display:block;">Зависимости (requirements.txt)</label>
|
||||
<textarea id="cc-deps" rows="4" placeholder="boto3
|
||||
requests>=2.28
|
||||
psycopg2-binary" style="width:100%; box-sizing:border-box; font-family:monospace; font-size:12px; background:#1a1a2e; border:1px dashed #3a3a5c; border-radius:4px; color:#cdd6f4; padding:6px 8px; resize:vertical;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div id="cc-gen-prompt" style="display:none; margin-top:8px; gap:6px; align-items:center;">
|
||||
<input id="cc-gen-desc" type="text"
|
||||
@@ -445,6 +451,12 @@
|
||||
<button class="btn ghost" id="e-exp-btn" onclick="aiExplain('e-code','e-lang-hidden','e-ai-result')">📖
|
||||
LLM: Что делает?</button>
|
||||
</div>
|
||||
<div style="margin-top:10px;">
|
||||
<label id="e-deps-label" style="font-size:12px; color:var(--text-secondary); margin-bottom:4px; display:block;">Зависимости (requirements.txt)</label>
|
||||
<textarea id="e-deps" rows="4" placeholder="boto3
|
||||
requests>=2.28
|
||||
psycopg2-binary" style="width:100%; box-sizing:border-box; font-family:monospace; font-size:12px; background:#1a1a2e; border:1px dashed #3a3a5c; border-radius:4px; color:#cdd6f4; padding:6px 8px; resize:vertical;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div id="e-archive-area" style="display:none;">
|
||||
<div id="e-archive-current" style="margin-bottom:10px; padding:8px 12px; background:var(--bg-alt); border-radius:6px; font-size:13px; color:var(--text-secondary);">
|
||||
@@ -614,7 +626,7 @@
|
||||
</div>
|
||||
|
||||
<div class="actions" style="justify-content:space-between; align-items:center;">
|
||||
<span style="font-size:0.75rem; color:var(--text-secondary);">v1.3.88</span>
|
||||
<span style="font-size:0.75rem; color:var(--text-secondary);">v1.3.89</span>
|
||||
<button class="btn ghost" onclick="closeHelp()">Закрыть</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -7,6 +7,23 @@ function onLangChangeCode() {
|
||||
document.getElementById('cc-entry').value = t.entrypoint;
|
||||
document.getElementById('cc-code').value = t.code;
|
||||
}
|
||||
// Обновляем лейбл поля зависимостей под язык
|
||||
var depsLabels = {
|
||||
python: 'Зависимости (requirements.txt)',
|
||||
nodejs: 'Зависимости (package.json dependencies)',
|
||||
php: 'Зависимости (composer.json)',
|
||||
ruby: 'Зависимости (Gemfile)',
|
||||
};
|
||||
var depsPlaceholders = {
|
||||
python: 'boto3\nrequests>=2.28\npsycopg2-binary',
|
||||
nodejs: 'express: ^4.18.2\naxios: ^1.6.0',
|
||||
php: '{\n "require": {\n "guzzlehttp/guzzle": "^7.0"\n }\n}',
|
||||
ruby: "gem 'httparty'\ngem 'pg'",
|
||||
};
|
||||
var label = document.getElementById('cc-deps-label');
|
||||
var area = document.getElementById('cc-deps');
|
||||
if (label) label.textContent = depsLabels[lang] || 'Зависимости';
|
||||
if (area) area.placeholder = depsPlaceholders[lang] || '';
|
||||
}
|
||||
|
||||
function openCreateCode() {
|
||||
@@ -16,6 +33,7 @@ function openCreateCode() {
|
||||
document.getElementById('cc-route').value = '';
|
||||
document.getElementById('cc-methods').value = 'GET';
|
||||
document.getElementById('cc-timeout').value = '60';
|
||||
document.getElementById('cc-deps').value = '';
|
||||
document.getElementById('cc-schedule-enabled').checked = false;
|
||||
document.getElementById('cc-cron').value = '';
|
||||
toggleScheduleFields('cc');
|
||||
@@ -47,7 +65,8 @@ async function submitCreateCode() {
|
||||
route: document.getElementById('cc-route').value.trim(),
|
||||
methods: parseMethods(document.getElementById('cc-methods').value),
|
||||
timeout: parseTimeout(document.getElementById('cc-timeout').value),
|
||||
code: document.getElementById('cc-code').value
|
||||
code: document.getElementById('cc-code').value,
|
||||
deps: document.getElementById('cc-deps').value.trim(),
|
||||
});
|
||||
|
||||
try {
|
||||
|
||||
@@ -188,6 +188,13 @@ async function openEdit(name) {
|
||||
else if (envName.includes('ruby')) lang = 'ruby';
|
||||
else if (envName.includes('php')) lang = 'php';
|
||||
document.getElementById('e-lang-hidden').value = lang;
|
||||
// Обновляем лейбл и плейсхолдер поля зависимостей
|
||||
var depsLabels = {python:'Зависимости (requirements.txt)', nodejs:'Зависимости (package.json dependencies)', php:'Зависимости (composer.json)', ruby:'Зависимости (Gemfile)'};
|
||||
var depsPlaceholders = {python:'boto3\nrequests>=2.28', nodejs:'express: ^4.18.2\naxios: ^1.6.0', php:'{\n "require": {\n "guzzlehttp/guzzle": "^7.0"\n }\n}', ruby:"gem 'httparty'\ngem 'pg'"};
|
||||
var eDepsLabel = document.getElementById('e-deps-label');
|
||||
var eDepsArea = document.getElementById('e-deps');
|
||||
if (eDepsLabel) eDepsLabel.textContent = depsLabels[lang] || 'Зависимости';
|
||||
if (eDepsArea) { eDepsArea.placeholder = depsPlaceholders[lang] || ''; eDepsArea.value = ''; }
|
||||
var aiRes = document.getElementById('e-ai-result');
|
||||
if (aiRes) { aiRes.style.display = 'none'; aiRes.textContent = ''; }
|
||||
var warnEl = document.getElementById('e-tf-warn');
|
||||
@@ -242,6 +249,7 @@ async function submitEdit() {
|
||||
} else {
|
||||
await requestJSON(API_BASE + '/functions/' + encodeURIComponent(name) + '/code', 'PUT', {
|
||||
code: document.getElementById('e-code').value,
|
||||
deps: document.getElementById('e-deps').value.trim(),
|
||||
timeout: parseTimeout(document.getElementById('e-timeout').value)
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user