This repository has been archived on 2026-10-11. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
HiNC-2025-win-desktop-Deploy/App/wwwroot/HiAPI-docsite/anatomy/execution/step-present-dialog.html
T
2026-09-09 18:06:21 +08:00

206 lines
14 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Step Present Dialog | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Step Present Dialog | HiAPI-C# 2025 ">
<link rel="icon" href="../../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../../public/docfx.min.css">
<link rel="stylesheet" href="../../public/main.css">
<meta name="docfx:navrel" content="../../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../../index.html">
<img id="logo" class="svg" src="../../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="Anatomy-StepPresentDialog">
<h1 id="step-present-dialog">Step Present Dialog</h1>
<h2 id="shipped-surface">Shipped Surface</h2>
<p>The dialog has no route and no Control-Tree node. It is a modal on the Execution page (<code>/execution</code>), opened by the <code>tune</code> icon button on the Step Properties panel's title bar in the Step Info column — so it is reachable only while that column and that panel are shown. The button sits next to the list it configures.</p>
<p>The dialog's own view models are the two fetched values, <code>categories</code> and <code>displayedKeys</code>. The server models they mirror are <code>UserService.CandidateStepPresentKeyList</code> plus <code>UserService.StepPresentAccessDictionary</code> (the candidates) and <code>UserConfig.DisplayedStepPresentKeyList</code> (the ordered displayed list). The dialog's only prop is its open/closed flag.</p>
<h2 id="layout">Layout</h2>
<ul>
<li>Header
<ul>
<li>Title, then the counts — <em>n displayed</em> / <em>n available</em></li>
<li>The save-state line (<em>Saving…</em> / <em>Saved</em> / error), which stands in for a Save button</li>
<li><code>Reset</code> and close</li>
</ul>
</li>
<li>Splitter
<ul>
<li>Candidate Keys Panel (left)
<ul>
<li>One accordion per category, in the order the server sends them
<ul>
<li>A tri-state checkbox on the category header</li>
<li>One checkbox per key, with the key's label and unit</li>
</ul>
</li>
<li><code>Add Selected</code></li>
</ul>
</li>
<li>Displayed Keys Panel (right)
<ul>
<li>One row per displayed key, in <code>UserConfig.DisplayedStepPresentKeyList</code> order, drag-reorderable
<ul>
<li>Per-row up / down / remove</li>
</ul>
</li>
<li><code>Clear</code></li>
</ul>
</li>
</ul>
</li>
</ul>
<p>Rows are labelled from the per-key payload the server sends — <code>key</code>, <code>name</code>, <code>shortName</code>, <code>unit</code>. The visible label is <code>shortName</code>, falling back to <code>key</code>, with a unit appended in parentheses when it is not <code>None</code>. The tooltip carries the full <code>name</code> above the raw <code>key</code>.</p>
<h2 id="behavior">Behavior</h2>
<p>Adding is a two-step gesture on the left: tick candidates — individually, or a whole category through the header's tri-state checkbox — then press <code>Add Selected</code>. A key that is already displayed has its checkbox disabled and shows a check badge instead. Removing lives only on the right, per row or through <code>Clear</code>.</p>
<p>Every add, remove and reorder persists immediately: the dialog POSTs the whole ordered list, the server drops unknown keys and duplicates and answers with the effective list, and the dialog re-syncs to that answer. <code>Reset</code> is a DELETE that empties the list; both <code>Reset</code> and <code>Clear</code> go through a confirmation. A failure flips the header state to its error label and notifies; a failed list write additionally re-reads from the server, so the editor never drifts from persisted state.</p>
<p>The dialog fetches fresh on every open, and re-pulls when the UI language changes, because the category and key labels arrive already localized.</p>
<p>The list this dialog configures omits <code>StepIndex</code> even when it is displayed: the Step Info column's group bar already shows the step index as a badge, so the panel filters that one row out rather than repeating it.</p>
<h3 id="categories">Categories</h3>
<p>Categories are a GUI-level grouping of keys. Each ships as a stable code plus a display label: the code is the transport identity the client compares and keys its UI state on, the label is display text only. The seven, in canonical order:</p>
<ol>
<li><code>fileCmdFlagTimeSystem</code> — &ldquo;File / Command / Flag / Time / System&rdquo; (<code>StepIndex</code>, <code>FileNo</code>, <code>LineNo</code>, <code>FilePath</code>, <code>LineText</code>, <code>FlagsText</code>, <code>EndTimecode</code>, <code>StepDuration</code>).</li>
<li><code>toolFeedrateSpindle</code> — &ldquo;Tool / Feedrate / Spindle Speed&rdquo; (<code>ToolId</code>, <code>SpindleSpeed_rpm</code>, <code>Feedrate_mmdmin</code>, <code>CuttingSpeed_mmds</code>, …).</li>
<li><code>coordinateMove</code> — &ldquo;Coordinate / Move&rdquo; (<code>Cl</code>, <code>MoveOnProgramCoordinate</code>, <code>MovingLength_mm</code>, and every <code>MC.</code> key).</li>
<li><code>cuttingGeometryChip</code> — &ldquo;Cutting Geometry / Chip / Bias / Roughness&rdquo; (<code>CuttingDepth_mm</code>, <code>ChipThickness_um</code>, <code>Mrr_mm3ds</code>, …).</li>
<li><code>mechanicsPowerEnergy</code> — &ldquo;Mechanics / Power / Energy&rdquo; (<code>MaxAbsForce_N</code>, <code>SpindleOutputPower_W</code>, <code>AvgAbsTorque_Nm</code>, …).</li>
<li><code>temperatureWear</code> — &ldquo;Temperature / Wear&rdquo; (<code>ChipTemperature_C</code>, <code>AccumulatedFlankWearWidth_um</code>, …).</li>
<li><code>custom</code> — &ldquo;Custom&rdquo;, the catch-all for every key the mapping does not place, including the keys registered at run time through <code>UserService.AdditionalStepPresentAccess</code>.</li>
</ol>
<p>All seven are always returned; nothing gates any of them, and the candidate list is read from <code>UserService.CandidateStepPresentKeyList</code> rather than from <a class="xref" href="../../api/Hi.MachiningSteps.MachiningStep.html">MachiningStep</a> directly, so runtime-registered keys are included.</p>
<p>The key → category mapping is <code>ResolveStepPresentCategory</code> on the webservice, with the seven category codes as its contract.</p>
<h3 id="labels-and-localization">Labels and Localization</h3>
<p>The web app resolves <code>name</code> and <code>shortName</code> server-side for the requested language from the shipped step-present catalog, laid over the live <a class="xref" href="../../api/Hi.MachiningSteps.PresentAttribute.html">PresentAttribute</a>.<a class="xref" href="../../api/Hi.MachiningSteps.PresentAttribute.html#Hi_MachiningSteps_PresentAttribute_Name">Name</a> and <a class="xref" href="../../api/Hi.MachiningSteps.PresentAttribute.html#Hi_MachiningSteps_PresentAttribute_ShortName">ShortName</a> values — those are the English truth and the fallback for a missing catalog file or key. <a class="xref" href="../../api/Hi.MachiningSteps.PresentAttribute.html#Hi_MachiningSteps_PresentAttribute_Unit">Unit</a> is sent as-is and does not localize. The dialog pins the language with a <code>?lang=</code> argument on the request and re-pulls when the UI locale changes.</p>
<p>Refer to the code to apply <a class="xref" href="../../api/Hi.MachiningSteps.PresentAttribute.html">PresentAttribute</a>:</p>
<pre><code class="lang-csharp" name="SampleCode-ShowStepPresent">internal static void ShowStepPresent(
UserService userEnv, MachiningStep machiningStep)
{
foreach (var entry in userEnv.DisplayedStepPresentAccessList)
{
var present = entry.Value.Present;
var valueText = string.Format(&quot;{0:&quot; + present.DataFormatString + &quot;}&quot;, entry.Value.GetValueFunc.Invoke(machiningStep));
Console.WriteLine($&quot;{present.ShortName}: {valueText} {present.TailUnitString} ({present.Name} [{entry.Key}])&quot;);
}
}
</code></pre><h2 id="see-also">See Also</h2>
<ul>
<li><a class="xref" href="selected-step-info-panel.html">Selected-Step Info Panel</a> — the panel whose property list this page configures</li>
<li><a class="xref" href="../shell/preference-menu.html">Preference Menu Dropdown</a> — the preference surface this editor sits beside</li>
<li><a href="../../manual/run/inspecting-a-step.html">Inspecting a Step</a> — the task this dialog serves, as a procedure</li>
</ul>
<h2 id="source-code-path">Source Code Path</h2>
<p>See <a class="xref" href="../index.html">HiNC App Anatomy</a> for git repository links.</p>
<p>HiNC-2025-webservice (Quasar CLI SPA):</p>
<ul>
<li><code>wwwroot-src/src/components/preference/StepPresentPreferenceDialog.vue</code> — the dialog itself: a Candidate Keys / Displayed Keys splitter, category accordions keyed on the stable category code, the per-category tri-state checkbox, <code>Add Selected</code>, drag-reorder plus up / down / remove and <code>Clear</code>, the header counts, <code>Reset</code> and close, and the auto-save state. Refetches on every open and on a locale change.</li>
<li><code>wwwroot-src/src/components/execution/SelectedStepInfoPanel.vue</code> — what opens it: the <code>tune</code> icon button teleported into the panel's title bar (the hosting expansion header, or the panel's own bar when standalone). Also the list the dialog configures, with the <code>StepIndex</code> row filtered out.</li>
<li><code>wwwroot-src/src/components/execution/StepInfoGroupBar.vue</code> — the Step Info column's group bar, which carries the step-index badge instead.</li>
<li><code>wwwroot-src/src/pages/ExecutionPage.vue</code> — the only surface the dialog is reachable from.</li>
<li><code>wwwroot-src/src/api/preference.ts</code> — <code>getStepPresentKeys</code> (language-pinned) / <code>setStepPresentKeys</code> / <code>resetStepPresentKeys</code>, and the <code>StepPresentKeyInfo</code> / <code>StepPresentCategory</code> / <code>StepPresentKeysSnapshot</code> types.</li>
<li><code>Environments/PreferenceController.cs</code> — <code>GET</code> / <code>POST</code> / <code>DELETE /api/preference/step-present-keys</code>, the seven-entry category table, the <code>ResolveStepPresentCategory</code> mapping, and persistence of <code>DisplayedStepPresentKeyList</code> through <code>SaveUserConfig()</code>.</li>
<li><code>Environments/PresentCatalogService.cs</code> — server-side localization of <code>name</code> and <code>shortName</code> from the shipped step-present catalog, with the live <a class="xref" href="../../api/Hi.MachiningSteps.PresentAttribute.html">PresentAttribute</a> data as the English base and fallback.</li>
<li><code>Environments/UserService.cs</code> — <code>StepPresentAccessDictionary</code> and <code>CandidateStepPresentKeyList</code>, the candidate-key model.</li>
<li><code>Environments/UserConfig.cs</code> — <code>DisplayedStepPresentKeyList</code>, the ordered displayed-key model.</li>
</ul>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>