-
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.
IIIF #82 - Adding SystemStatus widget to dashboard
- Loading branch information
1 parent
9b47055
commit db882af
Showing
10 changed files
with
334 additions
and
37 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,28 @@ | ||
// @flow | ||
|
||
import React, { type ComponentType } from 'react'; | ||
import styles from './AttributeView.module.css'; | ||
|
||
type Props = { | ||
label: string, | ||
value: string | ||
}; | ||
|
||
const AttributeView: ComponentType<any> = (props: Props) => ( | ||
<div | ||
className={styles.gridItem} | ||
> | ||
<div | ||
className={styles.label} | ||
> | ||
{ props.label } | ||
</div> | ||
<div | ||
className={styles.value} | ||
> | ||
{ props.value } | ||
</div> | ||
</div> | ||
); | ||
|
||
export default AttributeView; |
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,8 @@ | ||
.gridItem .label { | ||
color: rgba(0, 0, 0, .6); | ||
padding-top: 0.25em; | ||
} | ||
|
||
.gridItem .value { | ||
font-weight: bold; | ||
} |
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,45 @@ | ||
// @flow | ||
|
||
import React, { type ComponentType } from 'react'; | ||
import { Icon } from 'semantic-ui-react'; | ||
|
||
type Props = { | ||
className?: string, | ||
status: 'positive' | 'warning' | 'negative' | ||
}; | ||
|
||
const StatusIcon: ComponentType<any> = (props: Props) => { | ||
if (props.status === 'positive') { | ||
return ( | ||
<Icon | ||
className={props.className} | ||
color='green' | ||
name='check circle' | ||
/> | ||
); | ||
} | ||
|
||
if (props.status === 'warning') { | ||
return ( | ||
<Icon | ||
className={props.className} | ||
color='yellow' | ||
name='warning circle' | ||
/> | ||
); | ||
} | ||
|
||
if (props.status === 'negative') { | ||
return ( | ||
<Icon | ||
className={props.className} | ||
color='red' | ||
name='times circle' | ||
/> | ||
); | ||
} | ||
|
||
return null; | ||
}; | ||
|
||
export default StatusIcon; |
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,95 @@ | ||
// @flow | ||
|
||
import { BaseService } from '@performant-software/shared-components'; | ||
|
||
/** | ||
* Class responsible for handling all dashboard API requests. | ||
*/ | ||
class Dashboard extends BaseService { | ||
/** | ||
* Not implemented. | ||
* | ||
* @param args | ||
* | ||
* @returns {Promise<*>} | ||
*/ | ||
create(...args: any): Promise<any> { | ||
return Promise.reject(args); | ||
} | ||
|
||
/** | ||
* Not implemented. | ||
* | ||
* @param args | ||
* | ||
* @returns {Promise<*>} | ||
*/ | ||
delete(...args: any): Promise<any> { | ||
return Promise.reject(args); | ||
} | ||
|
||
/** | ||
* Not implemented. | ||
* | ||
* @param args | ||
* | ||
* @returns {Promise<*>} | ||
*/ | ||
fetchAll(...args: any): Promise<any> { | ||
return Promise.reject(args); | ||
} | ||
|
||
/** | ||
* Not implemented. | ||
* | ||
* @param args | ||
* | ||
* @returns {Promise<*>} | ||
*/ | ||
fetchOne(...args: any): Promise<any> { | ||
return Promise.reject(args); | ||
} | ||
|
||
/** | ||
* Returns the dashboard base URL. | ||
* | ||
* @returns {string} | ||
*/ | ||
getBaseUrl(): string { | ||
return '/api/dashboard'; | ||
} | ||
|
||
/** | ||
* Not implemented. | ||
* | ||
* @param args | ||
* | ||
* @returns {Promise<*>} | ||
*/ | ||
save(...args: any): Promise<any> { | ||
return Promise.reject(args); | ||
} | ||
|
||
/** | ||
* Calls the `/api/dashboard/status` API endpoint. | ||
* | ||
* @returns {*} | ||
*/ | ||
status(): Promise<any> { | ||
return this.getAxios().get(`${this.getBaseUrl()}/status`, null, this.getConfig()); | ||
} | ||
|
||
/** | ||
* Not implemented. | ||
* | ||
* @param args | ||
* | ||
* @returns {Promise<*>} | ||
*/ | ||
update(...args: any): Promise<any> { | ||
return Promise.reject(args); | ||
} | ||
} | ||
|
||
const DashboardService: Dashboard = new Dashboard(); | ||
export default DashboardService; |
Oops, something went wrong.