Skip to content

Commit

Permalink
wip: show blueprint 'upgrade' buttons in blueprint config page
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Oct 9, 2023
1 parent bac5f8a commit 9974c57
Show file tree
Hide file tree
Showing 5 changed files with 294 additions and 222 deletions.
2 changes: 1 addition & 1 deletion meteor/client/ui/Settings/Migration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import * as _ from 'underscore'
import { EditAttribute, EditAttributeBase } from '../../lib/EditAttribute'
import { MeteorCall } from '../../../lib/api/methods'
import { checkForOldDataAndCleanUp } from './SystemManagement'
import { UpgradesView } from './Upgrades'
import { stringifyError } from '@sofie-automation/shared-lib/dist/lib/stringifyError'
import { UpgradesView } from './Upgrades/View'

interface IProps {}
interface IState {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useCallback, useMemo } from 'react'
import { useTracker } from '../../../../lib/ReactMeteorData/react-meteor-data'
import { useSubscription, useTracker } from '../../../../lib/ReactMeteorData/react-meteor-data'
import { BlueprintManifestType } from '@sofie-automation/blueprints-integration'
import { BlueprintConfigSchemaSettings } from '../../BlueprintConfigSchema'
import {
Expand All @@ -12,6 +12,10 @@ import { useTranslation } from 'react-i18next'
import { DBStudio } from '@sofie-automation/corelib/dist/dataModel/Studio'
import { SelectConfigPreset } from './SelectConfigPreset'
import { SelectBlueprint } from './SelectBlueprint'
import { StudioId } from '@sofie-automation/corelib/dist/dataModel/Ids'
import { PubSub } from '../../../../../lib/api/pubsub'
import { UIBlueprintUpgradeStatuses } from '../../../Collections'
import { getUpgradeStatusMessage, UpgradeStatusButtons } from '../../Upgrades/Components'

interface StudioBlueprintConfigurationSettingsProps {
studio: DBStudio
Expand Down Expand Up @@ -58,6 +62,8 @@ export function StudioBlueprintConfigurationSettings(props: StudioBlueprintConfi
<SelectBlueprint studio={props.studio} />
<SelectConfigPreset studio={props.studio} blueprint={blueprint} />

<BlueprintUpgradeStatus studioId={props.studio._id} />

<BlueprintConfigSchemaSettings
schema={configSchema}
translationNamespaces={translationNamespaces}
Expand All @@ -69,3 +75,31 @@ export function StudioBlueprintConfigurationSettings(props: StudioBlueprintConfi
</>
)
}

interface BlueprintUpgradeStatusProps {
studioId: StudioId
}

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

const isReady = useSubscription(PubSub.uiBlueprintUpgradeStatuses)

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

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

return (
<p>
{t('Upgrade Status')}: {statusMessage}
{status && <UpgradeStatusButtons upgradeResult={status} />}
</p>
)
}
220 changes: 0 additions & 220 deletions meteor/client/ui/Settings/Upgrades.tsx

This file was deleted.

Loading

0 comments on commit 9974c57

Please sign in to comment.