-
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.
Button indicates pipeline registration error
- Loading branch information
1 parent
114718e
commit fb0539a
Showing
3 changed files
with
24 additions
and
40 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
36 changes: 19 additions & 17 deletions
36
ui/src/pages/overview/processing-services/processing-services-actions.tsx
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 |
---|---|---|
@@ -1,32 +1,34 @@ | ||
import { usePopulateProcessingService } from 'data-services/hooks/processing-services/usePopulateProcessingService' | ||
import { ProcessingService } from 'data-services/models/processing-service' | ||
import { Button, ButtonTheme } from 'design-system/components/button/button' | ||
import { useState } from 'react' | ||
import { IconType } from 'design-system/components/icon/icon' | ||
import { Tooltip } from 'design-system/components/tooltip/tooltip' | ||
import { STRING, translate } from 'utils/language' | ||
|
||
export const PopulateProcessingService = ({ | ||
processingService, | ||
}: { | ||
processingService: ProcessingService | ||
}) => { | ||
const [timestamp, setTimestamp] = useState<string>() | ||
const { populateProcessingService: populateProcessingService, isLoading } = | ||
const { populateProcessingService, isLoading, error } = | ||
usePopulateProcessingService() | ||
|
||
// TODO: It would be better to inspect task status here, but we currently don't have this information. | ||
const isPopulating = | ||
isLoading || timestamp === processingService.updatedAtDetailed | ||
|
||
return ( | ||
<Button | ||
label={translate(STRING.REGISTER_PIPELINES)} | ||
loading={isPopulating} | ||
disabled={isPopulating} | ||
theme={ButtonTheme.Success} | ||
onClick={() => { | ||
populateProcessingService(processingService.id) | ||
setTimestamp(processingService.updatedAtDetailed) | ||
}} | ||
/> | ||
<Tooltip | ||
content={ | ||
error | ||
? 'Could not register the pipelines, please check the endpoint URL.' | ||
: undefined | ||
} | ||
> | ||
<Button | ||
disabled={isLoading} | ||
label={translate(STRING.REGISTER_PIPELINES)} | ||
icon={error ? IconType.Error : undefined} | ||
loading={isLoading} | ||
onClick={() => populateProcessingService(processingService.id)} | ||
theme={error ? ButtonTheme.Error : ButtonTheme.Success} | ||
/> | ||
</Tooltip> | ||
) | ||
} |
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