Skip to content

Commit

Permalink
Initial doc from gitlab
Browse files Browse the repository at this point in the history
  • Loading branch information
belefuu committed Sep 14, 2021
1 parent 8e52c44 commit 78de81e
Show file tree
Hide file tree
Showing 48 changed files with 2,428 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.bat binary
*.gif binary
*.png binary

45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Compiled source #
###################
*.a
*.bin
*.class
*.com
*.dll
*.exe
*.o
*.pyc
*.pyo
*.sa
*.so

# Logs and databases #
######################
*.log

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Cruft & Swarf #
#################
*.bak
*.iml
*.swp
*~
.gradle
.idea
.metadata
.project
.settings
/.settings/
/.classpath
/.project
/bin/
build
docker
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.1.0 (July 15, 2021)

- First release
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# How to Contribute

The SAS Content SDK is not open for external contributions.
333 changes: 333 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

65 changes: 63 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,63 @@
# content-sdk
The SAS Content SDK is a set of JavaScript APIs and web components that enable SAS Viya content to be easily embedded in a third-party application or web page.
# SAS Content SDK

## Overview

The SAS Content SDK is a set of JavaScript APIs and web components that enables accessing content from a SAS Viya deployment in a third-party application or web page. Content Areas displaying tiles representing SAS content can be embedded for selection or launching into SAS solutions. This functionality is delivered as the `content-sdk-components` JavaScript
library.

## Prerequisites

Access to a deployment of SAS Viya 4.0.1 (or later) is necessary in order to use the SDK. For more information about server set up, see <a target="_blank" href="https://developer.sas.com/sdk/va/docs/getting-started#sas-viya-setup">SAS Viya setup</a>.

## Installation

### NPM

The <a target="_blank" href="https://www.npmjs.com/package/@sassoftware/content-sdk">`@sassoftware/content-sdk`</a> library is published to NPM and can be installed by running the `npm install` command as shown below. `content-sdk-components` does not support ES6 imports. Therefore, the contents of the `content-sdk-components/dist` folder must be deployed with your page, and then loaded using a `script` tag.

```bash
# From the root directory of your project
npm install @sassoftware/content-sdk

# Copy the contents of the package to an asset folder for deployment
cp -r ./node_modules/@sassoftware/content-sdk ./sdk-assets
```

The library can then be loaded out of the deployed assets folder using a `script` tag.

```html
<script async src="./sdk-assets/dist/umd/content-sdk-components.js"></script>
```

### CDN (Content Delivery Network)

Accessing the `content-sdk-components` library from a CDN is easy. It does not require installation or
hosting of the library code and assets. There are several public options for accessing NPM content through a CDN, such
as <a target="_blank" href="https://unpkg.com/">UNPKG</a> and <a target="_blank" href="https://www.jsdelivr.com/">jsDelivr</a>. Here is an example of loading the 0.1.0 version of `content-sdk-components` from UNPKG
using an HTML `script` tag. When used in production, the version should be pinned to the full `major.minor.patch` semantic version.

```html
<script async src="https://unpkg.com/@sassoftware/[email protected]/dist/umd/content-sdk-components.js"></script>
```

## Getting Started

For guides and an API reference, see <a target="_blank" href="https://developer.sas.com/sdk/content/">developer.sas.com</a>.

## Examples

Full examples are located in the [examples folder](./examples/) of this repository.

## Contributing

The SAS Content SDK is not open for external contributions.

## License

This project is licensed under this commercial [license](LICENSE.txt).

## Additional Resources

- SAS Content SDK on <a target="_blank" href="https://developer.sas.com/sdk/va/">developer.sas.com</a>
- SAS Viya <a target="_blank" href="https://support.sas.com/en/software/visual-analytics-support.html#documentation">documentation</a>
- SAS Visual Analytics <a target="_blank" href="https://communities.sas.com/t5/SAS-Visual-Analytics/bd-p/sas_va">Community</a>
3 changes: 3 additions & 0 deletions SUPPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Support

We use GitHub for tracking bugs and feature requests. Please submit a GitHub issue or pull request for support. Alternatively, email can be sent to [[email protected]](mailto:[email protected]).
14 changes: 14 additions & 0 deletions documentation/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.DS_Store
.vscode

node_modules

lib/core/metadata.js
lib/core/MetadataBlog.js

website/translated_docs
website/build/
website/yarn.lock
website/package-lock.json
website/node_modules
website/i18n/*
12 changes: 12 additions & 0 deletions documentation/docs/api-reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
id: api-reference
title: API Reference
---

The SAS Content SDK provides a set of components and APIs that enable you to render tiles representing items (such as Report and Models) stored in SAS Viya. It also enables
you to use SAS content items to drive your own processes or to interact with SAS Visual
Analytics SDK.

## Top-Level Exports

- [`ContentAreaElement`](api/ContentAreaElement.md)
61 changes: 61 additions & 0 deletions documentation/docs/api/ContentAreaElement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
id: ContentAreaElement
title: ContentAreaElement
---

`ContentAreaElement` is a custom HTML element that renders an entire report. This element extends <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement">`HTMLElement`</a>.

## Custom Element Tag

```html
<sas-content-area
url="http://my-viya-server.com"
></sas-content-area>
```

## Attributes

### `url: string`

Specify the URL of the SAS Viya server that hosts the content to display. This is the full context root, including the protocol,
optional port, and host.

## Properties
### `folderIdentifier: ItemIdentifier`

Specify a folder on the SAS Viya server that contains the content to display. Folder can mean several things, as specified by [ItemIdentifier](ItemIdentifier.md).

### `itemIdentifiers: ItemIdentifier[]`

Specify an array of individual items on the SAS Viya server to display. See [ItemIdentifier](ItemIdentifier.md)

### `contentFilterConfig: { queryModeFilter: string; }`

Specify options for filtering the content displayed in the content area.

### `contentFilterConfig.queryModeFilter: string`

A SAS REST filter that is forwarded to underlying service requests. For example, to filter content to only show reports, use the following vaue: `eq(contentType,'report')`.

## Methods
### `onSelect: (selectedItems: Item[], selectAll: boolean, lastSelectedItem: Item, selected?: boolean) => void`

A callback function that can be used to respond to the selection of items in the ContentAreaElement.

#### Arguments

`selectedItems: Item[]`

The [Items](Item.md) that are currently selected.

`selectAll: boolean`

Whether all of the items have been selected.

`lastSelectedItem: Item`

The most recently selected [Item](Item.md).

`selected?: boolean`

True if the onSelect was triggered by a selection, false if onSelect was triggered by an un-selection.
18 changes: 18 additions & 0 deletions documentation/docs/api/Item.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
id: Item
title: Item
---

`Item` is a data type representing a content item returned by many Content SDK event handlers.

## Attributes

`Item` comes from the sas-drive service, and has a goal of containing all attributes that could be useful to a consumer or web client. The following are most likely to be of use in the Content SDK.

### `resource.id: string`

The uri of the content item, such as the report uri or folder uri.

### `resource.type.sasType: string`

The SAS type of the content item, such as 'report', 'folder', or 'file'.
23 changes: 23 additions & 0 deletions documentation/docs/api/ItemIdentifier.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
id: ItemIdentifier
title: ItemIdentifier
---

`ItemIdentifier` is a data type for specifying content items for use with the Content SDK components.

## Attributes

### `type: 'persistentLocation' | 'folderUri'`

Specify what type of content item this is. `persistentLocation` refers to a set of pre-defined SAS Viya locations. `folderUri` can be any SAS Viya folder uri.

### `value: string`


- `myFolder`: the My Folder folder in SAS Viya
- `favorites`: the My Favorites folder in SAS Viya
- `root`: the SAS Content folder in SAS Viya
- `history`: the Recents folder in SAS Viya
- `trash`: the Recycle Bin folder in SAS Viya

For `type: 'folderUri'`, a SAS Viya folder uri of the form: `'/folder/folders/789d13d3-789d-4fa3-9fea-123e321f1ea1'`. You can find the URI for a Folder in SAS Drive in the Information Pane. Select the Folder, scroll down in the Information Pane to the More -> URI section and copy the URI.
64 changes: 64 additions & 0 deletions documentation/docs/faq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
id: faq
title: Frequently Asked Questions
sidebar_label: FAQ
---

## What are the prerequisites for using the SAS Content SDK?

Use of the SAS Content SDK requires access to SAS Visual Analytics version 8.4 or later. Additional server configuration is also required. These requirements are covered in [Getting Started](getting-started.md#sas-viya-setup).

## What browsers are supported?

The SAS Content SDK supports:

- Chrome 80+
- Firefox 68+
- Safari 13+
- Edge on Chromium 80+

## Is there a license to use the SAS Content SDK?

The SAS Content SDK is released under a <a target="_blank" href="https://github.com/sassoftware/content-sdk/blob/master/LICENSE.txt">commercial license</a>.

## How is authentication handled by the SAS Content SDK?

The SAS Content SDK can either connect as guest or as a credentialed user, controlled by the `authenticationType` attribute on [ContentAreaElement](api/ContentAreaElement.md#authenticationtype-string).

### Guest
Connecting as guest requires that the SAS Viya server be setup to [allow for guest access](getting-started.md#allow-guest-access). The authentication happens automatically, without any intervention by the user.

### Credentials
Connecting using credentials allows the user to logon to the SAS Viya server with their own credentials. This is done by using the SAS Logon service to establish an authenticated session, and is identical to the authentication when you access SAS Drive directly on the SAS Viya server. This allows the SAS Content SDK to take advantage of all supported SAS Logon configurations, including single sign-On.

If the user is already authenticated, then the server connection will be automatically established. If not, then the [SASContentArea](api/ContentAreaElement.md) will present a button for the user to initiate logon. This launches the SAS Logon page in a new browser window which is then closed after logon has succeeded.

## How do I resolve this error message?

### "The server cannot be reached."

If the SAS Content SDK is unable to reach the SAS Viya server, try these steps to resolve the problem:

1. Verify the SAS Viya server URL. This should be the full context root for the SAS Viya deployment, including the protocol, optional port, and host.
1. Disable your ad-blocker
1. [Enable cross-origin resource sharing on your SAS Viya deployment.](getting-started.md#enable-cross-origin-resource-sharing)

### "Unable to log on to the server."

If the SAS Content SDK can reach the SAS Viya server but is unable to log on, try these steps to resolve the
problem:

1. [Enable cross-origin resource sharing on your SAS Viya deployment.](getting-started.md#enable-cross-origin-resource-sharing)
1. If using `authenticationType="guest"`, ensure that the SAS Viya server you are connecting to is [configured for guest access](getting-started.md#allow-guest-access).
1. If using `authenticationType="credentials"`, ensure that your host URI is included in the allowlist for your SAS Viya server's [CSRF configuration](getting-started.md#cross-site-request-forgery).

### "Unable to load the selected folder."

If the SAS Content SDK has successfully connected to a SAS Viya server but is unable to load a particular content item or display the results of a search,
try these steps to resolve the problem:

1. Verify that you have entered correctly formatted search or folder criteria for displaying content tiles.
1. Verify that the content folder URI is formatted correctly. It should look something like
`"/folders/folders/ff31b68a-8830-4c6f-bc2b-c91cc94adf85"`. If the `"/folders/folders/"` prefix is missing, or if you
see `%2F` in place of `/`, then the report will not load. You can find the URI for a Folder in SAS Drive in the Information Pane. Select the Folder, scroll down in the Information Pane to the More -> URI section and copy the URI.
1. Ensure that you have permission to access the content given the current authentication type. If `authenticationType="guest"` is used then the report must be accessible to the guest user. If it is not then the content will not load.
Loading

0 comments on commit 78de81e

Please sign in to comment.