Skip to content

Commit

Permalink
gd-ui-boilerplate - Proxy - no authentication needed
Browse files Browse the repository at this point in the history
  • Loading branch information
BugsBunny338 committed Oct 19, 2021
1 parent edf5b51 commit 4014e3f
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 149 deletions.
16 changes: 5 additions & 11 deletions gd-ui-boilerplate/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
# GoodData.UI Boilerplate App

This app follows steps from https://sdk.gooddata.com/gooddata-ui/docs/ht_create_your_first_visualization.html:

* It initializes create-react-app
* It configures GoodData proxy
* It adds GoodData.UI dependencies

This app also shows:
This app shows:

* Use of `<AttributeFilter>` component
* Use of `<Kpi>` component
* Use of `<Headline>` component

And finally this app demonstrates 3 approaches how to render visualizations:

Expand All @@ -19,7 +13,7 @@ And finally this app demonstrates 3 approaches how to render visualizations:

## Live demo

This app is deployed at https://gooddata-demo.s3.amazonaws.com/gd-ui-boilerplate/index.html. For access, you can register at https://gooddata-examples.herokuapp.com/.
This app is deployed at https://gooddata-demo.s3.amazonaws.com/gd-ui-boilerplate/index.html.

## How to run locally

Expand All @@ -35,11 +29,11 @@ This app is deployed at https://gooddata-demo.s3.amazonaws.com/gd-ui-boilerplate

## Backend/proxy info

This app is configured to run against https://developer.na.gooddata.com/. For access, you can register at https://gooddata-examples.herokuapp.com/.
This app is configured to run against https://live-examples-proxy.herokuapp.com/, workspace `xms7ga4tf3g3nzucd8380o2bev8oeknp`. No authentication required.

## Screnshots

![homepage](https://raw.githubusercontent.com/gooddata/ui-sdk-examples/master/gd-ui-boilerplate/public/home.png "Homepage")
![homepage](public/home.png)

---

Expand Down
26 changes: 3 additions & 23 deletions gd-ui-boilerplate/src/App.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// Copyright (C) 2007-2020, GoodData(R) Corporation. All rights reserved.
import React, { useState, useEffect } from "react";
// Copyright (C) 2007-2021, GoodData(R) Corporation. All rights reserved.
import React, { useState } from "react";
import { Headline, ColumnChart } from "@gooddata/sdk-ui-charts";
import { newPositiveAttributeFilter } from "@gooddata/sdk-model";
import { BackendProvider, WorkspaceProvider, Execute } from "@gooddata/sdk-ui";
import { InsightView } from "@gooddata/sdk-ui-ext";
import { AttributeFilter } from "@gooddata/sdk-ui-filters";
import backend from "./backend";
import CustomBarChart from "./components/CustomBarChart";
import { loginMachinery } from "./utils";
import * as Ldm from "./ldm/full";

import "@gooddata/sdk-ui-charts/styles/css/main.css";
Expand All @@ -17,24 +16,8 @@ import "./App.css";
const WORKSPACE = "xms7ga4tf3g3nzucd8380o2bev8oeknp";

function App() {
const [isLogged, setIsLogged] = useState(false);
const [filters, setFilters] = useState([]);

useEffect(() => {
loginMachinery(
{
sdk: backend.sdk,
projectId: WORKSPACE,
domain: backend.config.hostname
},
() => setIsLogged(true)
);
});

if (!isLogged) {
return <span>Checking your credentials, please wait…</span>;
}

return (
<BackendProvider backend={backend}>
<WorkspaceProvider workspace={WORKSPACE}>
Expand All @@ -48,10 +31,7 @@ function App() {
}}
>
<AttributeFilter
filter={newPositiveAttributeFilter(
Ldm.LocationCity,
[]
)}
filter={newPositiveAttributeFilter(Ldm.LocationCity, [])}
onApply={filter => setFilters([filter])}
/>
</div>
Expand Down
23 changes: 5 additions & 18 deletions gd-ui-boilerplate/src/backend.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
// Copyright (C) 2007-2020, GoodData(R) Corporation. All rights reserved.
import bearFactory, {
ContextDeferredAuthProvider
} from "@gooddata/sdk-backend-bear";
// Copyright (C) 2007-2021, GoodData(R) Corporation. All rights reserved.
import bearFactory, { AnonymousAuthProvider } from "@gooddata/sdk-backend-bear";

const config = {
hostname: ""
};

if (process.env.NODE_ENV === "production") {
const gdUrl = process.env.GD_URL;
config.hostname = gdUrl
? `https://${gdUrl}`
: "https://developer.na.gooddata.com";
}

const backend = bearFactory(config).withAuthentication(
new ContextDeferredAuthProvider()
);
const backend = bearFactory({
hostname: "https://live-examples-proxy.herokuapp.com/"
}).withAuthentication(new AnonymousAuthProvider());

window.gooddata = backend;

Expand Down
2 changes: 1 addition & 1 deletion gd-ui-boilerplate/src/components/CustomBarChart.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2007-2020, GoodData(R) Corporation. All rights reserved.
// Copyright (C) 2007-2021, GoodData(R) Corporation. All rights reserved.
import React from "react";
import ReactHighcharts from "react-highcharts";

Expand Down
2 changes: 1 addition & 1 deletion gd-ui-boilerplate/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2007-2020, GoodData(R) Corporation. All rights reserved.
// Copyright (C) 2007-2021, GoodData(R) Corporation. All rights reserved.
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
Expand Down
34 changes: 0 additions & 34 deletions gd-ui-boilerplate/src/setupProxy.js

This file was deleted.

61 changes: 0 additions & 61 deletions gd-ui-boilerplate/src/utils.js

This file was deleted.

0 comments on commit 4014e3f

Please sign in to comment.