return query;
}
+// Helper function to determine if the upload button should be shown on the sidebar
+function backblazeCredentialsExist() {
+ return {
+ 'BACKBLAZE_ID': BACKBLAZE_ID ? true : false,
+ 'BACKBLAZE_KEY': BACKBLAZE_KEY ? true : false
+ }
+}
+
// Helper function which will be called from the client-side dialog
function uploadToBackblaze(byteArray) {
// b2_authorize_account
<p id="generate-notification"></p>
<a id="download-link"></a>
- <button id="upload-button" disabled>Upload .sqlite3 file to Backblaze</button>
+ <button id="upload-button" disabled style="display: none;">Upload .sqlite3 file to Backblaze</button>
<span id="upload-spinner" class="inline-spinner"></span>
<p id="upload-notification"></p>
setState('initial');
+ // Only show the upload button if both GAS properties are set
+ google.script.run.withSuccessHandler(exists => {
+ if (exists.BACKBLAZE_ID && exists.BACKBLAZE_KEY) {
+ uploadButton.style.display = '';
+ }
+ }).backblazeCredentialsExist();
+
// Call the server-side generateDatabaseQuery, then create the SQLite database
generateButton.addEventListener('click', () => {
setState('generatingDatabase');