Skip to content

Commit

Permalink
Update favicon while query running (#7)
Browse files Browse the repository at this point in the history
Bug: T316307
  • Loading branch information
vivian-rook authored Sep 20, 2022
1 parent 180ab04 commit ea7a4a2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Binary file added quarry/web/static/img/favicon-running.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions quarry/web/static/js/query/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ $( function () {
} );

$( '#stop-code' ).click( function () {
// revert favicon to default color
var favicon = document.querySelector("link[rel='icon']");
favicon.href = '/static/img/favicon.png';

$.post( '/api/query/stop', {
query_database: $( '#query-db' ).val(),
qrun_id: vars.qrun_id
Expand All @@ -193,6 +197,10 @@ $( function () {
} );

$( '#run-code' ).click( function () {
// update favicon to running color
var favicon = document.querySelector("link[rel='icon']");
favicon.href = '/static/img/favicon-running.png';

$.post( '/api/query/run', {
text: editor !== null ? editor.getValue() : $( '#code' ).val(),
query_database: $( '#query-db' ).val(),
Expand Down Expand Up @@ -242,6 +250,10 @@ $( function () {
let title = $( '#title' ).val() ? '"' + $( '#title' ).val() + '"' : 'Untitled query #' + vars.query_id;
sendNotification( title + ' execution has been completed' );
}

// revert favicon to default color
var favicon = document.querySelector("link[rel='icon']");
favicon.href = '/static/img/favicon.png';
} else if ( data.status === 'queued' || data.status === 'running' ) {
window.lastStatusCheck = setTimeout( function () {
checkStatus( qrun_id, false );
Expand Down

0 comments on commit ea7a4a2

Please sign in to comment.