From 498c7defe9be693547902db8a84aebabb98ab661 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Mon, 29 Mar 2021 11:28:13 -0400 Subject: [PATCH 1/9] release v4.2.0-rc.3 (#2400) Signed-off-by: Sebastian Malton --- package.json | 2 +- static/RELEASE_NOTES.md | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e346f8c11f..abeb0816b0 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "kontena-lens", "productName": "Lens", "description": "Lens - The Kubernetes IDE", - "version": "4.2.0-rc.2", + "version": "4.2.0-rc.3", "main": "static/build/main.js", "copyright": "© 2021, Mirantis, Inc.", "license": "MIT", diff --git a/static/RELEASE_NOTES.md b/static/RELEASE_NOTES.md index 7aa58e564c..f391d0d4b2 100644 --- a/static/RELEASE_NOTES.md +++ b/static/RELEASE_NOTES.md @@ -2,7 +2,7 @@ Here you can find description of changes we've built into each release. While we try our best to make each upgrade automatic and as smooth as possible, there may be some cases where you might need to do something to ensure the application works smoothly. So please read through the release highlights! -## 4.2.0-rc.2 (current version) +## 4.2.0-rc.3 (current version) - Add lens:// protocol handling with a routing mechanism - Add common app routes to the protocol renderer router from the documentation @@ -33,6 +33,10 @@ Here you can find description of changes we've built into each release. While we - Fix: Closing workspace menu after clicking on iframe - Fix: extension global pages are never able to be visible - Fix: recreate proxy kubeconfig if it is deleted +- Fix: Proxy should listen only on loopback device +- Fix: Block global path traversal in router +- Fix: Set initial cursor position for the editor to beginning +- Fix: Highlight sidebar's active section ## 4.1.4 From 69200b50c737af6bee756a542ae26ea84a423766 Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Tue, 30 Mar 2021 12:05:41 +0300 Subject: [PATCH 2/9] Wrapping ReactSelect styles into CacheProvider (#2365) * Wrap app into emotion CacheProvider to isolate styles Signed-off-by: Alex Andreev * Fix CacheProvider key Signed-off-by: Alex Andreev * Moving CacheProvider into more specific components Signed-off-by: Alex Andreev * Align @emotion/react & @emotion/cache version with ones inside react-select Signed-off-by: Alex Andreev * Covering more components with CacheProvider Signed-off-by: Alex Andreev * Changing emotion versions a bit more Signed-off-by: Alex Andreev * Moving CacheProvider into bootstrap Signed-off-by: Alex Andreev * Updating react-select types Signed-off-by: Alex Andreev * A bit of cleaning up types Signed-off-by: Alex Andreev * Specifying types a bit more Signed-off-by: Alex Andreev * Fix gradients in namespace selector Signed-off-by: Alex Andreev * Importing types separately Signed-off-by: Alex Andreev * Using generic NonceProvider in bootstrap Signed-off-by: Alex Andreev --- package.json | 4 +- src/renderer/bootstrap.tsx | 8 +- .../+namespaces/namespace-select-filter.scss | 41 ++++ .../+namespaces/namespace-select-filter.tsx | 5 +- .../+namespaces/namespace-select.scss | 16 -- .../+namespaces/namespace-select.tsx | 15 +- src/renderer/components/select/select.tsx | 30 +-- yarn.lock | 195 +++++++----------- 8 files changed, 149 insertions(+), 165 deletions(-) create mode 100644 src/renderer/components/+namespaces/namespace-select-filter.scss diff --git a/package.json b/package.json index abeb0816b0..da4956088c 100644 --- a/package.json +++ b/package.json @@ -288,7 +288,7 @@ "@types/react-beautiful-dnd": "^13.0.0", "@types/react-dom": "^17.0.0", "@types/react-router-dom": "^5.1.6", - "@types/react-select": "^3.0.13", + "@types/react-select": "^4.0.13", "@types/react-window": "^1.8.2", "@types/readable-stream": "^2.3.9", "@types/request": "^2.48.5", @@ -352,7 +352,7 @@ "react-beautiful-dnd": "^13.0.0", "react-refresh": "^0.9.0", "react-router-dom": "^5.2.0", - "react-select": "^3.1.0", + "react-select": "^4.3.0", "react-select-event": "^5.1.0", "react-window": "^1.8.5", "sass-loader": "^8.0.2", diff --git a/src/renderer/bootstrap.tsx b/src/renderer/bootstrap.tsx index 0d412e257c..ce822ca2ae 100644 --- a/src/renderer/bootstrap.tsx +++ b/src/renderer/bootstrap.tsx @@ -19,6 +19,7 @@ import { filesystemProvisionerStore } from "../main/extension-filesystem"; import { App } from "./components/app"; import { LensApp } from "./lens-app"; import { themeStore } from "./theme.store"; +import { NonceProvider as StyleCache } from "react-select"; /** * If this is a development buid, wait a second to attach @@ -80,9 +81,14 @@ export async function bootstrap(App: AppComponent) { window.location.href = "about:blank"; } }); + + const cacheProps = { nonce: "lens", cacheKey: "lens" }; + render(<> {isMac &&
} - + + + , rootElem); } diff --git a/src/renderer/components/+namespaces/namespace-select-filter.scss b/src/renderer/components/+namespaces/namespace-select-filter.scss new file mode 100644 index 0000000000..b9ad196e04 --- /dev/null +++ b/src/renderer/components/+namespaces/namespace-select-filter.scss @@ -0,0 +1,41 @@ +.NamespaceSelectFilter { + .Select { + &__placeholder { + width: 100%; + white-space: nowrap; + overflow: scroll!important; + text-overflow: unset!important; + margin-left: -8px; + padding-left: 8px; + margin-right: -8px; + padding-right: 8px; + + &::-webkit-scrollbar { + display: none; + } + } + + &__value-container { + position: relative; + + &::before, &::after { + content: ' '; + position: absolute; + z-index: 20; + display: block; + width: 8px; + height: var(--font-size); + } + + &::before { + left: 0px; + background: linear-gradient(to right, var(--contentColor) 0px, transparent); + } + + &::after { + right: 0px; + background: linear-gradient(to left, var(--contentColor) 0px, transparent); + } + } + } +} \ No newline at end of file diff --git a/src/renderer/components/+namespaces/namespace-select-filter.tsx b/src/renderer/components/+namespaces/namespace-select-filter.tsx index 85a6299b17..7b73cfc99d 100644 --- a/src/renderer/components/+namespaces/namespace-select-filter.tsx +++ b/src/renderer/components/+namespaces/namespace-select-filter.tsx @@ -2,7 +2,7 @@ import "./namespace-select.scss"; import React from "react"; import { observer } from "mobx-react"; -import { components, PlaceholderProps } from "react-select"; +import { components, OptionTypeBase, PlaceholderProps } from "react-select"; import { Icon } from "../icon"; import { FilterIcon } from "../item-object-list/filter-icon"; @@ -11,7 +11,7 @@ import { SelectOption } from "../select"; import { NamespaceSelect } from "./namespace-select"; import { namespaceStore } from "./namespace.store"; -const Placeholder = observer((props: PlaceholderProps) => { +const Placeholder = observer((props: PlaceholderProps) => { const getPlaceholder = (): React.ReactNode => { const namespaces = namespaceStore.contextNamespaces; @@ -71,6 +71,7 @@ export class NamespaceSelectFilter extends React.Component { placeholder={""} onChange={this.onChange} formatOptionLabel={this.formatOptionLabel} + className="NamespaceSelectFilter" /> ); } diff --git a/src/renderer/components/+namespaces/namespace-select.scss b/src/renderer/components/+namespaces/namespace-select.scss index 33293a6d7a..f300544cfb 100644 --- a/src/renderer/components/+namespaces/namespace-select.scss +++ b/src/renderer/components/+namespaces/namespace-select.scss @@ -23,22 +23,6 @@ .NamespaceSelect { @include namespaceSelectCommon; - - .Select { - &__placeholder { - width: 100%; - white-space: nowrap; - overflow: scroll; - margin-left: -8px; - padding-left: 8px; - margin-right: -8px; - padding-right: 8px; - - &::-webkit-scrollbar { - display: none; - } - } - } } .NamespaceSelectMenu { diff --git a/src/renderer/components/+namespaces/namespace-select.tsx b/src/renderer/components/+namespaces/namespace-select.tsx index d398f91f0a..d3df621b50 100644 --- a/src/renderer/components/+namespaces/namespace-select.tsx +++ b/src/renderer/components/+namespaces/namespace-select.tsx @@ -1,4 +1,4 @@ -import "./namespace-select.scss"; +import "./namespace-select-filter.scss"; import React from "react"; import { computed } from "mobx"; @@ -8,7 +8,6 @@ import { cssNames } from "../../utils"; import { Icon } from "../icon"; import { namespaceStore } from "./namespace.store"; import { kubeWatchApi } from "../../api/kube-watch-api"; -import { components, ValueContainerProps } from "react-select"; interface Props extends SelectProps { showIcons?: boolean; @@ -22,16 +21,6 @@ const defaultProps: Partial = { showClusterOption: false, }; -function GradientValueContainer({children, ...rest}: ValueContainerProps) { - return ( - -
- {children} -
- - ); -} - @observer export class NamespaceSelect extends React.Component { static defaultProps = defaultProps as object; @@ -77,8 +66,6 @@ export class NamespaceSelect extends React.Component { render() { const { className, showIcons, customizeOptions, components = {}, ...selectProps } = this.props; - components.ValueContainer ??= GradientValueContainer; - return (