Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
abfe04c
moving from standalone repo
ptr0x00 Jun 12, 2019
57fc72f
master -> dev
ptr0x00 Jun 12, 2019
ecb1311
media queries
ptr0x00 Jun 14, 2019
fde8787
header tweak for mobile layout
ptr0x00 Jun 14, 2019
67f1ef2
fixing table overflow
ptr0x00 Jun 14, 2019
c837d3e
appended to gitignore
ptr0x00 Jun 18, 2019
3d7a6ad
initial commit
celinehuang Jun 3, 2019
a00038d
moving from standalone repo
ptr0x00 Jun 12, 2019
a5647f2
media queries
ptr0x00 Jun 14, 2019
e327554
header tweak for mobile layout
ptr0x00 Jun 14, 2019
85eff39
fixing table overflow
ptr0x00 Jun 14, 2019
26ba732
appended to gitignore
ptr0x00 Jun 18, 2019
021e38b
merge master
ptr0x00 Jun 18, 2019
ff22ff4
fixed row height
ptr0x00 Jun 18, 2019
5aecfaa
layout autosizing fix
ptr0x00 Jun 19, 2019
c6012bc
changed logo, header, font
ptr0x00 Jun 19, 2019
63450f3
using dcc store
ptr0x00 Jun 21, 2019
8fc7e48
removed extra comments
ptr0x00 Jun 21, 2019
1d9d104
code cleanup
ptr0x00 Jun 21, 2019
e4c4dbd
ie prefixes
ptr0x00 Jun 25, 2019
ccd9cf2
black
ptr0x00 Jun 25, 2019
3f40e11
black v2
ptr0x00 Jun 25, 2019
7f8efc4
Merge branch 'master' into dash-salesforce-crm
Jun 25, 2019
173c486
Deployed commit: 7f8efc4751db3f3d672bf53fe4bb7cafb581ff29
Jun 25, 2019
2c15eb6
font change + breakpoint adjust
ptr0x00 Jun 28, 2019
51efc79
logo update + indicators fix
ptr0x00 Jun 28, 2019
93227cb
reqs stripped + logo resized
ptr0x00 Jun 28, 2019
660d444
procfile
ptr0x00 Jun 28, 2019
309a893
fixed relative path
ptr0x00 Jul 3, 2019
de9b27e
Merge branch 'master' into dash-salesforce-crm
Jul 3, 2019
065bb95
change logo path
ptr0x00 Jul 4, 2019
fbb3a1f
comment cleanup
ptr0x00 Jul 4, 2019
41128dc
manual black formatting
ptr0x00 Jul 4, 2019
520221a
Merge branch 'master' into dash-salesforce-crm
Jul 4, 2019
438f76a
Merge branch 'master' into dash-salesforce-crm
ycaokris Jul 5, 2019
08a3443
removed config
ptr0x00 Jul 5, 2019
d792407
merged master
ptr0x00 Jul 5, 2019
6fe4c62
Merge branch 'master' into dash-salesforce-crm
ycaokris Jul 5, 2019
6ce05a8
Update app name in readme and test playground deploy
ycaokris Jul 5, 2019
c16ff94
Remove Google analytic js
ycaokris Jul 5, 2019
55e7830
add gunicorn req
ptr0x00 Jul 8, 2019
39d5f3e
removing runtime
ptr0x00 Jul 8, 2019
489958b
css best practices
ptr0x00 Jul 8, 2019
c1e7591
alignment fixes + removing scrollbar
ptr0x00 Jul 8, 2019
6cead9d
Merge branch 'master' into dash-salesforce-crm
Jul 8, 2019
c79f55c
Merge branch 'master' into dash-salesforce-crm
Jul 12, 2019
a8d775f
Merge branch 'master' into dash-salesforce-crm
Jul 16, 2019
0c39179
header spacing, tab styling, font-size, tweaks
ptr0x00 Jul 25, 2019
4f51e94
merge master
ptr0x00 Jul 25, 2019
76ed13f
indicator styling update
ptr0x00 Jul 26, 2019
089a4f6
grid ratios corrected, indicator whitespace and font fixed
ptr0x00 Jul 26, 2019
3ad290c
manually fix black formatting
ptr0x00 Jul 26, 2019
c82f378
Merge branch 'master' into dash-salesforce-crm
Jul 26, 2019
9b8f06e
removing undo-redo
ptr0x00 Jul 26, 2019
5054981
mobile header, tabs, indicator spacing, re-ordered and re-styled
ptr0x00 Jul 29, 2019
7dd0729
color correction
ptr0x00 Jul 30, 2019
9842c29
black formatting
ptr0x00 Jul 30, 2019
74fd5ba
Merge branch 'master' into dash-salesforce-crm
Jul 30, 2019
d2465c0
comment cleanup
ptr0x00 Jul 31, 2019
b410589
merge master
ptr0x00 Jul 31, 2019
74bebc7
remove unnecessary imports
celinehuang Jul 31, 2019
ae185d3
add new styles to the panels
celinehuang Jul 31, 2019
124ede7
reformat with Black
celinehuang Jul 31, 2019
9956b08
Merge branch 'master' into dash-salesforce-crm
celinehuang Jul 31, 2019
c28bee4
adjust mobile layout and add screenshots to README
celinehuang Aug 1, 2019
91f89d1
Merge branch 'master' of https://github.com/plotly/dash-sample-apps i…
celinehuang Aug 1, 2019
e4d1183
Merge branch 'dash-salesforce-crm' of https://github.com/plotly/dash-…
celinehuang Aug 1, 2019
b3cb90f
reformat files with Black
celinehuang Aug 1, 2019
fd0cd70
change font colors
celinehuang Aug 1, 2019
1410c11
add code review changes
celinehuang Aug 2, 2019
49c60ca
Merge branch 'master' of https://github.com/plotly/dash-sample-apps i…
celinehuang Aug 2, 2019
6e709e9
add bash script info for credentials
celinehuang Aug 2, 2019
cf4a850
add flask to app.py and server to index.py
celinehuang Aug 2, 2019
44030a6
remove redundant code
celinehuang Aug 2, 2019
b3304a2
fix dcc.Link links
celinehuang Aug 5, 2019
ac23b4f
remove unnecessary links
celinehuang Aug 5, 2019
a2a631f
Merge branch 'master' into dash-salesforce-crm
celinehuang Aug 5, 2019
6c3f415
adjust dropdown spacing for mobile layout
celinehuang Aug 5, 2019
d6b33bb
Merge branch 'dash-salesforce-crm' of https://github.com/plotly/dash-…
celinehuang Aug 5, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions apps/dash-salesforce-crm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
venv/
.env
__pycache__/
apps/__pycache__/
*.DS_Store
.vscode
secrets.sh
1 change: 1 addition & 0 deletions apps/dash-salesforce-crm/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: gunicorn --pythonpath apps/dash-salesforce-crm index:server
64 changes: 64 additions & 0 deletions apps/dash-salesforce-crm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Dash Salesforce CRM

This is a demo of the Dash interactive Python framework developed by [Plotly](https://plot.ly/).

Dash abstracts away all of the technologies and protocols required to build an interactive web-based application and is a simple and effective way to bind a user interface around your Python code.

To learn more check out our [documentation](https://plot.ly/dash).

## Getting Started

### Running the app locally

First create a virtual environment with conda or venv inside a temp folder, then activate it.

```
virtualenv venv

# Windows
venv\Scripts\activate
# Or Linux
source venv/bin/activate

```

Clone the git repo, then install the requirements with pip

```

git clone https://github.com/plotly/dash-sample-apps
cd dash-sample-apps/apps/dash-salesforce-crm
pip install -r requirements.txt

```

To run the app, please create a SalesForce developer account (link is in the `About the App` section). There is an example of how the bash script should look like in the `secrets.example.sh` file. Be sure to create a new file named `secrets.sh` file and put your credentials in the file. Therefore, your credentials will not get pushed to github as the `secrets.sh` file is in the `.gitignore`.

Run the app

```
source secrets.sh
python index.py

```

## About the App

This app uses Salesforce API in order to implement a custom CRM dashboard. The API is used via the module [Simple-Salesforce](https://pypi.org/project/simple-salesforce/). Create a free SalesForce developer trial account: [https://developer.salesforce.com/signup](https://developer.salesforce.com/signup) to utilize this API and run the app.

## Built With

- [Dash](https://dash.plot.ly/) - Main server and interactive components
- [Plotly Python](https://plot.ly/python/) - Used to create the interactive plots

## Screenshots

The following are screenshots for the app in this repo:

![Screenshot1](screenshots/opportunities_screenshot.png)

![Screenshot1](screenshots/leads_screenshot.png)

![Screenshot1](screenshots/cases_screenshot.png)

![Animated](screenshots/dash-salesforce-demo.gif)
50 changes: 50 additions & 0 deletions apps/dash-salesforce-crm/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import math
import dash
import dash_html_components as html

from sfManager import sf_Manager

app = dash.Dash(
__name__, meta_tags=[{"name": "viewport", "content": "width=device-width"}]
)

app.config.suppress_callback_exceptions = True

sf_manager = sf_Manager()

millnames = ["", " K", " M", " B", " T"] # used to convert numbers


# return html Table with dataframe values
def df_to_table(df):
return html.Table(
[html.Tr([html.Th(col) for col in df.columns])]
+ [
html.Tr([html.Td(df.iloc[i][col]) for col in df.columns])
for i in range(len(df))
]
)


# returns most significant part of a number
def millify(n):
n = float(n)
millidx = max(
0,
min(
len(millnames) - 1, int(math.floor(0 if n == 0 else math.log10(abs(n)) / 3))
),
)

return "{:.0f}{}".format(n / 10 ** (3 * millidx), millnames[millidx])


# returns top indicator div
def indicator(color, text, id_value):
return html.Div(
[
html.P(id=id_value, className="indicator_value"),
html.P(text, className="twelve columns indicator_text"),
],
className="four columns indicator pretty_container",
)
Binary file added apps/dash-salesforce-crm/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading