Skip to content

Commit

Permalink
Merge branch 'release/2019-03'
Browse files Browse the repository at this point in the history
  • Loading branch information
zoltanbedi committed Mar 6, 2019
2 parents 5e4b734 + 242f353 commit 5d1158b
Show file tree
Hide file tree
Showing 154 changed files with 7,239 additions and 4,156 deletions.
19 changes: 19 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest Current File",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["${relativeFile}"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
}
}
],
"compounds": []
}
5 changes: 2 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"typescript.tsdk": "node_modules\\typescript\\lib",
"tslint.autoFixOnSave": true,
"editor.formatOnSave": true
"typescript.tsdk": "node_modules\\typescript\\lib",
"editor.formatOnSave": true
}
38 changes: 9 additions & 29 deletions examples/sn-dms-demo/README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,15 @@
# sn-dms-demo

[![Join the chat at https://gitter.im/SenseNet/sn-dms-demo](https://badges.gitter.im/SenseNet/sn-dms-demo.svg)](https://gitter.im/SenseNet/sn-dms-demo?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/SenseNet/sn-dms-demo.svg?branch=master)](https://travis-ci.org/SenseNet/sn-dms-demo)
[![codecov](https://codecov.io/gh/SenseNet/sn-dms-demo/branch/master/graph/badge.svg)](https://codecov.io/gh/SenseNet/sn-dms-demo)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/708a03362ad447958a6830badfc61d80)](https://www.codacy.com/app/herflis33/sn-dms-demo?utm_source=github.com&utm_medium=referral&utm_content=SenseNet/sn-dms-demo&utm_campaign=Badge_Grade)
[![License](https://img.shields.io/github/license/SenseNet/sn-dms-demo.svg?style=flat)](https://github.com/SenseNet/sn-dms-demo/LICENSE.txt)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat)](https://github.com/semantic-release/semantic-release)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat)](http://commitizen.github.io/cz-cli/)
[![Greenkeeper badge](https://badges.greenkeeper.io/SenseNet/sn-dms-demo.svg)](https://greenkeeper.io/)

sensenet Document Management demo with React.

[![Sense/Net Services](https://img.shields.io/badge/sensenet-7.0.0--beta3%20tested-green.svg)](https://github.com/SenseNet/sensenet/releases/tag/v7.0.0-beta3)
A sensenet Document Management demo with React.

## Install and start

```
$ git clone https://github.com/SenseNet/sn-dms-demo.git
$ cd sn-dms-demo
$ npm install
$ npm start
```

Please set the following enviroment variables:
- REACT_APP_SERVICE_URL: url of the site that has at least [sensenet services](https://github.com/SenseNet/sensenet) installed (default value is ```https://sn-local``` so if you have a site installed locally with this url, you have nothing to do with this).
- REACT_APP_RECAPTCHA_KEY: [Google ReCAPTCHA](https://www.google.com/recaptcha/intro/) sitekey. Without this registration won't work.

## Running Tests

```
$ npm test
```

The app is built with [create-react-app-typescript](https://github.com/wmonk/create-react-app-typescript) the TypeScript version of [create-react-app](https://github.com/facebookincubator/create-react-app), so for further information about build, test, config, etc. issues, check them on github.
1. Install yarn globally with: **npm i yarn -g**
2. Clone the monorepo with: **git clone https://github.com/SenseNet/sn-client.git**
3. Navigate into the monorepo's root folder: **cd sn-client**
4. Install all of the dependencies with a simple **yarn** command (this will take a second or two)
5. Set the environment options, Repository path in index.tsx, etc... *(Since this app is for demo purposes it requires several demo content items (e.g. demo users, demo content types, demo templates, demo actions) that are NOT the part of the official sensenet packages. So please, please if you want to try out the examples of the sn-client package, do it with connecting to our fully prepared demo sensenet instance at [https://dmsservice.demo.sensenet.com](https://dmsservice.demo.sensenet.com). Note: we rebuild this service daily and sometimes more frequently. When a reset happens, expect short downtimes and losing any changes you made before.)*
6. Build all of the packages with the command **yarn build**
7. Run the application with **yarn workspace sn-dms-demo run start**
8. You should be able to login at https://localhost:3000
34 changes: 16 additions & 18 deletions examples/sn-dms-demo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sn-dms-demo",
"version": "1.1.0",
"version": "1.2.0",
"description": "Document Management Demo upon sensenet",
"private": true,
"repository": {
Expand All @@ -27,51 +27,49 @@
}
},
"dependencies": {
"@date-io/date-fns": "0.0.2",
"@date-io/moment": "0.0.2",
"@material-ui/core": "^3.8.2",
"@material-ui/icons": "^3.0.2",
"@sensenet/authentication-google": "^2.0.3",
"@sensenet/authentication-jwt": "^1.0.7",
"@sensenet/client-core": "^1.4.0",
"@sensenet/authentication-google": "^2.0.4",
"@sensenet/authentication-jwt": "^1.0.8",
"@sensenet/client-core": "^1.4.1",
"@sensenet/client-utils": "^1.4.2",
"@sensenet/controls-react": "^2.3.7",
"@sensenet/controls-react": "^2.4.0",
"@sensenet/default-content-types": "^1.1.2",
"@sensenet/document-viewer-react": "^1.0.4",
"@sensenet/icons-react": "^1.2.5",
"@sensenet/list-controls-react": "^1.3.2",
"@sensenet/redux": "^5.1.4",
"@sensenet/repository-events": "^1.3.0",
"@sensenet/search-react": "^1.2.0",
"@sensenet/document-viewer-react": "^1.0.5",
"@sensenet/icons-react": "^1.2.6",
"@sensenet/list-controls-react": "^1.3.3",
"@sensenet/pickers-react": "^1.0.0",
"@sensenet/redux": "^5.1.5",
"@sensenet/repository-events": "^1.3.1",
"@sensenet/search-react": "^1.2.1",
"autoprefixer": "^9.4.2",
"css-loader": "^2.1.0",
"date-fns": "^2.0.0-alpha.21",
"dotenv": "6.2.0",
"file-loader": "3.0.1",
"fs-extra": "^7.0.1",
"history": "^4.7.2",
"html-webpack-plugin": "^3.2.0",
"lodash.groupby": "^4.6.0",
"material-ui-pickers": "^2.0.4",
"moment": "^2.22.2",
"object-assign": "4.1.1",
"postcss-flexbugs-fixes": "4.1.0",
"postcss-loader": "^3.0.0",
"promise": "8.0.2",
"react": "^16.6.3",
"react": "^16.8.1",
"react-async-script": "^1.0.0",
"react-cookie-consent": "^2.0.1",
"react-custom-scrollbars": "^4.2.1",
"react-dom": "^16.6.3",
"react-dom": "^16.8.1",
"react-google-recaptcha": "^1.0.5",
"react-loadable": "^5.5.0",
"react-markdown": "^4.0.4",
"react-moment": "^0.8.4",
"react-redux": "^6.0.0",
"react-responsive": "^6.0.1",
"react-router": "^4.3.1",
"react-router-dom": "^4.3.1",
"redux": "^4.0.1",
"redux-di-middleware": "^2.0.2",
"redux-di-middleware": "^3.0.0",
"reflect-metadata": "^0.1.12",
"ts-keycode-enum": "^1.0.6",
"typeface-roboto": "^0.0.54",
Expand Down
92 changes: 42 additions & 50 deletions examples/sn-dms-demo/src/Actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
import { debounce, ObservableValue, usingAsync } from '@sensenet/client-utils'
import { File as SnFile, GenericContent } from '@sensenet/default-content-types'
import { ActionModel } from '@sensenet/default-content-types/dist/ActionModel'
import { Action, AnyAction, Dispatch } from 'redux'
import { InjectableAction } from 'redux-di-middleware'
import { Dispatch } from 'redux'
import { IInjectableActionCallbackParams } from 'redux-di-middleware'
import { updateChildrenOptions } from './store/documentlibrary/actions'
import { rootStateType } from './store/rootReducer'

Expand Down Expand Up @@ -78,25 +78,24 @@ export const setEditedFirst = (edited: boolean) => ({
edited,
})

export const getListActions = (idOrPath: number | string, scenario?: string, customActions?: ActionModel[]) =>
({
type: 'GET_LIST_ACTIONS',
async inject(options) {
const actionsState = options.getState().dms.toolbar
if (!actionsState.isLoading && (actionsState.idOrPath !== idOrPath || actionsState.scenario !== scenario)) {
options.dispatch(loadListActions(idOrPath, scenario))
const repository = options.getInjectable(Repository)
const data: { d: { Actions: ActionModel[] } } = (await repository.getActions({ idOrPath, scenario })) as any
const actions = customActions ? [...data.d.Actions, ...customActions] : data.d.Actions
const ordered = actions.sort((a, b) => {
const x = a.Index
const y = b.Index
return x < y ? -1 : x > y ? 1 : 0
})
options.dispatch(setListActions(ordered))
}
},
} as InjectableAction<rootStateType, AnyAction>)
export const getListActions = (idOrPath: number | string, scenario?: string, customActions?: ActionModel[]) => ({
type: 'GET_LIST_ACTIONS',
async inject(options: IInjectableActionCallbackParams<rootStateType>) {
const actionsState = options.getState().dms.toolbar
if (!actionsState.isLoading && (actionsState.idOrPath !== idOrPath || actionsState.scenario !== scenario)) {
options.dispatch(loadListActions(idOrPath, scenario))
const repository = options.getInjectable(Repository)
const data: { d: { Actions: ActionModel[] } } = (await repository.getActions({ idOrPath, scenario })) as any
const actions = customActions ? [...data.d.Actions, ...customActions] : data.d.Actions
const ordered = actions.sort((a, b) => {
const x = a.Index
const y = b.Index
return x < y ? -1 : x > y ? 1 : 0
})
options.dispatch(setListActions(ordered))
}
},
})

export const loadListActions = (idOrPath: number | string, scenario?: string) => ({
type: 'LOAD_LIST_ACTIONS',
Expand Down Expand Up @@ -147,9 +146,7 @@ export const trackUploadProgress = async <T extends GenericContent>(
dispatch: Dispatch,
api: Repository,
) => {
let currentUpload: ExtendedUploadProgressInfo | undefined = getState().dms.uploads.uploads.find(
u => u.guid === currentValue.guid,
)
let currentUpload = getState().dms.uploads.uploads.find(u => u.guid === currentValue.guid)
if (currentUpload) {
dispatch(updateUploadItem(currentValue))
} else {
Expand All @@ -175,13 +172,11 @@ export const trackUploadProgress = async <T extends GenericContent>(
}
}

export const uploadFileList: <T extends SnFile>(
uploadOptions: Pick<UploadFromFileListOptions<T>, Exclude<keyof UploadFromFileListOptions<T>, 'repository'>>,
) => InjectableAction<rootStateType, Action> = <T extends SnFile>(
export const uploadFileList = <T extends SnFile>(
uploadOptions: Pick<UploadFromFileListOptions<T>, Exclude<keyof UploadFromFileListOptions<T>, 'repository'>>,
) => ({
type: 'DMS_UPLOAD_FILE_LIST_INJECTABLE_ACTION',
inject: async options => {
inject: async (options: IInjectableActionCallbackParams<rootStateType>) => {
const api = options.getInjectable(Repository)
await usingAsync(new ObservableValue<UploadProgressInfo>(), async progress => {
progress.subscribe(async currentValue =>
Expand All @@ -203,13 +198,11 @@ export const uploadFileList: <T extends SnFile>(
},
})

export const uploadDataTransfer: <T extends SnFile>(
options: Pick<UploadFromEventOptions<T>, Exclude<keyof UploadFromEventOptions<T>, 'repository'>>,
) => InjectableAction<rootStateType, Action> = <T extends SnFile>(
export const uploadDataTransfer = <T extends SnFile>(
uploadOptions: Pick<UploadFromEventOptions<T>, Exclude<keyof UploadFromEventOptions<T>, 'repository'>>,
) => ({
type: 'DMS_UPLOAD_DATA_TRANSFER_INJECTABLE_ACTION',
inject: async options => {
inject: async (options: IInjectableActionCallbackParams<rootStateType>) => {
const api = options.getInjectable(Repository)
await usingAsync(new ObservableValue<UploadProgressInfo>(), async progress => {
progress.subscribe(async currentValue =>
Expand Down Expand Up @@ -328,21 +321,20 @@ export const handleDrawerMenu = (open: boolean) => ({
open,
})

export const loadBreadcrumbActions = (idOrPath: number | string) =>
({
type: 'LOAD_BREADCRUMB_ACTIONS',
inject: async options => {
if (idOrPath === options.getState().dms.actionmenu.breadcrumb.idOrPath) {
return
}
const repository = options.getInjectable(Repository)
const actions: { d: { Actions: ActionModel[] } } = (await repository.getActions({
idOrPath,
scenario: 'DMSBreadcrumb',
})) as any
options.dispatch({
type: 'LOAD_BREADCRUMB_ACTIONS_SUCCESS',
result: { idOrPath, actions: actions.d.Actions },
})
},
} as InjectableAction<rootStateType, AnyAction>)
export const loadBreadcrumbActions = (idOrPath: number | string) => ({
type: 'LOAD_BREADCRUMB_ACTIONS',
inject: async (options: IInjectableActionCallbackParams<rootStateType>) => {
if (idOrPath === options.getState().dms.actionmenu.breadcrumb.idOrPath) {
return
}
const repository = options.getInjectable(Repository)
const actions: { d: { Actions: ActionModel[] } } = (await repository.getActions({
idOrPath,
scenario: 'DMSBreadcrumb',
})) as any
options.dispatch({
type: 'LOAD_BREADCRUMB_ACTIONS_SUCCESS',
result: { idOrPath, actions: actions.d.Actions },
})
},
})
Loading

0 comments on commit 5d1158b

Please sign in to comment.