Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6.0 html and json #400

Closed
wants to merge 18 commits into from
Closed

6.0 html and json #400

wants to merge 18 commits into from

Conversation

Lonestarjeepin
Copy link
Collaborator

I'm sure you will find ways to run this code more cleanly and likely some things to debug. Nonetheless, I was able to create the html front-end and json storage in this version. Each calendar gets run through the startSync individually so that all of the parameters are calendar-specific. The only variables left in code.gs are the main timer (howFrequnt) and the email variables... I gave up on trying to keep the existing array of arrays so this will have to be a clean break from the old version. One other thing of note is that this is somewhat based on my syncDelay version so all of the fromGAS entries are different than before so each calendar here can write to the same Target Calendar without conflict. I'm thinking it would be a good add to look for the old fromGAS=true and just delete all of those entries. If we don't, there will be duplicates the first time someone runs this code. Lastly, I updated the Installation Instructions for this version, but I'm not entirely sure Test Deployments is the "right" way to launch the index.html page, but it works so I just went with it. It seemed cleaner than messing with Deployments... since each user would have their own deployment anyway. This version also already includes #372 (it was a building block for this code), #392, and #217 so we can close all of those if this gets merged.

@jonas0b1011001
Copy link
Collaborator

since each user would have their own deployment anyway.

From how i understand deployments (i have no experience at all), the best way would be one 'official' deployment.
If i'm not mistaken you can select to run the deployed code 'as the user' which would allow to save and load all settings from the user properties service. I don't know how/if triggers will work with this.
So in theory the user will only need the html ui and never ever see the code or the code editor.

@Lonestarjeepin
Copy link
Collaborator Author

Lonestarjeepin commented Dec 23, 2023 via email

@Lonestarjeepin
Copy link
Collaborator Author

@jonas0b1011001 , try this URL as a "real" web app deployment and see if it works the way you described. I used the settings of "Execute As: User accessing the web app." and "Who has access: Anyone with Google account." https://script.google.com/macros/s/AKfycbw1P6zULjJVgElH6MGF7CPs8_m2nZRxjNC851gM1O32mAO4_-VCZ8CCJK98LDJBV_MHUw/exec Not to say I should host this if it does go live, but thought we could at least give this a try in testing.

Fixing failed check on // comment in styles.html
@jonas0b1011001
Copy link
Collaborator

I can create/edit/delete calendar entries, but i'm missing a way to actually start/schedule a sync.

@Lonestarjeepin
Copy link
Collaborator Author

Lonestarjeepin commented Dec 23, 2023 via email

@Lonestarjeepin
Copy link
Collaborator Author

Lonestarjeepin commented Dec 23, 2023 via email

Updated for Install/Uninstall in index.html and App Settings in appSettings.json
Added install/uninstall and App Settings section.  Fixed bug with "info" icon affecting checkbox nearby.
updated buttons
Updated buttons.
@Lonestarjeepin
Copy link
Collaborator Author

Lonestarjeepin commented Dec 24, 2023

@jonas0b1011001 I updated the html to include Install/Uninstall as well as the rest of the App Settings (separate json file called appSettings.json) so now there are zero settings or actions someone would have to take outside of the html. I updated the same public deployment so you should see the new UI if you use the URL from above.

Not entirely true... I left out startSync. Should that be included?

@jonas0b1011001
Copy link
Collaborator

The WebApp is creating Triggers, however they are 'empty':
Bildschirmfoto 2023-12-24 um 09 43 30

They get triggered but fail instantly.
Bildschirmfoto 2023-12-24 um 09 42 04

I did some testing earlier and got the same result, could not get it to work. Looks like the way i imagined it to work might be a dead end.

@Lonestarjeepin
Copy link
Collaborator Author

Do you think that's strictly a function of the web app being deployed by me instead of on your own profile? In other words, if you deploy straight from the code, do the triggers work for you?

@jonas0b1011001
Copy link
Collaborator

All seems to work normal if i deploy for myself (not matter the 'execute as' settings), can you confirm that the link above does creates working triggers for you?

@Lonestarjeepin
Copy link
Collaborator Author

I just confirmed that link does work for me to create a trigger. So it seems like the single-hosting method might not work... which is unfortunate because it sounded like the preferred method. I also noticed that when I pushed the last commit, my add/edit calendar functionality is now broken. I'll troubleshoot and fix now that I'm back from vacation.

moved webpage functions to Helpers.gs, fixed instructions, cleaned up some logging that was leftover from dev
Moved all website function from code to helpers.  Cleaned up google.script.run functions with error logging.  Fixed other bugs from last commit where screen would go blank after hitting certain buttons.
Cleaned up client-side google.script.run functions.  Fixed buttons that weren't responding correctly.  Added user confirmation dialogs for all actions.  Other debugging.  Also made sourceCalendarName the json key instead of sourceURL.  This gives the ability to have "variants" of each calendar (same ics, different parameters) that can co-exist.
minor updates to support newest index.html
Fixing minor CodeFactor failure.
Fixing minor CodeFactor error.
@Lonestarjeepin
Copy link
Collaborator Author

While this did work "locally", the centrally-hosted html page wouldn't work. Likely direction is to use config.gs (or similar).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants