Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/static/builder/command-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@
else if(d.harborChoice!==undefined){const rec=r(),v=el.value;if(v==='path')rec.harborDev='';else if(v==='dev')rec.harborDev=rec.harborDev||'~/harbor-dev/.venv/bin/harbor';renderForm();refreshPlan();if(v==='dev')root.querySelector('[data-field="harborDev"]')?.select();}
else if(el.id==='nb-import-file'){
const file=el.files[0];if(!file)return;
try{if(file.size>100000)throw Error('Recipe file is too large.');recipe=C.fromJSON(await file.text());savedId='';step=REVIEW;render(true);status('Imported “'+(recipe.title||recipe.name)+'”. Review the recipe before copying commands.');}catch(error){status('Could not import recipe: '+error.message);}el.value='';
try{if(file.size>100000)throw Error('Recipe file is too large.');recipe=C.fromJSON(await file.text());savedId='';step=REVIEW;render(true);status('Imported “'+(recipe.title||recipe.name)+'”. Check it, then Run.');}catch(error){status('Could not import recipe: '+error.message);}el.value='';
}
});
{ const dl=document.getElementById('nb-models'); if(dl){const seen=new Set(); for(const o of [...dl.options]){const v=C.bareModel(o.value); if(!v||seen.has(v)){o.remove();continue;} seen.add(v); o.value=v;}} }
Expand Down
23 changes: 23 additions & 0 deletions app/ui_tests/test_builder_notices.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""The builder's own words: Run on Review starts a recipe, nothing is copied."""
import re
import unittest
from pathlib import Path

APP = Path(__file__).resolve().parents[1]
BUILDER_TEXT = [*sorted((APP / "static/builder").glob("*.js")), *sorted((APP / "templates/builder").glob("*.html"))]


class BuilderNotices(unittest.TestCase):
def test_no_builder_text_tells_the_user_to_copy_run_commands(self):
for path in BUILDER_TEXT:
with self.subTest(path=path.name):
text = path.read_text(encoding="utf-8")
self.assertIsNone(re.search(r"cop(?:y|ying)\s+(?:the\s+)?(?:run\s+)?commands", text, re.I))

def test_the_import_notice_says_to_check_the_recipe_then_run_it(self):
page = (APP / "static/builder/command-builder.js").read_text(encoding="utf-8")
self.assertIn("status('Imported “'+(recipe.title||recipe.name)+'”. Check it, then Run.')", page)


if __name__ == "__main__":
unittest.main()
Loading