Skip to content

feat(ui): Save Config Only shows the TI code that runs the saved config - #92

Merged
nicolasbisurgi merged 1 commit into
cubewise-code:optimuspy2dot0from
nicolasbisurgi:ui/ti-snippet
Sep 30, 2026
Merged

nicolasbisurgi merged 1 commit into
cubewise-code:optimuspy2dot0from
nicolasbisurgi:ui/ti-snippet

Conversation

@nicolasbisurgi

Copy link
Copy Markdown
Collaborator

On the Optimize page, Save Config Only now opens a "Config saved" pop-up in place of the toast. It shows:

  • the full path of the saved JSON;
  • TI code for the Prolog of a process on the same TM1 server, with a Copy TI code button;
  • where to read the run's log, because ExecuteCommand doesn't pass OptimusPy's exit code back to TI.
sCommand = '"C:\OptimusPy\optimuspy.exe" optimize "C:\OptimusPy\cube-configs\Sales_tm1srv01.json"';
# 1 waits for OptimusPy to finish; 0 starts it and carries on.
ExecuteCommand(sCommand, 1);

How the command is built (ui.run_command / ui.ti_snippet)

  • The launcher is the executable the UI runs from when it's the bundle, since OptimusPy is assumed to be installed on the TM1 server. From a Python install, it's this Python with -m optimuspy.
  • --config is added only when the UI was started with --config. Otherwise the executable finds the same config.ini from its install folder: the Settings link or config/config.ini.
  • A single quote in a path is doubled, so the TI string stays valid.
  • POST /api/config also returns command, ti_snippet and log_path, next to the path and filename it already returned.

Scope: Save & Start is unchanged. Optimize DB is left for #91, because that page doesn't save an instructions file yet.

Docs: docs/ui/optimize-page.md has a new section, "Running a saved config from a TI process". It notes that the password has to be stored in config.ini.

Tests: three new tests in tests/test_ui_server.py cover the bundle command, --config only when the UI was started with it, and quote doubling. The full suite passes (476) and ruff is clean. The pop-up was checked by hand against tm1srv01.

🤖 Generated with Claude Code

The pop-up names the file it saved and gives an ExecuteCommand snippet for
this install: the executable itself when running as the bundle, else this
Python with -m optimuspy, with --config only when the UI was started with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nicolasbisurgi
nicolasbisurgi merged commit c21591e into cubewise-code:optimuspy2dot0 Sep 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant