Skip to content

Commit

Permalink
wip: tidying
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Oct 9, 2023
1 parent 9974c57 commit fcc4836
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import { MappingsExt } from '@sofie-automation/corelib/dist/dataModel/Studio'
import { DBShowStyleBase, SourceLayers } from '@sofie-automation/corelib/dist/dataModel/ShowStyleBase'
import { SelectConfigPreset } from './SelectConfigPreset'
import { SelectBlueprint } from './SelectBlueprint'
import { ShowStyleBaseId } from '@sofie-automation/corelib/dist/dataModel/Ids'
import { PubSub } from '../../../../../lib/api/pubsub'
import { useSubscription, useTracker } from '../../../../lib/ReactMeteorData/ReactMeteorData'
import { UIBlueprintUpgradeStatuses } from '../../../Collections'
import { getUpgradeStatusMessage, UpgradeStatusButtons } from '../../Upgrades/Components'

interface ShowStyleBaseBlueprintConfigurationSettingsProps {
showStyleBase: DBShowStyleBase
Expand Down Expand Up @@ -46,6 +51,8 @@ export function ShowStyleBaseBlueprintConfigurationSettings(
<SelectBlueprint showStyleBase={props.showStyleBase} />
<SelectConfigPreset showStyleBase={props.showStyleBase} />

<BlueprintUpgradeStatus showStyleBaseId={props.showStyleBase._id} />

<BlueprintConfigSchemaSettings
schema={props.schema}
translationNamespaces={translationNamespaces}
Expand All @@ -58,3 +65,31 @@ export function ShowStyleBaseBlueprintConfigurationSettings(
</>
)
}

interface BlueprintUpgradeStatusProps {
showStyleBaseId: ShowStyleBaseId
}

function BlueprintUpgradeStatus({ showStyleBaseId }: BlueprintUpgradeStatusProps): JSX.Element {
const { t } = useTranslation()

const isReady = useSubscription(PubSub.uiBlueprintUpgradeStatuses)

const status = useTracker(
() =>
UIBlueprintUpgradeStatuses.findOne({
documentId: showStyleBaseId,
documentType: 'showStyle',
}),
[showStyleBaseId]
)

const statusMessage = isReady && status ? getUpgradeStatusMessage(t, status) ?? t('OK') : t('Loading...')

return (
<p>
{t('Upgrade Status')}: {statusMessage}
{status && <UpgradeStatusButtons upgradeResult={status} />}
</p>
)
}
1 change: 0 additions & 1 deletion meteor/server/migration/upgrades/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from './showStyleBase'
export * from './studio'
export * from '../../systemStatus/blueprintUpgradeStatus'
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
import {
getSchemaUIField,
IShowStyleConfigPreset,
IStudioConfigPreset,
ITranslatableMessage,
JSONBlob,
JSONBlobParse,
JSONSchema,
SchemaFormUIField,
} from '@sofie-automation/blueprints-integration'
import { BlueprintHash } from '@sofie-automation/corelib/dist/dataModel/Blueprint'
import { BlueprintId } from '@sofie-automation/corelib/dist/dataModel/Ids'
import { DBShowStyleBase } from '@sofie-automation/corelib/dist/dataModel/ShowStyleBase'
import { DBStudio } from '@sofie-automation/corelib/dist/dataModel/Studio'
import { joinObjectPathFragments, objectPathGet, stringifyError } from '@sofie-automation/corelib/dist/lib'
import { joinObjectPathFragments, objectPathGet } from '@sofie-automation/corelib/dist/lib'
import { applyAndValidateOverrides } from '@sofie-automation/corelib/dist/settings/objectWithOverrides'
import { generateTranslation } from '../../../lib/lib'
import { logger } from '../../logging'
import { ShowStyleBaseFields, StudioFields } from './reactiveContentCache'
import _ from 'underscore'
import { UIBlueprintUpgradeStatusBase } from '../../../lib/api/upgradeStatus'
import { stringifyError } from '@sofie-automation/shared-lib/dist/lib/stringifyError'

export interface BlueprintMapEntry {
_id: BlueprintId
Expand Down Expand Up @@ -141,7 +144,7 @@ function diffJsonSchemaObjects(
generateTranslation(
'Config value "{{ name }}" has changed. From "{{ oldValue }}", to "{{ newValue }}"',
{
name: propSchema['ui:title'] || propPath,
name: getSchemaUIField(propSchema, SchemaFormUIField.Title) || propPath,

Check warning on line 147 in meteor/server/publications/blueprintUpgradeStatus/checkStatus.ts

View check run for this annotation

Codecov / codecov/patch

meteor/server/publications/blueprintUpgradeStatus/checkStatus.ts#L147

Added line #L147 was not covered by tests
// Future: this is not pretty when it is an object
oldValue: JSON.stringify(valueA) ?? '',
newValue: JSON.stringify(valueB) ?? '',
Expand Down
2 changes: 1 addition & 1 deletion meteor/server/systemStatus/systemStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ import { resolveCredentials, Credentials } from '../security/lib/credentials'
import { SystemReadAccess } from '../security/system'
import { StatusCode } from '@sofie-automation/blueprints-integration'
import { PeripheralDevices, Workers, WorkerThreadStatuses } from '../collections'
import { getUpgradeSystemStatusMessages } from '../migration/upgrades'
import { PeripheralDeviceId, StudioId } from '@sofie-automation/corelib/dist/dataModel/Ids'
import { ServerPeripheralDeviceAPI } from '../api/peripheralDevice'
import { PeripheralDeviceContentWriteAccess } from '../security/peripheralDevice'
import { MethodContext } from '../../lib/api/methods'
import { getBlueprintVersions } from './blueprintVersions'
import { getUpgradeSystemStatusMessages } from './blueprintUpgradeStatus'

const PackageInfo = require('../../package.json')
const integrationVersionRange = parseCoreIntegrationCompatabilityRange(PackageInfo.version)
Expand Down

0 comments on commit fcc4836

Please sign in to comment.