This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

feat(location): Related sn portal can be configured in a config file

  • Loading branch information...
Anikó Litványi
Anikó Litványi committed Nov 30, 2016
1 parent 9aa413f commit dc91f6cde817ae9a07174f66726601e591df2b10
@@ -9,7 +9,7 @@
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
This component lets you work with the SenseNet ECM Content Repository (create or manage content, execute queries, etc.) by providing a JavaScript client API for the main content
This component lets you work with the [SenseNet ECM](https://github.com/SenseNet) Content Repository (create or manage content, execute queries, etc.) by providing a JavaScript client API for the main content
operations.
This library connects to a SenseNet portal's REST API, but hides the underlying HTTP requests. You can work with simple load or create Content operations in JavaScript, instead of
@@ -18,14 +18,51 @@ having to construct ajax requests yourself.
It also provides you the full SenseNet Content Type system hierarchy through Typescript classes with all the fields defined in the CTDs and the Content Type schemas with FieldSettings
so that you can manage Content easy on client-side knowing the related fields and their settings.
### Installation
### Installation on an existing Sense/Net portal
Get the latest stable version with npm
```
npm install --save sn-client-js
```
or from the [GitHub repository](https://github.com/SenseNet/sn-client-js) and place the downloaded source into your project. If you want to use only the transpiled JavaScript
modules, you can find them in the dist/src folder and import them like
```
var SN = require('/pathtomodule/sn-client-js');
```
If you want to use the module types you can find them in the src folder. Import them the following way:
```
import * as SN from 'sn-client-js';
SN.Content.Create('Folder', { DisplayName: 'My folder' } );
```
### Installation into an external app with node and npm
To install the latest stable version
```
npm install --save sn-client-js
```
Check the ```properties.json``` file in your app's root and change to url to the url of your Sense/Net ECM instance:
```
{
"sensenet": {
"url": "https://mysite.com"
}
}
```
So that you can set the url of your Sense/Net portal that you want to communicate with. To enable your external app to send request against your Sense/Net portal change
your ```Portal.settings```. For further information about cross-origin resource sharing in Sense/Net check [this](http://wiki.sensenet.com/Cross-origin_resource_sharing#Origin_check)
article.
### Import
#### CommonJS

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"commit": "git-cz",
"report-coverage":"cat ./coverage/lcov.info | codecov",
"report-coverage": "cat ./coverage/lcov.info | codecov",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"repository": {
@@ -28,12 +28,15 @@
"homepage": "https://sensenet.com",
"dependencies": {
"@reactivex/rxjs": "5.0.0-rc.4",
"app-root-path": "2.0.1",
"isomorphic-fetch": "2.2.1"
},
"devDependencies": {
"@types/app-root-path": "1.2.4",
"@types/chai": "3.4.34",
"@types/isomorphic-fetch": "0.0.31",
"@types/mocha": "2.2.33",
"@types/node": "0.0.1",
"@types/orchestrator": "0.0.30",
"@types/sinon": "1.16.32",
"chai": "3.5.0",
@@ -0,0 +1,5 @@
{
"sensenet": {
"url": "https://mysite.com"
}
}
@@ -4,16 +4,22 @@ import { Content } from './Content';
import { ODataApi } from './ODataApi';
import 'isomorphic-fetch';
const { ajax } = Rx.Observable;
import {Value, Properties} from 'ts-json-properties';
/**
* This module contains methods for sending requests and getting responses from the Content Repository through OData REST API.
*
* Following methods return Rxjs ActionObservables which are made from the ajax requests' promises.
*/
//TODO: leírni a module-t
export module ODataApiActionObservables {
const ROOT_URL = 'https://daily.demo.sensenet.com/OData.svc';
const sensenetConfig = Properties.getValue('sensenet');
const config = Object.assign(sensenetConfig);
let ROOT_URL = '/';
if(typeof sensenetConfig !== 'undefined' && typeof sensenetConfig.url != 'undefined'){
ROOT_URL = config.url;
}
/**
* Method to get a Content from the Content Repository through OData REST API.
*
@@ -2,6 +2,7 @@ import { ODataHelper } from './ODataHelper';
import { Content } from './Content';
import 'isomorphic-fetch';
import * as Rx from '@reactivex/rxjs';
import {Value, Properties} from 'ts-json-properties';
/**
* This module contains methods and classes for sending requests and getting responses from the Content Repository through OData REST API.
@@ -10,8 +11,13 @@ import * as Rx from '@reactivex/rxjs';
* gets their responses as Observables and returns them so that you can subscribe them in your code.
*/
export module ODataApi {
//TODO: vhová kitenni
const ROOT_URL = 'https://daily.demo.sensenet.com/OData.svc';
const sensenetConfig = Properties.getValue('sensenet');
const config = Object.assign(sensenetConfig);
let ROOT_URL = '/';
if(typeof sensenetConfig !== 'undefined' && typeof sensenetConfig.url != 'undefined'){
ROOT_URL = config.url;
}
/**
* Method to get a Content from the Content Repository through OData REST API.
*
@@ -23,3 +23,10 @@ export { ODataApiActionObservables } from './ODataApiActionObservables';
export { ODataApi } from './ODataApi';
export { Resources } from './Resources';
export { Security } from './Security';
import {Properties} from 'ts-json-properties';
import * as appRoot from 'app-root-path';
Properties.initialize();
const rootPath = appRoot.path;
Properties.initialize(appRoot.path + '/properties.json');

0 comments on commit dc91f6c

Please sign in to comment.