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
48 changes: 38 additions & 10 deletions src/components/DNEGridChange/DNEGridChange.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,44 @@ type ChangeDetailsProps = {
setShowDetails: (show: boolean) => void;
}

type ChangeDetailsPropsNotFound = {
changeid: string;
timestamp: bigint;
}

const popoverWithText = (id: string, text: string) => {
return (
<Popover id={"bb-popover-change-details-" + id}>
<Popover.Content>
{text}
</Popover.Content>
</Popover>
);
}

export const DNEGridChangeNotFound = ({changeid, timestamp}: ChangeDetailsPropsNotFound) => {
const now = useCurrentTime();
const content = (
<>
<OverlayTrigger placement="top" overlay={popoverWithText("comments-" + changeid, "No Change Found")}>
<b className="dne-changedetails-revision">{changeid}</b>
</OverlayTrigger>
<OverlayTrigger
placement="top"
overlay={popoverWithText("date-" + changeid, dateFormat(timestamp))}
>
<span><br/>{durationFromNowFormat(timestamp, now)}</span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the <br/> should probably be between the two OverlayTrigger?

</OverlayTrigger>
</>
);

return (
<div className="dne-changedetails">
{content}
</div>
);
}

export const DNEGridChange = ({change, showDetails, setShowDetails}: ChangeDetailsProps) => {
const now = useCurrentTime();
const [showProps, setShowProps] = useState(false);
Expand Down Expand Up @@ -85,16 +123,6 @@ export const DNEGridChange = ({change, showDetails, setShowDetails}: ChangeDetai

const [changeAuthorName, changeEmail] = parseChangeAuthorNameAndEmail(change.author);

const popoverWithText = (id: string, text: string) => {
return (
<Popover id={"bb-popover-change-details-" + id}>
<Popover.Content>
{text}
</Popover.Content>
</Popover>
);
}

const content = (
<>
<OverlayTrigger placement="top" overlay={popoverWithText("comments-" + change.id, change.comments)}>
Expand Down
13 changes: 9 additions & 4 deletions src/views/GridView/DNEGridView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import './DNEGridView.scss';
import {ObservableMap, observable} from "mobx";
import {observer, useLocalObservable} from "mobx-react";
import {Link, useSearchParams} from "react-router-dom";
import {Form} from "react-bootstrap";
import {Form, OverlayTrigger, Popover} from "react-bootstrap";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused imports?

import {
Builder,
Build,
Expand All @@ -18,6 +18,7 @@ import {
Buildrequest,
} from "buildbot-data-js";
import {
dateFormat,
LoadingIndicator,
BuildLinkWithSummaryTooltip
} from "buildbot-ui";
Expand All @@ -27,6 +28,7 @@ import {getConfig, DNEConfig, DNEView} from "../../utils/Config";
import {getRelatedOfFilteredDataMultiCollection} from "../../utils/DataMultiCollectionUtils";
import {useState} from "react";
import {DNEGridChange} from "../../components/DNEGridChange/DNEGridChange";
import {DNEGridChangeNotFound} from "../../components/DNEGridChange/DNEGridChange";


function getViewSelectForm(config: DNEConfig, defaultFetchLimit: number) {
Expand Down Expand Up @@ -394,17 +396,20 @@ export const DNEGridView = observer(() => {
// then keep only last X changes
.splice(buildFetchLimit);

const body = buildsPerChange.map(({change, builds}) => {
const body = buildsPerChange.map(({changeid, change, builds}) => {
return (
<tr>
<td>
{
change
change // The change has been properly polled, pull from the polled change info
? <DNEGridChange change={change}
showDetails={changeIsExpandedByChangeId.get(change.changeid) ?? false}
setShowDetails={(show: boolean) => changeIsExpandedByChangeId.set(change.changeid, show)}
/>
: "ChangeNotFound"
: changeid.length !=0 && builds.length != 0 // The change wasn't polled, pull what we can from earliest build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this could be handled in DNEGridChangeNotFound?

? <DNEGridChangeNotFound changeid={changeid}
timestamp={builds[0].started_at}/>
: "ChangeNotFound" // Last resort, we just don't what this change is
}
</td>
{
Expand Down