custom page templates and other changes

This commit is contained in:
Christophe Coenraets 2018-01-02 11:35:23 -05:00
Родитель ce9880b368
Коммит 1b28220d4c
109 изменённых файлов: 3935 добавлений и 417 удалений

Просмотреть файл

@ -10,10 +10,11 @@
<label>DreamHouse</label>
<navType>Standard</navType>
<tab>standard-home</tab>
<tab>Property_Finder</tab>
<tab>Property_Explorer</tab>
<tab>Property__c</tab>
<tab>Broker__c</tab>
<tab>standard-Contact</tab>
<tab>Property_Explorer1</tab>
<tab>Command_Center</tab>
<tab>Einstein_Vision</tab>
<tab>standard-report</tab>

Просмотреть файл

@ -1,32 +0,0 @@
<aura:component implements="force:appHostable" access="global" controller="EinsteinVisionController">
<aura:attribute name="modelId" type="String"/>
<aura:attribute name="files" type="Object[]"/>
<aura:attribute name="predictions" type="Object[]"/>
<aura:attribute name="waiting" type="Boolean" default="false"/>
<aura:attribute name="pictureSrc" type="String" />
<aura:registerEvent name="einsteinVisionEvent" type="c:EinsteinVisionEvent"/>
<div>
<lightning:input aura:id="fileInput" type="file" name="file" multiple="false" accept="image/*;capture=camera" files="{!v.files}" onchange="{! c.readFile }"
label="Select a picture:"/>
<img src="{!v.pictureSrc}"/>
<aura:iteration items="{!v.predictions}" var="prediction">
<lightning:layout >
<lightning:layoutitem ><lightning:icon iconName="utility:preview" size="x-small"/></lightning:layoutitem>
<lightning:layoutitem >{! prediction.formattedProbability}</lightning:layoutitem>
<lightning:layoutitem flexibility="grow">{!prediction.label}</lightning:layoutitem>
</lightning:layout>
</aura:iteration>
<aura:if isTrue="{! v.waiting }">
<lightning:spinner size="large"/>
</aura:if>
</div>
</aura:component>

Просмотреть файл

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>39.0</apiVersion>
<description>A Lightning Component Bundle</description>
</AuraDefinitionBundle>

Просмотреть файл

@ -1,50 +0,0 @@
.THIS {
margin: 12px;
}
.THIS td {
padding: 2px;
}
.THIS .probability {
padding-right: 4px;
text-align: right;
}
.THIS {
position: relative;
}
.THIS img {
margin: 8px 0;
height: 150px;
}
.THIS table {
display: block;
width: 100%;
}
.THIS tr {
border-top: 1px dashed rgb(216, 221, 230);
width: 100%;
}
.THIS .slds-grid > div {
padding: 2px 3px 0 3px;
font-size: 12px;
border-bottom: 1px dashed rgb(216, 221, 230);
}
.THIS .slds-file-selector {
margin-top: 4px;
width: 100% !important;
}
.THIS .slds-file-selector__dropzone {
width: 100% !important;
}
.THIS .slds-form-element__label {
display: none;
}

Просмотреть файл

@ -1,3 +0,0 @@
<design:component >
</design:component>

Просмотреть файл

@ -1,20 +0,0 @@
({
readFile: function(component, event, helper) {
var files = component.get("v.files");
if (files && files.length > 0) {
var file = files[0][0];
if (!file.type.match(/(image.*)/)) {
return alert('Image file not supported');
}
var reader = new FileReader();
reader.onloadend = function() {
var dataURL = reader.result;
component.set("v.pictureSrc", dataURL);
helper.upload(component, file, dataURL.match(/,(.*)$/)[1]);
};
reader.readAsDataURL(file);
}
}
})

Просмотреть файл

@ -1,9 +0,0 @@
<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
<aura:attribute name="modelId" type="String"/>
<lightning:card title="Image-Based Search" iconName="utility:preview">
<c:EinsteinVision modelId="{!v.modelId}" />
</lightning:card>
</aura:component>

Просмотреть файл

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>39.0</apiVersion>
<description>A Lightning Component Bundle</description>
</AuraDefinitionBundle>

Просмотреть файл

@ -1,3 +0,0 @@
.THIS {
height: 330px;
}

Просмотреть файл

@ -1,3 +0,0 @@
<design:component label="Image-Based Search">
<design:attribute name="modelId" label="Model Id" description="Einstein Vision Model Id" />
</design:component>

Просмотреть файл

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="240px" height="240px" viewBox="0 0 240 240" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 42 (36781) - http://www.bohemiancoding.com/sketch -->
<title>Slice</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<rect id="Rectangle" fill="#5AA9C8" x="0" y="0" width="240" height="240" rx="8"></rect>
<g id="Group" transform="translate(30.000000, 63.000000)" fill-rule="nonzero" fill="#FFFFFF">
<path d="M176,53.6666667 C160.333333,22 127.666667,0 90,0 C52.3333333,0 19.6666667,22 4,53.6666667 C3,55.6666667 3,58 4,59.6666667 C19.6666667,91.3333333 52.3333333,113.333333 90,113.333333 C127.666667,113.333333 160.333333,91.3333333 176,59.6666667 C177,57.6666667 177,55.6666667 176,53.6666667 L176,53.6666667 Z M90,93.3333333 C69.6666667,93.3333333 53.3333333,77 53.3333333,56.6666667 C53.3333333,36.3333333 69.6666667,20 90,20 C110.333333,20 126.666667,36.3333333 126.666667,56.6666667 C126.666667,77 110.333333,93.3333333 90,93.3333333 L90,93.3333333 Z M90,33.3333333 C77,33.3333333 66.6666667,43.6666667 66.6666667,56.6666667 C66.6666667,69.6666667 77,80 90,80 C103,80 113.333333,69.6666667 113.333333,56.6666667 C113.333333,43.6666667 103,33.3333333 90,33.3333333 L90,33.3333333 Z" id="Shape"></path>
</g>
</g>
</svg>

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Просмотреть файл

@ -1,5 +0,0 @@
({
myAction : function(component, event, helper) {
}
})

Просмотреть файл

@ -1,34 +1,36 @@
<aura:component implements="flexipage:availableForAllPageTypes" access="global" controller="EinsteinVisionController">
<aura:attribute name="datasets" type="Object[]"/>
<aura:attribute name="pathToZip" type="String" default="https://s3-us-west-1.amazonaws.com/sfdc-demo/houses.zip"/>
<aura:attribute name="waiting" type="Boolean" default="false"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<aura:attribute name="datasets" type="Object[]" />
<aura:attribute name="pathToZip" type="String" default="https://s3-us-west-1.amazonaws.com/sfdc-demo/houses.zip" />
<aura:attribute name="waiting" type="Boolean" default="false" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<div>
<lightning:layout verticalAlign="end" class="path-to-zip slds-m-around--small">
<lightning:layoutitem flexibility="grow">
<lightning:input label="ZIP file URL:" value="{!v.pathToZip}"/>
</lightning:layoutitem>
<lightning:layoutitem >
<lightning:button onclick="{!c.onCreateDataset}">Create Dataset</lightning:button>
<lightning:button onclick="{!c.onRefresh}">Refresh Datasets</lightning:button>
</lightning:layoutitem>
</lightning:layout>
<lightning:card title="Create Dataset" iconName="utility:setup" class="slds-m-horizontal_small">
<lightning:layout verticalAlign="end" class="path-to-zip slds-m-around--small">
<lightning:layoutitem flexibility="grow">
<lightning:input label="ZIP file URL:" value="{!v.pathToZip}" />
</lightning:layoutitem>
<lightning:layoutitem>
<lightning:button onclick="{!c.onCreateDataset}">Create Dataset</lightning:button>
<lightning:button onclick="{!c.onRefresh}">Refresh Datasets</lightning:button>
</lightning:layoutitem>
</lightning:layout>
</lightning:card>
<lightning:layout multipleRows="true">
<aura:iteration items="{!v.datasets}" var="dataset">
<lightning:layoutitem size="6" padding="around-small">
<c:EinsteinVisionDataset dataset="{!dataset}" onchange="{!c.datasetChange}"/>
<c:EinsteinVisionDataset dataset="{!dataset}" onchange="{!c.datasetChange}" />
</lightning:layoutitem>
</aura:iteration>
</lightning:layout>
<aura:if isTrue="{! v.waiting }">
<lightning:spinner size="large"/>
</aura:if>
<lightning:spinner size="large" />
</aura:if>
</div>

Просмотреть файл

@ -0,0 +1,6 @@
<aura:documentation>
<aura:description>Documentation</aura:description>
<aura:example name="ExampleName" ref="exampleComponentName" label="Label">
Example Description
</aura:example>
</aura:documentation>

Просмотреть файл

@ -0,0 +1,23 @@
<aura:component implements="lightning:appHomeTemplate" description="Three columns layout" access="global">
<aura:attribute name="left" type="Aura.Component[]" access="global" />
<aura:attribute name="center" type="Aura.Component[]" access="global" />
<aura:attribute name="right" type="Aura.Component[]" access="global" />
<div aura:id="container">
<lightning:layout>
<lightning:layoutItem aura:id="leftColumn" size="2">
{!v.left}
</lightning:layoutItem>
<lightning:layoutItem aura:id="centerColumn" size="6" class="center">
{!v.center}
</lightning:layoutItem>
<lightning:layoutItem aura:id="rightColumn" size="4">
{!v.right}
</lightning:layoutItem>
</lightning:layout>
</div>
</aura:component>

Просмотреть файл

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<AuraDefinitionBundle xmlns="urn:metadata.tooling.soap.sforce.com" fqn="PageTemplate_2_6_4">
<apiVersion>41.0</apiVersion>
<description>A Lightning Component Bundle</description>
</AuraDefinitionBundle>

Просмотреть файл

@ -0,0 +1,3 @@
.THIS .center {
padding: 0 12px;
}

Просмотреть файл

@ -0,0 +1,7 @@
<design:component label="Three columns layout: 2 6 4">
<flexipage:template>
<flexipage:region name="left" defaultWidth="SMALL" />
<flexipage:region name="center" defaultWidth="LARGE" />
<flexipage:region name="right" defaultWidth="SMALL" />
</flexipage:template>
</design:component>

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 661 B

После

Ширина:  |  Высота:  |  Размер: 661 B

Просмотреть файл

@ -0,0 +1,5 @@
({
myAction : function(component, event, helper) {
}
})

Просмотреть файл

@ -0,0 +1,5 @@
({
helperMethod : function() {
}
})

Просмотреть файл

@ -0,0 +1,5 @@
({
// Your renderer method overrides go here
})

Просмотреть файл

@ -0,0 +1,6 @@
<aura:documentation>
<aura:description>Documentation</aura:description>
<aura:example name="ExampleName" ref="exampleComponentName" label="Label">
Example Description
</aura:example>
</aura:documentation>

Просмотреть файл

@ -0,0 +1,23 @@
<aura:component implements="lightning:appHomeTemplate" description="Three columns layout" access="global">
<aura:attribute name="left" type="Aura.Component[]" access="global" />
<aura:attribute name="center" type="Aura.Component[]" access="global" />
<aura:attribute name="right" type="Aura.Component[]" access="global" />
<div aura:id="container">
<lightning:layout>
<lightning:layoutItem aura:id="leftColumn" size="2">
{!v.left}
</lightning:layoutItem>
<lightning:layoutItem aura:id="centerColumn" size="7" class="center">
{!v.center}
</lightning:layoutItem>
<lightning:layoutItem aura:id="rightColumn" size="3">
{!v.right}
</lightning:layoutItem>
</lightning:layout>
</div>
</aura:component>

Просмотреть файл

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<AuraDefinitionBundle xmlns="urn:metadata.tooling.soap.sforce.com" fqn="PageTemplate_2_7_3">
<apiVersion>41.0</apiVersion>
<description>A Lightning Component Bundle</description>
</AuraDefinitionBundle>

Просмотреть файл

@ -0,0 +1,3 @@
.THIS .center {
padding: 0 12px;
}

Просмотреть файл

@ -0,0 +1,7 @@
<design:component label="Three columns layout: 2 7 3">
<flexipage:template>
<flexipage:region name="left" defaultWidth="SMALL" />
<flexipage:region name="center" defaultWidth="LARGE" />
<flexipage:region name="right" defaultWidth="SMALL" />
</flexipage:template>
</design:component>

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="120px" height="120px" viewBox="0 0 120 120" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M120,108 C120,114.6 114.6,120 108,120 L12,120 C5.4,120 0,114.6 0,108 L0,12 C0,5.4 5.4,0 12,0 L108,0 C114.6,0 120,5.4 120,12 L120,108 L120,108 Z" id="Shape" fill="#2A739E"/>
<path d="M77.7383308,20 L61.1640113,20 L44.7300055,63.2000173 L56.0543288,63.2000173 L40,99.623291 L72.7458388,54.5871812 L60.907727,54.5871812 L77.7383308,20 Z" id="Path-1" fill="#FFFFFF"/>
</g>
</svg>

После

Ширина:  |  Высота:  |  Размер: 661 B

Просмотреть файл

@ -0,0 +1,5 @@
({
myAction : function(component, event, helper) {
}
})

Просмотреть файл

@ -0,0 +1,5 @@
({
helperMethod : function() {
}
})

Просмотреть файл

@ -0,0 +1,5 @@
({
// Your renderer method overrides go here
})

Просмотреть файл

@ -11,6 +11,7 @@
<aura:attribute name="step" type="String" default="10"/>
<div>
<p class="slds-form-element__label">Price range</p>
<div aura:id="slider" class="slider"/>
</div>

Просмотреть файл

@ -1,19 +1,46 @@
.THIS {
margin-top: 6px;
}
.THIS .slider {
margin: 40px auto 0 auto;
margin: 30px 6px 12px 16px;
max-width: 350px;
}
.THIS .noUi-connect {
background: #0070D2;
}
.THIS .noUi-target,
.THIS .noUi-handle {
box-shadow: none !important;
background: #1F5395;
border: none;
}
.THIS .noUi-target {
background: #FFFFFF;
border: 1px solid rgb(216, 221, 230);
background: #ECEBEA;
border: none;
border-radius: .25rem;
height: 4px;
}
.THIS .noUi-handle {
margin-left: 2px;
border-radius: 50%;
height: 16px;
width: 16px;
background-color: #1F5395;
border: none;
box-shadow: none;
border: none !important;
cursor: pointer;
}
.THIS .noUi-handle::before,
.THIS .noUi-handle::after {
display: none;
}
.THIS .noUi-tooltip {
border: none;
background-color: transparent;
color: rgb(112, 110, 107);
font-size: .75rem;
line-height: 1.5;
padding: 0;
}

Просмотреть файл

@ -30,7 +30,7 @@
}
});
slider.noUiSlider.on('change', $A.getCallback(function(range) {
slider.noUiSlider.on('update', $A.getCallback(function(range) {
function convert(value) {
if (value.indexOf('M') > 0) {
@ -41,12 +41,12 @@
}
}
var myEvent = $A.get("e.c:RangeChange");
myEvent.setParams({
var rangeChangeEvent = component.getEvent("rangeChange");
rangeChangeEvent.setParams({
"minValue": convert(range[0]),
"maxValue": convert(range[1])
});
myEvent.fire();
rangeChangeEvent.fire();
}));
}
})

Просмотреть файл

@ -15,7 +15,7 @@
<aura:handler event="ltng:selectSObject" action="{!c.recordChangeHandler}"/>
<div>
<lightning:card title="Days on the market" iconName="utility:event">
<lightning:layout >
<lightning:layoutitem class="{! 'days-block ' + v.status}">
<div class="days">{!v.property.Days_On_Market__c}</div>days
@ -29,6 +29,6 @@
</div>
</lightning:layoutitem>
</lightning:layout>
</div>
</lightning:card>
</aura:component>

Просмотреть файл

@ -1,3 +1,7 @@
.THIS .slds-card__body {
padding: 0 12px;
}
.THIS .days-block {
text-align: center;
margin-right: 8px;

Просмотреть файл

@ -0,0 +1,8 @@
<aura:event type="APPLICATION" description="Event template">
<aura:attribute name="searchKey" type="String"/>
<aura:attribute name="minPrice" type="Decimal"/>
<aura:attribute name="maxPrice" type="Decimal"/>
<aura:attribute name="numberBedrooms" type="Integer"/>
<aura:attribute name="numberBathrooms" type="Integer"/>
<aura:attribute name="visualSearchKey" type="String"/>
</aura:event>

Просмотреть файл

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<AuraDefinitionBundle xmlns="urn:metadata.tooling.soap.sforce.com" fqn="PropertyFilterChange">
<apiVersion>41.0</apiVersion>
<description>A Lightning Event Bundle</description>
</AuraDefinitionBundle>

Просмотреть файл

@ -0,0 +1,6 @@
<aura:documentation>
<aura:description>Documentation</aura:description>
<aura:example name="ExampleName" ref="exampleComponentName" label="Label">
Example Description
</aura:example>
</aura:documentation>

Просмотреть файл

@ -0,0 +1,31 @@
<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
<aura:attribute name="einsteinVisionModelId" type="String" access="global"/>
<aura:attribute name="searchKey" type="String" default=""/>
<aura:attribute name="minPrice" type="Decimal" default="0"/>
<aura:attribute name="maxPrice" type="Decimal" default="2000000"/>
<aura:attribute name="numberBedrooms" type="Integer" default="0"/>
<aura:attribute name="numberBathrooms" type="Integer" default="0"/>
<aura:attribute name="visualSearchKey" type="String" default=""/>
<aura:registerEvent name="propertyFilterChange" type="c:PropertyFilterChange"/>
<lightning:card title="Filters" iconName="utility:rating">
<lightning:input label="Search"
onchange="{!c.onFilterChange}" value="{!v.searchKey}"/>
<c:PriceRange min="200000" max="1200000" step="50000"
rangeChange="{!c.onPriceRangeChange}"/>
<lightning:slider label="Bedrooms" step="1" min="0" max="6" value="{!v.numberBedrooms}"
onchange="{!c.onFilterChange}"/>
<lightning:slider label="Bathrooms" step="1" min="0" max="6" value="{!v.numberBathrooms}"
onchange="{!c.onFilterChange}"/>
<c:VisualSearchBox modelId="{!v.einsteinVisionModelId}" onPrediction="{!c.onPrediction}" />
</lightning:card>
</aura:component>

Просмотреть файл

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<AuraDefinitionBundle xmlns="urn:metadata.tooling.soap.sforce.com" fqn="PropertyFilters">
<apiVersion>41.0</apiVersion>
<description>A Lightning Component Bundle</description>
</AuraDefinitionBundle>

Просмотреть файл

@ -0,0 +1,11 @@
.THIS .slds-card__body {
padding: 0 12px;
}
.THIS .slds-slider__range::-webkit-slider-thumb {
box-shadow: none;
}
.THIS .slds-slider-label__label {
margin-top: 6px;
}

Просмотреть файл

@ -0,0 +1,5 @@
<design:component >
<design:attribute name="einsteinVisionModelId"
label="Einstein Vision Model Id"
description="Einstein Vision Model Id" />
</design:component>

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="120px" height="120px" viewBox="0 0 120 120" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M120,108 C120,114.6 114.6,120 108,120 L12,120 C5.4,120 0,114.6 0,108 L0,12 C0,5.4 5.4,0 12,0 L108,0 C114.6,0 120,5.4 120,12 L120,108 L120,108 Z" id="Shape" fill="#2A739E"/>
<path d="M77.7383308,20 L61.1640113,20 L44.7300055,63.2000173 L56.0543288,63.2000173 L40,99.623291 L72.7458388,54.5871812 L60.907727,54.5871812 L77.7383308,20 Z" id="Path-1" fill="#FFFFFF"/>
</g>
</svg>

После

Ширина:  |  Высота:  |  Размер: 661 B

Просмотреть файл

@ -0,0 +1,20 @@
({
onPriceRangeChange : function(component, event, helper) {
component.set("v.minPrice", event.getParam("minValue"));
component.set("v.maxPrice", event.getParam("maxValue"));
helper.fireFilterChangeEvent(component);
},
onFilterChange : function(component, event, helper) {
helper.fireFilterChangeEvent(component);
},
onPrediction: function (component, event, helper) {
var predictions = event.getParam("predictions");
if (predictions && predictions.length > 0) {
component.set("v.visualSearchKey", predictions[0].label);
helper.fireFilterChangeEvent(component);
}
},
})

Просмотреть файл

@ -0,0 +1,14 @@
({
fireFilterChangeEvent : function(component) {
var filterChangeEvent = $A.get("e.c:PropertyFilterChange");
filterChangeEvent.setParams({
"searchKey": component.get("v.searchKey"),
"minPrice": component.get("v.minPrice"),
"maxPrice": component.get("v.maxPrice"),
"numberBedrooms": component.get("v.numberBedrooms"),
"numberBathrooms": component.get("v.numberBathrooms"),
"visualSearchKey": component.get("v.visualSearchKey"),
});
filterChangeEvent.fire();
}
})

Просмотреть файл

@ -0,0 +1,5 @@
({
// Your renderer method overrides go here
})

Просмотреть файл

@ -0,0 +1,6 @@
<aura:documentation>
<aura:description>Documentation</aura:description>
<aura:example name="ExampleName" ref="exampleComponentName" label="Label">
Example Description
</aura:example>
</aura:documentation>

Просмотреть файл

@ -0,0 +1,26 @@
<aura:component implements="flexipage:availableForAllPageTypes" controller="PropertyController" access="global">
<ltng:require styles="{!$Resource.leaflet1 + '/leaflet.css'}"
scripts="{!$Resource.leaflet1 + '/leaflet.js'}"
afterScriptsLoaded="{!c.onJSLoaded}" />
<aura:attribute name="searchKey" type="String" default=""/>
<aura:attribute name="minPrice" type="integer" default="0"/>
<aura:attribute name="maxPrice" type="integer" default="10000000"/>
<aura:attribute name="numberBedrooms" type="integer" default="0"/>
<aura:attribute name="numberBathrooms" type="integer" default="0"/>
<aura:attribute name="visualSearchKey" type="String" default=""/>
<aura:attribute name="properties" type="Object[]" default="[]" />
<aura:attribute name="center" type="SObject" access="global" />
<aura:attribute name="jsLoaded" type="boolean" default="false" />
<aura:registerEvent name="selectSObject" type="ltng:selectSObject"/>
<aura:handler name="init" value="{!this}" action="{!c.onInit}" />
<aura:handler event="c:PropertyFilterChange" action="{!c.onFilterChange}"/>
<lightning:card>
<div aura:id="map"></div>
</lightning:card>
</aura:component>

Просмотреть файл

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<AuraDefinitionBundle xmlns="urn:metadata.tooling.soap.sforce.com" fqn="PropertyListMap">
<apiVersion>41.0</apiVersion>
<description>A Lightning Component Bundle</description>
</AuraDefinitionBundle>

Просмотреть файл

@ -0,0 +1,15 @@
.THIS {
width: 100%;
}
.THIS .leaflet-container {
height: 400px;
}
.THIS .slds-card__header {
display: none;
}
.THIS .slds-card__body {
margin-bottom: 0;
}

Просмотреть файл

@ -0,0 +1,3 @@
<design:component >
</design:component>

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="120px" height="120px" viewBox="0 0 120 120" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M120,108 C120,114.6 114.6,120 108,120 L12,120 C5.4,120 0,114.6 0,108 L0,12 C0,5.4 5.4,0 12,0 L108,0 C114.6,0 120,5.4 120,12 L120,108 L120,108 Z" id="Shape" fill="#2A739E"/>
<path d="M77.7383308,20 L61.1640113,20 L44.7300055,63.2000173 L56.0543288,63.2000173 L40,99.623291 L72.7458388,54.5871812 L60.907727,54.5871812 L77.7383308,20 Z" id="Path-1" fill="#FFFFFF"/>
</g>
</svg>

После

Ширина:  |  Высота:  |  Размер: 661 B

Просмотреть файл

@ -0,0 +1,20 @@
({
onInit: function (component, event, helper) {
helper.getProperties(component);
},
onJSLoaded: function (component) {
component.set("v.jsLoaded", true);
},
onFilterChange: function (component, event, helper) {
component.set("v.searchKey", event.getParam("searchKey"));
component.set("v.minPrice", event.getParam("minPrice"));
component.set("v.maxPrice", event.getParam("maxPrice"));
component.set("v.numberBedrooms", event.getParam("numberBedrooms"));
component.set("v.numberBathrooms", event.getParam("numberBathrooms"));
component.set("v.visualSearchKey", event.getParam("visualSearchKey"));
helper.getProperties(component);
}
})

Просмотреть файл

@ -0,0 +1,19 @@
({
getProperties : function(component) {
var action = component.get("c.getPropertyList");
action.setParams({
"searchKey": component.get("v.searchKey"),
"minPrice": component.get("v.minPrice"),
"maxPrice": component.get("v.maxPrice"),
"numberBedrooms": component.get("v.numberBedrooms"),
"numberBathrooms": component.get("v.numberBathrooms"),
"visualSearchKey": component.get("v.visualSearchKey")
});
action.setStorable();
action.setCallback(this, function (response) {
var properties = response.getReturnValue();
component.set("v.properties", properties);
});
$A.enqueueAction(action);
}
})

Просмотреть файл

@ -0,0 +1,53 @@
({
rerender: function (component) {
var nodes = this.superRerender();
// If the Leaflet library is not yet loaded, we can't draw the map: return
if (!window.L) {
return nodes;
}
// Draw the map if it hasn't been drawn yet
if (!component.map) {
var mapElement = component.find("map").getElement();
component.map = L.map(mapElement, {zoomControl: true}).setView([42.356045, -71.085650], 13);
component.map.scrollWheelZoom.disable();
window.L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {attribution: 'Tiles © Esri'}).addTo(component.map);
}
var center = component.get('v.center');
if (center && center.lat && center.long) {
component.map.setView(center);
}
if (component.layerGroup) {
component.map.removeLayer(component.layerGroup)
}
var properties = component.get("v.properties");
var markers = [];
properties.forEach(function(property) {
var latLng = [property.Location__Latitude__s, property.Location__Longitude__s];
var myIcon = L.divIcon({
className: 'my-div-icon',
html: '<svg width="28" height="28" viewBox="0 0 100 100"><g><path fill="#235493" d="m78.8 51.2h-6.3v27.5c0 0.8-0.5 1.2-1.3 1.2h-12.4c-0.8 0-1.3-0.5-1.3-1.2v-21.2h-15v21.2c0 0.8-0.5 1.2-1.3 1.2h-12.4c-0.8 0-1.3-0.5-1.3-1.2v-27.5h-6.3c-0.5 0-1-0.2-1.1-0.8-0.3-0.5-0.1-1 0.3-1.4l28.8-28.8c0.5-0.5 1.4-0.5 1.8 0l28.8 28.8c0.4 0.4 0.4 0.9 0.3 1.4s-0.8 0.8-1.3 0.8z"></path></g>'
});
var marker = window.L.marker(latLng, {icon: myIcon});
marker.propertyId = property.Id;
marker.on("click", function(event) {
var selectEvent = $A.get("e.ltng:selectSObject");
selectEvent.setParams({"recordId": event.target.propertyId, channel: "Properties"});
selectEvent.fire();
});
markers.push(marker);
});
component.layerGroup = L.layerGroup(markers);
component.layerGroup.addTo(component.map);
return nodes;
}
})

Просмотреть файл

@ -1,42 +1,59 @@
<aura:component implements="force:hasRecordId,flexipage:availableForAllPageTypes" access="global">
<aura:attribute name="recordId" type="Id" />
<aura:attribute name="property" type="Property__c" />
<force:recordData aura:id="service"
recordId="{!v.recordId}"
targetFields="{!v.property}"
fields="['Id', 'Thumbnail__c', 'Address__c', 'City__c', 'Price__c', 'Beds__c', 'Baths__c', 'Date_Listed__c']" />
<aura:handler event="ltng:selectSObject" action="{!c.recordChangeHandler}"/>
<lightning:card >
<aura:set attribute="title">
<lightning:icon iconName="standard:household"/>
<span class="title">Summary</span>
</aura:set>
<aura:attribute name="recordId" type="Id" />
<aura:attribute name="property" type="Property__c" />
<force:recordData aura:id="propertyService"
recordId="{!v.recordId}"
targetFields="{!v.property}"
fields="['Id', 'Thumbnail__c', 'Address__c', 'City__c', 'Price__c', 'Beds__c', 'Baths__c', 'Date_Listed__c', 'Broker__c', 'Broker__r.Name', 'Broker__r.Title__c', 'Broker__r.Mobile_Phone__c', 'Broker__r.Picture__c']"/>
<aura:handler event="ltng:selectSObject" action="{!c.onPropertySelected}" />
<lightning:card title="{! v.property.Address__c + ' ' + v.property.City__c}" iconName="utility:checkin">
<aura:set attribute="actions">
<lightning:buttonIcon iconName="utility:edit" variant="bare" alternativeText="Edit Record" onclick="{!c.editRecord}" />
</aura:set>
<aura:if isTrue="{!v.recordId==undefined}">
<div aura:id="selectSection" class="select slds-text-color--weak">
Select a property
Select a property to see details here
</div>
</aura:if>
<aura:if isTrue="{!v.recordId!=undefined}">
<img src="{!v.property.Thumbnail__c}"/>
<div class="summary">
<p>{!v.property.Address__c},&nbsp;{!v.property.City__c}</p>
<p>{!v.property.Beds__c} bedrooms, {!v.property.Baths__c} bathrooms</p>
<p>On the market since <c:FormattedDate value="{!v.property.Date_Listed__c}"/></p>
<h3><lightning:formattedNumber value="{!v.property.Price__c}" style="currency" currencyCode="USD"/></h3>
</div>
<lightning:layout verticalAlign="center">
<lightning:layoutItem padding="horizontal-small">
<aura:if isTrue="{!v.property.Thumbnail__c}"> <!-- to make sure we don't show a broken image before the record is loaded -->
<img src="{!v.property.Thumbnail__c}" class="property-pic" />
</aura:if>
</lightning:layoutItem>
<lightning:layoutItem>
<div>
<p>Bedrooms: {!v.property.Beds__c}</p>
<p>Bathrooms: {!v.property.Baths__c}</p>
<p>Date Listed: <c:FormattedDate value="{!v.property.Date_Listed__c}" /></p>
<h3><lightning:formattedNumber value="{!v.property.Price__c}" style="currency" currencyCode="USD" minimumFractionDigits="0" maximumFractionDigits="0" /></h3>
</div>
</lightning:layoutItem>
</lightning:layout>
<lightning:layout verticalAlign="center">
<lightning:layoutItem padding="around-small">
<aura:if isTrue="{!v.property.Broker__r.Picture__c}"> <!-- to make sure we don't show a broken image before the record is loaded -->
<img src="{!v.property.Broker__r.Picture__c}" class="broker-pic" />
</aura:if>
</lightning:layoutItem>
<lightning:layoutItem>
<div>
<p><a onclick="{!c.navigateToRecord}">{!v.property.Broker__r.Name}</a></p>
<p>{!v.property.Broker__r.Title__c}</p>
<p>{!v.property.Broker__r.Mobile_Phone__c}</p>
</div>
</lightning:layoutItem>
</lightning:layout>
</aura:if>
</lightning:card>
</aura:component>

Просмотреть файл

@ -1,40 +1,27 @@
.THIS .slds-card__body {
padding: 0 16px 0 12px;
display: flex;
height: 100px;
.THIS {
min-height: 226px;
}
.THIS .slds-card__body > div {
flex: 1;
padding: 8px 16px 0 16px;
}
.THIS .slds-card__body .summary {
text-align: left;
}
.THIS img {
.THIS .property-pic {
height: 90px;
width: 90px;
border: none;
}
.THIS .broker-pic {
height: 50px;
width: 50px;
border-radius: 50%;
border: none;
}
.THIS .slds-icon-standard-household {
background-color: transparent;
}
.THIS .slds-icon-standard-household svg {
fill: #54698D;
}
.THIS h3 {
font-size: 18px;
font-size: 16px;
color: #0070D2;
font-weight: 300;
margin-top: 2px;
}
.THIS .select {
margin-top: 20px;
text-align: center;
margin-top: 60px;
}

Просмотреть файл

@ -1,18 +1,27 @@
({
recordChangeHandler : function(component, event) {
var id = event.getParam("recordId");
component.set("v.recordId", id);
var service = component.find("service");
service.reloadRecord();
},
editRecord : function(component, event, helper) {
/*
When a new Property is selected (in another component), load the corresponding
property record.
*/
onPropertySelected: function (component, event) {
component.set("v.recordId", event.getParam("recordId"));
var propertyService = component.find("propertyService");
propertyService.reloadRecord();
},
editRecord: function (component, event, helper) {
var recordId = component.get("v.recordId")
var editRecordEvent = $A.get("e.force:editRecord");
editRecordEvent.setParams({
"recordId": recordId
});
editRecordEvent.fire();
editRecordEvent.fire();
},
navigateToRecord : function(component, event) {
var navigateEvent = $A.get("e.force:navigateToSObject");
navigateEvent.setParams({"recordId": component.get("v.brokerId"), slideDevName: "detail"});
navigateEvent.fire();
}
})

Просмотреть файл

@ -8,10 +8,10 @@
<a onclick="{!c.propertySelected}">
<div style="{# 'background-image:url(' + v.property.Thumbnail__c + ')'}">
<div class="lower-third">
<h1 class="truncate">{#v.property.Title__c}</h1>
<div>{#v.property.City__c}</div>
<div>Beds: {#v.property.Beds__c}&nbsp;&nbsp;&nbsp;Baths: {#v.property.Baths__c}</div>
<div><lightning:formattedNumber value="{#v.property.Price__c}" style="currency" currencyCode="USD"/></div>
<h1 class="truncate">{#v.property.Address__c}</h1>
<p>{#v.property.City__c}, {#v.property.State__c}</p>
<p>Beds: {#v.property.Beds__c}&nbsp;&nbsp;&nbsp;Baths: {#v.property.Baths__c}</p>
<p><lightning:formattedNumber value="{#v.property.Price__c}" style="currency" currencyCode="USD" minimumFractionDigits="0" maximumFractionDigits="0"/></p>
</div>
<lightning:buttonIcon iconName="utility:zoomin" variant="bare-inverse" size="medium" onclick="{!c.navigateToDetailsView}" class="open-button"/>
</div>

Просмотреть файл

@ -1,8 +1,6 @@
.THIS > div {
position:relative;
display: inline-block;
/*margin: 3px 6px;
padding: 1rem;*/
width: 100%;
height: 220px;
background-size: cover;
@ -15,21 +13,18 @@
bottom: 0;
left: 0;
right: 0;
color: #FFFFFF;
background-color: rgba(0, 0, 0, .4);
color: #FFF;
background-color: rgba(0, 0, 0, .3);
padding: 6px 8px;
/*border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;*/
}
.THIS .lower-third > div {
/*font-weight: 300;*/
.THIS .lower-third > p {
padding: 0;
margin: 0;
}
.THIS .lower-third h1 {
font-size: 18px !important;
font-size: 16px !important;
padding: 0;
margin: 0;
}

Просмотреть файл

@ -3,27 +3,30 @@
<aura:attribute name="properties" type="Property__c[]"/>
<aura:attribute name="pageSize" type="integer" default="8"/>
<aura:attribute name="page" type="integer"/>
<aura:attribute name="pageNumber" type="integer"/>
<aura:attribute name="pages" type="integer"/>
<aura:attribute name="total" type="integer"/>
<aura:attribute name="searchKey" type="String" default=""/>
<aura:attribute name="minPrice" type="integer" default="0"/>
<aura:attribute name="maxPrice" type="integer" default="10000000"/>
<aura:attribute name="numberBedrooms" type="integer" default="0"/>
<aura:attribute name="numberBathrooms" type="integer" default="0"/>
<aura:attribute name="visualSearchKey" type="String" default=""/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<aura:handler event="c:RangeChange" action="{!c.onRangeChange}"/>
<aura:handler event="c:EinsteinVisionEvent" action="{!c.onEinsteinVisionEvent}"/>
<aura:handler event="c:PropertyFilterChange" action="{!c.onFilterChange}"/>
<lightning:layout horizontalAlign="center" multipleRows="true">
<aura:iteration items="{!v.properties}" var="property">
<lightning:layoutItem padding="around-small" size="12" smallDeviceSize="6" mediumDeviceSize="4" largeDeviceSize="3">
<c:PropertyTile property="{#property}"/>
</lightning:layoutItem>
</aura:iteration>
</lightning:layout>
<c:PropertyPaginator page="{!v.page}" pages="{!v.pages}" total="{!v.total}"
pagePrevious="{!c.onPagePrevious}" pageNext="{!c.onPageNext}"/>
<lightning:card>
<lightning:layout horizontalAlign="center" multipleRows="true">
<aura:iteration items="{!v.properties}" var="property">
<lightning:layoutItem padding="around-small" size="12" smallDeviceSize="6" mediumDeviceSize="4" largeDeviceSize="3">
<c:PropertyTile property="{#property}"/>
</lightning:layoutItem>
</aura:iteration>
</lightning:layout>
<c:PropertyPaginator page="{!v.pageNumber}" pages="{!v.pages}" total="{!v.total}"
pagePrevious="{!c.onPagePrevious}" pageNext="{!c.onPageNext}"/>
</lightning:card>
</aura:component>

Просмотреть файл

@ -1,3 +1,7 @@
.THIS .slds-card__body {
padding: 0 8px;
}
.THIS .slds-p-around--small {
padding-left: 6px;
padding-right: 6px;

Просмотреть файл

@ -3,30 +3,35 @@
helper.getProperties(component);
},
onRangeChange: function(component, event, helper) {
component.set("v.minPrice", event.getParam("minValue"));
component.set("v.maxPrice", event.getParam("maxValue"));
onFilterChange: function(component, event, helper) {
component.set("v.searchKey", event.getParam("searchKey"));
component.set("v.minPrice", event.getParam("minPrice"));
component.set("v.maxPrice", event.getParam("maxPrice"));
component.set("v.numberBedrooms", event.getParam("numberBedrooms"));
component.set("v.numberBathrooms", event.getParam("numberBathrooms"));
helper.getProperties(component);
},
onEinsteinVisionEvent: function(component, event, helper) {
var predictions = event.getParam("predictions");
if (predictions && predictions.length>0) {
component.set("v.searchKey", predictions[0].label);
helper.getProperties(component);
}
onFilterChange: function (component, event, helper) {
component.set("v.searchKey", event.getParam("searchKey"));
component.set("v.minPrice", event.getParam("minPrice"));
component.set("v.maxPrice", event.getParam("maxPrice"));
component.set("v.numberBedrooms", event.getParam("numberBedrooms"));
component.set("v.numberBathrooms", event.getParam("numberBathrooms"));
component.set("v.visualSearchKey", event.getParam("visualSearchKey"));
helper.getProperties(component);
},
onPagePrevious: function(component, event, helper) {
var page = component.get("v.page") || 1;
page = page - 1;
helper.getProperties(component, page);
var pageNumber = component.get("v.pageNumber") || 1;
pageNumber = pageNumber - 1;
helper.getProperties(component, pageNumber);
},
onPageNext: function(component, event, helper) {
var page = component.get("v.page") || 1;
page = page + 1;
helper.getProperties(component, page);
var pageNumber = component.get("v.pageNumber") || 1;
pageNumber = pageNumber + 1;
helper.getProperties(component, pageNumber);
}
})

Просмотреть файл

@ -1,24 +1,27 @@
({
getProperties : function(component, page) {
var action = component.get("c.findAll");
action.setStorable();
var pageSize = component.get("v.pageSize");
action.setParams({
"searchKey": component.get("v.searchKey"),
"minPrice": component.get("v.minPrice"),
"maxPrice": component.get("v.maxPrice"),
"pageSize": pageSize,
"pageNumber": page || 1
});
action.setCallback(this, function(response) {
var result = response.getReturnValue();
console.log('Page %d loaded in %fms', result.page, performance.now() - startTime);
component.set("v.properties", result.properties);
component.set("v.page", result.page);
component.set("v.total", result.total);
component.set("v.pages", Math.ceil(result.total/pageSize));
});
var startTime = performance.now();
$A.enqueueAction(action);
}
getProperties: function (component, pageNumber) {
var action = component.get("c.getPropertyListPage");
action.setStorable();
var pageSize = component.get("v.pageSize");
action.setParams({
"searchKey": component.get("v.searchKey"),
"minPrice": component.get("v.minPrice"),
"maxPrice": component.get("v.maxPrice"),
"numberBedrooms": component.get("v.numberBedrooms"),
"numberBathrooms": component.get("v.numberBathrooms"),
"visualSearchKey": component.get("v.visualSearchKey"),
"pageSize": pageSize,
"pageNumber": pageNumber || 1
});
action.setCallback(this, function (response) {
var page = response.getReturnValue();
console.log('Page %d loaded in %fms', page.pageNumber, performance.now() - startTime);
component.set("v.properties", page.properties);
component.set("v.pageNumber", page.pageNumber);
component.set("v.total", page.total);
component.set("v.pages", Math.ceil(page.total / pageSize));
});
var startTime = performance.now();
$A.enqueueAction(action);
}
})

Просмотреть файл

@ -1,4 +1,4 @@
<aura:event type="APPLICATION">
<aura:event type="COMPONENT">
<aura:attribute name="minValue" type="Decimal"/>
<aura:attribute name="maxValue" type="Decimal"/>
</aura:event>

Просмотреть файл

@ -0,0 +1,6 @@
<aura:documentation>
<aura:description>Documentation</aura:description>
<aura:example name="ExampleName" ref="exampleComponentName" label="Label">
Example Description
</aura:example>
</aura:documentation>

Просмотреть файл

@ -0,0 +1,42 @@
<aura:component implements="force:appHostable" access="global" controller="EinsteinVisionController">
<aura:attribute name="modelId" type="String" />
<aura:attribute name="files" type="Object[]" />
<aura:attribute name="predictions" type="Object[]" />
<aura:attribute name="waiting" type="Boolean" default="false" />
<aura:attribute name="pictureSrc" type="String" />
<aura:registerEvent name="onPrediction" type="c:VisualSearchEvent" />
<div>
<p class="slds-form-element__label">Visual search</p>
<button class="slds-button slds-button_neutral upload-btn">
<lightning:icon iconName="utility:upload" size="xx-small" /> Upload Picture
<input aura:id="fileInput" type="file" accept="image/*" onchange="{!c.onFileChange}" />
</button>
<div class="frame" ondragover="{!c.onDragOver}" ondrop="{!c.onDrop}">
<aura:if isTrue="{!!v.pictureSrc}">
<p class="drop-message slds-text-color--weak">or drop picure here</p>
</aura:if>
<img src="{!v.pictureSrc}" />
</div>
<aura:iteration items="{!v.predictions}" var="prediction">
<lightning:layout>
<lightning:layoutitem>
<lightning:icon iconName="utility:preview" size="x-small" /></lightning:layoutitem>
<lightning:layoutitem>{! prediction.formattedProbability}</lightning:layoutitem>
<lightning:layoutitem flexibility="grow">{!prediction.label}</lightning:layoutitem>
</lightning:layout>
</aura:iteration>
<aura:if isTrue="{! v.waiting }">
<lightning:spinner size="large" />
</aura:if>
</div>
</aura:component>

Просмотреть файл

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<AuraDefinitionBundle xmlns="urn:metadata.tooling.soap.sforce.com" fqn="VisualSearchBox">
<apiVersion>41.0</apiVersion>
<description>A Lightning Component Bundle</description>
</AuraDefinitionBundle>

Просмотреть файл

@ -0,0 +1,74 @@
.THIS {
margin-top: 8px;
}
.THIS td {
padding: 2px;
}
.THIS .probability {
padding-right: 4px;
text-align: right;
}
.THIS {
position: relative;
}
.THIS table {
display: block;
width: 100%;
}
.THIS tr {
border-top: 1px dashed rgb(216, 221, 230);
width: 100%;
}
.THIS .slds-grid > div {
padding: 2px 3px 0 3px;
font-size: 12px;
border-bottom: 1px dashed rgb(216, 221, 230);
}
.THIS .frame {
width: 100%;
min-height: 80px;
line-height: 80px;
border: 1px dashed rgb(216, 221, 230);
padding: 4px;
text-align: center;
position: relative;
}
.THIS .upload-btn {
width: 100%;
margin: 0 0 4px 0;
}
.THIS .upload-btn svg {
fill: #1F539C;
margin-right: 1px;
}
.THIS .drop-message {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: 0 auto;
}
.THIS input[type=file] {
cursor: pointer;
display: block;
filter: alpha(opacity=0);
min-height: 100%;
min-width: 100%;
opacity: 0;
position: absolute;
right: 0;
text-align: right;
top: 0;
}

Просмотреть файл

@ -0,0 +1,3 @@
<design:component >
</design:component>

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="120px" height="120px" viewBox="0 0 120 120" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M120,108 C120,114.6 114.6,120 108,120 L12,120 C5.4,120 0,114.6 0,108 L0,12 C0,5.4 5.4,0 12,0 L108,0 C114.6,0 120,5.4 120,12 L120,108 L120,108 Z" id="Shape" fill="#2A739E"/>
<path d="M77.7383308,20 L61.1640113,20 L44.7300055,63.2000173 L56.0543288,63.2000173 L40,99.623291 L72.7458388,54.5871812 L60.907727,54.5871812 L77.7383308,20 Z" id="Path-1" fill="#FFFFFF"/>
</g>
</svg>

После

Ширина:  |  Высота:  |  Размер: 661 B

Просмотреть файл

@ -0,0 +1,24 @@
({
onDragOver: function(component, event) {
event.preventDefault();
},
onFileChange: function(component, event, helper) {
var fileInput = component.find("fileInput").getElement();
var files = fileInput.files;
helper.readFile(component, helper, files[0]);
},
onDrop: function(component, event, helper) {
console.log('ondrop: ' + new Date());
event.stopPropagation();
event.preventDefault();
event.dataTransfer.dropEffect = 'copy';
var files = event.dataTransfer.files;
if (files.length>1) {
return alert("You can only upload one profile picture");
}
helper.readFile(component, helper, files[0]);
}
})

Просмотреть файл

@ -1,6 +1,22 @@
({
readFile: function(component, helper, file) {
console.log('readfile: ' + new Date());
if (!file.type.match(/(image.*)/)) {
return alert('Image file not supported');
}
var reader = new FileReader();
reader.onloadend = function() {
console.log('readfile onloadend: ' + new Date());
var dataURL = reader.result;
component.set("v.pictureSrc", dataURL);
helper.upload(component, file, dataURL.match(/,(.*)$/)[1]);
};
reader.readAsDataURL(file);
},
upload: function(component, file, base64Data) {
console.log('upload: ' + new Date());
var action = component.get("c.predict");
var modelId = component.get("v.modelId");
action.setParams({
@ -9,6 +25,7 @@
modelId: modelId
});
action.setCallback(this, function(a) {
console.log('upload callback: ' + new Date());
component.set("v.waiting", false);
var state = a.getState();
if (state === 'ERROR') {
@ -24,12 +41,12 @@
formattedProbability: '' + Math.round(result[i].probability * 100) + '%'
});
}
component.set("v.predictions", predictions);
var myEvent = $A.get("e.c:EinsteinVisionEvent");
myEvent.setParams({
component.set("v.predictions", predictions);
var predictionEvent = component.getEvent("onPrediction");
predictionEvent.setParams({
"predictions": result
});
myEvent.fire();
predictionEvent.fire();
}
});
component.set("v.predictions", null);

Просмотреть файл

@ -0,0 +1,5 @@
({
// Your renderer method overrides go here
})

Просмотреть файл

@ -0,0 +1,3 @@
<aura:event type="COMPONENT" description="Event template">
<aura:attribute name="predictions" type="List"/>
</aura:event>

Просмотреть файл

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<AuraDefinitionBundle xmlns="urn:metadata.tooling.soap.sforce.com" fqn="VisualSearchEvent">
<apiVersion>41.0</apiVersion>
<description>A Lightning Event Bundle</description>
</AuraDefinitionBundle>

Просмотреть файл

@ -2,7 +2,7 @@ global with sharing class DreamHouseSampleDataController {
@RemoteAction
global static void deleteAll() {
DELETE [SELECT ID FROM favorite__c];
//DELETE [SELECT ID FROM favorite__c];
DELETE [SELECT ID FROM property__c];
DELETE [SELECT ID FROM broker__c];
DELETE [SELECT ID FROM bot_command__c];

Просмотреть файл

@ -1,24 +1,44 @@
global with sharing class PropertyController {
@AuraEnabled
public static PropertyPagedResult findAll(String searchKey, Decimal minPrice, Decimal maxPrice, Decimal pageSize, Decimal pageNumber) {
Integer pSize = (Integer)pageSize;
public static Property__c[] getPropertyList(String searchKey, Decimal minPrice, Decimal maxPrice, Integer numberBedrooms, Integer numberBathrooms, String visualSearchKey) {
String key = '%' + searchKey + '%';
Integer offset = ((Integer)pageNumber - 1) * pSize;
PropertyPagedResult r = new PropertyPagedResult();
r.pageSize = pSize;
r.page = (Integer) pageNumber;
r.total = [SELECT count() FROM property__c
WHERE (title__c LIKE :key OR city__c LIKE :key OR tags__c LIKE :key)
AND price__c >= :minPrice
AND price__c <= :maxPrice];
r.properties = [SELECT Id, title__c, city__c, description__c, price__c, baths__c, beds__c, thumbnail__c FROM property__c
String visualKey = '%' + visualSearchKey + '%';
return [SELECT Id, address__c, city__c, state__c, description__c, price__c, baths__c, beds__c, thumbnail__c, location__latitude__s, location__longitude__s FROM property__c
WHERE (title__c LIKE :key OR city__c LIKE :key OR tags__c LIKE :key)
AND (title__c LIKE :visualKey OR city__c LIKE :visualKey OR tags__c LIKE :visualKey)
AND price__c >= :minPrice
AND price__c <= :maxPrice
AND beds__c >= :numberBedrooms
AND baths__c >= :numberBathrooms
ORDER BY price__c LIMIT 100];
}
@AuraEnabled
public static PropertyListPage getPropertyListPage(String searchKey, Decimal minPrice, Decimal maxPrice, Integer numberBedrooms, Integer numberBathrooms, String visualSearchKey, Decimal pageSize, Decimal pageNumber) {
Integer pSize = (Integer)pageSize;
String key = '%' + searchKey + '%';
String visualKey = '%' + visualSearchKey + '%';
Integer offset = ((Integer)pageNumber - 1) * pSize;
PropertyListPage page = new PropertyListPage();
page.pageSize = pSize;
page.pageNumber = (Integer) pageNumber;
page.total = [SELECT count() FROM property__c
WHERE (title__c LIKE :key OR city__c LIKE :key OR tags__c LIKE :key)
AND (title__c LIKE :visualKey OR city__c LIKE :visualKey OR tags__c LIKE :visualKey)
AND price__c >= :minPrice
AND price__c <= :maxPrice
AND beds__c >= :numberBedrooms
AND baths__c >= :numberBathrooms];
page.properties = [SELECT Id, address__c, city__c, state__c, description__c, price__c, baths__c, beds__c, thumbnail__c FROM property__c
WHERE (title__c LIKE :key OR city__c LIKE :key OR tags__c LIKE :key)
AND (title__c LIKE :visualKey OR city__c LIKE :visualKey OR tags__c LIKE :visualKey)
AND price__c >= :minPrice
AND price__c <= :maxPrice
AND beds__c >= :numberBedrooms
AND baths__c >= :numberBathrooms
ORDER BY price__c LIMIT :pSize OFFSET :offset];
System.debug(r);
return r;
return page;
}
@AuraEnabled

Просмотреть файл

@ -1,12 +1,25 @@
@isTest
public class PropertyControllerTest {
static testMethod void testFindAll() {
static testMethod void testgetPropertyList() {
Boolean success = true;
try {
Property__c p = new Property__c(Location__Latitude__s=-71.110448,Location__Longitude__s=42.360642);
insert p;
PropertyPagedResult r = PropertyController.findAll('', 0, 1000000, 8, 1);
PropertyController.getPropertyList('', 0, 1000000, 0, 0, '');
} catch (Exception e) {
success = false;
} finally {
System.assert(success);
}
}
static testMethod void testgetPropertyListPage() {
Boolean success = true;
try {
Property__c p = new Property__c(Location__Latitude__s=-71.110448,Location__Longitude__s=42.360642);
insert p;
PropertyListPage page = PropertyController.getPropertyListPage('', 0, 1000000, 0, 0, '', 8, 1);
} catch (Exception e) {
success = false;
} finally {

Просмотреть файл

@ -1,10 +1,10 @@
public class PropertyPagedResult {
public class PropertyListPage {
@AuraEnabled
public Integer pageSize { get;set; }
@AuraEnabled
public Integer page { get;set; }
public Integer pageNumber { get;set; }
@AuraEnabled
public Integer total { get;set; }

Просмотреть файл

@ -18,8 +18,8 @@ public with sharing class PushPriceChangeNotification {
Set<String> userIds = new Set<String>();
List<Favorite__c> favorites = [SELECT user__c from favorite__c WHERE property__c=:propId];
for (Favorite__c favorite : favorites) {
List<Property_Favorite__c> favorites = [SELECT user__c from Property_Favorite__c WHERE property__c=:propId];
for (Property_Favorite__c favorite : favorites) {
userIds.add(favorite.user__c);
}

Просмотреть файл

@ -20,7 +20,7 @@ public class RejectDuplicateFavoriteTest {
insert p;
User u = getTestUser();
insert u;
Favorite__c f1 = new Favorite__c(property__c=p.Id, user__c=u.Id);
Property_Favorite__c f1 = new Property_Favorite__c(property__c=p.Id, user__c=u.Id);
insert f1;
} catch (Exception e) {
System.debug(e);
@ -37,9 +37,9 @@ public class RejectDuplicateFavoriteTest {
insert p;
User u = getTestUser();
insert u;
Favorite__c f1 = new Favorite__c(property__c=p.Id, user__c=u.Id);
Property_Favorite__c f1 = new Property_Favorite__c(property__c=p.Id, user__c=u.Id);
insert f1;
Favorite__c f2 = new Favorite__c(property__c=p.Id, user__c=u.Id);
Property_Favorite__c f2 = new Property_Favorite__c(property__c=p.Id, user__c=u.Id);
insert f2;
} catch (Exception e) {
success = false;

Просмотреть файл

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<FlexiPage xmlns="http://soap.sforce.com/2006/04/metadata">
<flexiPageRegions>
<componentInstances>
<componentInstanceProperties>
<name>collapsed</name>
<value>false</value>
</componentInstanceProperties>
<componentName>force:highlightsPanel</componentName>
</componentInstances>
<mode>Replace</mode>
<name>header</name>
<type>Region</type>
</flexiPageRegions>
<flexiPageRegions>
<componentInstances>
<componentName>force:relatedListContainer</componentName>
</componentInstances>
<mode>Replace</mode>
<name>relatedTabContent</name>
<type>Facet</type>
</flexiPageRegions>
<flexiPageRegions>
<componentInstances>
<componentName>force:detailPanel</componentName>
</componentInstances>
<mode>Replace</mode>
<name>detailTabContent</name>
<type>Facet</type>
</flexiPageRegions>
<flexiPageRegions>
<componentInstances>
<componentInstanceProperties>
<name>body</name>
<value>relatedTabContent</value>
</componentInstanceProperties>
<componentInstanceProperties>
<name>title</name>
<value>Standard.Tab.relatedLists</value>
</componentInstanceProperties>
<componentName>flexipage:tab</componentName>
</componentInstances>
<componentInstances>
<componentInstanceProperties>
<name>active</name>
<value>true</value>
</componentInstanceProperties>
<componentInstanceProperties>
<name>body</name>
<value>detailTabContent</value>
</componentInstanceProperties>
<componentInstanceProperties>
<name>title</name>
<value>Standard.Tab.detail</value>
</componentInstanceProperties>
<componentName>flexipage:tab</componentName>
</componentInstances>
<mode>Replace</mode>
<name>maintabs</name>
<type>Facet</type>
</flexiPageRegions>
<flexiPageRegions>
<componentInstances>
<componentInstanceProperties>
<name>tabs</name>
<value>maintabs</value>
</componentInstanceProperties>
<componentName>flexipage:tabset</componentName>
</componentInstances>
<mode>Replace</mode>
<name>main</name>
<type>Region</type>
</flexiPageRegions>
<flexiPageRegions>
<componentInstances>
<componentInstanceProperties>
<name>parentFieldApiName</name>
<value>Broker__c.Id</value>
</componentInstanceProperties>
<componentInstanceProperties>
<name>relatedListApiName</name>
<value>Properties__r</value>
</componentInstanceProperties>
<componentInstanceProperties>
<name>relatedListComponentOverride</name>
<value>NONE</value>
</componentInstanceProperties>
<componentName>force:relatedListSingleContainer</componentName>
</componentInstances>
<mode>Replace</mode>
<name>sidebar</name>
<type>Region</type>
</flexiPageRegions>
<masterLabel>Broker Record Page</masterLabel>
<parentFlexiPage>flexipage__default_rec_L</parentFlexiPage>
<sobjectType>Broker__c</sobjectType>
<template>
<name>flexipage:recordHomeTemplateDesktop</name>
</template>
<type>RecordPage</type>
</FlexiPage>

Просмотреть файл

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<FlexiPage xmlns="http://soap.sforce.com/2006/04/metadata">
<flexiPageRegions>
<componentInstances>
<componentInstanceProperties>
<name>collapsed</name>
<value>false</value>
</componentInstanceProperties>
<componentName>force:highlightsPanel</componentName>
</componentInstances>
<mode>Replace</mode>
<name>header</name>
<type>Region</type>
</flexiPageRegions>
<flexiPageRegions>
<componentInstances>
<componentName>force:relatedListContainer</componentName>
</componentInstances>
<mode>Replace</mode>
<name>relatedTabContent</name>
<type>Facet</type>
</flexiPageRegions>
<flexiPageRegions>
<componentInstances>
<componentName>force:detailPanel</componentName>
</componentInstances>
<mode>Replace</mode>
<name>detailTabContent</name>
<type>Facet</type>
</flexiPageRegions>
<flexiPageRegions>
<componentInstances>
<componentInstanceProperties>
<name>body</name>
<value>relatedTabContent</value>
</componentInstanceProperties>
<componentInstanceProperties>
<name>title</name>
<value>Standard.Tab.relatedLists</value>
</componentInstanceProperties>
<componentName>flexipage:tab</componentName>
</componentInstances>
<componentInstances>
<componentInstanceProperties>
<name>active</name>
<value>true</value>
</componentInstanceProperties>
<componentInstanceProperties>
<name>body</name>
<value>detailTabContent</value>
</componentInstanceProperties>
<componentInstanceProperties>
<name>title</name>
<value>Standard.Tab.detail</value>
</componentInstanceProperties>
<componentName>flexipage:tab</componentName>
</componentInstances>
<mode>Replace</mode>
<name>maintabs</name>
<type>Facet</type>
</flexiPageRegions>
<flexiPageRegions>
<componentInstances>
<componentInstanceProperties>
<name>tabs</name>
<value>maintabs</value>
</componentInstanceProperties>
<componentName>flexipage:tabset</componentName>
</componentInstances>
<mode>Replace</mode>
<name>main</name>
<type>Region</type>
</flexiPageRegions>
<flexiPageRegions>
<componentInstances>
<componentInstanceProperties>
<name>parentFieldApiName</name>
<value>Broker__c.Id</value>
</componentInstanceProperties>
<componentInstanceProperties>
<name>relatedListApiName</name>
<value>Properties__r</value>
</componentInstanceProperties>
<componentInstanceProperties>
<name>relatedListComponentOverride</name>
<value>NONE</value>
</componentInstanceProperties>
<componentName>force:relatedListSingleContainer</componentName>
</componentInstances>
<mode>Replace</mode>
<name>sidebar</name>
<type>Region</type>
</flexiPageRegions>
<masterLabel>Broker Record Page</masterLabel>
<parentFlexiPage>flexipage__default_rec_L</parentFlexiPage>
<sobjectType>Broker__c</sobjectType>
<template>
<name>flexipage:recordHomeTemplateDesktop</name>
</template>
<type>RecordPage</type>
</FlexiPage>

Просмотреть файл

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<FlexiPage xmlns="http://soap.sforce.com/2006/04/metadata">
<flexiPageRegions>
<componentInstances>
<componentInstanceProperties>
<name>modelId</name>
<value>ILSBYG2YGPO2COQFQS5ILJVVUE</value>
</componentInstanceProperties>
<componentName>EinsteinVisionCard</componentName>
</componentInstances>
<componentInstances>
<componentInstanceProperties>
<name>pageSize</name>
<value>8</value>
</componentInstanceProperties>
<componentName>PropertyTileList</componentName>
</componentInstances>
<name>main</name>
<type>Region</type>
</flexiPageRegions>
<masterLabel>House Explorer</masterLabel>
<template>
<name>flexipage:defaultAppHomeTemplate</name>
</template>
<type>AppPage</type>
</FlexiPage>

Просмотреть файл

@ -3,19 +3,15 @@
<flexiPageRegions>
<componentInstances>
<componentInstanceProperties>
<name>max</name>
<value>1200000</value>
<name>einsteinVisionModelId</name>
<value>YQXUQ3NXBEW3MRF5BSJBIA7MSA</value>
</componentInstanceProperties>
<componentInstanceProperties>
<name>min</name>
<value>200000</value>
</componentInstanceProperties>
<componentInstanceProperties>
<name>step</name>
<value>50000</value>
</componentInstanceProperties>
<componentName>PriceRange</componentName>
<componentName>PropertyFilters</componentName>
</componentInstances>
<name>left</name>
<type>Region</type>
</flexiPageRegions>
<flexiPageRegions>
<componentInstances>
<componentInstanceProperties>
<name>pageSize</name>
@ -23,20 +19,13 @@
</componentInstanceProperties>
<componentName>PropertyTileList</componentName>
</componentInstances>
<name>region1</name>
<name>center</name>
<type>Region</type>
</flexiPageRegions>
<flexiPageRegions>
<componentInstances>
<componentName>PropertySummary</componentName>
</componentInstances>
<componentInstances>
<componentName>PropertyDaysOnMarketChart</componentName>
</componentInstances>
<name>region2</name>
<type>Region</type>
</flexiPageRegions>
<flexiPageRegions>
<componentInstances>
<componentInstanceProperties>
<name>latField</name>
@ -52,12 +41,19 @@
</componentInstanceProperties>
<componentName>MapCard</componentName>
</componentInstances>
<name>region3</name>
<componentInstances>
<componentInstanceProperties>
<name>searchCriteria</name>
<value>Price</value>
</componentInstanceProperties>
<componentName>SimilarProperties</componentName>
</componentInstances>
<name>right</name>
<type>Region</type>
</flexiPageRegions>
<masterLabel>Property Explorer</masterLabel>
<template>
<name>flexipage:appHomeTemplateTwoColumnsStacked</name>
<name>PageTemplate_2_7_3</name>
</template>
<type>AppPage</type>
</FlexiPage>

Просмотреть файл

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<FlexiPage xmlns="http://soap.sforce.com/2006/04/metadata">
<flexiPageRegions>
<componentInstances>
<componentInstanceProperties>
<name>einsteinVisionModelId</name>
<value>YQXUQ3NXBEW3MRF5BSJBIA7MSA</value>
</componentInstanceProperties>
<componentName>PropertyFilters</componentName>
</componentInstances>
<name>left</name>
<type>Region</type>
</flexiPageRegions>
<flexiPageRegions>
<componentInstances>
<componentName>PropertyListMap</componentName>
</componentInstances>
<name>center</name>
<type>Region</type>
</flexiPageRegions>
<flexiPageRegions>
<componentInstances>
<componentName>PropertySummary</componentName>
</componentInstances>
<componentInstances>
<componentName>PropertyDaysOnMarketChart</componentName>
</componentInstances>
<componentInstances>
<componentInstanceProperties>
<name>animations</name>
<value>true</value>
</componentInstanceProperties>
<componentName>PictureGalleryCard</componentName>
</componentInstances>
<name>right</name>
<type>Region</type>
</flexiPageRegions>
<masterLabel>Property Finder</masterLabel>
<template>
<name>PageTemplate_2_6_4</name>
</template>
<type>AppPage</type>
</FlexiPage>

Просмотреть файл

@ -236,7 +236,7 @@
<fields>NAME</fields>
<fields>User__c</fields>
<fields>CREATED_DATE</fields>
<relatedList>Favorite__c.Property__c</relatedList>
<relatedList>Property_Favorite__c.Property__c</relatedList>
<sortField>CREATED_DATE</sortField>
<sortOrder>Desc</sortOrder>
</relatedLists>

Просмотреть файл

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomObjectTranslation xmlns="http://soap.sforce.com/2006/04/metadata">
<caseValues>
<plural>false</plural>
<value>Property Favorite</value>
</caseValues>
<caseValues>
<plural>true</plural>
<value>Property Favorites</value>
</caseValues>
<startsWith>Consonant</startsWith>
</CustomObjectTranslation>

Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomFieldTranslation xmlns="http://soap.sforce.com/2006/04/metadata">
<label><!-- Property --></label>
<name>Property__c</name>
<relationshipLabel><!-- Property Favorites --></relationshipLabel>
</CustomFieldTranslation>

Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomFieldTranslation xmlns="http://soap.sforce.com/2006/04/metadata">
<label><!-- User --></label>
<name>User__c</name>
<relationshipLabel><!-- Property Favorites --></relationshipLabel>
</CustomFieldTranslation>

Просмотреть файл

@ -52,13 +52,14 @@
<enableSearch>true</enableSearch>
<enableSharing>true</enableSharing>
<enableStreamingApi>true</enableStreamingApi>
<label>Favorite</label>
<externalSharingModel>ReadWrite</externalSharingModel>
<label>Property Favorite</label>
<nameField>
<displayFormat>F-{00000000}</displayFormat>
<label>Favorite Name</label>
<label>Property Favorite Name</label>
<type>AutoNumber</type>
</nameField>
<pluralLabel>Favorites</pluralLabel>
<pluralLabel>Property Favorites</pluralLabel>
<searchLayouts/>
<sharingModel>ReadWrite</sharingModel>
<visibility>Public</visibility>

Просмотреть файл

@ -5,7 +5,6 @@
<externalId>false</externalId>
<label>Property</label>
<referenceTo>Property__c</referenceTo>
<relationshipLabel>Favorites</relationshipLabel>
<relationshipName>Favorites</relationshipName>
<required>false</required>
<trackTrending>false</trackTrending>

Просмотреть файл

@ -165,7 +165,7 @@
<enabled>true</enabled>
</classAccesses>
<classAccesses>
<apexClass>PropertyPagedResult</apexClass>
<apexClass>PropertyListPage</apexClass>
<enabled>true</enabled>
</classAccesses>
<classAccesses>
@ -240,12 +240,12 @@
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Favorite__c.Property__c</field>
<field>Property_Favorite__c.Property__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Favorite__c.User__c</field>
<field>Property_Favorite__c.User__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
@ -399,7 +399,7 @@
<allowEdit>true</allowEdit>
<allowRead>true</allowRead>
<modifyAllRecords>true</modifyAllRecords>
<object>Favorite__c</object>
<object>Property_Favorite__c</object>
<viewAllRecords>true</viewAllRecords>
</objectPermissions>
<objectPermissions>
@ -447,10 +447,6 @@
<tab>Heat_Map_Mock</tab>
<visibility>Visible</visibility>
</tabSettings>
<tabSettings>
<tab>Property_Explorer1</tab>
<visibility>Visible</visibility>
</tabSettings>
<tabSettings>
<tab>Property__c</tab>
<visibility>Visible</visibility>

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше