Skip to content

Commit

Permalink
sales-embedding-demo - Beta WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
BugsBunny338 committed Mar 24, 2021
1 parent 7707dcc commit fda3278
Show file tree
Hide file tree
Showing 102 changed files with 18,287 additions and 0 deletions.
1 change: 1 addition & 0 deletions sales-embedding-demo/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SKIP_PREFLIGHT_CHECK=true
25 changes: 25 additions & 0 deletions sales-embedding-demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

.gdcatalogrc
5 changes: 5 additions & 0 deletions sales-embedding-demo/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 110,
"tabWidth": 4,
"trailingComma": "all"
}
150 changes: 150 additions & 0 deletions sales-embedding-demo/CONFIGURATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# Configuration

The purpose of running this app on your localhost is that you can alter it to your needs any time you wish. Some places in the code have been designed to make it as easy as possible.

> Please download [Visual Studio Code](https://code.visualstudio.com/) for easy files editing.
(Jump back to [INSTRUCTIONS](INSTRUCTIONS.md) or [README](README.md).)

## List of Features

* [Change the domain and workspace](#change-the-domain-and-workspace)
* [Change the name of the application](#change-the-name-of-the-application)
* [Change the URL of the embedded dashboard](#change-the-url-of-the-embedded-dashboard)
* [Change the logo](#change-the-logo)
* [Show/hide the embedded dashboard navigation](#showhide-the-embedded-dashboard-navigation)
* [Show/hide the embedded dashboard top bar](#showhide-the-embedded-dashboard-top-bar)
* [Show/hide the embedded dashboard filter bar](#showhide-the-embedded-dashboard-filter-bar)
* [Show/hide the embedded dashboard widgets catalogue](#showhide-the-embedded-dashboard-widgets-catalogue)
* [Integrate an individual insight](#integrate-an-individual-insight)
* [Integrate a dashboard](#integrate-a-dashboard)

## Opening sales-embedding-demo in Visual Studio Code

* Open VSCode (if you don't have VSCode, get it at https://code.visualstudio.com/)
* At the top of your screen, click View --> Explorer
* Click `Open Folder` and select `sales-embedding-demo` folder to be found in `~/Documents/my-projects/ui-sdk-examples/`
* You can now open files by clicking Go --> Go to File…

<img src="public/configuration/01-vscode-01.png" width=800>
<img src="public/configuration/01-vscode-02.png" width=800>
<img src="public/configuration/01-vscode-03.png" width=800>
<img src="public/configuration/01-vscode-04.png" width=800>

---

### Change the Domain and Workspace

* Kill the app (hit `CTRL + C` in the Terminal)
* [Open sales-embedding-demo in VSCode](#opening-sales-embedding-demo-in-visual-studio-code)
* While in VSCode, click Go --> Go to File… and type in `constants` to open `src/constants.js` file
* Change the value of `backend` to your domain (e.g. https://leilani.na.gooddata.com/)
* Change the value of `workspace` to the workspace you'll be working with
* Save the changes in `src/constants.js` file
* Restart the app (run `yarn start` again in the Terminal)
* You'll now need to `Log out` from the application, and then `Log in` again

---

### Change the Name of the Application

* [Open sales-embedding-demo in VSCode](#opening-sales-embedding-demo-in-visual-studio-code)
* While in VSCode, click Go --> Go to File… and type in `constants` to open `src/constants.js` file
* Change the value of `appName` to from `sales-embedding-demo` to `ShopBoard Demo`
* Save the changes in `src/constants.js` file
* Wait till your app refreshes in your browser (or refresh manually)

---

### Change the URL of the Embedded Dashboard

* [Open sales-embedding-demo in VSCode](#opening-sales-embedding-demo-in-visual-studio-code)
* Open `src/routes/Home.js` in VSCode
* Look for the `iframe` tag
* Change the value of `src` attribute

`src` attribute of the `iframe` should contain either absolute or relative URL of the dashboard, where there is word `/embedded/` added after `/dashboards/` and before `/#/`. See the example:

Standard dashboard URL: `https://my-domain.com/dashboards/#/project/{projId}/dashboard/{dashId}`

Dashboard URL for emedding: `https://my-domain.com/dashboards/embedded/#/project/{projId}/dashboard/{dashId}`

See the [documentation](https://help.gooddata.com/doc/enterprise/en/expand-your-gooddata-platform/gooddata-integration-into-your-application/embed-gooddata-elements-into-your-applications/embed-a-kpi-dashboard#EmbedaKPIDashboard-Advancedconfigurationoptions) for more.

---

### Change the Logo

TODO

---

### Show/hide the Embedded Dashboard Navigation

* [Open sales-embedding-demo in VSCode](#opening-sales-embedding-demo-in-visual-studio-code)
* Open `src/routes/Home.js` in VSCode
* Look for the `iframe` tag
* Append `?showNavigation=true` (or `false`) to the value of `src` attribute

Standard dashboard URL: `https://my-domain.com/dashboards/#/project/{projId}/dashboard/{dashId}`

Dashboard URL with navigation: `https://my-domain.com/dashboards/#/project/{projId}/dashboard/{dashId}?showNavigation=true`

See the [documentation](https://help.gooddata.com/doc/enterprise/en/expand-your-gooddata-platform/gooddata-integration-into-your-application/embed-gooddata-elements-into-your-applications/embed-a-kpi-dashboard#EmbedaKPIDashboard-Advancedconfigurationoptions) for more.

---

### Show/hide the Embedded Dashboard Top Bar

* [Open sales-embedding-demo in VSCode](#opening-sales-embedding-demo-in-visual-studio-code)
* Open `src/routes/Home.js` in VSCode
* Look for the `iframe` tag
* Append `?hideControl=[topBar]` to the value of `src` attribute

Standard dashboard URL: `https://my-domain.com/dashboards/#/project/{projId}/dashboard/{dashId}`

Dashboard URL without top bar: `https://my-domain.com/dashboards/#/project/{projId}/dashboard/{dashId}?hideControl=[topBar]`

Dashboard URL with navigation without top bar: `https://my-domain.com/dashboards/#/project/{projId}/dashboard/{dashId}?showNavigation=true&hideControl=[topBar]`

See the [documentation](https://help.gooddata.com/doc/enterprise/en/expand-your-gooddata-platform/gooddata-integration-into-your-application/embed-gooddata-elements-into-your-applications/embed-a-kpi-dashboard#EmbedaKPIDashboard-Advancedconfigurationoptions) for more.

---

### Show/hide the Embedded Dashboard Filter Bar

* [Open sales-embedding-demo in VSCode](#opening-sales-embedding-demo-in-visual-studio-code)
* Open `src/routes/Home.js` in VSCode
* Look for the `iframe` tag
* Append `?hideControl=[filterBar]` to the value of `src` attribute

Standard dashboard URL: `https://my-domain.com/dashboards/#/project/{projId}/dashboard/{dashId}`

Dashboard URL without filter bar: `https://my-domain.com/dashboards/#/project/{projId}/dashboard/{dashId}?hideControl=[filterBar]`

Dashboard URL with navigation without filter bar: `https://my-domain.com/dashboards/#/project/{projId}/dashboard/{dashId}?showNavigation=true&hideControl=[filterBar]`

Dashboard URL with navigation without filter bar and top bar: `https://my-domain.com/dashboards/#/project/{projId}/dashboard/{dashId}?showNavigation=true&hideControl=[topBar,filterBar]`

See the [documentation](https://help.gooddata.com/doc/enterprise/en/expand-your-gooddata-platform/gooddata-integration-into-your-application/embed-gooddata-elements-into-your-applications/embed-a-kpi-dashboard#EmbedaKPIDashboard-Advancedconfigurationoptions) for more.

---

### Show/hide the Embedded Dashboard Widgets Catalogue

* [Open sales-embedding-demo in VSCode](#opening-sales-embedding-demo-in-visual-studio-code)
* Open `src/routes/Home.js` in VSCode
* Look for the `iframe` tag
* Append `?hideControl=[widgetsCatalogue]` to the value of `src` attribute

Standard dashboard URL: `https://my-domain.com/dashboards/#/project/{projId}/dashboard/{dashId}`

Dashboard URL without widgets catalogue: `https://my-domain.com/dashboards/#/project/{projId}/dashboard/{dashId}?hideControl=[widgetsCatalogue]`

See the [documentation](https://help.gooddata.com/doc/enterprise/en/expand-your-gooddata-platform/gooddata-integration-into-your-application/embed-gooddata-elements-into-your-applications/embed-a-kpi-dashboard#EmbedaKPIDashboard-Advancedconfigurationoptions) for more.

---

### Integrate an Individual Insight

TODO
10 changes: 10 additions & 0 deletions sales-embedding-demo/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM nginx:1.19-alpine

# the port nginx will listen on
# you can either change it here, or by using --env PORT=1234 when running the container
ENV PORT=8080

COPY ./docker/nginx.conf.template /etc/nginx/templates/default.conf.template
COPY ./build/ /usr/share/nginx/html

CMD ["nginx", "-g", "daemon off;"]
60 changes: 60 additions & 0 deletions sales-embedding-demo/HOWTO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.<br>
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br>
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.<br>
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.<br>
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br>
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

### Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

### Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

### Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
130 changes: 130 additions & 0 deletions sales-embedding-demo/INSTRUCTIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Instructions for Non-Developers

The following steps will guide you through running this application on your computer for the very first time. The following steps do not aim to explain the basic concepts of frontend development.

> Use at your own risk!
(Jump back to [README](README.md), or skip forward to [CONFIGURATION](CONFIGURATION.md).)

## Instructions for MacOS

### Open Terminal

1. Open Spotlight Search (hit `CMD + Spacebar`)
1. Search for `Terminal.app`
1. Hit `Enter`

<img src="public/instructions/01-terminal-01.png" width=800>

---

### Install brew

Check if you have brew installed on your machine:

* `brew -v`
* (specific version does not matter)

<img src="public/instructions/02-brew-01.png" width=800>

If you have brew installed on your machine, proceed to [installing npm](#install-npm). Otherwise do:

1. Visit https://brew.sh/
1. Copy `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"` into your clipboard
1. Paste into your Terminal window
1. Hit `Enter`

Confirm that brew installed successfully by running `brew -v`, then proceed to [installing npm](#install-npm).

---

### Install npm

Check if you have npm installed on your machine:

* `npm -v`
* (specific version does not matter)

<img src="public/instructions/03-npm-01.png" width=800>

If you have npm installed on your machine, proceed to [installing yarn](#install-yarn). Otherwise do:

* `brew install node`
* (npm will be installed with Node)

Confirm that npm installed successfully by running `npm -v`, then proceed to [installing yarn](#install-yarn).

---

### Install yarn

Check if you have yarn installed on your machine:

* `yarn -v`
* (specific version does not matter)

<img src="public/instructions/04-yarn-01.png" width=800>

If you have yarn installed on your machine, proceed to [checking if git is working](#check-that-git-is-working). Otherwise do:

* `npm install -g yarn`

Confirm that yarn installed successfully by running `yarn -v`, then proceed to [checking if git is working](#check-that-git-is-working).

---

### Check that git is working

* `git --version`
* (specific version does not matter)

<img src="public/instructions/05-git-01.png" width=800>

If git is working, proceed to [clonning the repository](#clone-the-repository-and-run-the-app). Otherwise do:

* `xcode-select --install`

Once Xcode command line tools are installed, confirm that git is working by running `git --version`, then proceed to [clonning the repository](#clone-the-repository-and-run-the-app).

---

### Clone the repository and run the app

First, navigate to the folder where you'd like to have this repository clonned. If the folder does not exist, you can create it first, for example:

1. `mkdir ~/Documents/my-projects` (`mkdir` == "make directory", this command creates new directory)
1. `cd ~/Documents/my-projects/` (`cd` == "change directory", this command navigates to specified directory)

<img src="public/instructions/06-mkdir-01.png" width=800>

Now, clone the repository, enter the repository folder, enter the project folder, install the dependencies and run the app:

1. `git clone --depth 1 https://github.com/gooddata/ui-sdk-examples.git`
1. `cd ui-sdk-examples/sales-embedding-demo/`
1. `yarn install`
1. `yarn start`

<img src="public/instructions/07-start-01-clone.png" width=800>
<img src="public/instructions/07-start-02-install.png" width=800>
<img src="public/instructions/07-start-03-start.png" width=800>
<img src="public/instructions/07-start-04-running.png" width=800>

Once the app is started, your browser will most likely warn you that "Your connection is not private." Click on `Advanced` and then `Proceed to localhost (unsafe)`. In case you don't see the the `Advanced` button or the `Proceed to localhost (unsafe)` link, simply click anywhere inside the page and start typing `thisisunsafe`; see https://stackoverflow.com/questions/58802767/no-proceed-anyway-option-on-neterr-cert-invalid-in-chrome-on-macos/58957322 for more.

<img src="public/instructions/07-start-05-private.png" width=800>
<img src="public/instructions/07-start-06-advanced.png" width=800>
<img src="public/instructions/07-start-07-login.png" width=800>
<img src="public/instructions/07-start-08-login.png" width=800>

The app should now be running at https://localhost:3000 and you may proceed to [CONFIGURATION](CONFIGURATION.md). Once you're done working with the, you may want to kill it by hitting `CTRL + C` in Terminal.

<img src="public/instructions/08-kill-01.png" width=800>

## Instructions for Windows

TODO

## Screenshots

![login](public/login.png)
![homepage](public/homepage.png)
Loading

0 comments on commit fda3278

Please sign in to comment.