Skip to content

Commit

Permalink
Merge pull request buildbot#8072 from terencehonles/fix-force-schedul…
Browse files Browse the repository at this point in the history
…er-link

www: fix /builders/:builderid/force/:scheduler route not implemented
  • Loading branch information
p12tic authored Oct 3, 2024
2 parents dcc0e6b + c46de3e commit b3d70ad
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
1 change: 1 addition & 0 deletions newsfragments/www-builder-force-modal.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix missing builder force scheduler route ``/builders/:builderid/force/:scheduler``.
30 changes: 22 additions & 8 deletions www/base/src/views/BuilderView/BuilderView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const buildTopbarActions = (builds: DataCollection<Build>,

export const BuilderView = observer(() => {
const builderid = useParams<"builderid">().builderid
const activeSchedulerName = useParams<"scheduler">().scheduler;
const navigate = useNavigate();

const accessor = useDataAccessor([builderid]);
Expand Down Expand Up @@ -183,16 +184,23 @@ export const BuilderView = observer(() => {
const [shownForceScheduler, setShownForceScheduler] = useState<null|Forcescheduler>(null);

const actions = buildTopbarActions(builds, buildrequests, forceschedulers, isCancelling,
cancelWholeQueue, (sch) => setShownForceScheduler(sch));
cancelWholeQueue, (sch) => navigate(`/builders/${builderid}/force/${sch.name}`));

useTopbarActions(actions);

const activeScheduler = forceschedulers.array.find((sch) => sch.name === activeSchedulerName);
if (activeScheduler && shownForceScheduler?.name !== activeScheduler.name) {
setShownForceScheduler(activeScheduler);
} else if (activeSchedulerName == null && shownForceScheduler) {
setShownForceScheduler(null);
}

const onForceBuildModalClose = (buildRequestNumber: string | null) => {
if (buildRequestNumber === null) {
setShownForceScheduler(null);
} else {
navigate(`/buildrequests/${buildRequestNumber}?redirect_to_build=true`);
}
navigate(
buildRequestNumber === null
? `/builders/${builderid}`
: `/buildrequests/${buildRequestNumber}?redirect_to_build=true`
);
};

const renderDescription = (builder: Builder) => {
Expand Down Expand Up @@ -263,7 +271,13 @@ export const BuilderView = observer(() => {
buildbotSetupPlugin((reg) => {
reg.registerRoute({
route: "builders/:builderid",
group: null,
element: () => <BuilderView/>,
group: null,
element: () => <BuilderView/>,
});

reg.registerRoute({
route: "builders/:builderid/force/:scheduler",
group: null,
element: () => <BuilderView/>,
});
});

0 comments on commit b3d70ad

Please sign in to comment.