mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Jump from notification to Preferences
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
3ea47fe764
commit
6fdb55ed3a
@ -100,7 +100,10 @@ export class CatalogAddButton extends React.Component<CatalogAddButtonProps> {
|
|||||||
key={index}
|
key={index}
|
||||||
icon={<Icon material={menuItem.icon}/>}
|
icon={<Icon material={menuItem.icon}/>}
|
||||||
tooltipTitle={menuItem.title}
|
tooltipTitle={menuItem.title}
|
||||||
onClick={() => menuItem.onClick()}
|
onClick={(evt) => {
|
||||||
|
evt.stopPropagation();
|
||||||
|
menuItem.onClick();
|
||||||
|
}}
|
||||||
TooltipClasses={{
|
TooltipClasses={{
|
||||||
popper: "catalogSpeedDialPopper"
|
popper: "catalogSpeedDialPopper"
|
||||||
}}
|
}}
|
||||||
|
|||||||
@ -36,6 +36,14 @@ export interface SettingLayoutProps extends React.DOMAttributes<any> {
|
|||||||
back?: (evt: React.MouseEvent | KeyboardEvent) => void;
|
back?: (evt: React.MouseEvent | KeyboardEvent) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function scrollToAnchor() {
|
||||||
|
const { hash } = window.location;
|
||||||
|
|
||||||
|
if (hash) {
|
||||||
|
document.querySelector(`${hash}`).scrollIntoView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const defaultProps: Partial<SettingLayoutProps> = {
|
const defaultProps: Partial<SettingLayoutProps> = {
|
||||||
provideBackButtonNavigation: true,
|
provideBackButtonNavigation: true,
|
||||||
contentGaps: true,
|
contentGaps: true,
|
||||||
@ -59,6 +67,8 @@ export class SettingLayout extends React.Component<SettingLayoutProps> {
|
|||||||
|
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
window.addEventListener("keydown", this.onEscapeKey);
|
window.addEventListener("keydown", this.onEscapeKey);
|
||||||
|
|
||||||
|
scrollToAnchor();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
@ -79,7 +89,7 @@ export class SettingLayout extends React.Component<SettingLayoutProps> {
|
|||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
contentClass, provideBackButtonNavigation,
|
contentClass, provideBackButtonNavigation,
|
||||||
contentGaps, navigation, children, ...elemProps
|
contentGaps, navigation, children, back, ...elemProps
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const className = cssNames("SettingLayout", { showNavigation: navigation }, this.props.className);
|
const className = cssNames("SettingLayout", { showNavigation: navigation }, this.props.className);
|
||||||
|
|
||||||
|
|||||||
@ -19,14 +19,17 @@
|
|||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import React from "react";
|
||||||
import { kubernetesClusterCategory } from "../../common/catalog-entities";
|
import { kubernetesClusterCategory } from "../../common/catalog-entities";
|
||||||
import { addClusterURL } from "../../common/routes";
|
import { addClusterURL, kubernetesURL } from "../../common/routes";
|
||||||
import { multiSet } from "../utils";
|
import { multiSet } from "../utils";
|
||||||
import { UserStore } from "../../common/user-store";
|
import { UserStore } from "../../common/user-store";
|
||||||
import { getAllEntries } from "../components/+preferences/kubeconfig-syncs";
|
import { getAllEntries } from "../components/+preferences/kubeconfig-syncs";
|
||||||
import { runInAction } from "mobx";
|
import { runInAction } from "mobx";
|
||||||
import { isWindows } from "../../common/vars";
|
import { isWindows } from "../../common/vars";
|
||||||
import { PathPicker } from "../components/path-picker/path-picker";
|
import { PathPicker } from "../components/path-picker/path-picker";
|
||||||
|
import { Notifications } from "../components/notifications";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
async function addSyncEntries(filePaths: string[]) {
|
async function addSyncEntries(filePaths: string[]) {
|
||||||
const entries = await getAllEntries(filePaths);
|
const entries = await getAllEntries(filePaths);
|
||||||
@ -34,6 +37,14 @@ async function addSyncEntries(filePaths: string[]) {
|
|||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
multiSet(UserStore.getInstance().syncKubeconfigEntries, entries);
|
multiSet(UserStore.getInstance().syncKubeconfigEntries, entries);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Notifications.ok(
|
||||||
|
<div>
|
||||||
|
<p>Selected items has been added to Kubeconfig Sync.</p><br/>
|
||||||
|
<p>Check the <Link style={{ textDecoration: "underline" }} to={`${kubernetesURL()}#kube-sync`}>Preferences</Link>{" "}
|
||||||
|
to see full list.</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function initCatalogCategoryRegistryEntries() {
|
export function initCatalogCategoryRegistryEntries() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user