diff --git a/resources/js/app.js b/resources/js/app.js index 3e223e22..a29f4c4c 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -5,7 +5,13 @@ import Routes from './routes'; import VueRouter from 'vue-router'; import VueJsonPretty from 'vue-json-pretty'; -require('bootstrap'); +window.Popper = require('popper.js').default; + +try { + window.$ = window.jQuery = require('jquery'); + + require('bootstrap'); +} catch (e) {} let token = document.head.querySelector('meta[name="csrf-token"]'); @@ -17,8 +23,6 @@ if (token) { Vue.use(VueRouter); -window.Popper = require('popper.js').default; - Vue.prototype.$http = axios.create(); window.Horizon.basePath = '/' + window.Horizon.path; @@ -41,6 +45,14 @@ Vue.component('alert', require('./components/Alert.vue').default); Vue.mixin(Base); +Vue.directive('tooltip', function(el, binding) { + $(el).tooltip({ + title: binding.value, + placement: binding.arg, + trigger: 'hover', + }); +}); + new Vue({ el: '#horizon', diff --git a/resources/js/base.js b/resources/js/base.js index 1539e70d..b0034925 100644 --- a/resources/js/base.js +++ b/resources/js/base.js @@ -45,5 +45,12 @@ export default { readableTimestamp(timestamp) { return this.formatDate(timestamp).format('YYYY-MM-DD HH:mm:ss'); }, + + /** + * Convert to human readable timestamp e.g. "18 minutes". + */ + readableHumanTimestamp(timestamp) { + return this.formatDate(timestamp).fromNow(true); + }, }, }; diff --git a/resources/js/components/Alert.vue b/resources/js/components/Alert.vue index 04889d12..0f95784e 100644 --- a/resources/js/components/Alert.vue +++ b/resources/js/components/Alert.vue @@ -1,6 +1,4 @@ + diff --git a/resources/js/screens/recentJobs/job.vue b/resources/js/screens/recentJobs/job.vue index 958def7b..87f45c31 100644 --- a/resources/js/screens/recentJobs/job.vue +++ b/resources/js/screens/recentJobs/job.vue @@ -1,5 +1,6 @@