diff --git a/PROJECT/Exercise Files/.DS_Store b/PROJECT/Exercise Files/.DS_Store new file mode 100644 index 0000000..39435d3 Binary files /dev/null and b/PROJECT/Exercise Files/.DS_Store differ diff --git a/PROJECT/Exercise Files/feature-chan-map/.DS_Store b/PROJECT/Exercise Files/feature-chan-map/.DS_Store new file mode 100644 index 0000000..36b01d9 Binary files /dev/null and b/PROJECT/Exercise Files/feature-chan-map/.DS_Store differ diff --git a/PROJECT/Exercise Files/feature-chan-map/RecordMap/RecordMap.cmp b/PROJECT/Exercise Files/feature-chan-map/RecordMap/RecordMap.cmp new file mode 100644 index 0000000..34d84b7 --- /dev/null +++ b/PROJECT/Exercise Files/feature-chan-map/RecordMap/RecordMap.cmp @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PROJECT/Exercise Files/feature-chan-map/RecordMap/RecordMap.cmp-meta.xml b/PROJECT/Exercise Files/feature-chan-map/RecordMap/RecordMap.cmp-meta.xml new file mode 100644 index 0000000..1bd1278 --- /dev/null +++ b/PROJECT/Exercise Files/feature-chan-map/RecordMap/RecordMap.cmp-meta.xml @@ -0,0 +1,5 @@ + + + 47.0 + A Lightning Component Bundle + \ No newline at end of file diff --git a/PROJECT/Exercise Files/feature-chan-map/RecordMap/RecordMap.css b/PROJECT/Exercise Files/feature-chan-map/RecordMap/RecordMap.css new file mode 100644 index 0000000..e30d87b --- /dev/null +++ b/PROJECT/Exercise Files/feature-chan-map/RecordMap/RecordMap.css @@ -0,0 +1,3 @@ +.THIS .slds-card__body { + margin-bottom: 0; +} \ No newline at end of file diff --git a/PROJECT/Exercise Files/feature-chan-map/RecordMap/RecordMap.design b/PROJECT/Exercise Files/feature-chan-map/RecordMap/RecordMap.design new file mode 100644 index 0000000..63a6b1d --- /dev/null +++ b/PROJECT/Exercise Files/feature-chan-map/RecordMap/RecordMap.design @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/PROJECT/Exercise Files/feature-chan-map/RecordMap/RecordMapController.js b/PROJECT/Exercise Files/feature-chan-map/RecordMap/RecordMapController.js new file mode 100644 index 0000000..1d64690 --- /dev/null +++ b/PROJECT/Exercise Files/feature-chan-map/RecordMap/RecordMapController.js @@ -0,0 +1,31 @@ +({ + doInit : function(component, event, helper) { + component.set("v.fields", ["Id", component.get("v.latField"), component.get("v.longField"), component.get("v.titleField")]); + var recordId = component.get("v.recordId"); + component.set("v.dsRecordId", recordId); + helper.reloadRecord(component); + }, + + recordChangeHandler : function(component, event, helper) { + console.log('recordChangeHandler'); + var id = event.getParam("recordId"); + component.set("v.dsRecordId", id); + helper.reloadRecord(component); + }, + + onRecordUpdated : function(component, event) { + console.log('onRecordUpdated'); + var sObject = component.get("v.sObject"); + if (sObject) { + component.set("v.title", sObject[component.get("v.titleField")]); + component.set("v.mapMarkers", [ + { + location: { + Latitude: sObject[component.get("v.latField")], + Longitude: sObject[component.get("v.longField")] + } + } + ]); + } + } +}) \ No newline at end of file diff --git a/PROJECT/Exercise Files/feature-chan-map/RecordMap/RecordMapHelper.js b/PROJECT/Exercise Files/feature-chan-map/RecordMap/RecordMapHelper.js new file mode 100644 index 0000000..6fe7d5e --- /dev/null +++ b/PROJECT/Exercise Files/feature-chan-map/RecordMap/RecordMapHelper.js @@ -0,0 +1,17 @@ +({ + reloadRecord : function(component) { + var service = component.find("service"); + service.reloadRecord(false, function() { + var sObject = component.get("v.sObject"); + component.set("v.mapMarkers", [ + { + location: { + Latitude: sObject[component.get("v.latField")], + Longitude: sObject[component.get("v.longField")] + } + } + ]); + }); + } + +}) \ No newline at end of file diff --git a/PROJECT/Exercise Files/feature-maria-gallery/.DS_Store b/PROJECT/Exercise Files/feature-maria-gallery/.DS_Store new file mode 100644 index 0000000..2e92a97 Binary files /dev/null and b/PROJECT/Exercise Files/feature-maria-gallery/.DS_Store differ diff --git a/PROJECT/Exercise Files/feature-maria-gallery/PictureCarousel/.DS_Store b/PROJECT/Exercise Files/feature-maria-gallery/PictureCarousel/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/PROJECT/Exercise Files/feature-maria-gallery/PictureCarousel/.DS_Store differ diff --git a/PROJECT/Exercise Files/feature-maria-gallery/PictureCarousel/PictureCarousel.cmp b/PROJECT/Exercise Files/feature-maria-gallery/PictureCarousel/PictureCarousel.cmp new file mode 100644 index 0000000..e2d445f --- /dev/null +++ b/PROJECT/Exercise Files/feature-maria-gallery/PictureCarousel/PictureCarousel.cmp @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PROJECT/Exercise Files/feature-maria-gallery/PictureCarousel/PictureCarousel.cmp-meta.xml b/PROJECT/Exercise Files/feature-maria-gallery/PictureCarousel/PictureCarousel.cmp-meta.xml new file mode 100644 index 0000000..57c925e --- /dev/null +++ b/PROJECT/Exercise Files/feature-maria-gallery/PictureCarousel/PictureCarousel.cmp-meta.xml @@ -0,0 +1,5 @@ + + + 47.0 + A Lightning Component Bundle + diff --git a/PROJECT/Exercise Files/feature-maria-gallery/PictureCarousel/PictureCarousel.css b/PROJECT/Exercise Files/feature-maria-gallery/PictureCarousel/PictureCarousel.css new file mode 100644 index 0000000..0cf6a84 --- /dev/null +++ b/PROJECT/Exercise Files/feature-maria-gallery/PictureCarousel/PictureCarousel.css @@ -0,0 +1,57 @@ +.THIS { + position: relative; + width: 100%; + height: 100%; + overflow: hidden; +} + +.THIS * { + box-sizing: border-box; +} + +.THIS .filmstrip { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + transition: all .5s ease-in-out; + height: 100%; + display: inline-block; + white-space: nowrap; +} + +.THIS .slide { + height: 100%; + display: inline-block; + background-size: cover; + background-repeat: no-repeat; + background-position: center; +} + +.THIS .btn { + position: absolute; +} + +.THIS .btn.next { + top: 44%; + right: 6px; +} + +.THIS .btn.prev { + top: 44%; + left: 6px; +} + +.THIS .btn.fullscreen, +.THIS .btn.close +{ + bottom: 0; + left: 0; +} + +.THIS .btn.x-large .slds-button { + width: 3.5rem; + height: 3.5rem; +} +.THIS .btn.x-large .slds-button__icon { + width: 1.7rem; + height: 1.7rem; +} \ No newline at end of file diff --git a/PROJECT/Exercise Files/feature-maria-gallery/PictureCarousel/PictureCarouselController.js b/PROJECT/Exercise Files/feature-maria-gallery/PictureCarousel/PictureCarouselController.js new file mode 100644 index 0000000..67b4d69 --- /dev/null +++ b/PROJECT/Exercise Files/feature-maria-gallery/PictureCarousel/PictureCarouselController.js @@ -0,0 +1,19 @@ +({ + next: function(component) { + var slideIndex = component.get("v.slideIndex"); + var slides = component.get("v.slides"); + if (slideIndex + 1 < slides.length) { + slideIndex = slideIndex + 1; + component.set("v.slideIndex", slideIndex); + } + }, + + prev: function(component) { + var slideIndex = component.get("v.slideIndex"); + if (slideIndex > 0) { + slideIndex = slideIndex - 1; + component.set("v.slideIndex", slideIndex); + } + } + +}) \ No newline at end of file diff --git a/PROJECT/Exercise Files/feature-maria-gallery/PictureCarousel/PictureCarouselHelper.js b/PROJECT/Exercise Files/feature-maria-gallery/PictureCarousel/PictureCarouselHelper.js new file mode 100644 index 0000000..8f4a313 --- /dev/null +++ b/PROJECT/Exercise Files/feature-maria-gallery/PictureCarousel/PictureCarouselHelper.js @@ -0,0 +1,6 @@ +({ + setSlideWidth: function (component) { + var slideWidth = component.find("gallery").getElement().offsetWidth; + component.set("v.slideWidth", slideWidth); + } +}) \ No newline at end of file diff --git a/PROJECT/Exercise Files/feature-maria-gallery/PictureCarousel/PictureCarouselRenderer.js b/PROJECT/Exercise Files/feature-maria-gallery/PictureCarousel/PictureCarouselRenderer.js new file mode 100644 index 0000000..986894f --- /dev/null +++ b/PROJECT/Exercise Files/feature-maria-gallery/PictureCarousel/PictureCarouselRenderer.js @@ -0,0 +1,6 @@ +({ + afterRender: function (component, helper) { + this.superAfterRender(); + helper.setSlideWidth(component, helper); + } +}) \ No newline at end of file diff --git a/PROJECT/Exercise Files/feature-maria-gallery/PictureGalleryCard/.DS_Store b/PROJECT/Exercise Files/feature-maria-gallery/PictureGalleryCard/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/PROJECT/Exercise Files/feature-maria-gallery/PictureGalleryCard/.DS_Store differ diff --git a/PROJECT/Exercise Files/feature-maria-gallery/PictureGalleryCard/PictureGalleryCard.cmp b/PROJECT/Exercise Files/feature-maria-gallery/PictureGalleryCard/PictureGalleryCard.cmp new file mode 100644 index 0000000..38b64eb --- /dev/null +++ b/PROJECT/Exercise Files/feature-maria-gallery/PictureGalleryCard/PictureGalleryCard.cmp @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PROJECT/Exercise Files/feature-maria-gallery/PictureGalleryCard/PictureGalleryCard.cmp-meta.xml b/PROJECT/Exercise Files/feature-maria-gallery/PictureGalleryCard/PictureGalleryCard.cmp-meta.xml new file mode 100644 index 0000000..57c925e --- /dev/null +++ b/PROJECT/Exercise Files/feature-maria-gallery/PictureGalleryCard/PictureGalleryCard.cmp-meta.xml @@ -0,0 +1,5 @@ + + + 47.0 + A Lightning Component Bundle + diff --git a/PROJECT/Exercise Files/feature-maria-gallery/PictureGalleryCard/PictureGalleryCard.css b/PROJECT/Exercise Files/feature-maria-gallery/PictureGalleryCard/PictureGalleryCard.css new file mode 100644 index 0000000..465d1d1 --- /dev/null +++ b/PROJECT/Exercise Files/feature-maria-gallery/PictureGalleryCard/PictureGalleryCard.css @@ -0,0 +1,21 @@ +.THIS * { + box-sizing: border-box; +} + +.THIS .slds-card__body { + height: 340px; + margin-bottom: 0; +} + +.THIS .slds-modal__container { + margin-top: 100px; + height: 90%; + width: 90%; + max-width: initial; +} + +.THIS .slds-modal__close { + position: absolute; + top: 100px; + right: 5%; +} \ No newline at end of file diff --git a/PROJECT/Exercise Files/feature-maria-gallery/PictureGalleryCard/PictureGalleryCard.design b/PROJECT/Exercise Files/feature-maria-gallery/PictureGalleryCard/PictureGalleryCard.design new file mode 100644 index 0000000..9e7c300 --- /dev/null +++ b/PROJECT/Exercise Files/feature-maria-gallery/PictureGalleryCard/PictureGalleryCard.design @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/PROJECT/Exercise Files/feature-maria-gallery/PictureGalleryCard/PictureGalleryCard.svg b/PROJECT/Exercise Files/feature-maria-gallery/PictureGalleryCard/PictureGalleryCard.svg new file mode 100644 index 0000000..a562108 --- /dev/null +++ b/PROJECT/Exercise Files/feature-maria-gallery/PictureGalleryCard/PictureGalleryCard.svg @@ -0,0 +1,14 @@ + + + + image + Created with Sketch. + + + + + + + + + \ No newline at end of file diff --git a/PROJECT/Exercise Files/feature-maria-gallery/PictureGalleryCard/PictureGalleryCardController.js b/PROJECT/Exercise Files/feature-maria-gallery/PictureGalleryCard/PictureGalleryCardController.js new file mode 100644 index 0000000..72073a3 --- /dev/null +++ b/PROJECT/Exercise Files/feature-maria-gallery/PictureGalleryCard/PictureGalleryCardController.js @@ -0,0 +1,19 @@ +({ + doInit : function(component) { + // Hardcoding images in this demo component + component.set("v.slides", [ + 'https://s3-us-west-1.amazonaws.com/sfdc-demo/houses/living_room.jpg', + 'https://s3-us-west-1.amazonaws.com/sfdc-demo/houses/eatinkitchen.jpg', + 'https://s3-us-west-1.amazonaws.com/sfdc-demo/houses/kitchen.jpg' + ]); + }, + + fullScreen : function(component) { + component.set("v.fullScreen", true); + }, + + closeDialog : function(component) { + component.set("v.fullScreen", false); + } + +}) \ No newline at end of file diff --git a/PROJECT/Water4Plants/.eslintignore b/PROJECT/Water4Plants/.eslintignore new file mode 100644 index 0000000..5f7b681 --- /dev/null +++ b/PROJECT/Water4Plants/.eslintignore @@ -0,0 +1,16 @@ +**/lwc/**/*.css +**/lwc/**/*.html +**/lwc/**/*.json +**/lwc/**/*.svg +**/lwc/**/*.xml +**/aura/**/*.auradoc +**/aura/**/*.cmp +**/aura/**/*.css +**/aura/**/*.design +**/aura/**/*.evt +**/aura/**/*.json +**/aura/**/*.svg +**/aura/**/*.tokens +**/aura/**/*.xml +**/aura/**/*.app +.sfdx diff --git a/PROJECT/Water4Plants/.forceignore b/PROJECT/Water4Plants/.forceignore new file mode 100644 index 0000000..7b5b5a7 --- /dev/null +++ b/PROJECT/Water4Plants/.forceignore @@ -0,0 +1,12 @@ +# List files or directories below to ignore them when running force:source:push, force:source:pull, and force:source:status +# More information: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_exclude_source.htm +# + +package.xml + +# LWC configuration files +**/jsconfig.json +**/.eslintrc.json + +# LWC Jest +**/__tests__/** \ No newline at end of file diff --git a/PROJECT/Water4Plants/.gitignore b/PROJECT/Water4Plants/.gitignore new file mode 100644 index 0000000..eecf1a5 --- /dev/null +++ b/PROJECT/Water4Plants/.gitignore @@ -0,0 +1,38 @@ +# This file is used for Git repositories to specify intentionally untracked files that Git should ignore. +# If you are not using git, you can delete this file. For more information see: https://git-scm.com/docs/gitignore +# For useful gitignore templates see: https://github.com/github/gitignore + +# Salesforce cache +.sfdx/ +.localdevserver/ + +# LWC VSCode autocomplete +**/lwc/jsconfig.json + +# LWC Jest coverage reports +coverage/ + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Dependency directories +node_modules/ + +# Eslint cache +.eslintcache + +# MacOS system files +.DS_Store + +# Windows system files +Thumbs.db +ehthumbs.db +[Dd]esktop.ini +$RECYCLE.BIN/ + +# Local environment variables +.env \ No newline at end of file diff --git a/PROJECT/Water4Plants/.prettierignore b/PROJECT/Water4Plants/.prettierignore new file mode 100644 index 0000000..f3720b2 --- /dev/null +++ b/PROJECT/Water4Plants/.prettierignore @@ -0,0 +1,10 @@ +# List files or directories below to ignore them when running prettier +# More information: https://prettier.io/docs/en/ignore.html +# + +**/staticresources/** +.localdevserver +.sfdx +.vscode + +coverage/ \ No newline at end of file diff --git a/PROJECT/Water4Plants/.prettierrc b/PROJECT/Water4Plants/.prettierrc new file mode 100644 index 0000000..15683b6 --- /dev/null +++ b/PROJECT/Water4Plants/.prettierrc @@ -0,0 +1,13 @@ +{ + "trailingComma": "none", + "overrides": [ + { + "files": "**/lwc/**/*.html", + "options": { "parser": "lwc" } + }, + { + "files": "*.{cmp,page,component}", + "options": { "parser": "html" } + } + ] +} diff --git a/PROJECT/Water4Plants/.vscode/extensions.json b/PROJECT/Water4Plants/.vscode/extensions.json new file mode 100644 index 0000000..7e6cb10 --- /dev/null +++ b/PROJECT/Water4Plants/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "salesforce.salesforcedx-vscode", + "redhat.vscode-xml", + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode", + "financialforce.lana" + ] +} diff --git a/PROJECT/Water4Plants/.vscode/launch.json b/PROJECT/Water4Plants/.vscode/launch.json new file mode 100644 index 0000000..e07e391 --- /dev/null +++ b/PROJECT/Water4Plants/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Launch Apex Replay Debugger", + "type": "apex-replay", + "request": "launch", + "logFile": "${command:AskForLogFileName}", + "stopOnEntry": true, + "trace": true + } + ] +} diff --git a/PROJECT/Water4Plants/.vscode/settings.json b/PROJECT/Water4Plants/.vscode/settings.json new file mode 100644 index 0000000..76decfb --- /dev/null +++ b/PROJECT/Water4Plants/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "search.exclude": { + "**/node_modules": true, + "**/bower_components": true, + "**/.sfdx": true + } +} diff --git a/PROJECT/Water4Plants/README.md b/PROJECT/Water4Plants/README.md new file mode 100644 index 0000000..afcda4a --- /dev/null +++ b/PROJECT/Water4Plants/README.md @@ -0,0 +1,18 @@ +# Salesforce DX Project: Next Steps + +Now that you’ve created a Salesforce DX project, what’s next? Here are some documentation resources to get you started. + +## How Do You Plan to Deploy Your Changes? + +Do you want to deploy a set of changes, or create a self-contained application? Choose a [development model](https://developer.salesforce.com/tools/vscode/en/user-guide/development-models). + +## Configure Your Salesforce DX Project + +The `sfdx-project.json` file contains useful configuration information for your project. See [Salesforce DX Project Configuration](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_config.htm) in the _Salesforce DX Developer Guide_ for details about this file. + +## Read All About It + +- [Salesforce Extensions Documentation](https://developer.salesforce.com/tools/vscode/) +- [Salesforce CLI Setup Guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_intro.htm) +- [Salesforce DX Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_intro.htm) +- [Salesforce CLI Command Reference](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference.htm) diff --git a/PROJECT/Water4Plants/config/project-scratch-def.json b/PROJECT/Water4Plants/config/project-scratch-def.json new file mode 100644 index 0000000..bb72192 --- /dev/null +++ b/PROJECT/Water4Plants/config/project-scratch-def.json @@ -0,0 +1,13 @@ +{ + "orgName": "Demo company", + "edition": "Developer", + "features": ["EnableSetPasswordInApi"], + "settings": { + "lightningExperienceSettings": { + "enableS1DesktopEnabled": true + }, + "mobileSettings": { + "enableS1EncryptedStoragePref2": false + } + } +} diff --git a/PROJECT/Water4Plants/force-app/main/default/aura/.eslintrc.json b/PROJECT/Water4Plants/force-app/main/default/aura/.eslintrc.json new file mode 100644 index 0000000..bde085b --- /dev/null +++ b/PROJECT/Water4Plants/force-app/main/default/aura/.eslintrc.json @@ -0,0 +1,8 @@ +{ + "plugins": ["@salesforce/eslint-plugin-aura"], + "extends": ["plugin:@salesforce/eslint-plugin-aura/recommended", "prettier"], + "rules": { + "vars-on-top": "off", + "no-unused-expressions": "off" + } +} diff --git a/PROJECT/Water4Plants/force-app/main/default/classes/Water4PlantsController.cls b/PROJECT/Water4Plants/force-app/main/default/classes/Water4PlantsController.cls new file mode 100644 index 0000000..940799c --- /dev/null +++ b/PROJECT/Water4Plants/force-app/main/default/classes/Water4PlantsController.cls @@ -0,0 +1,27 @@ +public with sharing class Water4PlantsController { + public Water4PlantsController() { + } + @AuraEnabled(cacheable=true) + public static List getThirstyPlants(Id rootLocationId) { + // Return thirsty plants whose root location matches 'rootLocationId' + // Note: For production app, implement pagination and handle security exceptions gracefully + List plants; + if (rootLocationId != NULL) { + plants = [ + SELECT Id, Name, Nickname__c, Kind__c, Last_Watering__c, Watering_Period__c, Location__r.Name + FROM Plant__c + WHERE Requires_Watering__c = TRUE AND Location__r.RootLocationId = :rootLocationId + WITH SECURITY_ENFORCED + ]; + } + else { + plants = [ + SELECT Id, Name, Nickname__c, Kind__c, Last_Watering__c, Watering_Period__c, Location__r.Name + FROM Plant__c + WHERE Requires_Watering__c = TRUE + WITH SECURITY_ENFORCED + ]; + } + return plants; + } +} \ No newline at end of file diff --git a/PROJECT/Water4Plants/force-app/main/default/classes/Water4PlantsController.cls-meta.xml b/PROJECT/Water4Plants/force-app/main/default/classes/Water4PlantsController.cls-meta.xml new file mode 100644 index 0000000..dd61d1f --- /dev/null +++ b/PROJECT/Water4Plants/force-app/main/default/classes/Water4PlantsController.cls-meta.xml @@ -0,0 +1,5 @@ + + + 52.0 + Active + diff --git a/PROJECT/Water4Plants/force-app/main/default/lwc/.eslintrc.json b/PROJECT/Water4Plants/force-app/main/default/lwc/.eslintrc.json new file mode 100644 index 0000000..d679b1d --- /dev/null +++ b/PROJECT/Water4Plants/force-app/main/default/lwc/.eslintrc.json @@ -0,0 +1,11 @@ +{ + "extends": ["@salesforce/eslint-config-lwc/recommended", "prettier"], + "overrides": [ + { + "files": ["*.test.js"], + "rules": { + "@lwc/lwc/no-unexpected-wire-adapter-usages": "off" + } + } + ] +} diff --git a/PROJECT/Water4Plants/force-app/main/default/lwc/commandCenterCard/commandCenterCard.html b/PROJECT/Water4Plants/force-app/main/default/lwc/commandCenterCard/commandCenterCard.html new file mode 100644 index 0000000..ad58b85 --- /dev/null +++ b/PROJECT/Water4Plants/force-app/main/default/lwc/commandCenterCard/commandCenterCard.html @@ -0,0 +1,16 @@ + + + + + + + + + No plants are thirsty! + + + Error! + + + + \ No newline at end of file diff --git a/PROJECT/Water4Plants/force-app/main/default/lwc/commandCenterCard/commandCenterCard.js b/PROJECT/Water4Plants/force-app/main/default/lwc/commandCenterCard/commandCenterCard.js new file mode 100644 index 0000000..2c9a219 --- /dev/null +++ b/PROJECT/Water4Plants/force-app/main/default/lwc/commandCenterCard/commandCenterCard.js @@ -0,0 +1,83 @@ +import { LightningElement, wire } from 'lwc'; +import { subscribe, unsubscribe, MessageContext, APPLICATION_SCOPE } from 'lightning/messageService'; +import COMMAND_CENTER_MSG_CHANNEL from '@salesforce/messageChannel/lightning__CommandCenterMessageChannel'; +import getThirstyPlants from '@salesforce/apex/Water4PlantsController.getThirstyPlants'; +const columns = [ + { label: 'Plant', fieldName: 'plantUrl', 'initialWidth': 100, 'type': 'url', typeAttributes: { label: { fieldName: 'name' } }}, + { label: 'Kind', fieldName: 'kind', type: 'text' }, + { label: 'Last Watered', fieldName: 'lastWatered', type: 'date', typeAttributes:{ + year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit"} }, + { label: 'Location', fieldName: 'location', type: 'text' } +]; +export default class Water4PlantsCard extends LightningElement { + globalLocationName; + globalLocationId; + subscription; + error; + columns = columns; + plants = Array(); +@wire(MessageContext) +messageContext; +@wire(getThirstyPlants, { rootLocationId: '$globalLocationId' }) +response(value) { + const { error, data } = value; + if (data) { + // Transform Salesforce object data into format for display in data table + this.plants = Array(); + for (var i = 0; i < data.length; i++) { + let plantUrl = (typeof(data[i].Name) != 'undefined') ? '/'+data[i].Id : ''; + this.plants.push ({ + 'id': data[i].Id, + 'plantUrl': plantUrl, + 'name': data[i].Name, + 'kind': data[i].Kind__c, + 'lastWatered': data[i].Last_Watering__c, + 'location': data[i].Location__r.Name + }); + } + this.error = undefined; + } + else if (error) { + this.error = error; + this.issues = []; + } + } + connectedCallback() { + this.subscribeToChannel(); + } + /** + * Subscribe to Command Center Message Channel to listen to global filter changes + */ + subscribeToChannel() { + if (!this.subscription) { + this.subscription = subscribe(this.messageContext, COMMAND_CENTER_MSG_CHANNEL, message => this.handleEvent(message), { + scope: APPLICATION_SCOPE + }); + } + } + /** + * Any time global filter changes are captured get updated values + * @param {} message + */ + handleEvent(message) { + switch (message.EventType) { + case 'CC_LOCATION_CHANGE': { + /* This event returns two attributes within it's EventPayload (locationName & locationId) */ + this.globalLocationName = message.EventPayload.locationName; + this.globalLocationId = message.EventPayload.locationId; + break; + } + default: { + break; + } + } + } + /** + * If disconnected unsubscribe from Message Channel + */ + disconnectedCallback() { + if (this.subscription) { + unsubscribe(this.subscription); + } + } +} \ No newline at end of file diff --git a/PROJECT/Water4Plants/force-app/main/default/lwc/commandCenterCard/commandCenterCard.js-meta.xml b/PROJECT/Water4Plants/force-app/main/default/lwc/commandCenterCard/commandCenterCard.js-meta.xml new file mode 100644 index 0000000..437c2de --- /dev/null +++ b/PROJECT/Water4Plants/force-app/main/default/lwc/commandCenterCard/commandCenterCard.js-meta.xml @@ -0,0 +1,10 @@ + + + 48.0 + true + + lightning__RecordPage + lightning__AppPage + lightning__HomePage + + \ No newline at end of file diff --git a/PROJECT/Water4Plants/jest.config.js b/PROJECT/Water4Plants/jest.config.js new file mode 100644 index 0000000..f5a9fed --- /dev/null +++ b/PROJECT/Water4Plants/jest.config.js @@ -0,0 +1,6 @@ +const { jestConfig } = require('@salesforce/sfdx-lwc-jest/config'); + +module.exports = { + ...jestConfig, + modulePathIgnorePatterns: ['/.localdevserver'] +}; diff --git a/PROJECT/Water4Plants/package.json b/PROJECT/Water4Plants/package.json new file mode 100644 index 0000000..060c432 --- /dev/null +++ b/PROJECT/Water4Plants/package.json @@ -0,0 +1,43 @@ +{ + "name": "salesforce-app", + "private": true, + "version": "1.0.0", + "description": "Salesforce App", + "scripts": { + "lint": "npm run lint:lwc && npm run lint:aura", + "lint:aura": "eslint **/aura/**", + "lint:lwc": "eslint **/lwc/**", + "test": "npm run test:unit", + "test:unit": "sfdx-lwc-jest", + "test:unit:watch": "sfdx-lwc-jest --watch", + "test:unit:debug": "sfdx-lwc-jest --debug", + "test:unit:coverage": "sfdx-lwc-jest --coverage", + "prettier": "prettier --write \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"", + "prettier:verify": "prettier --list-different \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"" + }, + "devDependencies": { + "@prettier/plugin-xml": "^0.12.0", + "@salesforce/eslint-config-lwc": "^0.11.0", + "@salesforce/eslint-plugin-aura": "^2.0.0", + "@salesforce/sfdx-lwc-jest": "^0.10.4", + "eslint": "^7.24.0", + "eslint-config-prettier": "^6.11.0", + "husky": "^4.2.1", + "lint-staged": "^10.0.7", + "prettier": "^2.0.5", + "prettier-plugin-apex": "^1.6.0" + }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "lint-staged": { + "**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}": [ + "prettier --write" + ], + "**/{aura|lwc}/**": [ + "eslint" + ] + } +} diff --git a/PROJECT/Water4Plants/scripts/apex/hello.apex b/PROJECT/Water4Plants/scripts/apex/hello.apex new file mode 100644 index 0000000..1fba732 --- /dev/null +++ b/PROJECT/Water4Plants/scripts/apex/hello.apex @@ -0,0 +1,10 @@ +// Use .apex files to store anonymous Apex. +// You can execute anonymous Apex in VS Code by selecting the +// apex text and running the command: +// SFDX: Execute Anonymous Apex with Currently Selected Text +// You can also execute the entire file by running the command: +// SFDX: Execute Anonymous Apex with Editor Contents + +string tempvar = 'Enter_your_name_here'; +System.debug('Hello World!'); +System.debug('My name is ' + tempvar); \ No newline at end of file diff --git a/PROJECT/Water4Plants/scripts/soql/account.soql b/PROJECT/Water4Plants/scripts/soql/account.soql new file mode 100644 index 0000000..10d4b9c --- /dev/null +++ b/PROJECT/Water4Plants/scripts/soql/account.soql @@ -0,0 +1,6 @@ +// Use .soql files to store SOQL queries. +// You can execute queries in VS Code by selecting the +// query text and running the command: +// SFDX: Execute SOQL Query with Currently Selected Text + +SELECT Id, Name FROM Account diff --git a/PROJECT/Water4Plants/sfdx-project.json b/PROJECT/Water4Plants/sfdx-project.json new file mode 100644 index 0000000..3defd2e --- /dev/null +++ b/PROJECT/Water4Plants/sfdx-project.json @@ -0,0 +1,12 @@ +{ + "packageDirectories": [ + { + "path": "force-app", + "default": true + } + ], + "name": "Water4Plants", + "namespace": "", + "sfdcLoginUrl": "https://login.salesforce.com", + "sourceApiVersion": "52.0" +} diff --git a/PROJECT/sfdx-project b/PROJECT/sfdx-project new file mode 160000 index 0000000..f92a9a5 --- /dev/null +++ b/PROJECT/sfdx-project @@ -0,0 +1 @@ +Subproject commit f92a9a5279afb52ad225d1640dabcf797e6b8175