Release 6.1.11 (#6397)

* Release 6.1.11

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Add release guide (#6374)

Signed-off-by: Sebastian Malton <sebastian@malton.name>

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix crash when opening pod details (#6376)

Signed-off-by: Sebastian Malton <sebastian@malton.name>

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix ReactiveDuration to update as frequently as necessary (#6375)

- When used in non compact mode (eg KubeObjectMeta's age) the seconds
  can be displayed but previously between 10m and 180m of age, the
  display would only update every minute

Signed-off-by: Sebastian Malton <sebastian@malton.name>

Signed-off-by: Sebastian Malton <sebastian@malton.name>

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton authored and GitHub committed 2022-10-11 11:39:33 -04:00
1 parent a31f773795
commit 11e7a38823
5 files changed
+46 -23

No files matched your search

@@ -18,19 +18,29 @@ export interface ReactiveDurationProps {
compact?: boolean;
}
const everySecond = 1000;
const everyMinute = 60 * 1000;
/**
* This function computes a resonable update
* This function computes a resonable update interval, matching `formatDuration`'s rules on when to display seconds
*/
function computeUpdateInterval(creationTimestampEpoch: number): number {
function computeUpdateInterval(creationTimestampEpoch: number, compact: boolean): number {
const seconds = Math.floor((Date.now() - creationTimestampEpoch) / 1000);
const minutes = Math.floor(seconds / 60);
if (minutes < 10) {
// Update every second
return 1000;
return everySecond;
}
return 60 * 1000;
if (compact) {
return everyMinute;
}
if (minutes < (60 * 3)) {
return everySecond;
}
return everyMinute;
}
export const ReactiveDuration = observer(({ timestamp, compact = true }: ReactiveDurationProps) => {
@@ -42,7 +52,7 @@ export const ReactiveDuration = observer(({ timestamp, compact = true }: Reactiv
return (
<>
{formatDuration(reactiveNow(computeUpdateInterval(timestampSeconds)) - timestampSeconds, compact)}
{formatDuration(reactiveNow(computeUpdateInterval(timestampSeconds, compact)) - timestampSeconds, compact)}
</>
);
});
@@ -62,13 +62,7 @@ const NonInjectedKubeObjectMeta = observer(({
<DrawerItem name="Created" hidden={isHidden("creationTimestamp")}>
<KubeObjectAge object={object} compact={false} />
{" ago "}
{creationTimestamp && (
<>
(
<LocaleDate date={creationTimestamp} />
)
</>
)}
{creationTimestamp && <LocaleDate date={creationTimestamp} />}
</DrawerItem>
<DrawerItem name="Name" hidden={isHidden("name")}>
{getName()}
+9 -9
View File
@@ -69,10 +69,10 @@ export class Menu extends React.Component<MenuProps, State> {
super(props);
autoBind(this);
}
public opener: HTMLElement | null = null;
public elem: HTMLUListElement | null = null;
private opener: HTMLElement | null = null;
private elem: HTMLUListElement | null = null;
protected items: { [index: number]: MenuItem } = {};
public state: State = {};
state: State = {};
get isOpen() {
return !!this.props.isOpen;
@@ -88,15 +88,15 @@ export class Menu extends React.Component<MenuProps, State> {
htmlFor,
toggleEvent,
} = this.props;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const elem = this.elem!;
if (!usePortal) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const parent = elem.parentElement!;
const position = window.getComputedStyle(parent).position;
if (this.elem?.parentElement) {
const { position } = window.getComputedStyle(this.elem.parentElement);
if (position === "static") parent.style.position = "relative";
if (position === "static") {
this.elem.parentElement.style.position = "relative";
}
}
} else if (this.isOpen) {
this.refreshPosition();
}