mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Factor out mode display function
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
ba31a2528b
commit
8c354f029b
@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
import { displayMode } from "../../../../../utils";
|
||||
import { DrawerItem, DrawerTitle } from "../../../../drawer";
|
||||
import type { VolumeVariantComponent } from "../variant-helpers";
|
||||
|
||||
@ -12,7 +13,7 @@ export const Projected: VolumeVariantComponent<"projected"> = (
|
||||
<>
|
||||
{typeof defaultMode === "number" && (
|
||||
<DrawerItem name="Default Mount Mode">
|
||||
{`0o${defaultMode.toString(8)}`}
|
||||
{displayMode(defaultMode)}
|
||||
</DrawerItem>
|
||||
)}
|
||||
<DrawerItem name="Sources">
|
||||
@ -31,7 +32,7 @@ export const Projected: VolumeVariantComponent<"projected"> = (
|
||||
<li key={key}>
|
||||
{`${key}⇢${path}`}
|
||||
{typeof mode === "number" && (
|
||||
` (0o${mode.toString(8)})`
|
||||
` (${displayMode(mode)})`
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
|
||||
11
src/renderer/utils/display-mode.ts
Normal file
11
src/renderer/utils/display-mode.ts
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Format `mode` in octal notation
|
||||
*/
|
||||
export function displayMode(mode: number): string {
|
||||
return `0o${mode.toString(8)}`;
|
||||
}
|
||||
@ -10,6 +10,7 @@ export * from "../../common/event-emitter";
|
||||
export * from "./cssNames";
|
||||
export * from "./cssVar";
|
||||
export * from "./display-booleans";
|
||||
export * from "./display-mode";
|
||||
export * from "./interval";
|
||||
export * from "./isMiddleClick";
|
||||
export * from "./isReactNode";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user