@raidou/pi-notify 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -30,10 +30,16 @@ const COLUMNS: Column[] = [
|
|
|
30
30
|
name: 'STATE',
|
|
31
31
|
width: 20,
|
|
32
32
|
render: (session, theme, width) => {
|
|
33
|
-
const
|
|
33
|
+
const isDashboard = session.pid === process.pid
|
|
34
|
+
const label = isDashboard ? 'dashboard' : session.state
|
|
35
|
+
const color = isDashboard
|
|
36
|
+
? 'syntaxKeyword'
|
|
37
|
+
: session.state === 'running'
|
|
38
|
+
? 'success'
|
|
39
|
+
: 'muted'
|
|
34
40
|
return theme.fg(
|
|
35
41
|
color,
|
|
36
|
-
truncateToWidth(
|
|
42
|
+
truncateToWidth(label, width, '…', true).padEnd(width),
|
|
37
43
|
)
|
|
38
44
|
},
|
|
39
45
|
},
|
|
@@ -122,6 +122,42 @@ describe('hidden column toggle', () => {
|
|
|
122
122
|
})
|
|
123
123
|
})
|
|
124
124
|
|
|
125
|
+
describe('dashboard state display', () => {
|
|
126
|
+
it('renders dashboard as state for the current process pid', () => {
|
|
127
|
+
const dashboard = makeDashboard([
|
|
128
|
+
makeSession({ pid: process.pid, state: 'idle' }),
|
|
129
|
+
])
|
|
130
|
+
try {
|
|
131
|
+
const row = dashboard
|
|
132
|
+
.render(200)
|
|
133
|
+
.map(stripAnsi)
|
|
134
|
+
.find((l) => l.includes('abc123'))
|
|
135
|
+
expect(row).toBeDefined()
|
|
136
|
+
expect(row).toContain('dashboard')
|
|
137
|
+
expect(row).not.toContain('idle')
|
|
138
|
+
} finally {
|
|
139
|
+
dashboard.dispose()
|
|
140
|
+
}
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
it('keeps real state for other pids', () => {
|
|
144
|
+
const dashboard = makeDashboard([
|
|
145
|
+
makeSession({ pid: 999, state: 'running' }),
|
|
146
|
+
])
|
|
147
|
+
try {
|
|
148
|
+
const row = dashboard
|
|
149
|
+
.render(200)
|
|
150
|
+
.map(stripAnsi)
|
|
151
|
+
.find((l) => l.includes('abc123'))
|
|
152
|
+
expect(row).toBeDefined()
|
|
153
|
+
expect(row).toContain('running')
|
|
154
|
+
expect(row).not.toContain('dashboard')
|
|
155
|
+
} finally {
|
|
156
|
+
dashboard.dispose()
|
|
157
|
+
}
|
|
158
|
+
})
|
|
159
|
+
})
|
|
160
|
+
|
|
125
161
|
describe('auto-refresh', () => {
|
|
126
162
|
it('manual r triggers refresh', () => {
|
|
127
163
|
const onRefresh = vi.fn(async () => [makeSession({})])
|