Skip to content

Commit

Permalink
cgra-multiworkspacefilter - Filtering Across Multiple Workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
BugsBunny338 committed Mar 29, 2022
1 parent 0c9bbf4 commit 108af8c
Show file tree
Hide file tree
Showing 80 changed files with 17,765 additions and 0 deletions.
1 change: 1 addition & 0 deletions cgra-multiworkspacefilter/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions cgra-multiworkspacefilter/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SKIP_PREFLIGHT_CHECK=true
25 changes: 25 additions & 0 deletions cgra-multiworkspacefilter/.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
1 change: 1 addition & 0 deletions cgra-multiworkspacefilter/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v12.15.0
5 changes: 5 additions & 0 deletions cgra-multiworkspacefilter/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 110,
"tabWidth": 4,
"trailingComma": "all"
}
15 changes: 15 additions & 0 deletions cgra-multiworkspacefilter/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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

# Uncomment the lines below if you are setting up HTTPS for localhost
#
# COPY ./docker/localhost.crt /etc/ssl/certs/localhost.crt
# COPY ./docker/localhost.key /etc/ssl/private/localhost.key

CMD ["nginx", "-g", "daemon off;"]
64 changes: 64 additions & 0 deletions cgra-multiworkspacefilter/HOWTO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
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

### `npm run build` fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
20 changes: 20 additions & 0 deletions cgra-multiworkspacefilter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Filtering Across Multiple Workspaces

This app demonstrates how you can implement an attribute filter that will apply to multiple insights in different workspaces.

## Backend

This app is designed to connect to workspace `ar1ge3rv4o7szbo9gly0us1q00yq0eh1` (GoodFlights Demo) and `srk96wm3l4y48nie5ghp81tdnsubbai1` (Call Center Demo) on https://demos.na.gooddata.com/ domain.

## How to run locally

* `yarn install`
* `yarn start`

## Screenshot

![home](public/home.png)

---

This project was bootstrapped with [GoodData.UI Accelerator Toolkit](https://sdk.gooddata.com/gooddata-ui/docs/create_new_application.html).
74 changes: 74 additions & 0 deletions cgra-multiworkspacefilter/docker/nginx.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_types image/jpeg image/bmp image/svg+xml text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon;

client_max_body_size 10M;

log_format json escape=json '{'
'"timestamp": "$time_iso8601", '
'"remoteAddress": "$remote_addr", '
'"method": "$request_method", '
'"url": "$request_uri", '
'"httpVersion": "$server_protocol", '
'"statusCode": "$status", '
'"body_bytes_sent":"$body_bytes_sent",'
'"requestTime": "$request_time", '
'"upstreamTime": "$upstream_response_time", '
'"userAgent": "$http_user_agent", '
'"referer": "$http_referer", '
'"requestSize": "$request_length", '
'"responseSize": "$bytes_sent"'
'}';

map $sent_http_content_type $expires {
default off;
text/html -1;
application/json -1;
text/css max;
application/javascript max;
}

server {
#
# Comment this out if you are setting up HTTPS for localhost
#
listen ${PORT};

#
# Uncomment the lines below if you are setting up HTTPS for localhost
#
# listen ${PORT} ssl;
#
# server_name localhost;
# ssl_certificate /etc/ssl/certs/localhost.crt;
# ssl_certificate_key /etc/ssl/private/localhost.key;
#

root /usr/share/nginx/html;
index index.html;
access_log /var/log/nginx/access.log json;

expires $expires;

location / {
try_files $uri $uri/ /index.html;
}

location ^~ /gdc {
proxy_pass ${BACKEND_URL};
proxy_set_header x-forwarded-host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host ${BACKEND_HOST};
proxy_set_header Referer ${BACKEND_URL};
proxy_set_header Origin "";
proxy_cookie_domain ${BACKEND_HOST} $host;
proxy_ssl_server_name on;
}

location ~* \.(?:css|js)$ {
add_header Cache-Control "public";
}

}
4 changes: 4 additions & 0 deletions cgra-multiworkspacefilter/jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const enzyme = require("enzyme");
const Adapter = require("@wojtekmaj/enzyme-adapter-react-17");

enzyme.configure({ adapter: new Adapter() });
7 changes: 7 additions & 0 deletions cgra-multiworkspacefilter/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"compilerOptions": {
"checkJs": true,
"jsx": "react"
},
"exclude": ["node_modules"]
}
80 changes: 80 additions & 0 deletions cgra-multiworkspacefilter/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"name": "cgra-multiworkspacefilter",
"version": "0.1.0",
"private": true,
"dependencies": {
"@gooddata/sdk-backend-bear": "^8.9.0",
"@gooddata/sdk-model": "^8.9.0",
"@gooddata/sdk-ui": "^8.9.0",
"@gooddata/sdk-ui-charts": "^8.9.0",
"@gooddata/sdk-ui-dashboard": "^8.9.0",
"@gooddata/sdk-ui-ext": "^8.9.0",
"@gooddata/sdk-ui-filters": "^8.9.0",
"@gooddata/sdk-ui-geo": "^8.9.0",
"@gooddata/sdk-ui-pivot": "^8.9.0",
"classnames": "^2.3.1",
"formik": "^2.2.9",
"lodash": "^4.17.15",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-helmet": "^6.1.0",
"react-router-dom": "^5.3.0",
"react-router-use-location-state": "^2.3.1",
"react-scripts": "4.0.3",
"use-location-state": "^2.3.1",
"yup": "^0.32.9"
},
"scripts": {
"start": "cross-env HTTPS=true PORT=3000 react-scripts start",
"build": "react-scripts build",
"build-with-explicit-hostname": "cross-env REACT_APP_SET_HOSTNAME=true npm run build",
"eject": "react-scripts eject",
"test": "react-scripts test --setupFilesAfterEnv ./jest.setup.js",
"testcafe-backend": "rm -R ./build & yarn build & serve -l 5000 build",
"testcafe": "cross-env TEST_BACKEND=http://localhost:5000 ./scripts/run-testcafe.js",
"testcafe-visual": "cross-env TEST_MODE=visual ./scripts/run-testcafe.js",
"refresh-md": "node ./scripts/refresh-md.js"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@babel/core": "^7.16.5",
"@babel/plugin-transform-typescript": "^7.16.1",
"@babel/preset-env": "^7.16.5",
"@babel/preset-typescript": "^7.16.5",
"@babel/register": "^7.16.5",
"@gooddata/catalog-export": "^8.9.0",
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.6",
"babel-plugin-add-module-exports": "^1.0.4",
"cross-env": "^5.2.0",
"enzyme": "^3.10.0",
"husky": "^3.0.0",
"prettier": "2.5.1",
"pretty-quick": "^3.1.3",
"sass": "^1.45.1",
"serve": "^11.3.2",
"testcafe": "^1.18.3",
"typescript": "^4.1.5"
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged --pattern \"**/*.*(js|jsx|ts|tsx|scss)\""
}
},
"engines": {
"node": ">=12.15.0"
}
}
Binary file added cgra-multiworkspacefilter/public/favicon.ico
Binary file not shown.
Binary file added cgra-multiworkspacefilter/public/home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions cgra-multiworkspacefilter/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>GoodData App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
--></body>
</html>
15 changes: 15 additions & 0 deletions cgra-multiworkspacefilter/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"short_name": "GoodData App",
"name": "Create GoodData App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
12 changes: 12 additions & 0 deletions cgra-multiworkspacefilter/scripts/refresh-md.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env node

require("@babel/register")({
presets: ["@babel/preset-typescript", "@babel/preset-env"],
plugins: ["add-module-exports"],
extensions: [".ts", ".js"],
});

const { workspace, backend } = require("../src/constants");
const path = "./src/md/full.js";
process.argv.push("--workspace-id", workspace, "--hostname", backend, "--output", path);
require("../node_modules/@gooddata/catalog-export");
Loading

0 comments on commit 108af8c

Please sign in to comment.