Skip to content

Commit 24e236f

Browse files
chore: Add displayName (#26)
1 parent b230e64 commit 24e236f

10 files changed

Lines changed: 39 additions & 17 deletions

File tree

extensions/apex-fusion/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
nameOverride: ""
22
fullnameOverride: ""
3+
displayName: ""
34

45
image:
56
repository: ghcr.io/blinklabs-io/cardano-node

extensions/cardano-node/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
nameOverride: ""
22
fullnameOverride: ""
3+
displayName: ""
34

45
image:
56
repository: ghcr.io/blinklabs-io/cardano-node

extensions/dolos/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
nameOverride: ""
22
fullnameOverride: ""
3+
displayName: ""
34

45
image:
56
repository: ghcr.io/txpipe/dolos

extensions/hydra-node/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
nameOverride: ""
22
fullnameOverride: ""
3+
displayName: ""
34

45
image:
56
repository: ghcr.io/input-output-hk/hydra-node

extensions/midnight/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
nameOverride: ""
22
fullnameOverride: ""
3+
displayName: ""
34

45
image:
56
repository: midnightnetwork/midnight-node

frontends/dashboard/src/utils/helm-install/dolos.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Utils
2-
import { runCommand } from '~/utils/process';
2+
import { runCommand, shellEscape } from '~/utils/process';
33

44
export async function install(namespace: string, name: string, image: string, version: string) {
55
await runCommand(`
6-
helm install ${name} ${image} \
7-
--namespace ${namespace} \
8-
--version "${version}" \
6+
helm install ${shellEscape(name)} ${shellEscape(image)} \
7+
--namespace ${shellEscape(namespace)} \
8+
--version ${shellEscape(version)} \
99
--set image.tag=v0.32.0 \
1010
--set extraLabels.supernode/status=ready \
1111
--set config.upstreamAddress=relay.cnode-m1.demeter.run:3002 \
Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
import { runCommand } from '~/utils/process';
1+
import { runCommand, shellEscape } from '~/utils/process';
22

33
// Installs
44
import { install as midnightInstall } from '~/utils/helm-install/midnight';
55
import { install as dolosInstall } from '~/utils/helm-install/dolos';
66

7-
export async function runInstall(repo: string, namespace: string, name: string, image: string, version: string) {
7+
export async function runInstall(
8+
repo: string,
9+
namespace: string,
10+
name: string,
11+
image: string,
12+
version: string,
13+
) {
814
if (repo.includes('midnight')) {
915
return midnightInstall(namespace, name, image, version);
1016
}
@@ -14,9 +20,9 @@ export async function runInstall(repo: string, namespace: string, name: string,
1420
}
1521

1622
return runCommand(`
17-
helm install ${name} ${image} \
18-
--namespace ${namespace} \
19-
--version "${version}" \
23+
helm install ${shellEscape(name)} ${shellEscape(image)} \
24+
--namespace ${shellEscape(namespace)} \
25+
--version ${shellEscape(version)} \
2026
--set extraLabels.supernode/status=ready
2127
`.trim());
2228
}

frontends/dashboard/src/utils/helm-install/midnight.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { randomBytes } from 'crypto';
22

33
// Utils
44
import { getClients } from '~/utils/k8s';
5-
import { runCommand } from '~/utils/process';
5+
import { runCommand, shellEscape } from '~/utils/process';
66

77
export async function install(namespace: string, name: string, image: string, version: string) {
88
const { core } = getClients();
@@ -24,9 +24,9 @@ export async function install(namespace: string, name: string, image: string, ve
2424
});
2525

2626
await runCommand(`
27-
helm install ${name} ${image} \
28-
--namespace ${namespace} \
29-
--version "${version}" \
27+
helm install ${shellEscape(name)} ${shellEscape(image)} \
28+
--namespace ${shellEscape(namespace)} \
29+
--version ${shellEscape(version)} \
3030
--set nodeKey.existingSecret.name=${secretName} \
3131
--set nodeKey.existingSecret.key=node.key \
3232
--set persistence.size=5Gi \

frontends/dashboard/src/utils/home/calls.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,20 @@ import { nanoid } from '~/utils/generic';
1515
import { runInstall } from '~/utils/helm-install';
1616

1717
function getAnnotationsFromRelease(release: DecodedHelmRelease): SupernodeAnnotations | undefined {
18-
if (!release.chart.metadata.annotations) {
18+
const annotations = release.chart.metadata.annotations;
19+
20+
const customDisplayName = typeof release.config?.displayName === 'string'
21+
? release.config.displayName.trim()
22+
: '';
23+
24+
if (!annotations && !customDisplayName) {
1925
return undefined;
2026
}
2127

2228
return {
23-
displayName: release.chart.metadata.annotations['displayName'] || release.name,
24-
icon: release.chart.metadata.annotations['icon'],
25-
category: release.chart.metadata.annotations['category'],
29+
displayName: customDisplayName || annotations?.['displayName'] || release.name,
30+
icon: annotations?.['icon'] || '',
31+
category: annotations?.['category'],
2632
network: getNetworkFromHelmRelease(release),
2733
};
2834
}

frontends/dashboard/src/utils/process.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import childProcess from 'child_process';
44
const exec = promisify(childProcess.exec);
55
const DEFAULT_TIMEOUT = 30000; // 30 seconds
66

7+
export function shellEscape(value: string): string {
8+
const quote = '\'';
9+
return quote + value.replace(/'/g, `${quote}\\${quote}${quote}`) + quote;
10+
}
11+
712
export async function runCommand(command: string): Promise<string> {
813
const { stdout, stderr } = await exec(command, { timeout: DEFAULT_TIMEOUT });
914

0 commit comments

Comments
 (0)