Skip to content

Latest commit

 

History

History
4030 lines (2945 loc) · 154 KB

MAN.md

File metadata and controls

4030 lines (2945 loc) · 154 KB

GCC Code Documentation

Classes

GccCollection
GccColor
GccContainer
GccEnv
GccPage
GccRun
GccRunGroup
GccSheet
GccTest
GccUi
GccUiCollection
GccUiCss
GccUiDialog
GccUiLoader
GccUiRun
GccUiRunForm
GccUiSelectDisclosure
GccUiSelectForm

Functions

getIndefiniteArticle(str)string

getIndefiniteArticle

stringToCapitalised(str)string

stringToCapitalised

stringToId(str)string

stringToId

errorMessage(value, types, identifier)

errorMessage

isArray(value)boolean

isArray

isBoolean(value)boolean

isBoolean

isNull(value)boolean

isNull

isNumber(value)boolean

isNumber

isObject(value)boolean

isObject

isString(value)boolean

isString

isString1(value)boolean

isString1

isStringNumber(value)boolean

isStringNumber

validate(value, type, identifier, condition)*

validate

doGet(e)*

doGet

gccMiddleware(classMethod, ...args)*

gccMiddleware

gccSheetHandleEdit(e)*

gccSheetHandleEdit

gccSheetHandleOpen()*

gccSheetHandleOpen

getResultsFromServer()*

GccCollection

Kind: global class
Summary: Properties and methods related to a collection point on a compost run. Instances of GccCollection (backend) are converted to objects and passed to the frontend where they are processed by GccUiCollection (frontend). Note that GccContainer (backend) has no frontend equivalent so its instance object is remapped to properties when it reaches GccUiCollection (frontend).
Access: public

new GccCollection(config)

Param Type Description
config object Module configuration.
config.abbreviations Array Abbreviations and their expansions (used to accessibly expand collection types).
config.address string Street address of collection.
config.collectionMapLocale string Map locale to append to Google Maps lookups.
config.container object Instance of GccContainer.
config.dateFlag string Any special instructions for the collection on a particular collection date (Skip, Drop, etc).
config.dateFlags Array All available date flags.
config.dateValue number | string | boolean Recorded collection amount or status or checkbox state for a particular collection date.
config.name string The name of the customer.
config.notes string General notes about this collection, such as where to find the container or how to contact the customer.
config.runDate string The date of the collection.
config.runName string The name of the parent run.
config.type string The type of customer.

gccCollection.abbreviations : Array

abbreviations

Kind: instance property of GccCollection

gccCollection.address : string

address

Kind: instance property of GccCollection

gccCollection.cancelled : boolean

cancelled

Kind: instance property of GccCollection

gccCollection.collect : boolean

collect

Kind: instance property of GccCollection

gccCollection.container : object

container

Kind: instance property of GccCollection

gccCollection.dateFlag : string

dateFlag

Kind: instance property of GccCollection

gccCollection.dateFlags : Array

dateFlags

Kind: instance property of GccCollection

gccCollection.dateValue : number | string | boolean

dateValue

Kind: instance property of GccCollection

gccCollection.collectionMapLocale : string

collectionMapLocale

Kind: instance property of GccCollection

gccCollection.name : string

name

Kind: instance property of GccCollection

gccCollection.onHold : boolean

onHold

Kind: instance property of GccCollection

gccCollection.notes : string

notes

Kind: instance property of GccCollection

gccCollection.pending : boolean

pending

Kind: instance property of GccCollection

gccCollection.runDate : string

runDate

Kind: instance property of GccCollection

gccCollection.runName : string

runName

Kind: instance property of GccCollection

gccCollection.type : string

type

Kind: instance property of GccCollection

gccCollection.typeDefinition : string

typeDefinition

Kind: instance property of GccCollection

gccCollection.volumesAndDateFlags : Array

volumesAndDateFlags

Kind: instance property of GccCollection

GccCollection.getVolumesAndDateFlags(dateFlags, quantity, type, volumes, format) ⇒ Array | string

getVolumesAndDateFlags

Kind: static method of GccCollection
Summary: Generate a series of human-readable labels/options to display in the volumes/date-flags dropdown.
Returns: Array | string - volumesAndDateFlags (html: Array | spreadsheet: string)

Param Type Description
dateFlags Array All available date flags.
quantity number | string Quantity of containers to collect; can be '' if collection.type === 'X'.
type string Type of container to collect; can be '' if collection.type === 'X'.
volumes Array All available date flags.
format string Format (html or spreadsheet)

GccColor

Kind: global class
Summary: Properties and methods relating to the colours used in the app and spreadsheet.
Access: public
Todo

  • Refactor colour theming to generic primary, secondary, tertiary etc

new GccColor(config)

Param Type Description
config object Module configuration.
config.colorNamedRangeNames Array Named range names (rather than values, as we use the cell colors)

gccColor.colors : Array

colors

Kind: instance property of GccColor

gccColor.instance : GccColor

instance

Kind: instance property of GccColor

gccColor.colorNamedRangeNames : Array

colorNamedRangeNames

Kind: instance property of GccColor

gccColor.getColors() ⇒ Array

getColors

Kind: instance method of GccColor
Summary: Get a structured list of code colours from the GCC Variables sheet.
Returns: Array - Colors

gccColor.getColorStyles() ⇒ string

getColorStyles

Kind: instance method of GccColor
Summary: Create color variables and class attributes using RGBA variations.
Returns: string - styleHtml

GccColor.getInstance(config) ⇒ GccColor

getInstance

Kind: static method of GccColor
Summary: Note: this refers to class instance in prototype methods and class constructor in static methods.
Returns: GccColor - instance of class
See

Param Type Description
config object Config

GccColor.hexToRgb(hex) ⇒ object

hexToRgb

Kind: static method of GccColor
Summary: Convert hexidecimal colour notation to RGB for use with the CSS Custom Properties (variables) system.
Returns: object - rgb
See

Param Type Description
hex string Hexidecimal notation

GccContainer

Kind: global class
Summary: Properties and methods relating to the containers used on a compost run.
Access: public
Todo

  • Resolve duplication of capacities/types/nonVolumes/volumeFractions across instances

new GccContainer(config)

Param Type Description
config object Module configuration.
config.capacities Array All available container capacities.
config.nonVolumes Array All non-volume statuses available in the volume dropdown, e.g. 'No access'
config.quantity number | string Quantity of containers to collect; can be '' if collection.type === 'X'.
config.type string Type of container to collect; can be '' if collection.type === 'X'.
config.types Array All available container types.
config.volumeFractions Array All volume fractions available in the volume dropdown, e.g. '3/4'

gccContainer.capacities : Array

capacities

Kind: instance property of GccContainer

gccContainer.nonVolumes : Array

nonVolumes

Kind: instance property of GccContainer

gccContainer.quantity : number | string

quantity

Kind: instance property of GccContainer

gccContainer.type : string

type

Kind: instance property of GccContainer

gccContainer.types : Array

types

Kind: instance property of GccContainer

gccContainer.volumeFractions : Array

volumeFractions

Kind: instance property of GccContainer

gccContainer.volumes : Array

volumes

Kind: instance property of GccContainer

gccContainer.cacheInstance()

cacheInstance

Kind: instance method of GccContainer
Summary: Cache an instance of GccContainer.
Todo

  • This will repeatedly cache identical content, but on the other hand we do need to be able to update the cache.

gccContainer.fractionToValue(fraction, containerIndex, capacity) ⇒ string

fractionToValue

Kind: instance method of GccContainer
Summary: Convert a fraction into a number (2dp)
Returns: string - value
See: runUnitTests

Param Type Description
fraction string Fraction
containerIndex number Container index
capacity number Container capacity

gccContainer.getCapacity() ⇒ number

getCapacity

Kind: instance method of GccContainer
Summary: Get the capacity of a container.
Returns: number - capacity

gccContainer.getVolumeLabel(containerIndex, fraction, fractionNumber) ⇒ string

getVolumeLabel

Kind: instance method of GccContainer
Summary: Generate a human-readable label/option to display in the volme dropdown. Note: fractions > 1 are filtered out by getVolumes before they reach getVolumeLabel and given a label of 'Overfull' for the 'last' bucket (1st bucket if 1 bucket, 2nd bucket if 2 buckets, etc) otherwise ignored.
Returns: string - containerVolumeLabel
See: runUnitTests

Param Type Description
containerIndex number Container index
fraction string Volume fraction.
fractionNumber number Volume fraction as a number.

gccContainer.getVolumes() ⇒ Array

getVolumes

Kind: instance method of GccContainer
Summary: Generate a series of human-readable labels/options to display in the volume dropdown.
Returns: Array - options
See: runUnitTests
Todo

  • Also cache this with the container

GccContainer.getInstanceFromCache(type, quantity) ⇒ GccContainer | null

getInstanceFromCache

Kind: static method of GccContainer
Summary: Get a cached instance of GccContainer.
Returns: GccContainer | null - Reinstantiated container instance
Todo

  • Consider storing quantities as nested objects so there's just one cache per type
Param Type Description
type string Type of container to collect.
quantity number Quantity of containers to collect.

GccEnv

Kind: global class
Summary: Environment methods.
Access: public

new GccEnv(config)

Param Type Description
config object Module configuration.
config.developerUserEmails Array Email address of developers who manage this project (used to display UI elements and specify recipients for feedback emails).
config.env object Environment settings
config.env.cloudProjectId object Project ID from Google Cloud (used for GCC Help menu item links, see Middleware.js) https://console.cloud.google.com/home/dashboard > Select a project (dropdown menu) > ID (copy)
config.env.containerBoundAppScriptId object Script ID of the container-bound (spreadsheet-linked) project sheets.google.com > (open spreadsheet) > Extensions > Apps Script > Project Settings (cog icon) > Script ID > Copy
config.env.headDeploymentId object Head Deployment ID from the container-bound project sheets.google.com > (open spreadsheet) > Extensions > Apps Script > Deploy > Test deployments > Select type > Web app > Head Deployment ID > Copy
config.env.pubDeploymentId object Deployment ID from the container-bound project sheets.google.com > (open spreadsheet) > Extensions > Apps Script > Deploy > Manage deployments > Initial deployment > Deployment ID > Copy (note: fill this in after created the initial deployment)
config.env.spreadsheetId object SPREADSHEET_ID from the spreadsheet URL: https://docs.google.com/spreadsheets/d/SPREADSHEET_ID/edit#gid=0
config.env.standaloneAppScriptId object Script ID of the standalone (library) project script.google.com > (open standalone project) > Project Settings (cog icon) > Script ID > Copy (note: this also needs to be set in appsscript.json > dependencies > libraries > libraryId)

gccEnv.containerBoundAppScriptId : string

containerBoundAppScriptId

Kind: instance property of GccEnv

gccEnv.developerUserEmails : Array

developerUserEmails

Kind: instance property of GccEnv

gccEnv.env : object

env

Kind: instance property of GccEnv
Summary: Object containing environment properties, set by getEnv();

gccEnv.headDeploymentId : string

headDeploymentId

Kind: instance property of GccEnv

gccEnv.instance : GccEnv

instance

Kind: instance property of GccEnv

gccEnv.pubDeploymentId : string

pubDeploymentId

Kind: instance property of GccEnv

gccEnv.spreadsheetId : string

spreadsheetId

Kind: instance property of GccEnv

gccEnv.standaloneAppScriptId : string

standaloneAppScriptId

Kind: instance property of GccEnv

gccEnv.getEnv() ⇒ object

getEnv

Kind: instance method of GccEnv
Summary: Get environment variables.
Returns: object - env

gccEnv.isDev() ⇒ boolean

isDev

Kind: instance method of GccEnv
Summary: Determine whether the app is displaying the DEV build.
Returns: boolean - isDev

gccEnv.isDeveloper() ⇒ boolean

isDeveloper

Kind: instance method of GccEnv
Summary: Test whether the current user is a developer.
Returns: boolean - isDeveloper

gccEnv.isStable() ⇒ boolean

isStable

Kind: instance method of GccEnv
Summary: Is the app displaying the STABLE build
Returns: boolean - isStable

GccEnv.getInstance(config) ⇒ GccEnv

getInstance

Kind: static method of GccEnv
Summary: Note: this refers to class instance in prototype methods and class constructor in static methods.
Returns: GccEnv - instance of class
See

Param Type Description
config object Config

GccPage

Kind: global class
Summary: Properties and methods relating to the HTML templating.
Access: public
Todo

  • Use this style of config.namedRangeValues documentation in other classes.

new GccPage(config)

Param Type Description
config object Module configuration.
config.appName string App name (used in the feedback email).
config.debug boolean Output debugging messages.
config.developerUserEmails Array Email address of developers who manage this project (used to display UI elements and specify recipients for feedback emails).
config.extraCollectionsLabel string Label for the optional pre/post run checkbox.
config.feedbackEmailBody string Message body for the feedback email.
config.helpLinks string Help links (used by Quick Start guide link and help dialog links; note that spreadsheet and Feedback links are appended in code; Quick Start guide link must come first.)
config.imageFavicon string Image displayed when the page is bookmarked.
config.imageLogo string Image displayed at the bottom of the page and in the background
config.namedRangeValues Array Values of the various named ranges.
config.namedRangeValues.runGroups Array Information about each group of runs.
config.organisationName string Used in web browser page title.
config.pageTemplate string HTML template file.
config.pageTitle string Web browser page title.

gccPage.appName : string

appName

Kind: instance property of GccPage

gccPage.config : object

config

Kind: instance property of GccPage

gccPage.debug : boolean

debug

Kind: instance property of GccPage

gccPage.developerUserEmails : Array

developerUserEmails

Kind: instance property of GccPage

gccPage.extraCollectionsLabel : string

extraCollectionsLabel

Kind: instance property of GccPage

gccPage.feedbackEmailBody : string

feedbackEmailBody

Kind: instance property of GccPage

gccPage.helpLinks : Array

helpLinks

Kind: instance property of GccPage

gccPage.imageFavicon : string

imageFavicon

Kind: instance property of GccPage

gccPage.imageLogo : string

imageLogo

Kind: instance property of GccPage

gccPage.instance : GccPage

instance

Kind: instance property of GccPage

gccPage.organisationName : string

organisationName

Kind: instance property of GccPage

gccPage.pageTemplate : string

pageTemplate

Kind: instance property of GccPage

gccPage.pageTitle : string

pageTitle

Kind: instance property of GccPage

gccPage.runGroups : object

runGroups

Kind: instance property of GccPage

gccPage.addMetaTags(tpl) ⇒ object

addMetaTags

Kind: instance method of GccPage
Summary: The app runs within a nested iframe. Add meta tags to the parent page.
Returns: object - tpl - HtmlTemplate object
See

Param Type Description
tpl object HtmlTemplate object

gccPage.createHtmlTemplate() ⇒ object

createHtmlTemplate

Kind: instance method of GccPage
Summary: Generates an HtmlTemplate object from the HTML file and the supplied template variables
Returns: object - page Page
See

gccPage.createUnitTestHtmlTemplate() ⇒ object

createUnitTestHtmlTemplate

Kind: instance method of GccPage
Summary: Generates an HtmlTemplate object from the HTML file
Returns: object - page Page

gccPage.getHelpLinks() ⇒ Array

getHelpLinks

Kind: instance method of GccPage
Summary: Get links used in Help dialog.
Returns: Array - helpLinks

gccPage.getFeedbackMailtoLink() ⇒ string

getFeedbackMailtoLink

Kind: instance method of GccPage
Summary: Get the URL for the Feedback link in the page footer.
Returns: string - feedbackMailtoLink
See: runUnitTests

gccPage.getHtmlAndVariablesFromRunDateFormObject(formObj) ⇒ object

getHtmlAndVariablesFromRunDateFormObject

Kind: instance method of GccPage
Summary: Respond when the user selects a run name or date from the top of the page.
Returns: object - output Object for processing by GccUiSelectForm.processSelections

Param Type Description
formObj object Submitted form data as a simple object

GccPage.getInstance(config) ⇒ GccPage

getInstance

Kind: static method of GccPage
Summary: Note: this refers to class instance in prototype methods and class constructor in static methods.
Returns: GccPage - instance of class
See

Param Type Description
config object Config

GccPage.include(filename, [tplVariables]) ⇒ string

include

Kind: static method of GccPage
Summary: Import the specified file content into the current file, evaluating any variables that are passed in. Note: nested includes are not supported.
Returns: string - HTML file contents
See: https://developers.google.com/apps-script/guides/html/best-practices#code.gs

Param Type Default Description
filename string File name
[tplVariables] object Template variables

GccRun

Kind: global class
Summary: Properties and methods relating to the physical compost run.
Access: public

new GccRun(config)

Param Type Description
config object Module configuration.
config.abbreviations Array Abbreviations and their expansions (used to accessibly expand collection types).
config.collectionMapLocale string City and country information (passed to Google Maps along with the address).
config.containerVolumeFractions string Container volume fractions (used in spreadsheet date dropdowns and app collection volume dropdowns).
config.name string Run name (title).
config.nextRunName string | null Name of the next run in the sheet (below it).
config.runBlankRowsAfter number The number of blank rows after a run (used to calculate run bounds).
config.runBounds object Run position on the sheet: { startRowIndex, rowCount }.

gccRun.abbreviations : Array

abbreviations

Kind: instance property of GccRun

gccRun.collectionDateFlags : Array

collectionDateFlags

Kind: instance property of GccRun

gccRun.collectionMapLocale : string

collectionMapLocale

Kind: instance property of GccRun

gccRun.containerCapacities : Array

containerCapacities

Kind: instance property of GccRun

gccRun.containerNonVolumes : Array

containerNonVolumes

Kind: instance property of GccRun

gccRun.containerTypes : Array

containerTypes

Kind: instance property of GccRun

gccRun.containerVolumeFractions : Array

containerVolumeFractions

Kind: instance property of GccRun

gccRun.name : string

name

Kind: instance property of GccRun

gccRun.nextRunName : string | null

nextRunName

Kind: instance property of GccRun

gccRun.runBlankRowsAfter : number

runBlankRowsAfter

Kind: instance property of GccRun

gccRun.runBounds : object

runBounds

Kind: instance property of GccRun

gccRun.runGroup : object

runGroup

Kind: instance property of GccRun

gccRun.cacheInstance()

cacheInstance

Kind: instance method of GccRun
Summary: Cache an instance of GccRun.

gccRun.getBounds() ⇒ object

getBounds

Kind: instance method of GccRun
Summary: Multiple runs are stored in the same spreadsheet. Get the cell range used for one run.
Returns: object - runBounds Run bounds
See: runUnitTests

gccRun.getCollections(runDate) ⇒ Array

getCollections

Kind: instance method of GccRun
Summary: Create collection points on the run.
Returns: Array - collections
See: runIntegrationTests
Todo

  • Store runName collection ranges (except date) with run
  • Row 19 on "Town Run (FRI)" is still not being processed
Param Type Description
runDate string Run date

gccRun.getCollectionRanges(runDate) ⇒ object

getCollectionRanges

Kind: instance method of GccRun
Summary: Get row and column range for each element of a run collection.
Returns: object - ranges
Todo

  • Add caching once tested
Param Type Description
runDate string Run date

gccRun.getColumnRange(columnHeader, rowCountOverride) ⇒ Range

getColumnRange

Kind: instance method of GccRun
Summary: Gets a range of all rows in a specific column of a specific run
Returns: Range - columnRange
See: runIntegrationTests
Todo

  • This appears to be a partial duplicate of GccRun.getCollectionRanges
  • getColumnIndex caches each (date) result individually - better to update the cached runGroup
Param Type Description
columnHeader string Column header
rowCountOverride number Override for run.rowCount

GccRun.getInstanceFromCache(runName) ⇒ GccRun | null

getInstanceFromCache

Kind: static method of GccRun
Summary: Get a cached instance of GccRun.
Returns: GccRun | null - Reinstantiated run instance

Param Type Description
runName string Run name

GccRun.getRunGroup(runName) ⇒ object

getRunGroup

Kind: static method of GccRun
Summary: Each run belongs to a group (sheet) - retrieve that group
Returns: object - Run group
See: runIntegrationTests
Todo

  • Investigate adding preRunExtras, postRunExtras to runs object (getRun)
  • Get from cached GccRunGroup instance
Param Type Description
runName string Run name

GccRunGroup

Kind: global class
Summary: Properties and methods relating to the group of Kaicycle compost runs present on a sheet.
Access: public

new GccRunGroup(config)

Param Type Description
config object Module configuration.
config.columnHeaderIndices object Index position of each column header.
config.columnHeaderRowIndex number Index position of the column header row.
config.dateFormat string Used to load the next run date.
config.footer string Text in footer row (boundary row at end of runs).
config.postRunExtras string Name/title of post-run run.
config.preRunExtras string Name/title of pre-run run.
config.runNames Array Names of the runs in this group.
config.sheetName string Name of the sheet.

gccRunGroup.columnHeaderIndices : object

columnHeaderIndices

Kind: instance property of GccRunGroup

gccRunGroup.columnHeaderRowIndex : number

columnHeaderRowIndex

Kind: instance property of GccRunGroup

gccRunGroup.dateHeaderRangeA1Notation : string

dateHeaderRangeA1Notation

Kind: instance property of GccRunGroup

gccRunGroup.dateHeaders : Array

dateHeaders

Kind: instance property of GccRunGroup

gccRunGroup.dateHeadersFormatted : Array

dateHeadersFormatted

Kind: instance property of GccRunGroup

gccRunGroup.footer : string

footer

Kind: instance property of GccRunGroup

gccRunGroup.id : string

id

Kind: instance property of GccRunGroup

gccRunGroup.preRunExtras : string

preRunExtras

Kind: instance property of GccRunGroup

gccRunGroup.postRunExtras : string

postRunExtras

Kind: instance property of GccRunGroup

gccRunGroup.runNames : Array

runNames

Kind: instance property of GccRunGroup

gccRunGroup.sheetName : string

sheetName

Kind: instance property of GccRunGroup

gccRunGroup.cacheInstance()

cacheInstance

Kind: instance method of GccRunGroup
Summary: Cache an instance of GccRunGroup.

gccRunGroup.getDates() ⇒ Array

getDates

Kind: instance method of GccRunGroup
Summary: Gets all run dates header strings from a run sheet (not the column indices).
Returns: Array - runDates
See

gccRunGroup.getDateHeaders(getDisplayValue) ⇒ Array

getDateHeaders

Kind: instance method of GccRunGroup
Returns: Array - dateHeaders

Param Type Description
getDisplayValue boolean Get formatted display value rather than underlying value

gccRunGroup.getDateHeadersRange(format) ⇒ Range | string

getDateHeadersRange

Kind: instance method of GccRunGroup
Summary: Gets a range of all date column headers for a specific run group
Returns: Range | string - dateHeadersRange

Param Type Default Description
format string "range" Format (range

gccRunGroup.getNextRunDate() ⇒ string

getNextRunDate

Kind: instance method of GccRunGroup
Summary: Gets the next run date (today or a future run date)
Returns: string - nextRunDate

gccRunGroup.getNextRunName(runName) ⇒ string | null

getNextRunName

Kind: instance method of GccRunGroup
Summary: Gets the name (title) of the next run in the group
Returns: string | null - nextRunName

Param Type Description
runName string Preceding run name

GccRunGroup.getInstanceFromCache(runGroupName) ⇒ GccRunGroup

getInstanceFromCache

Kind: static method of GccRunGroup
Summary: Get a cached instance of GccRunGroup.
Returns: GccRunGroup - Reinstantiated run group instance

Param Type Description
runGroupName string Run group name (sheet name)

GccSheet

Kind: global class
Summary: Properties and methods relating to querying of the spreadsheet.

new GccSheet(config)

Param Type Description
config object Module configuration.
config.appName string App name (used in the feedback email).
config.computedNamedRangeNames Array Named ranges which are computed by the app.
config.containerVolumeFractions string Container volume fractions (used in spreadsheet date dropdowns and app collection volume dropdowns).
config.dateFormat string Date format (used to locate the next run date)
config.debug boolean Output debugging messages.
config.namedRangeItems Array { name, description, validation } of the named ranges set in the spreadsheet (an array of objects).
config.runBlankRowsAfter number Number of blank rows after a run (used to calculate run bounds).
config.runGroupCount number Number of NRRunGroup items to process.
config.runGroupRunCount number Number of NRRunGroupRunHeader items to process.

gccSheet.appName : string

appName

Kind: instance property of GccSheet

gccSheet.computedNamedRangeNames : Array

computedNamedRangeNames

Kind: instance property of GccSheet

gccSheet.dateFormat : string

dateFormat

Kind: instance property of GccSheet

gccSheet.debug : boolean

debug

Kind: instance property of GccSheet

gccSheet.helplinks : Array

helplinks

Kind: instance property of GccSheet

gccSheet.instance : GccSheet

instance

Kind: instance property of GccSheet

gccSheet.namedRangeItems : Array

namedRangeItems

Kind: instance property of GccSheet

gccSheet.namedRangeValues : object

namedRangeValues

Kind: instance property of GccSheet

gccSheet.runBlankRowsAfter : number

runBlankRowsAfter

Kind: instance property of GccSheet

gccSheet.runGroupCount : number

runGroupCount

Kind: instance property of GccSheet

gccSheet.runGroupRunCount : number

runGroupRunCount

Kind: instance property of GccSheet

gccSheet.cacheLog() ⇒ *

cacheLog

Kind: instance method of GccSheet
Summary: Show the contents of the cache
Returns: * - Open link

gccSheet.focusNR(namedRangeName)

focusNR

Kind: instance method of GccSheet
Summary: Activate a specific sheet/tab in the current spreadsheet and focus a named range in it (from a custom menu item).
See: https://spreadsheet.dev/navigation-menu-in-google-sheets

Param Type Description
namedRangeName string Named Range name

gccSheet.getActiveSpreadsheet() ⇒ object

getActiveSpreadsheet

Kind: instance method of GccSheet
Summary: Get the active spreadsheet (container-bound script) or the configured spreadsheet (standalone script)
Returns: object - activeSheet

gccSheet.getAllNamedRangeValues() ⇒ object

getAllNamedRangeValues

Kind: instance method of GccSheet
Summary: Retrieve, validate and cache all named ranges upfront, to mitigate app failure due to bad input. Note: arguments are passed in rather than retrieved from the instantiated class as this function is called during instantiation
Returns: object - namedRangeValues
See: https://stackoverflow.com/questions/35288998/how-to-remove-data-validations

gccSheet.getLastRowIndex(sheetName, footer) ⇒ number

getLastRowIndex

Kind: instance method of GccSheet
Summary: Get the index of the last row in the spreadsheet.
Returns: number - lastRowIndex
See: runIntegrationTests
Todo

  • Replace with footerRowIndex
Param Type Description
sheetName string Sheet name
footer string Text in footer row

gccSheet.getMenu() ⇒ object

getMenu

Kind: instance method of GccSheet
Summary: Get the custom menu which is displayed in the spreadsheet.
Returns: object - menu

gccSheet.getNamedRange(name) ⇒ Range

getNamedRange

Kind: instance method of GccSheet
Returns: Range - namedRange

Param Type Description
name string Name

gccSheet.getNamedRangeBackgrounds(name) ⇒ Array

getNamedRangeBackgrounds

Kind: instance method of GccSheet
Summary: Simple wrapper function to support stubbing in unit tests.
Returns: Array - namedRangeBackgrounds

Param Type Description
name string Name

gccSheet.getNamedRangeFontColors(name) ⇒ Array

getNamedRangeFontColors

Kind: instance method of GccSheet
Summary: Simple wrapper function to support stubbing in unit tests.
Returns: Array - namedRangeFontColors

Param Type Description
name string Name

gccSheet.getNamedRangeValue(name) ⇒ *

getNamedRangeValue

Kind: instance method of GccSheet
Returns: * - namedRangeValue

Param Type Description
name string Name

gccSheet.getNamedRangeValues(name, onlyFirst) ⇒ Array

getNamedRangeValues

Kind: instance method of GccSheet
Returns: Array - namedRangeValues
See: runIntegrationTests

Param Type Default Description
name string Name
onlyFirst boolean false Whether to return only the first value

gccSheet.getRangeValues(runName, runDate) ⇒ Array

getRangeValues

Kind: instance method of GccSheet
Summary: Called by client-side JS on page load to populate the form with the values in the spreadsheet.
Returns: Array - Range values
See: runIntegrationTests

Param Type Description
runName string Run name
runDate string Run date

gccSheet.getRunGroups() ⇒ Array

getRunGroups

Kind: instance method of GccSheet
Summary: Build runGroups object from named ranges. Called once by GccSheet.getAllNamedRangeValues.
Returns: Array - runGroups
Todo

  • Change postRunExtras to postRunExtrasName
  • Change preRunExtras to preRunExtrasName

gccSheet.getTimeZone() ⇒ string

getTimeZone

Kind: instance method of GccSheet
Returns: string - timezone Region/City

gccSheet.handleOpen()

handleOpen

Kind: instance method of GccSheet
Summary: Add custom menu when the spreadsheet is opened. For each namedRangeItem there must be a matching function in gsheet-compost-collections/src/Middleware.js, see example below
Todo

  • Only show App Links if user has access
  • Document how to add the Named Ranges to the spreadsheet
  • Add Bitly QR Codes for STABLE/DEV APP in popups

Example

// example of adding a namedRangeItem to gsheet-compost-collections/src/Middleware.js
function gccMiddlewareFocusNRDateFlags() {
  return gccMiddleware('GccSheet.focusNR', 'NRDateFlags');
}

gccSheet.setDateValidationRow(runGroup, [rowIndex]) ⇒ string

setDateValidationRow

Kind: instance method of GccSheet
Summary: Apply data validation rules to all visible date cells in one row.
Returns: string - Success message

Param Type Description
runGroup object Run group
[rowIndex] number | null Row index

gccSheet.setDateValidationRows() ⇒ string

setDateValidationRows

Kind: instance method of GccSheet
Summary: Apply data validation rules to all visible date cells in all rows. Used on handleOpen, rather than when a particular row has been updated.
Returns: string - Success message
Todo

  • Document why preRunExtras and postRunExtras are added below rather than in getRunGroups, e.g. to limit what appears in Run A/B dropdown?

gccSheet.showLog(log)

showLog

Kind: instance method of GccSheet
Summary: Show contents of cache in modal (container-bound script) or console (standalone script)

Param Type Description
log string Cache log

gccSheet.showNotification(message, title, duration)

showNotification ('toast')

Kind: instance method of GccSheet
Summary: Displays a temporary notification within a spreadsheet
See: https://spreadsheet.dev/toast-notifications-in-google-sheets

Param Type Default Description
message string Message
title string "GCC" Title
duration number 5 Duration (seconds)

gccSheet.showSidebarHelp(section)

showSidebar

Kind: instance method of GccSheet
Summary: Show the sidebar, which is used to display contextual help.

Param Type Description
section string Help section

gccSheet.showVersionHistory()

showVersionHistory

Kind: instance method of GccSheet
Summary: Show version history in a modal

GccSheet.getCellByString(sheetName, cellText) ⇒ Range

getCellByString

Kind: static method of GccSheet
Summary: Get a reference to spreadsheet cells containing the specified text.
Returns: Range - Range object
See: runIntegrationTests

Param Type Description
sheetName string Sheet name
cellText string Cell text

GccSheet.getColumnIndex(sheetName, cellText) ⇒ number

getColumnIndex

Kind: static method of GccSheet
Summary: Get the number of the spreadsheet column containing the specified text (to find the column headers). Note: this is an expensive operation as getCellByString uses createTextFinder to search the entire sheet.
Returns: number - columnIndex
See

Todo

  • For dates follow technique of setDateValidationCriteria - dateHeadersRange.getColumn() + offset
Param Type Description
sheetName string Sheet name
cellText string Cell text

GccSheet.getInstance(config) ⇒ GccSheet

getInstance

Kind: static method of GccSheet
Summary: Note: this refers to class instance in prototype methods and class constructor in static methods.
Returns: GccSheet - instance of class
See

Param Type Description
config object Config

GccSheet.getRowIndex(sheetName, cellText) ⇒ number

getRowIndex

Kind: static method of GccSheet
Summary: Get the number of the spreadsheet row containing the specified text, to find the runs start and end rows.
Returns: number - rowIndex
See: runIntegrationTests

Param Type Description
sheetName string Sheet name
cellText string Cell text

GccSheet.getRunSheet(sheetName) ⇒ object

getRunSheet

Kind: static method of GccSheet
Summary: Get suburbs or town spreadsheet sheet (if the user is allowed to access it).
Returns: object - runSheet
See: runIntegrationTests

Param Type Description
sheetName object Sheet name

GccSheet.handleEdit(e, cbConfig)

handleEdit

Kind: static method of GccSheet
Summary: Run when the spreadsheet is edited.
Todo

  • Clear cache if any/specific fields edited
  • Determine which field in which run was edited so we can update the UI (#50)
Param Type Description
e object Event object
cbConfig object Container-bound config

GccSheet.openLink(linkUrl)

openLink

Kind: static method of GccSheet
Summary: Open a URL (from a custom menu item).
See

Param Type Description
linkUrl string Link URL

GccSheet.openLinkPhoneSize(linkUrl)

openLinkPhoneSize

Kind: static method of GccSheet
Summary: Open a URL (from a custom menu item).
See

Param Type Description
linkUrl string Link URL

GccSheet.setConditionalFormatting(runName)

setConditionalFormatting

Kind: static method of GccSheet

Param Type Description
runName string Run name

GccSheet.setDateValidation(runGroup, [rowIndex])

setDateValidation

Kind: static method of GccSheet
Summary: Apply data validation rules to all visible date cells in one row or all rows.

Param Type Default Description
runGroup object Run group
[rowIndex] number | null Row index

GccSheet.setDateValidationCriteria(sheetName, dateHeadersRange, rowIndex, type, container, lastRow)

setDateValidationCriteria

Kind: static method of GccSheet
Summary: Apply data validation rules to all visible date cells in one row. This transforms TRUE/FALSE values to checkboxes and volume values to list dropdowns.

Param Type Default Description
sheetName string Sheet name
dateHeadersRange Range Date headers range
rowIndex number Row index
type string Type (uppercase in range)
container object Instance of GccContainer
lastRow boolean false Last row

GccSheet.setRangeValidationCriteria(range, criteriaType, criteriaValues, allowInvalid)

setRangeValidationCriteria

Kind: static method of GccSheet
Summary: Apply validation rules to a range.

Param Type Default Description
range Range Range to add validation to
criteriaType string Criteria type
criteriaValues Array Criteria values
allowInvalid boolean true whether to show a warning when input fails data validation or whether to reject the input entirely

GccSheet.validateRangeValues(range, replacementValues) ⇒ object

validateRangeValues

Kind: static method of GccSheet
Summary: Test whether the data in the range is valid according to the validation rules present.
Returns: object - results Results
See

Param Type Default Description
range Range Range
replacementValues Array | null A two-dimensional array of replacement values, indexed by row, then by column. Prevents a runtime error when using range.setValue() to set a value which does not meet the range's data validation criteria. try .. catch cannot be used to mitigate this.

GccSheet.validateValue(criteriaType, criteriaValues, cellRange, cellValue) ⇒ object

validateValue

Kind: static method of GccSheet
Summary: Test whether a value is valid according to the validation rules supplied.
Returns: object - result
See

Param Type Description
criteriaType string Criteria type
criteriaValues Array Criteria values
cellRange Range Cell range
cellValue * Value to validate

GccSheet.writeToSheetFromRunFormObject(formObject) ⇒ string

writeToSheetFromRunFormObject

Kind: static method of GccSheet
Summary: When the user selects a container volume, write the app data back to the spreadsheet.
Returns: string - Success message for processing by the success handler in JavaScript.js.html
See: runIntegrationTests
Todo

  • Is the key deletion used below still necessary?
  • Reference to JavaScript.js.html (??) is incorrect - what should it be?
Param Type Description
formObject object Submitted form object

GccTest

Kind: global class
Summary: Properties and methods relating to testing of the codebase.

new GccTest(config)

Param Type Description
config object App configuration.

gccTest.config : object

config

Kind: instance property of GccTest

gccTest.expectations : object

expectations

Kind: instance property of GccTest

gccTest.stubbedMap : Map

stubbedMap

Kind: instance property of GccTest

gccTest.getCollectionInstances() ⇒ Array

getCollectionInstances

Kind: instance method of GccTest
Returns: Array - instances of GccCollection

gccTest.getColorInstances() ⇒ Array

getColorInstances

Kind: instance method of GccTest
Returns: Array - instances of GccColor

gccTest.getContainerInstances() ⇒ Array

getContainerInstances

Kind: instance method of GccTest
Returns: Array - instances of GccContainer

gccTest.getEnvInstances() ⇒ Array

getEnvInstances

Kind: instance method of GccTest
Returns: Array - instances of GccEnv

gccTest.getPageInstances() ⇒ Array

getPageInstances

Kind: instance method of GccTest
Returns: Array - instances of GccPage

gccTest.getRunInstances() ⇒ Array

getRunInstances

Kind: instance method of GccTest
Returns: Array - instances of GccRun

gccTest.getRunGroupInstances() ⇒ Array

getRunGroupInstances

Kind: instance method of GccTest
Returns: Array - instances of GccRunGroup

gccTest.getSheetInstances() ⇒ Array

getSheetInstances

Kind: instance method of GccTest
Returns: Array - instances of GccSheet

gccTest.getUtilsInstances() ⇒ Array

getUtilsInstances

Kind: instance method of GccTest
Returns: Array - instances of GccUtils

gccTest.runIntegrationTests(QUnit)

runIntegrationTests

Kind: instance method of GccTest
Summary: Run integration tests

Param Type Description
QUnit object QUnit

gccTest.runUnitTests(QUnit)

runUnitTests

Kind: instance method of GccTest
Summary: Run unit tests. Note: config object is passed into instantiations as unit tests can't access the serverside cache.
See: https://api.qunitjs.com/QUnit/module/ for setup/teardown

Param Type Description
QUnit object QUnit

gccTest.stub(classMethod, args, returnValue)

stub

Kind: instance method of GccTest
Summary: Stub a function in order to control its output and prevent calls to the server.

Param Type Description
classMethod string Class.method
args Array Args
returnValue * Return value

Example

this.stub('GccCache.clearCache', [], 'Deleted cache');

gccTest.stubGccCache()

stubGccCache

Kind: instance method of GccTest

gccTest.stubGccCollection()

stubGccCollection

Kind: instance method of GccTest

gccTest.stubGccEnv()

stubGccEnv

Kind: instance method of GccTest

gccTest.stubGccRun()

stubGccRun

Kind: instance method of GccTest

gccTest.stubGccRunGroup()

stubGccRunGroup

Kind: instance method of GccTest

gccTest.stubGccSheet()

stubGccSheet

Kind: instance method of GccTest

GccTest.getQUnitGS2() ⇒ object

The QUnitGS2 callback function getResultsFromServer() has to reside in the container-bound app as only that has the datasource and configuration information to load the test page. But QUnitGS2 is only a dependency of the standalone app, not of the container-bound app. The solution is to pass QUnitGS2 from the standalone app to the container-bound app.

Kind: static method of GccTest
Summary: Get QUnitGS2
Returns: object - QUnitGS2 - QUnitGS2 testing framework

GccUi

Kind: global class
Summary: UI helpers.
Access: public

new GccUi(config)

Param Type Description
config object App configuration.
config.uiFocusableSelectors Array UI elements which can be focussed by the user.

gccUi.focusableSelector : string

focusableSelector

Kind: instance property of GccUi

gccUi.instance : GccUi

instance

Kind: instance property of GccUi

gccUi.enableActiveStates(parentSelector)

enableActiveStates

Kind: instance method of GccUi
Summary: Fix for iOS which does not apply the active state by default, applied per-element for better performance
See

Param Type Description
parentSelector string Parent selector

GccUi.createCustomEvent(eventName) ⇒ *

createCustomEvent

Kind: static method of GccUi
Summary: Create a synthetic event which can be triggered and which will then invoke the element's matching event listener
Returns: * - CustomEvent
See: https://developer.mozilla.org/en-US/docs/Web/Events/Creating_and_triggering_events

Param Type Description
eventName string Event name

GccUi.getInstance(config) ⇒ GccUi

getInstance

Kind: static method of GccUi
Summary: Note: this refers to class instance in prototype methods and class constructor in static methods.
Returns: GccUi - instance of class
See

Param Type Description
config object Config

GccUi.log(str)

log

Kind: static method of GccUi
Summary: Log a string to the console

Param Type Description
str string String to log

GccUiCollection

Kind: global class
Access: public

new GccUiCollection(config)

Param Type Description
config object Module configuration.
config.abbreviations Array Abbreviations and their expansions (used to accessibly expand collection types).
config.address string Street address of collection.
config.cancelled boolean Whether the collection is permanently cancelled.
config.collect boolean Whether the collection should be collected.
config.collectionMapLocale string Map locale to append to Google Maps lookups.
config.containerQuantity number Quantity of containers to collect.
config.containerType string Type of container to collect.
config.dateFlag string Any special instructions for the collection on a particular collection date (Skip, Drop, etc).
config.dateValue number | string | boolean Recorded collection amount or status or checkbox state for a particular collection date.
config.editableToggleClass string Class selector used by the notes edit buttons.
config.groupActiveIndex number Index of this instance within a group of collections (the 'active count').
config.groupTotal number Total number of instance within a group of collections.
config.loopIndex number Index of this instance within a group of collections.
config.name string The name of the customer.
config.notes string General notes about this collection, such as where to find the container or how to contact the customer.
config.onHold boolean Whether the collection is temporarily on hold.
config.pending boolean Whether the collection is yet to begin.
config.runDate string The date of the collection.
config.runName string The name of the parent run.
config.type string The type of customer.
config.volumesAndDateFlags Array | null Volumes and date flags.

gccUiCollection.abbreviations : Array

abbreviations

Kind: instance property of GccUiCollection

gccUiCollection.address : string

address

Kind: instance property of GccUiCollection

gccUiCollection.cancelled : boolean

cancelled

Kind: instance property of GccUiCollection

gccUiCollection.collect : boolean

collect

Kind: instance property of GccUiCollection

gccUiCollection.collectionMapLocale : string

collectionMapLocale

Kind: instance property of GccUiCollection

gccUiCollection.collectionStatus : string

collectionStatus

Kind: instance property of GccUiCollection

gccUiCollection.containerQuantity : number

containerQuantity

Kind: instance property of GccUiCollection

gccUiCollection.containerType : string

containerType

Kind: instance property of GccUiCollection

gccUiCollection.dateFlag : string

dateFlag

Kind: instance property of GccUiCollection

gccUiCollection.dateValue : number | string | boolean

dateValue

Kind: instance property of GccUiCollection

gccUiCollection.index : number

index

Kind: instance property of GccUiCollection

gccUiCollection.groupActiveIndex : number

groupActiveIndex

Kind: instance property of GccUiCollection

gccUiCollection.groupTotal : number

groupTotal

Kind: instance property of GccUiCollection

gccUiCollection.name : string

name

Kind: instance property of GccUiCollection

gccUiCollection.notes : string

notes

Kind: instance property of GccUiCollection

gccUiCollection.onHold : boolean

onHold

Kind: instance property of GccUiCollection

gccUiCollection.pending : boolean

pending

Kind: instance property of GccUiCollection

gccUiCollection.runDate : string

runDate

Kind: instance property of GccUiCollection

gccUiCollection.runName : string

runName

Kind: instance property of GccUiCollection

gccUiCollection.type : string

type

Kind: instance property of GccUiCollection

gccUiCollection.typeDefinition : string

typeDefinition

Kind: instance property of GccUiCollection

gccUiCollection.volumesAndDateFlags : null | Array

volumesAndDateFlags

Kind: instance property of GccUiCollection

gccUiCollection.editNotesStart(element)

editNotesStart

Kind: instance method of GccUiCollection
Summary: User starts editing of notes
See: https://stackoverflow.com/a/70565696/6850747

Param Type Description
element HTMLElement HTML Element

gccUiCollection.editNotesEnd(element)

editNotesEnd

Kind: instance method of GccUiCollection
Summary: User starts editing of notes

Param Type Description
element HTMLElement HTML Element

gccUiCollection.getAddressUrl(address, collectionMapLocale) ⇒ string

getAddressUrl

Kind: instance method of GccUiCollection
Summary: Generate a link to the collection address using Google Maps.
Returns: string - URL
See: https://gearside.com/easily-link-to-locations-and-directions-using-the-new-google-maps/

Param Type Description
address string Address
collectionMapLocale string Map locale

gccUiCollection.getChecklistItemHtml(collectionId, inputId, targetStateId) ⇒ string

getChecklistItemHtml

Kind: instance method of GccUiCollection
Summary: Generate the HTML for the collection checkbox. Checked attribute set by GccUiRunForm.populateForm.
Returns: string - html

Param Type Description
collectionId string Collection ID
inputId string Input ID
targetStateId string State proxy ID

gccUiCollection.getCollectionHtml() ⇒ string

getCollectionHtml

Kind: instance method of GccUiCollection
Summary: Generate the HTML for the collection area of the collection.
Returns: string - html

gccUiCollection.getCollectionStatus() ⇒ string

getCollectionStatus

Kind: instance method of GccUiCollection
Returns: string - collectionStatus

gccUiCollection.getContainerHtml() ⇒ string

getContainerHtml

Kind: instance method of GccUiCollection
Summary: Generate the HTML for the container area of the collection.
Returns: string - html

gccUiCollection.getDisclosureButtonHtml(disclosureId, targetStateId) ⇒ string

getDisclosureButtonHtml

Kind: instance method of GccUiCollection
Summary: Generate the HTML for the collection disclosure button
Returns: string - html

Param Type Description
disclosureId string Disclosure ID
targetStateId string State proxy ID

gccUiCollection.getLegendHtml(notesId) ⇒ string

getLegendHtml

Kind: instance method of GccUiCollection
Summary: Generate the HTML for the collection legend
Returns: string - html

Param Type Description
notesId string Notes ID

gccUiCollection.getNotesHtml(notesId, targetStateId) ⇒ string

getNotesHtml

Kind: instance method of GccUiCollection
Summary: Generate the HTML for the collection notes area.
Returns: string - html
Todo

  • date flag disappears after user input is written to then read from spreadsheet (#193)
Param Type Description
notesId string Notes ID
targetStateId string State proxy ID

gccUiCollection.getSelectHtml(collectionId, inputId, targetStateId) ⇒ string

getSelectHtml

Kind: instance method of GccUiCollection
Summary: Generate the HTML for the collection volume select. Values are set by GccUiRunForm.populateForm.
Returns: string - html

Param Type Description
collectionId string Collection ID
inputId string Input ID
targetStateId string State proxy ID

gccUiCollection.getSelectionHtml(collectionId) ⇒ string

getSelectionHtml

Kind: instance method of GccUiCollection
Summary: Generate the HTML for the collection selection output area.
Returns: string - html

Param Type Description
collectionId string Collection ID

gccUiCollection.getTargetInput(element) ⇒ HTMLElement

getTargetInput

Kind: instance method of GccUiCollection
Summary: Get the HTML element which the supplied element targets. This allows the user to affect element B by interacting with element A.
Returns: HTMLElement - targetInputEl Target element

Param Type Description
element HTMLElement HTML Element

gccUiCollection.getTypeDefinition() ⇒ string

getTypeDefinition

Kind: instance method of GccUiCollection
Summary: Get the expanded form of a type abbreviation used in the spreadsheet.
Returns: string - definition
See: runUnitTests

gccUiCollection.linkPhoneNumbers(text) ⇒ string

linkPhoneNumbers

Kind: instance method of GccUiCollection
Summary: Link phone numbers in a body of text.
Returns: string - linkedText
See: https://en.wikipedia.org/wiki/Telephone_numbers_in_New_Zealand

Param Type Description
text string Text

gccUiCollection.updateCheckedState(element)

updateCheckedState

Kind: instance method of GccUiCollection
Summary: Transform the :checked UI state to a :value that the server can understand (true|false) and so that the value is always submitted to the server irrespective of the :checked state.
Todo

  • Does this need to be bidirectional?
Param Type Description
element HTMLElement HTML Element

gccUiCollection.updateCollectionColor(element)

updateCollectionColor

Kind: instance method of GccUiCollection
Summary: Update the collection colour scheme to reflect the current selection

Param Type Description
element HTMLElement HTML Element

gccUiCollection.updateCollectionSelection(element)

updateCollectionSelection

Kind: instance method of GccUiCollection
Summary: Update the visible selection output to reflect the current selection

Param Type Description
element HTMLElement HTML Element

GccUiCollection.getSourceInput(element) ⇒ HTMLElement

getSourceInput

Kind: static method of GccUiCollection
Summary: Get the HTML element which targets the supplied element. This allows the user to affect (hidden) element B by interacting with (visible) element A.
Returns: HTMLElement - sourceInputEl Target element

Param Type Description
element HTMLElement HTML Element

GccUiCollection.isCheckbox(element) ⇒ boolean

isCheckbox

Kind: static method of GccUiCollection
Summary: Determine whether an element is a checkbox
Returns: boolean - isCheckbox

Param Type Description
element HTMLElement HTML Element

GccUiCss

Kind: global class
Summary: Manage dynamic CSS
Access: public

new GccUiCss(config)

Param Type Description
config object App configuration.
config.uiCss object Module configuration.
config.uiCss.fixedPositionIds Array IDs of elements that use fixed positioning, used to generate CSS variables.

gccUiCss.fixedPositionIds : Array

fixedPositionIds

Kind: instance property of GccUiCss

gccUiCss.instance : GccUiCss

instance

Kind: instance property of GccUiCss

gccUiCss.injectHeightVariables()

injectHeightVariables

Kind: instance method of GccUiCss
Summary: Store heights of fixed position elements

GccUiCss.getInstance(config) ⇒ GccUiCss

getInstance

Kind: static method of GccUiCss
Summary: Note: this refers to class instance in prototype methods and class constructor in static methods.
Returns: GccUiCss - instance of class
See

Param Type Description
config object Config

GccUiDialog

Kind: global class
Summary: Show a different screen, without triggering a page reload (which would lose the fullscreen effect) or otherwise affecting the underlying page state.
Access: public
See: https://www.w3.org/TR/wai-aria-practices/#dialog_modal

new GccUiDialog(config)

Param Type Description
config object App configuration.
config.uiDialog object Module configuration.
config.uiDialogCacheClearButtonId string ID selector used to target the Clear Cache button
config.uiDialogCacheLogButtonId string ID selector used to target the Log Cache button
config.uiDialogCloseClass string Class selector of button that hides the component
config.uiDialogComponentClass string Class selector of component
config.uiDialogConsoleContainerId string ID selector of console container
config.uiDialogErudaScriptId string ID selector of eruda script element
config.uiDialogParentDataAttr string Data attribute used to manage state of parent element
config.uiDialogTriggerClass string Class selector of button that shows the component
config.uiDialogUpdateDateValidationId string ID selector used to target the Refresh collection inputs button
config.uiFocusableSelectors Array UI elements which can be focussed by the user.

gccUiDialog.cacheClearButtonId : string

cacheClearButtonId

Kind: instance property of GccUiDialog

gccUiDialog.cacheLogButtonId : string

cacheLogButtonId

Kind: instance property of GccUiDialog

gccUiDialog.closeClass : string

closeClass

Kind: instance property of GccUiDialog

gccUiDialog.componentClass : string

componentClass

Kind: instance property of GccUiDialog

gccUiDialog.consoleContainerId : string

consoleContainerId

Kind: instance property of GccUiDialog

gccUiDialog.endClass : string

endClass

Kind: instance property of GccUiDialog

gccUiDialog.erudaScriptId : string

erudaScriptId

Kind: instance property of GccUiDialog

gccUiDialog.focusableSelector : string

focusableSelector

Kind: instance property of GccUiDialog

gccUiDialog.instance : GccUiDialog

instance

Kind: instance property of GccUiDialog

gccUiDialog.parentDataAttr : string

parentDataAttr

Kind: instance property of GccUiDialog

gccUiDialog.startClass : string

startClass

Kind: instance property of GccUiDialog

gccUiDialog.triggerClass : string

triggerClass

Kind: instance property of GccUiDialog

gccUiDialog.updateDateValidationId : string

updateDateValidationId

Kind: instance property of GccUiDialog

gccUiDialog.init()

init

Kind: instance method of GccUiDialog

gccUiDialog.cacheClear()

cacheClear

Kind: instance method of GccUiDialog
Summary: Clear the contents of the cache

gccUiDialog.logCache()

logCache

Kind: instance method of GccUiDialog
Summary: Log the contents of the cache

gccUiDialog.handleClick(event)

handleClick

Kind: instance method of GccUiDialog
Summary: Handle clicks/touches

Param Type Description
event object Event object

gccUiDialog.handleFocusTrap(event)

handleFocusTrap

Kind: instance method of GccUiDialog
Summary: Prevent user from tabbing outside the dialog

Param Type Description
event object Event object

gccUiDialog.handleKeyDown(event)

handleKeyDown

Kind: instance method of GccUiDialog
Summary: Handle key presses

Param Type Description
event object Event object

gccUiDialog.hide()

hide

Kind: instance method of GccUiDialog
Summary: Hide the dialog.

gccUiDialog.injectConsole()

Inject console

Kind: instance method of GccUiDialog

gccUiDialog.setDateValidation()

setDateValidation

Kind: instance method of GccUiDialog
Summary: Apply data validation rules to all visible date cells in all rows.

gccUiDialog.show(triggerEl)

show

Kind: instance method of GccUiDialog
Summary: Show the dialog.

Param Type Description
triggerEl HTMLElement The element (button) which triggered the show.

GccUiDialog.getInstance(config) ⇒ GccUiDialog

getInstance

Kind: static method of GccUiDialog
Summary: Note: this refers to class instance in prototype methods and class constructor in static methods.
Returns: GccUiDialog - instance of class
See

Param Type Description
config object Config

GccUiLoader

Kind: global class
Summary: Toggle a loading animation
Access: public

new GccUiLoader(config)

Param Type Description
config object App configuration.
config.uiLoader object Module configuration.
config.uiLoader.componentClass string Class selector of the loader element
config.uiLoader.dataAttr string Data attribute used to manage state
config.uiLoader.descriptionClass string Class selector of the loader description
config.uiLoader.hideDelay number Number of milliseconds to wait before hiding the loader
config.uiLoader.parentDataAttr string Data attribute used to manage state of parent element
config.uiLoader.runLoaderId string ID selector of the loader component that appears in the overlay
config.uiLoader.runSaverId string ID selector of the loader component that appears save status bar
config.uiLoader.titleClass string Class selector of the loader title

gccUiLoader.instance : GccUiLoader

instance

Kind: instance property of GccUiLoader

gccUiLoader.componentClass : string

componentClass

Kind: instance property of GccUiLoader

gccUiLoader.dataAttr : string

dataAttr

Kind: instance property of GccUiLoader

gccUiLoader.descriptionClass : string

descriptionClass

Kind: instance property of GccUiLoader

gccUiLoader.hideDelay : number

hideDelay

Kind: instance property of GccUiLoader

gccUiLoader.parentDataAttr : string

parentDataAttr

Kind: instance property of GccUiLoader

gccUiLoader.runLoaderId : string

runLoaderId

Kind: instance property of GccUiLoader

gccUiLoader.runSaverId : string

runSaverId

Kind: instance property of GccUiLoader

gccUiLoader.titleClass : string

titleClass

Kind: instance property of GccUiLoader

gccUiLoader.show(loaderId, isLoading, [title], [description])

show

Hide or show the loader (icon visibility is set in CSS).

Kind: instance method of GccUiLoader
See: https://loading.io/css/

Param Type Default Description
loaderId string Loader ID (runLoaderId or runSaverId depending on context)
isLoading string Loading state (true
[title] string null Visible title
[description] string null Visible description

GccUiLoader.getInstance(config) ⇒ GccUiLoader

getInstance

Kind: static method of GccUiLoader
Summary: Note: this refers to class instance in prototype methods and class constructor in static methods.
Returns: GccUiLoader - instance of class
See

Param Type Description
config object Config

GccUiRun

Kind: global class
Access: public

new GccUiRun(config)

Param Type Description
config object Module configuration.
config.collections Array Collection points on the run.
config.date string Date of the run
config.name string Name of the run

gccUiRun.bucketsTotal : number | string

bucketsTotal

Kind: instance property of GccUiRun

gccUiRun.collections : Array

collections

Kind: instance property of GccUiRun

gccUiRun.collectionsActiveTotal : number

collectionsActiveTotal

Kind: instance property of GccUiRun

gccUiRun.date : string

date

Kind: instance property of GccUiRun

gccUiRun.name : string

name

Kind: instance property of GccUiRun

gccUiRun.tubsTotal : number

tubsTotal

Kind: instance property of GccUiRun

gccUiRun.getTotalActiveCollections() ⇒ number

getTotalActiveCollections

Kind: instance method of GccUiRun
Returns: number - collectionsActiveTotal

gccUiRun.getTotalBuckets() ⇒ number | string

getTotalBuckets

Kind: instance method of GccUiRun
Returns: number | string - bucketsTotal

gccUiRun.getTotalTubs() ⇒ number

getTotalTubs

Kind: instance method of GccUiRun
Returns: number - tubsTotal

gccUiRun.getRunHeaderHtml() ⇒ string

getRunHeaderHtml

Kind: instance method of GccUiRun
Summary: Generate the HTML for the run header.
Returns: string - html

GccUiRunForm

Kind: global class
Access: public

new GccUiRunForm(config)

Param Type Description
config object App configuration.
config.uiRunForm object Module configuration.
config.uiRunForm.collectionsId string ID selector used to target the collections container
config.uiRunForm.id string ID selector used to target the run form
config.uiRunForm.placeholderLogoClass string Class selector which applies the background logo
config.uiRunForm.runId string ID selector of the run component

gccUiRunForm.collectionsId : string

collectionsId

Kind: instance property of GccUiRunForm

gccUiRunForm.id : string

id

Kind: instance property of GccUiRunForm

gccUiRunForm.instance : GccUiRunForm

instance

Kind: instance property of GccUiRunForm

gccUiRunForm.placeholderLogoClass : string

placeholderLogoClass

Kind: instance property of GccUiRunForm

gccUiRunForm.runId : string

runId

Kind: instance property of GccUiRunForm

gccUiRunForm.getCollectionsHtml(data) ⇒ string

getCollectionsHtml

Kind: instance method of GccUiRunForm
Summary: Instances of GccCollection (backend) are converted to objects and passed to the frontend where they are processed by GccUiCollection (frontend)
Returns: string - html

Param Type Description
data object Pubsub data

gccUiRunForm.init()

init

Kind: instance method of GccUiRunForm
Summary: Runs every time a new run form is selected/loaded.

gccUiRunForm.handleChange(event)

handleChange

Kind: instance method of GccUiRunForm

Param Type Description
event object Event object

gccUiRunForm.handleClick(event)

handleClick

Kind: instance method of GccUiRunForm

Param Type Description
event object Event object

gccUiRunForm.handleSubmit(event)

handleSubmit

Kind: instance method of GccUiRunForm
See: https://developers.google.com/apps-script/guides/html/communication#index.html_4

Param Type Description
event object Event object

gccUiRunForm.handleSubmitFailCb(serverResponse)

handleSubmitFailCb

Kind: instance method of GccUiRunForm
Summary: Message is returned from serverside function

Param Type Description
serverResponse string Server error message

gccUiRunForm.handleSubmitSuccessCb()

handleSubmitSuccessCb

Kind: instance method of GccUiRunForm
Summary: Message is returned from serverside function

gccUiRunForm.injectTemplate(data)

injectTemplate

Kind: instance method of GccUiRunForm

Param Type Description
data object Pubsub data

gccUiRunForm.populateForm(data)

populateForm

Kind: instance method of GccUiRunForm
Summary: Apply spreadsheet values to the templated form elements
See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input/checkbox

Param Type Description
data object Pubsub data

gccUiRunForm.reset()

reset

Kind: instance method of GccUiRunForm

gccUiRunForm.showPlaceholderLogo(show)

showPlaceholderLogo

Kind: instance method of GccUiRunForm
Summary: Show the placeholder logo when the run form is not present.

Param Type Description
show boolean Whether to show the placeholder

GccUiRunForm.getInstance(config) ⇒ GccUiRunForm

getInstance

Kind: static method of GccUiRunForm
Summary: Note: this refers to class instance in prototype methods and class constructor in static methods.
Returns: GccUiRunForm - instance of class
See

Param Type Description
config object Config

GccUiSelectDisclosure

Kind: global class
Summary: Expand and collapse a container, and expose the state of the select element contained within.
Access: public

new GccUiSelectDisclosure(config)

Param Type Description
config object App configuration.
config.uiSelectDisclosure object Module configuration.
config.uiSelectDisclosure.closeOnSelect boolean Whether to automatically close the disclosure after a volume option is selected
config.uiSelectDisclosure.closeOnSelectDelay number Number of milliseconds to wait before automatically closing the disclosure
config.uiSelectDisclosure.triggerClass string Class selector of button that opens the disclosure

gccUiSelectDisclosure.closeOnSelect : boolean

closeOnSelect

Kind: instance property of GccUiSelectDisclosure

gccUiSelectDisclosure.closeOnSelectDelay : number

closeOnSelectDelay

Kind: instance property of GccUiSelectDisclosure

gccUiSelectDisclosure.instance : GccUiSelectDisclosure

instance

Kind: instance property of GccUiSelectDisclosure

gccUiSelectDisclosure.triggerClass : string

triggerClass

Kind: instance property of GccUiSelectDisclosure

gccUiSelectDisclosure.init(formId)

init

Kind: instance method of GccUiSelectDisclosure
See: https://www.w3.org/TR/wai-aria-practices/#disclosure

Param Type Description
formId string Form ID

gccUiSelectDisclosure.toggle(triggerEl)

toggle

Kind: instance method of GccUiSelectDisclosure
Summary: Open or close the disclosure.

Param Type Description
triggerEl HTMLElement The element (button) which triggered the toggle.

gccUiSelectDisclosure.updateTriggerState(triggerEl)

updateTriggerState

Kind: instance method of GccUiSelectDisclosure
Summary: When a volume option is selected, or a checklist item is checked, change the colour of the disclosure trigger checkbox.

Param Type Description
triggerEl HTMLElement The element (button) which triggered the toggle.

GccUiSelectDisclosure.getInstance(config) ⇒ GccUiSelectDisclosure

getInstance

Kind: static method of GccUiSelectDisclosure
Summary: Note: this refers to class instance in prototype methods and class constructor in static methods.
Returns: GccUiSelectDisclosure - instance of class
See

Param Type Description
config object Config

GccUiSelectForm

Kind: global class
Access: public

new GccUiSelectForm(config)

Param Type Description
config object App configuration.
config.uiSelectForm object Module configuration.
config.uiSelectForm.id string ID selector of the form element.

gccUiSelectForm.id : string

id

Kind: instance property of GccUiSelectForm

gccUiSelectForm.instance : GccUiSelectForm

instance

Kind: instance property of GccUiSelectForm

gccUiSelectForm.handleChange(event)

handleChange

Kind: instance method of GccUiSelectForm

Param Type Description
event object Event object

gccUiSelectForm.handleFormData(event)

handleFormData

Kind: instance method of GccUiSelectForm
See: https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects

Param Type Description
event object Event object

gccUiSelectForm.handleSubmit(event) ⇒ *

handleSubmit

Kind: instance method of GccUiSelectForm
Returns: * - handleFormData
See: https://developers.google.com/apps-script/guides/html/communication#index.html_4

Param Type Description
event object Event object

gccUiSelectForm.handleSubmitFailCb(serverResponse)

handleSubmitFailCb

Kind: instance method of GccUiSelectForm
Summary: Message is returned from serverside function

Param Type Description
serverResponse string Server error message

gccUiSelectForm.handleSubmitSuccessCb(serverResponseObj)

handleSubmitSuccessCb

Kind: instance method of GccUiSelectForm
Summary: Callback after the form containing the run and date selects is submitted to the server.

Param Type Description
serverResponseObj object Server response object

gccUiSelectForm.init()

init

Kind: instance method of GccUiSelectForm

gccUiSelectForm.processSelections(serverResponseObj)

processSelections

Kind: instance method of GccUiSelectForm

Param Type Description
serverResponseObj object Server response object

gccUiSelectForm.toggleOptgroups(element)

toggleOptgroups

Kind: instance method of GccUiSelectForm
Summary: When an option is selected from an optgroup, limit other selects to choosing from the same optgroup. This is to prevent runs being chosen from different run sheets / days.

Param Type Description
element HTMLElement Select element

GccUiSelectForm.getInstance(config) ⇒ GccUiSelectForm

getInstance

Kind: static method of GccUiSelectForm
Summary: Note: this refers to class instance in prototype methods and class constructor in static methods.
Returns: GccUiSelectForm - instance of class
See

Param Type Description
config object Config

getIndefiniteArticle(str) ⇒ string

getIndefiniteArticle

Kind: global function
Summary: Get the appropriate indefinite article for the specified string
Returns: string - indefiniteArticle

Param Type Description
str string String

stringToCapitalised(str) ⇒ string

stringToCapitalised

Kind: global function
Summary: Capitalise a string
Returns: string - capitalisedStr

Param Type Description
str string String to convert

stringToId(str) ⇒ string

stringToId

Kind: global function
Summary: Convert a string into a form safe for use as an HTML id attribute.
Returns: string - safeStr

Param Type Description
str string String to convert

errorMessage(value, types, identifier)

errorMessage

Kind: global function
Summary: Generate a validation error message.

Param Type Description
value * Value to validate
types Array Expected type(s)
identifier string Label to use in error message

isArray(value) ⇒ boolean

isArray

Kind: global function
Summary: Validate that a value is an array
Returns: boolean - valid

Param Type Description
value * Value to validate

isBoolean(value) ⇒ boolean

isBoolean

Kind: global function
Summary: Validate that a value is a boolean
Returns: boolean - valid

Param Type Description
value * Value to validate

isNull(value) ⇒ boolean

isNull

Kind: global function
Summary: Validate that a value is null
Returns: boolean - valid

Param Type Description
value * Value to validate

isNumber(value) ⇒ boolean

isNumber

Kind: global function
Summary: Validate that a value is a number
Returns: boolean - valid

Param Type Description
value * Value to validate

isObject(value) ⇒ boolean

isObject

Kind: global function
Summary: Validate that a value is an object
Returns: boolean - valid

Param Type Description
value * Value to validate

isString(value) ⇒ boolean

isString

Kind: global function
Summary: Validate that a value is a string (even an empty one)
Returns: boolean - valid

Param Type Description
value * Value to validate

isString1(value) ⇒ boolean

isString1

Kind: global function
Summary: Validate that a value is a string of at least one character in length
Returns: boolean - valid

Param Type Description
value * Value to validate

isStringNumber(value) ⇒ boolean

isStringNumber

Kind: global function
Summary: Validate that a value is a number
Returns: boolean - valid

Param Type Description
value * Value to validate

validate(value, type, identifier, condition) ⇒ *

validate

Kind: global function
Summary: Validate a value against a type.
Returns: * - value

Param Type Default Description
value * Value to validate
type string Expected type
identifier string Label to use in error message
condition boolean true Validate if condition is true

doGet(e) ⇒ *

doGet

Kind: global function
Summary: Function which runs when the web app is visited in a web browser. Do not edit.
Returns: * - - The GsheetCompostCollections library will load the web page.

Param Type Description
e object An event parameter that can contain information about any request parameters.

gccMiddleware(classMethod, ...args) ⇒ *

gccMiddleware

Kind: global function
Summary: Middleware to call standalone scripts from container-bound environment.
Returns: * - callback - Callable function with args

Param Type Description
classMethod string Class.method (combined arguments to facilitate find and replace in codebase)
...args * Args for callable function

gccSheetHandleEdit(e) ⇒ *

gccSheetHandleEdit

Kind: global function
Summary: Run when the spreadsheet is edited. 'Installable Trigger' (Triggers > Add Trigger) Differs from a 'Simple Trigger' (i.e. handleEdit in Main.gs) in that it can access services that require authorization.
Returns: * - callback

Param Type Description
e object Trigger event object

gccSheetHandleOpen() ⇒ *

gccSheetHandleOpen

Kind: global function
Summary: Run when the spreadsheet is opened. 'Installable Trigger' (Triggers > Add Trigger) Differs from a 'Simple Trigger' (i.e. handleEdit in Main.gs) in that it can access services that require authorization.
Returns: * - callback

getResultsFromServer() ⇒ *

Kind: global function
Summary: Retrieve test results when ready.
Returns: * - - Test results