pcp-tgu-ops-ui: гасить кнопки решения по истечении grace-окна WAITING_DECISION
This commit is contained in:
@@ -4,6 +4,13 @@ import { platformLabel } from "./tguTimelineMapper";
|
||||
import { statusStyle } from "./tguStatus";
|
||||
import { formatUtcDateTime, parseUtc } from "../../utils/utcTime";
|
||||
|
||||
// Бэкенд (pcp-tgu-service) ждёт решения по плану только waiting-decision-grace-minutes
|
||||
// минут после его startTime; затем IssueDuePlanWorker.tryAdvancePastUnconfirmedPlan
|
||||
// «молчаливо» продолжает цепочку, оставляя план в WAITING_DECISION, но решение по нему
|
||||
// больше не принимается (endpoint вернёт 409). Держим значение синхронным с
|
||||
// config-repo/pcp-tgu-service.yaml → tgu.planning.waiting-decision-grace-minutes.
|
||||
const DECISION_GRACE_MINUTES = 30;
|
||||
|
||||
type TguPlanDetailsProps = {
|
||||
plan?: TguPlanUi;
|
||||
decisionInFlight: boolean;
|
||||
@@ -27,6 +34,8 @@ export function TguPlanDetails({ plan, decisionInFlight, notice, error, onDecisi
|
||||
|
||||
const style = statusStyle(plan.status);
|
||||
const duration = formatDuration(plan.endMs - plan.startMs);
|
||||
// Окно решения закрылось, если с момента старта плана прошло больше grace-периода.
|
||||
const decisionWindowClosed = Date.now() > plan.startMs + DECISION_GRACE_MINUTES * 60_000;
|
||||
|
||||
const reject = () => {
|
||||
const reason = window.prompt("Reason для REJECTED", "UI_TEST_REJECTED");
|
||||
@@ -62,21 +71,27 @@ export function TguPlanDetails({ plan, decisionInFlight, notice, error, onDecisi
|
||||
<Detail label="status" value={plan.status} mono />
|
||||
</dl>
|
||||
|
||||
{plan.status === "WAITING_DECISION" && (
|
||||
<div className="tgu-details__actions">
|
||||
<button
|
||||
className="tgu-button tgu-button--accept"
|
||||
type="button"
|
||||
disabled={decisionInFlight}
|
||||
onClick={() => onDecision(plan.planId, "ACCEPTED", "UI_TEST_ACCEPTED")}
|
||||
>
|
||||
Принять
|
||||
</button>
|
||||
<button className="tgu-button tgu-button--reject" type="button" disabled={decisionInFlight} onClick={reject}>
|
||||
Отклонить
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
{plan.status === "WAITING_DECISION" &&
|
||||
(decisionWindowClosed ? (
|
||||
<div className="tgu-alert tgu-alert--warning">
|
||||
Окно решения истекло: прошло больше {DECISION_GRACE_MINUTES} мин после начала плана. Система продолжила
|
||||
цепочку без подтверждения — решение по этому плану больше не принимается.
|
||||
</div>
|
||||
) : (
|
||||
<div className="tgu-details__actions">
|
||||
<button
|
||||
className="tgu-button tgu-button--accept"
|
||||
type="button"
|
||||
disabled={decisionInFlight}
|
||||
onClick={() => onDecision(plan.planId, "ACCEPTED", "UI_TEST_ACCEPTED")}
|
||||
>
|
||||
Принять
|
||||
</button>
|
||||
<button className="tgu-button tgu-button--reject" type="button" disabled={decisionInFlight} onClick={reject}>
|
||||
Отклонить
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user