Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Add an offset for epoch #163

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/components/dashboard/job_last_10.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@ import _ from 'lodash';
import JobsStoreHEC from '../../jobs/hec'
import moment from 'moment';
import gen_path from '../../path_utils';
import store from '../../store';


class JobGroupItem extends React.Component {
render() {
let job_id = this.props.job_id;
let job = this.props.job;
let link = `/job_result/${job_id}`;
let settings = store.get('settings')
return (
<li key={job_id} className="list-group-item">
<span className="badge">{moment.unix(job.StartTime).fromNow()}</span>
<span className="badge">{moment.unix(job.StartTime - settings.OFFSET).fromNow()}</span>
<i className="fa fa-calendar" /> <Link to={gen_path(link)}>[{job_id}] {job.Function} on "{job.Target}"</Link>
</li>
)
Expand Down
4 changes: 3 additions & 1 deletion app/components/job_history.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {ReactBootstrapTableStyle} from '../../node_modules/react-bootstrap-table
import moment from 'moment';
import { Link } from 'react-router';
import gen_path from '../path_utils';
import store from '../store';

class JobHistory extends React.Component {
render() {
Expand All @@ -19,7 +20,8 @@ class JobHistory extends React.Component {
}

function DateFormatter(job_start_time, job){
return moment.unix(job_start_time).calendar();
let settings = store.get('settings')
return moment.unix(job_start_time - settings.OFFSET).calendar();
}

function JidOutputLink(jid, job){
Expand Down
4 changes: 3 additions & 1 deletion app/components/notification.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import {SessionHEC} from '../hec/session';
import {SingleJobStoreHEC} from '../jobs/hec';
import {If} from './shared/templates';
import gen_path from '../path_utils';
import store from '../store';

class JobRunNotification extends React.Component {
render() {

const job = this.props.job;
let MinionsNumber = _.size(job.Minions);
let ResultNumber = _.size(job.Result);
let settings = store.get('settings')

var className = "fa fa-clock-o";

Expand All @@ -29,7 +31,7 @@ class JobRunNotification extends React.Component {
</span>
</div>
<div className="details">
<p><muted>{moment.unix(this.props.job.StartTime).fromNow()}</muted><br/>
<p><muted>{moment.unix(this.props.job.StartTime - settings.OFFSET).fromNow()}</muted><br/>
<Link to={gen_path(`/job_result/${this.props.job.jid}`)}>{this.props.job.Function} on {this.props.job.Target}</Link><br/>
<i className="fa fa-users"> {ResultNumber}/{MinionsNumber}</i><br/>
{this.props.job.jid}<br/>
Expand Down
1 change: 1 addition & 0 deletions settings.json.sample
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"API_URL": "localhost:5417", # The API URL
"SECURE_HTTP": false, # Is the API protected by HTTPS?
"OFFSET": 0, # This is the offset in epoch(seconds)
"templates": { # Templates sample
"basic": { # Template name
"description": "Basic template", # Template description
Expand Down