mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix sizing
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
2085383987
commit
a3bf07ab02
@ -2,6 +2,7 @@ import { action, observable, IComputedValue, computed, ObservableMap, runInActio
|
|||||||
import { CatalogEntity, catalogEntityRegistry } from "../../common/catalog";
|
import { CatalogEntity, catalogEntityRegistry } from "../../common/catalog";
|
||||||
import { watch } from "chokidar";
|
import { watch } from "chokidar";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
import fse from "fs-extra";
|
||||||
import * as uuid from "uuid";
|
import * as uuid from "uuid";
|
||||||
import stream from "stream";
|
import stream from "stream";
|
||||||
import { Disposer, ExtendedObservableMap, iter, Singleton } from "../../common/utils";
|
import { Disposer, ExtendedObservableMap, iter, Singleton } from "../../common/utils";
|
||||||
@ -71,16 +72,20 @@ export class KubeconfigSyncManager extends Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
protected startNewSync(filePath: string, port: number): void {
|
protected async startNewSync(filePath: string, port: number): Promise<void> {
|
||||||
if (this.sources.has(filePath)) {
|
if (this.sources.has(filePath)) {
|
||||||
// don't start a new sync if we already have one
|
// don't start a new sync if we already have one
|
||||||
return void logger.debug(`${logPrefix} already syncing file/folder`, { filePath });
|
return void logger.debug(`${logPrefix} already syncing file/folder`, { filePath });
|
||||||
}
|
}
|
||||||
|
|
||||||
this.sources.set(filePath, watchFileChanges(filePath, port));
|
try {
|
||||||
|
this.sources.set(filePath, await watchFileChanges(filePath, port));
|
||||||
|
|
||||||
logger.info(`${logPrefix} starting sync of file/folder`, { filePath });
|
logger.info(`${logPrefix} starting sync of file/folder`, { filePath });
|
||||||
logger.debug(`${logPrefix} ${this.sources.size} files/folders watched`, { files: Array.from(this.sources.keys()) });
|
logger.debug(`${logPrefix} ${this.sources.size} files/folders watched`, { files: Array.from(this.sources.keys()) });
|
||||||
|
} catch (error) {
|
||||||
|
logger.warn(`${logPrefix} failed to start watching changes: ${error}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
@ -213,10 +218,11 @@ function diffChangedConfig(filePath: string, source: RootSource, port: number):
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function watchFileChanges(filePath: string, port: number): [IComputedValue<CatalogEntity[]>, Disposer] {
|
async function watchFileChanges(filePath: string, port: number): Promise<[IComputedValue<CatalogEntity[]>, Disposer]> {
|
||||||
|
const stat = await fse.stat(filePath); // traverses symlinks, is a race condition
|
||||||
const watcher = watch(filePath, {
|
const watcher = watch(filePath, {
|
||||||
followSymlinks: true,
|
followSymlinks: true,
|
||||||
depth: 1, // shallow
|
depth: stat.isDirectory() ? 0 : 1, // DIRs works with 0 but files need 1 (bug: https://github.com/paulmillr/chokidar/issues/1095)
|
||||||
disableGlobbing: true,
|
disableGlobbing: true,
|
||||||
});
|
});
|
||||||
const rootSource = new ExtendedObservableMap<string, ObservableMap<string, RootSourceValue>>(observable.map);
|
const rootSource = new ExtendedObservableMap<string, ObservableMap<string, RootSourceValue>>(observable.map);
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { remote } from "electron";
|
import { remote } from "electron";
|
||||||
import { Avatar, IconButton, List, ListItem, ListItemAvatar, ListItemSecondaryAction, ListItemText, Paper } from "@material-ui/core";
|
import { Avatar, IconButton, List, ListItem, ListItemAvatar, ListItemSecondaryAction, ListItemText, Paper } from "@material-ui/core";
|
||||||
@ -168,7 +166,7 @@ export class KubeconfigSyncs extends React.Component {
|
|||||||
onClick={() => void this.openFileDialog()}
|
onClick={() => void this.openFileDialog()}
|
||||||
/>
|
/>
|
||||||
<div className="hint">
|
<div className="hint">
|
||||||
Sync an individual file or folders (and subfolders to a depth of 1).
|
Sync an individual file or all files in a folder (non-recursive).
|
||||||
</div>
|
</div>
|
||||||
{this.renderEntries()}
|
{this.renderEntries()}
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@ -13,15 +13,19 @@
|
|||||||
|
|
||||||
.MuiAvatar-root {
|
.MuiAvatar-root {
|
||||||
color: var(--buttonPrimaryBackground);
|
color: var(--buttonPrimaryBackground);
|
||||||
|
font-size: calc(2.5 * var(--unit));
|
||||||
}
|
}
|
||||||
|
|
||||||
.description {
|
.description {
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
font-size: inherit;
|
|
||||||
|
.MuiTypography-body1 {
|
||||||
|
font-size: var(--font-size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.action {
|
.action .MuiIconButton-root {
|
||||||
font-size: inherit;
|
font-size: calc(2.5 * var(--unit));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user