Skip to content

Commit

Permalink
[STTNHUB-340] ui: New STTCoverageVersion preview field (#29)
Browse files Browse the repository at this point in the history
* [STTNHUB-340] ui: New STTCoverageVersion preview field

* Rename STTCoverageVersionPreviewField to STTCoverageVersionField
  • Loading branch information
MarkLark86 authored May 6, 2024
1 parent f45587c commit fe12029
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 3 deletions.
2 changes: 0 additions & 2 deletions client/app.js

This file was deleted.

4 changes: 4 additions & 0 deletions client/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import {exposed} from 'newsroom-core';
import {STTCoverageVersionField} from './stt/STTCoverageVersionField';

exposed.agenda.registerCoverageFieldComponent('sttversion', STTCoverageVersionField);
24 changes: 24 additions & 0 deletions client/stt/STTCoverageVersionField.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import * as React from 'react';

import {ICoverageMetadataPreviewProps} from 'newsroom-core/assets/interfaces';
import {exposed} from 'newsroom-core';

export function STTCoverageVersionField({coverage, fullCoverage}: ICoverageMetadataPreviewProps) {
const {gettext} = exposed.locale;

if (fullCoverage == null) {
console.warn(`Unable to find the full coverage for ${coverage.coverage_id}`);
return null;
}

const sttVersion = (fullCoverage.planning?.subjects || []).filter(
(subject) => subject.scheme === 'sttversion'
);

return sttVersion.length === 0 ? null : (
<div className="coverage-item__row align-items-center">
<span className="coverage-item__text-label me-1">{gettext('Version')}:</span>
<span>{sttVersion[0].name}</span>
</div>
);
}
6 changes: 6 additions & 0 deletions client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "newsroom-core/tsconfig",
"include": [
"."
],
}
34 changes: 33 additions & 1 deletion server/data/ui_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
},
{
"_id": "agenda",
"init_version": 3,
"init_version": 4,
"subnav": {
"filters": [
"item_type",
Expand All @@ -109,6 +109,38 @@
"contacts": {
"displayed": false
}
},
"preview": {
"coverage_metadata_fields": [
"coverage_header",
"sttversion",
"coverage_expected_date",
"coverage_provider",
"coverage_wire_text",
"coverage_update_coming",
"coverage_status",
"coverage_scheduled_status",
"coverage_ednote",
"coverage_workflow_reason",
"coverage_internal_note",
"coverage_actions"
]
},
"details": {
"coverage_metadata_fields": [
"coverage_header",
"sttversion",
"coverage_expected_date",
"coverage_provider",
"coverage_wire_text",
"coverage_update_coming",
"coverage_status",
"coverage_scheduled_status",
"coverage_ednote",
"coverage_workflow_reason",
"coverage_internal_note",
"coverage_actions"
]
}
}
]
2 changes: 2 additions & 0 deletions server/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,5 @@
})

CONTENTAPI_ELASTICSEARCH_SETTINGS["settings"]["analysis"]["analyzer"]["html_field_analyzer"]["filter"] = ["lowercase"]

AGENDA_HIDE_COVERAGE_ASSIGNEES = True

0 comments on commit fe12029

Please sign in to comment.