Put commit hash and build time on admin page

This commit is contained in:
2017-02-17 12:15:37 +00:00
parent a880a5f2bc
commit a5ea6dc035
4 changed files with 45 additions and 0 deletions

View File

@@ -22,6 +22,10 @@ class Admin extends React.Component {
name: PropTypes.string,
total: PropTypes.integer,
})).isRequired,
build: PropTypes.shape({
hash: PropTypes.string,
time: PropTypes.string,
}),
};
render() {
@@ -50,6 +54,12 @@ class Admin extends React.Component {
))}
</ul>
</div>
<div>
Build hash: <a href={`https://bitbucket.org/dan_head/wedding/commits/${this.props.build.hash}`}>{this.props.build.hash}</a>
</div>
<div>
Build time: {this.props.build.time}
</div>
</div>
</div>
);

View File

@@ -1,6 +1,7 @@
import React from 'react';
import Layout from '../../components/Layout';
import fetchQL from '../../core/fetchQL';
import fetch from '../../core/fetch';
import { starters, mains } from '../../config';
const title = 'Admin';
@@ -11,7 +12,14 @@ export default {
async action() {
const resp = await fetchQL('{getAllPersons{key,firstname,lastname,email,password,completed,starter,main}}');
const configResp = await fetch('/config.json', {
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
});
const { data } = await resp.json();
const config = await configResp.json();
const people = data.getAllPersons || [];
const food = {
@@ -37,6 +45,7 @@ export default {
people={people}
starters={food.starters}
mains={food.mains}
build={config.build}
/></Layout>,
};
},