-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from performant-software/feature/iiif78_resour…
…ce_status IIIF #78 - Resource Status
- Loading branch information
Showing
17 changed files
with
464 additions
and
21 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,19 @@ | ||
module Cantaloupe | ||
class Api | ||
|
||
def clear_cache(key) | ||
auth = { | ||
username: ENV['CANTALOUPE_API_USERNAME'], | ||
password: ENV['CANTALOUPE_API_PASSWORD'] | ||
} | ||
|
||
body = { | ||
verb: 'PurgeItemFromCache', | ||
identifier: key | ||
} | ||
|
||
HTTParty.post("#{ENV['IIIF_HOST']}/tasks", body: body.to_json, basic_auth: auth) | ||
end | ||
|
||
end | ||
end |
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,80 @@ | ||
// @flow | ||
|
||
import cx from 'classnames'; | ||
import React, { type ComponentType } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { Icon, Image, List } from 'semantic-ui-react'; | ||
import FileUtils from '../utils/File'; | ||
import styles from './AttachmentDetails.module.css'; | ||
|
||
type Props = { | ||
attachment?: { | ||
byte_size: number, | ||
content_type: string, | ||
key: string, | ||
} | ||
}; | ||
|
||
const AttachmentDetails: ComponentType<any> = (props: Props) => { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<div | ||
className={styles.attachmentDetails} | ||
> | ||
{ !props.attachment && ( | ||
<span> | ||
{ t('AttachmentDetails.messages.noContent') } | ||
</span> | ||
)} | ||
{ props.attachment && ( | ||
<List | ||
className={cx(styles.ui, styles.list, styles.horizontal)} | ||
horizontal | ||
> | ||
<List.Item | ||
content={props.attachment?.key} | ||
header={t('AttachmentDetails.labels.key')} | ||
image={( | ||
<Image> | ||
<Icon | ||
circular | ||
name='aws' | ||
size='large' | ||
/> | ||
</Image> | ||
)} | ||
/> | ||
<List.Item | ||
content={FileUtils.getFileSize(props.attachment?.byte_size)} | ||
header={t('AttachmentDetails.labels.fileSize')} | ||
image={( | ||
<Image> | ||
<Icon | ||
circular | ||
name='file alternate' | ||
size='large' | ||
/> | ||
</Image> | ||
)} | ||
/> | ||
<List.Item | ||
content={props.attachment?.content_type} | ||
header={t('AttachmentDetails.labels.type')} | ||
image={( | ||
<Image> | ||
<Icon | ||
circular | ||
name='th large' | ||
size='large' | ||
/> | ||
</Image> | ||
)} | ||
/> | ||
</List> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default AttachmentDetails; |
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,9 @@ | ||
.attachmentDetails { | ||
margin-top: 1.5em; | ||
} | ||
|
||
.attachmentDetails > .ui.list.horizontal { | ||
display: flex; | ||
justify-content: space-between; | ||
width: 100%; | ||
} |
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,31 @@ | ||
// @flow | ||
|
||
import React, { type ComponentType } from 'react'; | ||
import { Icon } from 'semantic-ui-react'; | ||
|
||
type Props = { | ||
className?: string, | ||
value: boolean | ||
}; | ||
|
||
const AttachmentStatus: ComponentType<any> = (props: Props) => { | ||
if (props.value) { | ||
return ( | ||
<Icon | ||
className={props.className} | ||
color='green' | ||
name='check circle' | ||
/> | ||
); | ||
} | ||
|
||
return ( | ||
<Icon | ||
className={props.className} | ||
color='red' | ||
name='times circle' | ||
/> | ||
); | ||
}; | ||
|
||
export default AttachmentStatus; |
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
Oops, something went wrong.