-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: updating label name and input-slot will both be saved in db and used when starting prod * fix: source-card checks for production-source-label instead of inventory-source-label * fix: lint-error and review-comment * fix: thumbnails show on locked screen
- Loading branch information
Showing
5 changed files
with
129 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { useState } from 'react'; | ||
import { CallbackHook } from './types'; | ||
import { Production } from '../interfaces/production'; | ||
import { ResourcesCompactPipelineResponse } from '../../types/ateliere-live'; | ||
|
||
export function useCheckProductionPipelinesAndControlPanels(): CallbackHook< | ||
( | ||
production: Production, | ||
pipelines: ResourcesCompactPipelineResponse[] | undefined | ||
) => Production | ||
> { | ||
const [loading, setLoading] = useState(false); | ||
|
||
const checkProductionPipelinesAndControlPanels = ( | ||
production: Production, | ||
pipelines: ResourcesCompactPipelineResponse[] | undefined | ||
) => { | ||
if (!production.production_settings) return production; | ||
const productionPipelines = production.production_settings.pipelines; | ||
|
||
const activePipelinesForProduction = pipelines?.filter((pipeline) => | ||
productionPipelines.some( | ||
(productionPipeline) => | ||
productionPipeline.pipeline_name === pipeline.name | ||
) | ||
); | ||
const availablePipelines = productionPipelines.map((productionPipeline) => { | ||
const activePipeForProduction = activePipelinesForProduction?.find( | ||
(p) => p.name === productionPipeline.pipeline_name | ||
); | ||
if (activePipeForProduction?.streams.length === 0) { | ||
return productionPipeline; | ||
} | ||
return productionPipeline; | ||
}); | ||
|
||
return { | ||
...production, | ||
production_settings: { | ||
...production.production_settings, | ||
pipelines: availablePipelines | ||
} | ||
}; | ||
}; | ||
return [checkProductionPipelinesAndControlPanels, loading]; | ||
} |
Oops, something went wrong.