Changing DOM based on Google Calendar resource availablity - javascript

Thanks for any help that you provide in advance! I've been learning to code for the last year, and I'm actively building my first app.
I'm using: - Front End: HTML, CSS, Bootstrap (with MDBootstrap add-on), jQuery - Back End: Node.JS (with Express, Passport, Cookie-session) and MongoDB
My question I believe is relatively simple, but I just haven't been able to piece together what I need to build to realise my vision for this app. Although the front end is more complex, the fundamental functionality of this app is to authenticate users (using Google Sign-in) and then display either RED or GREEN based on a shared Google Calendar's event data.
On the Back End, I'm authenticating users then pulling their Google profile data. Authenticating using Google gives me access to an AccessToken and a RefreshToken. Everything up to this point is fine and seems to work well (at least for a first attempt).
Anyway, the problem is getting access to the private (shared between colleagues) Calendar Event data on the Front End so I can set up logic to choose what is displayed to the user. I can't seem to be able to make an API call because I need the Access Token/Refresh Token on the Front End and I can't see how I can pass that data through. I assume that because the code for the API call is on the Front End, this might not be the best way to go about this?
I'm partial to stripping down the app and starting again, but I don't know if what I've built so far is already on the right path, or if I need to follow a different path altogether? Really all I'm looking for is a guidance on a structure/path that I should follow to get this done as I'm lacking a lot of direction at the moment.
I'd really appreciate anyones help here.
Thanks all

Related

Overall flow of a simple script that uses Whoop and Google Sheets API?

I have a spreadsheet I manually fill out every day where I fill in sleep data recorded by my Whoop strap. As a fun project I thought I'd make this automatic and take advantage of the developer tools for Whoop and Google Sheets. Should be noted that I have experience in scientific computing (Matlab and Julia), but absolutely zero web dev experience.
I tried following the instructions in this link which goes through setting up the HTTP request to get sleep data. However, in order to get that to work, I first need to get an access token, so I tried following this tutorial which goes over authentication. I think I know what each of these is doing, but I'm struggling to put it into context of how the overall script will look. Should I just put all those bits of code into a single .js file and just run that? I see terms such as "middleware stack", "routing layer" and "server-side frameowrks" Are these relevant to the presumably simple script I'm trying to implement?
The perfect answer would be directions to any tutorials/books/articles/videos where someone implemented a similar idea just so I get a better idea of how it should all look.
Thanks in advance!

Is it possible to use Google Places Autocomplete Service in a managed Expo app?

I've been scouring the web and I've found several posts that almost seem to address my issue, but none that I've found seem to get it quite right. I'm developing an app in Expo using the managed workflow, and all I want is a simple input component that will suggest/autocomplete names of cities/towns as the user types. The Google Places API has their Place Autocomplete, and the AutocompleteServices class seems to be a way to handle this without a prebuild UI component (as their components expect basic HTML elements).
The trouble is: The only way to import this library seems to be with a <script> tag, and it's my understanding (please current my if I'm wrong because I am comploetely new to mobile development), that you can't simply put an HTML script tag on a "page" in React Native/Expo.
I've been looking into solutions via NPM packages, but the best solution I've found - "react-native-google-places-autocomplete" - uses the Autocomplete query request instead of the basic request. The problem here is that the query form of the request doesn't allow you to filter by place type. (I need to list only cities/towns, which can only be done with the bbasic Autocomplete request, as far as I can tell).
So, basically, all I want is access to the library so I can build what I need myself, but every instruction I've found for importing it assumes you can use a <script> tag in an HTML document.
I thought what I wanted to do was simple, but apparently not? Is there something I'm overlooking (i.e. no one has mentioned it because it's so simple)? Should I just go use GeoDB instead? (I'd really like to use Google Maps if possible, as the app will need more complex location-based functionality later down the road).
Any tips would be greatly appreciated!

Creating a note taking app using JQuery mobile and phone gap

I have an app i'm developing with JQ Mobile and PhoneGap. Within this app, i want to include a 'Notes Taking' page and it has to do the following.
Make new notes and save them locally.
Recall them whenever i need to,
Edit them and delete them
i could not find a good example to follow, i tried this:
http://tutorialzine.com/2012/09/simple-note-taking-app-ajax/
but he lost me at the index php and how to implement that, i also tried this example:
http://miamicoder.com/2011/building-a-jquery-mobile-application-part-1/
but its so complex i got lost in all the code.
I'm a beginner at programming and my JavaScript is very very poor and i have no idea where to start and what kind of code is involved in making this part of the app.
Please help. Thank you.
Your first site (http://tutorialzine.com/2012/09/simple-note-taking-app-ajax/) will not work for you as the examples are embedding PHP into the html and that is not acceptable with phonegap apps.
Your second site is making it way more complicated than it needs to be for your limited scope.
Not going to do this for you but I will give you some advice and places to look.
Draw out what you want the user interface to look like and create that html
Create a load and save function in javascript to... well... load and save your notes. Take a look at the below references:
This will show you how to interact with the local database and store and retrieve info. Always a good thing to read the documentation.
This is a great resource for help all sorts of stuff. In this case, with SQL queries.
Test, test, test. With the above, you will be able to figure it out if you put your mind to it. Come back here and post specific questions with code samples of what you have tried if you get stuck.

Capture all opportunity fields & send to PHP script

I am building an app that lets our sales team (who uses Salesforce) export to a new Evernote note with one click. I have the Evernote functionality already available in a PHP script I wrote, and I was planning on using Javascript to make an XHR to that script, but that is irrelevant at this point.
What I need to be able to do is capture all of the fields in the currently-open opportunity and upon clicking my custom button / link, capture all those fields as a javascript variable that I can then POST to my PHP app. Even a simple example of how I could go about capturing one field would be great -- I can't seem to find anything in the SalesForce documentation that covers this.
What you need here is an Apex callout. This doc on developer.force.com covers it OK, it's a starting point anyway (although it doesn't show you how to query for the fields of Opportunity -- you'll find that in the regular Apex docs under SOQL). For some sample code you might look at the Force.com Toolkit for Google APIs, which uses callouts pretty extensively (although you may need to wade through it a bit to find the relevant parts).
In any case, if you start by searching the docs on Apex callouts, that will probably get you rolling in the right direction.
Another method of doing this, incidentally, would be to wire up a custom button with the AJAX toolkit to compose the body of the post, and then post it and have your PHP page redirect the user back to where he started. That could work too, although my first inclination would be to do it in Apex instead.
Do they really have to click a button? What if meeting some condition would work?
I'm asking because Workflow rules (which are usually good for field updates, creation of Tasks or sending emails) have option to send out a SOAP message. It'd be a somewhat bloated XML but on the plus side - no coding needed, pure configuration. Plus - their delivery status can be tracked easily.
Check the help and at the very least you now have the keyword to Google for ;) Topic on consuming them on salesforce.stackexchange.com might also be useful.
If it has to be under a button - you probably could do with making a fake update of some helper field... Maybe even "count of messages sent"?

Unable to see complete scraped web page in Google Apps Script logs

A few weeks ago I started learning Javascript and the Google Apps Script API, specifically in regard to spreadsheets. I have been trying to make a spreadsheet that fetches web pages and pulls stats about my friends for the game League of Legends. However, I have been running into a problem with the site I want to use, which is basically the only free LoL stats site that updates frequently. I'm not familiar at all with web development, but it seems when I try to access a page on lolking.net, for example http://www.lolking.net/summoner/na/60783 with Google's UrlFetchApp.fetch() it does not load the dynamic page. So instead of the final source, I get this which doesn't help me. Is there an easy way around this or would I simply have to use another website?
Thanks for thie info! Although it turns out I was mistaken. The UrlFetchApp was indeed returning the full source code, but I was using GAS's Logger to view the text. It seems the Logger has a length limit, so when I searched for the stats I wanted they weren't there simply because the source code got truncated. So, due to an oversight on my part, I never had a problem in the first place. For other people reading this question, in the end I have no idea how UrlFetchApp works with dynamic pages using clientside js (you'd probably want to talk to the poster below or post a new question).
You are getting fhe raw html page with clientside js included. That wont work from any system not just gas. You need to debug that page js and find where it does an ajax call to get the data you want.
Then do the same from your gas. Might not work if the call is authenticated etc.

Categories

Resources