mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-19 17:01:13 +00:00
Pull request preview URLs (#625)
* Dynamic link to HEAD of a given PR * Display pr name and link in notification console * Pass along query string to Explorer This means you can write a URL like: https://cosmos-explorer-preview.azurewebsites.net/pull/123?feature.enableFoo=true and when Explorer loads it'll have enableFoo set to true in the features object.
This commit is contained in:
@@ -2,19 +2,20 @@
|
||||
* React component for control bar
|
||||
*/
|
||||
|
||||
import * as React from "react";
|
||||
import { ClientDefaults, KeyCodes } from "../../../Common/Constants";
|
||||
import AnimateHeight from "react-animate-height";
|
||||
import { Dropdown, IDropdownOption } from "office-ui-fabric-react";
|
||||
import LoadingIcon from "../../../../images/loading.svg";
|
||||
import * as React from "react";
|
||||
import AnimateHeight from "react-animate-height";
|
||||
import LoaderIcon from "../../../../images/circular_loader_black_16x16.gif";
|
||||
import ClearIcon from "../../../../images/Clear.svg";
|
||||
import ErrorBlackIcon from "../../../../images/error_black.svg";
|
||||
import ErrorRedIcon from "../../../../images/error_red.svg";
|
||||
import infoBubbleIcon from "../../../../images/info-bubble-9x9.svg";
|
||||
import InfoIcon from "../../../../images/info_color.svg";
|
||||
import ErrorRedIcon from "../../../../images/error_red.svg";
|
||||
import ClearIcon from "../../../../images/Clear.svg";
|
||||
import LoaderIcon from "../../../../images/circular_loader_black_16x16.gif";
|
||||
import ChevronUpIcon from "../../../../images/QueryBuilder/CollapseChevronUp_16x.png";
|
||||
import LoadingIcon from "../../../../images/loading.svg";
|
||||
import ChevronDownIcon from "../../../../images/QueryBuilder/CollapseChevronDown_16x.png";
|
||||
import ChevronUpIcon from "../../../../images/QueryBuilder/CollapseChevronUp_16x.png";
|
||||
import { ClientDefaults, KeyCodes } from "../../../Common/Constants";
|
||||
import { userContext } from "../../../UserContext";
|
||||
|
||||
/**
|
||||
* Log levels
|
||||
@@ -135,6 +136,7 @@ export class NotificationConsoleComponent extends React.Component<
|
||||
<span className="numInfoItems">{numInfoItems}</span>
|
||||
</span>
|
||||
</span>
|
||||
{userContext.features.pr && <PrPreview pr={userContext.features.pr} />}
|
||||
<span className="consoleSplitter" />
|
||||
<span className="headerStatus">
|
||||
<span className="headerStatusEllipsis">{this.state.headerStatus}</span>
|
||||
@@ -304,3 +306,18 @@ export class NotificationConsoleComponent extends React.Component<
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
const PrPreview = (props: { pr: string }) => {
|
||||
const url = new URL(props.pr);
|
||||
const [, ref] = url.hash.split("#");
|
||||
url.hash = "";
|
||||
|
||||
return (
|
||||
<>
|
||||
<span className="consoleSplitter" />
|
||||
<a target="_blank" href={url.href} style={{ marginRight: "1em", fontWeight: "bold" }}>
|
||||
{ref}
|
||||
</a>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user