-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinfos.ts
More file actions
70 lines (67 loc) · 2.05 KB
/
infos.ts
File metadata and controls
70 lines (67 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import type { ServiceInfos } from '@cpn-console/hooks'
import { readFileSync } from 'node:fs'
import { join } from 'node:path'
import { compressUUID, ENABLED } from '@cpn-console/shared'
import { getConfig } from './utils.js'
const imageData = Buffer.from((readFileSync(join(import.meta.dirname, '../files/logo.png'))).toString('base64'))
const infos = {
name: 'observability',
// @ts-ignore retro compatibility
to: ({ project, projectId, organization }) => {
let isInfV9 = false
const params = {
id: '',
slug: '',
}
const grafanaUrl = getConfig().grafanaUrl
if (typeof project === 'string' && typeof organization === 'string') {
params.id = projectId
params.slug = `${organization}-${project}`
isInfV9 = true
} else {
params.id = project.id
params.slug = project.slug
}
return [
{
to: `${grafanaUrl}/prod-${compressUUID(String(params.id))}`,
title: isInfV9 ? 'Production' : undefined,
description: 'Production',
},
{
to: `${grafanaUrl}/prod-${params.slug}`,
title: isInfV9 ? 'Production ancien' : undefined,
description: 'Production ancien',
},
{
to: `${grafanaUrl}/hprod-${compressUUID(String(params.id))}`,
title: isInfV9 ? 'Hors production' : undefined,
description: 'Hors production',
},
{
to: `${grafanaUrl}/hprod-${params.slug}`,
title: isInfV9 ? 'Hors production ancien' : undefined,
description: 'Hors production ancien',
},
]
},
title: 'Grafana',
imgSrc: `data:image/png;base64,${imageData}`,
description: 'Grafana est un outil de métrique et de logs',
config: {
global: [{
kind: 'switch',
key: 'enabled',
initialValue: ENABLED,
permissions: {
admin: { read: true, write: true },
user: { read: true, write: false },
},
title: 'Activer le plugin',
value: ENABLED,
description: 'Activer le plugin',
}],
project: [],
},
} as const satisfies ServiceInfos
export default infos