feat(414): stamp immutable Channel.Origin (auto-tuned vs user-created) and surface it (#575)
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (push) Has been skipped
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (push) Has been skipped
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (push) Successful in 6m23s
Build ErsatzTV Image / Functional E2E (curl contracts) (push) Successful in 14m21s
Build ErsatzTV Image / Build & test (.NET) (push) Successful in 19m9s
Build ErsatzTV Image / Build & push image (amd64) (push) Successful in 12m1s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (push) Has been skipped
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (push) Has been skipped
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (push) Successful in 6m23s
Build ErsatzTV Image / Functional E2E (curl contracts) (push) Successful in 14m21s
Build ErsatzTV Image / Build & test (.NET) (push) Successful in 19m9s
Build ErsatzTV Image / Build & push image (amd64) (push) Successful in 12m1s
Co-authored-by: Timothy <timothy.look@gmail.com> Co-committed-by: Timothy <timothy.look@gmail.com>
This commit was merged in pull request #575.
This commit is contained in:
Vendored
+2
@@ -236,6 +236,7 @@ export interface components {
|
||||
"startUtc": string;
|
||||
"finishUtc": string;
|
||||
};
|
||||
"ChannelOrigin": "Unknown" | "UserCreated" | "AutoTuned";
|
||||
"ChannelPlayoutMode": "Continuous" | "OnDemand";
|
||||
"ChannelPlayoutSource": "Generated" | "Mirror";
|
||||
"ChannelPreviewResponseModel": {
|
||||
@@ -258,6 +259,7 @@ export interface components {
|
||||
"playoutCount": number;
|
||||
"logo": null | string;
|
||||
"preview": components["schemas"]["ChannelPreviewResponseModel"];
|
||||
"origin": components["schemas"]["ChannelOrigin"];
|
||||
};
|
||||
"ChannelSongVideoMode": "Default" | "WithProgress";
|
||||
"ChannelStateResponseModel": {
|
||||
|
||||
@@ -262,6 +262,24 @@ describe('ChannelsScreen — load + render', () => {
|
||||
expect(screen.getByRole('button', { name: 'No playout 0' })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('badges an auto-tuned channel and leaves user-created and legacy rows unmarked', async () => {
|
||||
// origin is immutable creation-provenance: AutoTuned is badged, UserCreated is not, and a legacy
|
||||
// row (origin omitted / 'Unknown') is deliberately left unmarked rather than asserted user-created.
|
||||
mockApi({
|
||||
channels: [
|
||||
channelRow({ id: 1, name: 'Generated One', number: '1', origin: 'AutoTuned' }),
|
||||
channelRow({ id: 2, name: 'Hand Made', number: '2', origin: 'UserCreated' }),
|
||||
channelRow({ id: 3, name: 'Legacy', number: '3', origin: 'Unknown' })
|
||||
]
|
||||
});
|
||||
|
||||
render(<ChannelsScreen />);
|
||||
|
||||
const table = await screen.findByRole('table', { name: 'Channels lineup' });
|
||||
// Exactly one Auto-tuned badge, on the generated row only.
|
||||
expect(within(table).getAllByText('Auto-tuned')).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('polls only channel state after the initial load', async () => {
|
||||
const intervalHandlers: Array<() => void> = [];
|
||||
vi.spyOn(window, 'setInterval').mockImplementation((handler) => {
|
||||
|
||||
@@ -614,6 +614,16 @@ function ChannelTableRow({
|
||||
A tooltip-only glyph would be invisible on touch and easy to miss in a long lineup.
|
||||
*/}
|
||||
{willNeverPlay(channel) && <Badge tone="error">No playout</Badge>}
|
||||
{/*
|
||||
Creation-provenance marker. Rendered only for AutoTuned: its absence means user-created
|
||||
(or a legacy row predating the origin column, which reads as 'Unknown' — we never
|
||||
back-fill provenance, so we don't assert 'user-created' about those).
|
||||
*/}
|
||||
{channel.origin === 'AutoTuned' && (
|
||||
<span title="Created by Auto-Tune from a channel lineup">
|
||||
<Badge tone="neutral">Auto-tuned</Badge>
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
<small>{channel.language || 'Language unset'}</small>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user