Skip to content
Merged
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
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"highlight.js": "^10.4.1",
"jquery": "^3.5.0",
"laravel-mix": "^6.0.13",
"lodash": "^4.17.19",
"md5": "^2.2.1",
"moment": "^2.29.4",
"moment-timezone": "^0.5.35",
Expand Down
2 changes: 1 addition & 1 deletion public/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"/app.js": "/app.js?id=766b568d1924aa83b2a1f279d2c5ab9e",
"/app.js": "/app.js?id=11fdcdd352319325cdc6732793bdae1d",
"/app-dark.css": "/app-dark.css?id=15c72df05e2b1147fa3e4b0670cfb435",
"/app.css": "/app.css?id=4d6a1a7fe095eedc2cb2a4ce822ea8a5",
"/img/favicon.png": "/img/favicon.png?id=1542bfe8a0010dcbee710da13cce367f",
Expand Down
20 changes: 20 additions & 0 deletions resources/js/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,25 @@ export default {
readableTimestamp(timestamp) {
return this.formatDate(timestamp).format('YYYY-MM-DD HH:mm:ss');
},

/**
* Uppercase the first character of the string.
*/
upperFirst(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
},

/**
* Group array entries by a given key.
*/
groupBy(array, key) {
return array.reduce((grouped, entry) => ({
...grouped,
[entry[key]]: [
...(grouped[entry[key]] || []),
entry,
],
}), {});
},
},
};
2 changes: 1 addition & 1 deletion resources/js/components/LineChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
display: true
},
beforeBuildTicks: function (scale) {
var max = _.max(scale.chart.data.datasets[0].data);
var max = scale.chart.data.datasets[0].data.reduce((max, value) => value > max ? value : max)

scale.max = parseFloat(max) + parseFloat(max * 0.25);
},
Expand Down
4 changes: 1 addition & 3 deletions resources/js/components/Stacktrace.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script type="text/ecmascript-6">
import _take from "lodash/take"

export default {
props: ['trace'],

Expand All @@ -16,7 +14,7 @@

computed: {
lines() {
return this.showAll ? _take(this.trace, 1000) : _take(this.trace, this.minimumLines);
return this.trace.slice(0, this.showAll ? 1000 : this.minimumLines);
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions resources/js/screens/batches/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@
return;
}


if (!this.$root.autoLoadsNewEntries && refreshing && this.batches.length && _.first(response.data.batches).id !== _.first(this.batches).id) {
if (!this.$root.autoLoadsNewEntries && refreshing && this.batches.length && response.data.batches[0]?.id !== this.batches[0]?.id) {
this.hasNewEntries = true;
} else {
this.batches = response.data.batches;
Expand Down Expand Up @@ -111,10 +110,10 @@
* Load the batches for the next page.
*/
next() {
this.previousFirstId = _.first(this.batches).id + '0';
this.previousFirstId = this.batches[0]?.id + '0';

this.loadBatches(
_.last(this.batches).id
this.batches.slice(-1)[0]?.id
);

this.page += 1;
Expand Down
11 changes: 5 additions & 6 deletions resources/js/screens/dashboard.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script type="text/ecmascript-6">
import _ from 'lodash';
import moment from 'moment';

export default {
Expand Down Expand Up @@ -68,9 +67,9 @@
.then(response => {
this.stats = response.data;

if (_.values(response.data.wait)[0]) {
this.stats.max_wait_time = _.values(response.data.wait)[0];
this.stats.max_wait_queue = _.keys(response.data.wait)[0].split(':')[1];
if (Object.values(response.data.wait)[0]) {
this.stats.max_wait_time = Object.values(response.data.wait)[0];
this.stats.max_wait_queue = Object.keys(response.data.wait)[0].split(':')[1];
}
});
},
Expand Down Expand Up @@ -120,15 +119,15 @@
* Count processes for the given supervisor.
*/
countProcesses(processes) {
return _.chain(processes).values().sum().value().toLocaleString()
return Object.values(processes).reduce((total, value) => total + value, 0).toLocaleString();
},


/**
* Format the Supervisor display name.
*/
superVisorDisplayName(supervisor, worker) {
return _.replace(supervisor, worker + ':', '');
return supervisor.replace(worker + ':', '');
},


Expand Down
13 changes: 6 additions & 7 deletions resources/js/screens/failedJobs/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@
return;
}


if (!this.$root.autoLoadsNewEntries && refreshing && this.jobs.length && _.first(response.data.jobs).id !== _.first(this.jobs).id) {
if (!this.$root.autoLoadsNewEntries && refreshing && this.jobs.length && response.data.jobs[0]?.id !== this.jobs[0]?.id) {
this.hasNewEntries = true;
} else {
this.jobs = response.data.jobs;
Expand Down Expand Up @@ -112,10 +111,10 @@
this.$http.post(Horizon.basePath + '/api/jobs/retry/' + id)
.then((response) => {
setTimeout(() => {
this.retryingJobs = _.reject(this.retryingJobs, job => job == id);
this.retryingJobs = this.retryingJobs.filter(job => job != id);
}, 5000);
}).catch(error => {
this.retryingJobs = _.reject(this.retryingJobs, job => job == id);
this.retryingJobs = this.retryingJobs.filter(job => job != id);
});
},

Expand All @@ -124,15 +123,15 @@
* Determine if the given job is currently retrying.
*/
isRetrying(id) {
return _.includes(this.retryingJobs, id);
return this.retryingJobs.includes(id);
},


/**
* Determine if the given job has completed.
*/
hasCompleted(job) {
return _.find(job.retried_by, retry => retry.status == 'completed');
return job.retried_by.find(retry => retry.status === 'completed');
},


Expand All @@ -157,7 +156,7 @@
retriedJobTooltip(job) {
let lastRetry = job.retried_by[job.retried_by.length - 1];

return `Total retries: ${job.retried_by.length}, Last retry status: ${_.upperFirst(lastRetry.status)}`;
return `Total retries: ${job.retried_by.length}, Last retry status: ${this.upperFirst(lastRetry.status)}`;
},

/**
Expand Down
15 changes: 0 additions & 15 deletions resources/js/screens/failedJobs/job.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,6 @@
},


/**
* Convert exception to a more readable format.
*/
prettyPrintException(exception) {
var lines = _.split(exception, "\n"),
output = '';

lines.forEach(line => {
output += '<span>' + line + '</span>';
});

return output;
},


/**
* Pretty print serialized job.
*
Expand Down
29 changes: 10 additions & 19 deletions resources/js/screens/metrics/preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,14 @@
* Prepare the response data for charts.
*/
prepareData(data) {
return _.chain(data)
.map(value => {
value.time = this.formatDate(value.time).format("MMM-D hh:mmA");

return value;
})
.groupBy(value => value.time)
.map(value => {
return _.reduce(value, (sum, value) => {
return {
runtime: parseFloat(sum.runtime) + parseFloat(value.runtime),
throughput: parseInt(sum.throughput) + parseInt(value.throughput),
time: value.time
};
})
})
.value();
return Object.values(this.groupBy(data.map(value => ({
...value,
time: this.formatDate(value.time).format("MMM-D hh:mmA"),
})), 'time')).map(value => value.reduce((sum, value) => ({
runtime: parseFloat(sum.runtime) + parseFloat(value.runtime),
throughput: parseInt(sum.throughput) + parseInt(value.throughput),
time: value.time
})))
},


Expand All @@ -80,11 +71,11 @@
*/
buildChartData(data, attribute, label) {
return {
labels: _.map(data, 'time'),
labels: data.map(entry => entry.time),
datasets: [
{
label: label,
data: _.map(data, attribute),
data: data.map(entry => entry[attribute]),
lineTension: 0,
backgroundColor: 'transparent',
pointBackgroundColor: '#fff',
Expand Down
2 changes: 1 addition & 1 deletion resources/js/screens/monitoring/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
stopMonitoring(tag) {
this.$http.delete(Horizon.basePath + '/api/monitoring/' + encodeURIComponent(tag))
.then(() => {
this.tags = _.reject(this.tags, existing => existing.tag == tag)
this.tags = this.tags.filter(existing => existing.tag !== tag)
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion resources/js/screens/monitoring/tag-jobs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@

this.$http.get(Horizon.basePath + '/api/monitoring/' + encodeURIComponent(tag) + '?starting_at=' + starting + '&limit=' + this.perPage)
.then(response => {
if (!this.$root.autoLoadsNewEntries && refreshing && this.jobs.length && _.first(response.data.jobs).id !== _.first(this.jobs).id) {
if (!this.$root.autoLoadsNewEntries && refreshing && this.jobs.length && response.data.jobs[0]?.id !== this.jobs[0]?.id) {
this.hasNewEntries = true;
} else {
this.jobs = response.data.jobs;
Expand Down
2 changes: 1 addition & 1 deletion resources/js/screens/recentJobs/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@

this.$http.get(Horizon.basePath + '/api/jobs/' + this.$route.params.type + '?starting_at=' + starting + '&limit=' + this.perPage)
.then(response => {
if (!this.$root.autoLoadsNewEntries && refreshing && this.jobs.length && _.first(response.data.jobs).id !== _.first(this.jobs).id) {
if (!this.$root.autoLoadsNewEntries && refreshing && this.jobs.length && response.data.jobs[0]?.id !== this.jobs[0]?.id) {
this.hasNewEntries = true;
} else {
this.jobs = response.data.jobs;
Expand Down