mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Merge branch 'master' into fix/iframe-ipc-flakyness
This commit is contained in:
commit
57a4c0d01c
@ -59,8 +59,6 @@ export class UserStore extends BaseStore<UserStoreModel> {
|
|||||||
colorTheme: UserStore.defaultTheme,
|
colorTheme: UserStore.defaultTheme,
|
||||||
downloadMirror: "default",
|
downloadMirror: "default",
|
||||||
downloadKubectlBinaries: true, // Download kubectl binaries matching cluster version
|
downloadKubectlBinaries: true, // Download kubectl binaries matching cluster version
|
||||||
downloadBinariesPath: this.getDefaultKubectlPath(),
|
|
||||||
kubectlBinariesPath: ""
|
|
||||||
};
|
};
|
||||||
|
|
||||||
get isNewVersion() {
|
get isNewVersion() {
|
||||||
|
|||||||
@ -36,7 +36,7 @@ const packageMirrors: Map<string, string> = new Map([
|
|||||||
let bundledPath: string
|
let bundledPath: string
|
||||||
const initScriptVersionString = "# lens-initscript v3\n"
|
const initScriptVersionString = "# lens-initscript v3\n"
|
||||||
|
|
||||||
if (isDevelopment || isTestEnv) {
|
if (isDevelopment || isTestEnv) {
|
||||||
const platformName = isWindows ? "windows" : process.platform
|
const platformName = isWindows ? "windows" : process.platform
|
||||||
bundledPath = path.join(process.cwd(), "binaries", "client", platformName, process.arch, "kubectl")
|
bundledPath = path.join(process.cwd(), "binaries", "client", platformName, process.arch, "kubectl")
|
||||||
} else {
|
} else {
|
||||||
@ -110,7 +110,11 @@ export class Kubectl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected getDownloadDir() {
|
protected getDownloadDir() {
|
||||||
return userStore.preferences?.downloadBinariesPath || Kubectl.kubectlDir
|
if (userStore.preferences?.downloadBinariesPath) {
|
||||||
|
return path.join(userStore.preferences.downloadBinariesPath, "kubectl")
|
||||||
|
}
|
||||||
|
|
||||||
|
return Kubectl.kubectlDir
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getPath(bundled = false): Promise<string> {
|
public async getPath(bundled = false): Promise<string> {
|
||||||
@ -214,7 +218,7 @@ export class Kubectl {
|
|||||||
});
|
});
|
||||||
isValid = !await this.checkBinary(this.path, false)
|
isValid = !await this.checkBinary(this.path, false)
|
||||||
}
|
}
|
||||||
if(!isValid) {
|
if (!isValid) {
|
||||||
logger.debug(`Releasing lock for ${this.kubectlVersion}`)
|
logger.debug(`Releasing lock for ${this.kubectlVersion}`)
|
||||||
release()
|
release()
|
||||||
return false
|
return false
|
||||||
|
|||||||
@ -43,7 +43,10 @@ export async function bootstrap(App: AppComponent) {
|
|||||||
window.location.href = "about:blank"
|
window.location.href = "about:blank"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
render(<App/>, rootElem);
|
render(<>
|
||||||
|
{isMac && <div id="draggable-top" />}
|
||||||
|
<App />
|
||||||
|
</>, rootElem);
|
||||||
}
|
}
|
||||||
|
|
||||||
// run
|
// run
|
||||||
|
|||||||
@ -18,44 +18,22 @@ export const KubectlBinaries = observer(({ preferences }: { preferences: UserPre
|
|||||||
{ value: "china", label: "China (Azure)" },
|
{ value: "china", label: "China (Azure)" },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
const save = () => {
|
const save = () => {
|
||||||
preferences.downloadBinariesPath = downloadPath;
|
preferences.downloadBinariesPath = downloadPath;
|
||||||
preferences.kubectlBinariesPath = binariesPath;
|
preferences.kubectlBinariesPath = binariesPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
const renderPath = () => {
|
|
||||||
if (preferences.downloadKubectlBinaries) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<SubTitle title="Path to Kubectl binary"/>
|
|
||||||
<Input
|
|
||||||
theme="round-black"
|
|
||||||
value={binariesPath}
|
|
||||||
validators={isPath}
|
|
||||||
onChange={setBinariesPath}
|
|
||||||
onBlur={save}
|
|
||||||
/>
|
|
||||||
<small className="hint">
|
|
||||||
<Trans>Default:</Trans>{" "}{Kubectl.bundledKubectlPath}
|
|
||||||
</small>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h2><Trans>Kubectl Binary</Trans></h2>
|
<h2><Trans>Kubectl Binary</Trans></h2>
|
||||||
<small className="hint">
|
|
||||||
<Trans>Download kubectl binaries matching to Kubernetes cluster verison.</Trans>
|
|
||||||
</small>
|
|
||||||
<Checkbox
|
<Checkbox
|
||||||
label={<Trans>Download kubectl binaries</Trans>}
|
label={<Trans>Download kubectl binaries</Trans>}
|
||||||
value={preferences.downloadKubectlBinaries}
|
value={preferences.downloadKubectlBinaries}
|
||||||
onChange={downloadKubectlBinaries => preferences.downloadKubectlBinaries = downloadKubectlBinaries}
|
onChange={downloadKubectlBinaries => preferences.downloadKubectlBinaries = downloadKubectlBinaries}
|
||||||
/>
|
/>
|
||||||
|
<small className="hint">
|
||||||
|
<Trans>Download kubectl binaries matching to Kubernetes cluster version.</Trans>
|
||||||
|
</small>
|
||||||
<SubTitle title="Download mirror" />
|
<SubTitle title="Download mirror" />
|
||||||
<Select
|
<Select
|
||||||
placeholder={<Trans>Download mirror for kubectl</Trans>}
|
placeholder={<Trans>Download mirror for kubectl</Trans>}
|
||||||
@ -64,20 +42,32 @@ export const KubectlBinaries = observer(({ preferences }: { preferences: UserPre
|
|||||||
onChange={({ value }: SelectOption) => preferences.downloadMirror = value}
|
onChange={({ value }: SelectOption) => preferences.downloadMirror = value}
|
||||||
disabled={!preferences.downloadKubectlBinaries}
|
disabled={!preferences.downloadKubectlBinaries}
|
||||||
/>
|
/>
|
||||||
<SubTitle title="Directory for binaries"/>
|
<SubTitle title="Directory for binaries" />
|
||||||
<Input
|
<Input
|
||||||
theme="round-black"
|
theme="round-black"
|
||||||
value={downloadPath}
|
value={downloadPath}
|
||||||
placeholder={`Directory to download binaries into`}
|
placeholder={userStore.getDefaultKubectlPath()}
|
||||||
validators={isPath}
|
validators={isPath}
|
||||||
onChange={setDownloadPath}
|
onChange={setDownloadPath}
|
||||||
onBlur={save}
|
onBlur={save}
|
||||||
disabled={!preferences.downloadKubectlBinaries}
|
disabled={!preferences.downloadKubectlBinaries}
|
||||||
/>
|
/>
|
||||||
<small>
|
<small className="hint">
|
||||||
Default: {userStore.getDefaultKubectlPath()}
|
The directory to download binaries into.
|
||||||
|
</small>
|
||||||
|
<SubTitle title="Path to Kubectl binary" />
|
||||||
|
<Input
|
||||||
|
theme="round-black"
|
||||||
|
placeholder={Kubectl.bundledKubectlPath}
|
||||||
|
value={binariesPath}
|
||||||
|
validators={isPath}
|
||||||
|
onChange={setBinariesPath}
|
||||||
|
onBlur={save}
|
||||||
|
disabled={preferences.downloadKubectlBinaries}
|
||||||
|
/>
|
||||||
|
<small className="hint">
|
||||||
|
<Trans>The path to the kubectl binary on the system.</Trans>
|
||||||
</small>
|
</small>
|
||||||
{renderPath()}
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
:root {
|
:root {
|
||||||
--mainBackground: #1e2124;
|
--mainBackground: #1e2124;
|
||||||
--main-layout-header: 40px;
|
--main-layout-header: 40px;
|
||||||
|
--drag-region-height: 22px
|
||||||
}
|
}
|
||||||
|
|
||||||
::selection {
|
::selection {
|
||||||
@ -47,7 +48,7 @@ html, body {
|
|||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: var(--main-layout-header);
|
height: var(--drag-region-height);
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import { ClusterSettings, clusterSettingsRoute } from "../+cluster-settings";
|
|||||||
import { clusterViewRoute, clusterViewURL, getMatchedCluster, getMatchedClusterId } from "./cluster-view.route";
|
import { clusterViewRoute, clusterViewURL, getMatchedCluster, getMatchedClusterId } from "./cluster-view.route";
|
||||||
import { clusterStore } from "../../../common/cluster-store";
|
import { clusterStore } from "../../../common/cluster-store";
|
||||||
import { hasLoadedView, initView, lensViews, refreshViews } from "./lens-views";
|
import { hasLoadedView, initView, lensViews, refreshViews } from "./lens-views";
|
||||||
|
import { isMac } from "../../../common/vars";
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class ClusterManager extends React.Component {
|
export class ClusterManager extends React.Component {
|
||||||
@ -53,21 +54,20 @@ export class ClusterManager extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="ClusterManager">
|
<div className="ClusterManager">
|
||||||
<div id="draggable-top"/>
|
|
||||||
<main>
|
<main>
|
||||||
<div id="lens-views"/>
|
<div id="lens-views" />
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route component={LandingPage} {...landingRoute}/>
|
<Route component={LandingPage} {...landingRoute} />
|
||||||
<Route component={Preferences} {...preferencesRoute}/>
|
<Route component={Preferences} {...preferencesRoute} />
|
||||||
<Route component={Workspaces} {...workspacesRoute}/>
|
<Route component={Workspaces} {...workspacesRoute} />
|
||||||
<Route component={AddCluster} {...addClusterRoute}/>
|
<Route component={AddCluster} {...addClusterRoute} />
|
||||||
<Route component={ClusterView} {...clusterViewRoute}/>
|
<Route component={ClusterView} {...clusterViewRoute} />
|
||||||
<Route component={ClusterSettings} {...clusterSettingsRoute}/>
|
<Route component={ClusterSettings} {...clusterSettingsRoute} />
|
||||||
<Redirect exact to={this.startUrl}/>
|
<Redirect exact to={this.startUrl} />
|
||||||
</Switch>
|
</Switch>
|
||||||
</main>
|
</main>
|
||||||
<ClustersMenu/>
|
<ClustersMenu />
|
||||||
<BottomBar/>
|
<BottomBar />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user