-
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.
Present latest job status in collections table and update populate bu…
…tton logic (#657) * feat: add job count to collection table * feat: add status column to collection table * feat: update test deployment data to test related jobs API data * feat: add jobs data to deployment list API endpoint * feat: add job type to nested job status * docs: add notes about custom job verbs & vocabulary * fix: handle edge case in error state component * feat: add some error handling to populate action * style: move populate button next to other action buttons * feat: show job type label on status hover --------- Co-authored-by: Michael Bunsen <[email protected]>
- Loading branch information
Showing
9 changed files
with
159 additions
and
55 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
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 |
---|---|---|
@@ -1,31 +1,31 @@ | ||
import { usePopulateCollection } from 'data-services/hooks/collections/usePopulateCollection' | ||
import { Collection } from 'data-services/models/collection' | ||
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 PopulateCollection = ({ | ||
collection, | ||
}: { | ||
collection: Collection | ||
}) => { | ||
const [timestamp, setTimestamp] = useState<string>() | ||
const { populateCollection, isLoading } = usePopulateCollection() | ||
|
||
// When the collection is updated, we consider the population to be completed. | ||
// TODO: It would be better to inspect task status here, but we currently don't have this information. | ||
const isPopulating = isLoading || timestamp === collection.updatedAtDetailed | ||
const { populateCollection, isLoading, error } = usePopulateCollection() | ||
|
||
return ( | ||
<Button | ||
label={translate(STRING.POPULATE)} | ||
loading={isPopulating} | ||
disabled={isPopulating} | ||
theme={ButtonTheme.Success} | ||
onClick={() => { | ||
populateCollection(collection.id) | ||
setTimestamp(collection.updatedAtDetailed) | ||
}} | ||
/> | ||
<Tooltip | ||
content={ | ||
error ? 'Could not populate the collection, please retry.' : undefined | ||
} | ||
> | ||
<Button | ||
disabled={isLoading} | ||
label={translate(STRING.POPULATE)} | ||
icon={error ? IconType.Error : undefined} | ||
loading={isLoading} | ||
onClick={() => populateCollection(collection.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
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