Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features/add update date #33

Merged
merged 9 commits into from
Sep 4, 2019
12 changes: 12 additions & 0 deletions cogboard-webapp/src/components/LastUpdate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import {Typography} from "@material-ui/core";

const LastUpdate = ({ lastUpdateTime }) => {
return (
<Typography align='left' color='textSecondary' variant='caption' gutterBottom={false}>
Last update: {lastUpdateTime}
</Typography>
);
};

export default LastUpdate;
7 changes: 7 additions & 0 deletions cogboard-webapp/src/components/Widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import AppDialog from './AppDialog';
import EditWidget from './EditWidget';
import MoreMenu from './MoreMenu';
import WidgetContent from './WidgetContent';
import LastUpdate from "./LastUpdate";
import widgetTypes from "./widgets";

const mapStatusToColor = (status, theme) => theme.palette.status[status];

Expand Down Expand Up @@ -103,6 +105,8 @@ const Widget = ({ id, index }) => {
closeMenu();
};

const showUpdateTime = widgetTypes[type] ? widgetTypes[type].showUpdateTime : false;

return (
<>
<StyledCard
Expand Down Expand Up @@ -137,6 +141,9 @@ const Widget = ({ id, index }) => {
<StyledCardContent>
{!disabled ? <WidgetContent type={type} content={content} /> : 'Disabled'}
</StyledCardContent>
{showUpdateTime && <CardContent>
<LastUpdate lastUpdateTime={new Date().toLocaleString()} />
</CardContent>}
</StyledCard>
<AppDialog
handleDialogClose={handleDialogClose}
Expand Down
2 changes: 1 addition & 1 deletion cogboard-webapp/src/components/styled/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const StyledFieldset = styled(FormControl)`
min-width: 300px;
`;

export const StyledIFrame = (props) => <IFrameEmbed {...props} frameBorder={0} allowFullScreen/>;
export const StyledIFrame = (props) => <IFrameEmbed {...props} frameBorder={0} allowFullScreen height="100%"/>;

export const StyledFormControlForDropdown = styled(FormControl)`
display: flex;
Expand Down
15 changes: 10 additions & 5 deletions cogboard-webapp/src/components/widgets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,32 @@ const widgetTypes = {
ExampleWidget: {
name: 'Example widget',
component: ExampleWidget,
dialogFields: ['SchedulePeriod']
dialogFields: ['SchedulePeriod'],
showUpdateTime : true
},
JenkinsJobWidget: {
name: 'Jenkins Job widget',
component: JenkinsJobWidget,
dialogFields: ['EndpointField', 'SchedulePeriod', 'Path']
dialogFields: ['EndpointField', 'SchedulePeriod', 'Path'],
showUpdateTime : true
},
SonarQubeWidget: {
name: 'SonarQube widget',
component: SonarQubeWidget,
dialogFields: ['EndpointField', 'SchedulePeriod', 'Key', 'IdNumber', 'SonarQubeMetricsInput']
dialogFields: ['EndpointField', 'SchedulePeriod', 'Key', 'IdNumber', 'SonarQubeMetricsInput'],
showUpdateTime : true
},
ServiceCheckWidget: {
name: 'Service Check widget',
component: ServiceCheckWidget,
dialogFields: ['SchedulePeriod', 'URL', 'StatusCode']
dialogFields: ['SchedulePeriod', 'URL', 'StatusCode'],
showUpdateTime : true
},
BambooPlanWidget: {
name: 'Bamboo Plan widget',
component: BambooPlanWidget,
dialogFields: ['EndpointField', 'SchedulePeriod', 'IdString']
dialogFields: ['EndpointField', 'SchedulePeriod', 'IdString'],
showUpdateTime : true
},
WorldClockWidget: {
name: 'World Clock widget',
Expand Down