Skip to content

Commit

Permalink
Merge branch 'release/2019-06_2'
Browse files Browse the repository at this point in the history
  • Loading branch information
gallayl committed Jun 26, 2019
2 parents 2a9b844 + 84dfb64 commit 532b6a2
Show file tree
Hide file tree
Showing 448 changed files with 9,138 additions and 6,543 deletions.
9 changes: 9 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
packages/**/node_modules/*
examples/**/node_modules/*
apps/**/node_modules/*
packages/**/dist/*
examples/**/build/*
examples/**/storybook-static/*
apps/**/bundle/*

examples/sn-react-redux-todo-app/*
89 changes: 89 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:cypress/recommended',
'plugin:import/recommended',
'plugin:import/react',
'plugin:import/typescript',
'prettier',
'prettier/react',
'prettier/@typescript-eslint',
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'prettier', 'react', 'cypress', 'jsdoc', 'import', 'react-hooks'],
env: { browser: true, node: true, es6: true, jest: true, 'cypress/globals': true },
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
settings: {
react: {
version: 'detect',
},
jsdoc: { exemptEmptyFunctions: false },
},
rules: {
'arrow-parens': ['error', 'as-needed'],
'no-unused-vars': 'off',
'no-console': 'off',
'react/prop-types': 0,
'@typescript-eslint/no-unused-vars': 'off', // Use Typescript own check for this
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': [
'error',
{
accessibility: 'explicit',
overrides: {
accessors: 'explicit',
constructors: 'no-public',
methods: 'explicit',
properties: 'off',
parameterProperties: 'explicit',
},
},
],
'@typescript-eslint/no-parameter-properties': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/array-type': ['error', 'array-simple'],
'no-unused-expressions': ['error', { allowShortCircuit: true, allowTernary: true }],
'prettier/prettier': 'error',
'require-jsdoc': 1,
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies
'import/no-unresolved': 'off',
'import/order': 'error',
'object-shorthand': 'error',
'dot-notation': 'error',
'no-caller': 'error',
'no-useless-concat': 'error',
radix: 'error',
yoda: 'error',
'prefer-arrow-callback': 'error',
'prefer-rest-params': 'error',
'no-var': 'error',
'prefer-const': 'error',
'prefer-spread': 'error',
'no-shadow': 'error',
'@typescript-eslint/no-useless-constructor': 'error',
'prefer-template': 'error',
'prefer-destructuring': ['error', { array: false, object: true }],
'default-case': 'error',
},
overrides: [
{
files: ['packages/**/test/**/*.{ts,tsx}'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-object-literal-type-assertion': 'off',
'dot-notation': 'off',
},
},
],
}
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ before_install:
- export PATH="$HOME/.yarn/bin:$PATH"

cache:
yarn: true
- yarn
- directories:
- node_modules

jobs:
allow_failures:
Expand All @@ -35,16 +37,16 @@ jobs:
name: 'DMS'
install: yarn && npm install netlify-cli -g
script: yarn build && yarn dms build:webpack
after_success: netlify deploy --site 12d988ec-f023-45e1-9f49-d05f8b309c42 --auth $NETLIFY_ACCESS_TOKEN --dir ./examples/sn-dms-demo/build --message $TRAVIS_PULL_REQUEST
after_success: wait-on $SN_BOT_URL -l -t 60000 && netlify deploy --site 12d988ec-f023-45e1-9f49-d05f8b309c42 --auth $NETLIFY_ACCESS_TOKEN --dir ./examples/sn-dms-demo/build --message $TRAVIS_PULL_REQUEST

- if: type = pull_request
name: 'Component docs'
install: yarn && npm install netlify-cli -g
script: yarn build && yarn storybook build-storybook
after_success: netlify deploy --site 2e86544e-b4b5-4f40-b1a0-a5d34367a03f --auth $NETLIFY_ACCESS_TOKEN --dir ./examples/sn-react-component-docs/storybook-static --message $TRAVIS_PULL_REQUEST
after_success: wait-on $SN_BOT_URL -l -t 60000 && netlify deploy --site 2e86544e-b4b5-4f40-b1a0-a5d34367a03f --auth $NETLIFY_ACCESS_TOKEN --dir ./examples/sn-react-component-docs/storybook-static --message $TRAVIS_PULL_REQUEST

- if: type = pull_request
name: 'Sn app'
install: yarn && npm install netlify-cli -g
script: yarn build && yarn snapp build:webpack
after_success: netlify deploy --site eddadc9d-3e2d-42ab-a0c6-81b9d58fce84 --auth $NETLIFY_ACCESS_TOKEN --dir ./apps/sensenet/bundle/assets --message $TRAVIS_PULL_REQUEST
after_success: wait-on $SN_BOT_URL -l -t 60000 && netlify deploy --site eddadc9d-3e2d-42ab-a0c6-81b9d58fce84 --auth $NETLIFY_ACCESS_TOKEN --dir ./apps/sensenet/bundle/assets --message $TRAVIS_PULL_REQUEST
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"typescript.tsdk": "node_modules\\typescript\\lib",
"editor.formatOnSave": true
"editor.formatOnSave": true,
"eslint.validate": [{ "language": "typescript", "autoFix": true }, { "language": "typescriptreact", "autoFix": true }]
}
63 changes: 31 additions & 32 deletions apps/sensenet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sensenet/sn-app",
"version": "0.3.0",
"version": "0.4.0",
"main": "dist/index.js",
"files": [
"dist",
Expand All @@ -14,10 +14,7 @@
"content management"
],
"scripts": {
"fix": "npm run fix:prettier && npm run fix:tslint",
"fix:prettier": "prettier \"{,!(dist|temp|bundle)/**/}*.{ts,tsx}\" --write",
"fix:tslint": "tslint --fix --project .",
"lint": "tslint --project .",
"build:webpack": "rimraf bundle && webpack",
"start": "webpack-dev-server --progress"
},
Expand All @@ -30,15 +27,15 @@
"homepage": "https://sensenet.com",
"devDependencies": {
"@types/autosuggest-highlight": "^3.1.0",
"@types/react": "^16.8.4",
"@types/react-autosuggest": "^9.3.7",
"@types/react-dom": "^16.8.2",
"@types/react-redux": "^7.0.1",
"@types/react": "^16.8.19",
"@types/react-autosuggest": "^9.3.8",
"@types/react-dom": "^16.8.4",
"@types/react-redux": "^7.0.9",
"@types/react-responsive": "^3.0.3",
"@types/react-router": "^4.4.5",
"@types/react-router-dom": "^4.3.1",
"@types/react-router": "^5.0.1",
"@types/react-router-dom": "^4.3.3",
"@types/uuid": "^3.4.4",
"autoprefixer": "^9.4.8",
"autoprefixer": "^9.5.1",
"awesome-typescript-loader": "^5.2.1",
"css-loader": "^2.1.0",
"file-loader": "^3.0.1",
Expand All @@ -53,33 +50,35 @@
"style-loader": "^0.23.1",
"ts-config-webpack-plugin": "^1.3.1",
"url-loader": "^1.1.2",
"webpack": "^4.29.5",
"webpack-bundle-analyzer": "^3.0.4",
"webpack-cli": "^3.2.3",
"webpack-dev-server": "^3.2.0"
"webpack": "^4.32.2",
"webpack-bundle-analyzer": "^3.3.2",
"webpack-cli": "^3.3.2",
"webpack-dev-server": "^3.4.1"
},
"dependencies": {
"@furystack/logging": "^1.1.0",
"@material-ui/core": "^3.9.2",
"@material-ui/icons": "^3.0.2",
"@sensenet/client-core": "^2.0.1",
"@sensenet/client-utils": "^1.6.1",
"@sensenet/controls-react": "^2.7.0",
"@sensenet/default-content-types": "^1.2.1",
"@sensenet/document-viewer-react": "^1.1.1",
"@sensenet/list-controls-react": "^1.3.7",
"@sensenet/pickers-react": "^1.2.0",
"@sensenet/query": "^1.1.6",
"@sensenet/redux": "^5.1.9",
"@sensenet/repository-events": "^1.4.1",
"@furystack/inject": "^3.0.7",
"@furystack/logging": "^1.1.6",
"@material-ui/core": "^4.0.1",
"@material-ui/icons": "^4.0.1",
"@sensenet/client-core": "^2.1.0",
"@sensenet/client-utils": "^1.6.2",
"@sensenet/controls-react": "^2.8.0",
"@sensenet/default-content-types": "^1.2.2",
"@sensenet/document-viewer-react": "^1.1.2",
"@sensenet/list-controls-react": "^1.3.8",
"@sensenet/pickers-react": "^1.2.1",
"@sensenet/query": "^1.1.7",
"@sensenet/redux": "^5.1.10",
"@sensenet/repository-events": "^1.4.2",
"autosuggest-highlight": "^3.1.1",
"monaco-editor": "^0.16.2",
"monaco-editor": "^0.17.0",
"react": "^16.8.2",
"react-autosuggest": "^9.4.3",
"react-dom": "^16.8.2",
"react-monaco-editor": "^0.25.1",
"react-redux": "^6.0.1",
"react-responsive": "^6.1.1",
"react-markdown": "^4.0.8",
"react-monaco-editor": "^0.26.1",
"react-redux": "^7.0.3",
"react-responsive": "^6.1.2",
"redux": "^4.0.1",
"redux-di-middleware": "^4.0.1",
"semaphore-async-await": "^1.5.1",
Expand Down
31 changes: 21 additions & 10 deletions apps/sensenet/src/components/AddButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@ import Add from '@material-ui/icons/Add'
import CloudUpload from '@material-ui/icons/CloudUpload'
import { GenericContent, Schema } from '@sensenet/default-content-types'
import React, { useContext, useEffect, useState } from 'react'
import { CurrentContentContext, InjectorContext, LocalizationContext, RepositoryContext } from '../context'
import { LoggerContext } from '../context/LoggerContext'
import { UploadProgressInfo } from '@sensenet/client-core'
import { ObservableValue } from '@sensenet/client-utils'
import { CurrentContentContext } from '../context'
import { useInjector, useLocalization, useLogger, useRepository } from '../hooks'
import { UploadTracker } from '../services/UploadTracker'
import { AddDialog } from './AddDialog'
import { AddDialog } from './dialogs/add'
import { Icon } from './Icon'

export interface AddButtonProps {
parent?: GenericContent
}

export const AddButton: React.FunctionComponent<AddButtonProps> = props => {
const injector = useContext(InjectorContext)
const repo = useContext(RepositoryContext)
const injector = useInjector()
const repo = useRepository()
const parentContext = useContext(CurrentContentContext)
const [parent, setParent] = useState(parentContext)
const [showSelectType, setShowSelectType] = useState(false)
Expand All @@ -28,16 +30,16 @@ export const AddButton: React.FunctionComponent<AddButtonProps> = props => {
const [showAddNewDialog, setShowAddNewDialog] = useState(false)
const [selectedSchema, setSelectedSchema] = useState<Schema>(repo.schemas.getSchemaByName('GenericContent'))

const localization = useContext(LocalizationContext).values.addButton
const logger = useContext(LoggerContext).withScope('AddButton')
const localization = useLocalization().addButton
const logger = useLogger('AddButton')

useEffect(() => {
props.parent && setParent(props.parent)
}, [props.parent])

useEffect(() => {
!props.parent && setParent(parentContext)
}, [parentContext])
}, [parentContext, props.parent])

useEffect(() => {
if (showSelectType) {
Expand All @@ -53,7 +55,16 @@ export const AddButton: React.FunctionComponent<AddButtonProps> = props => {
})
})
}
}, [parent.Id, showSelectType])
}, [localization.errorGettingAllowedContentTypes, logger, parent.Id, repo, showSelectType])

const [progressObservable] = useState(new ObservableValue<UploadProgressInfo>())

useEffect(() => {
const subscription = progressObservable.subscribe(p =>
injector.getInstance(UploadTracker).onUploadProgress.setValue({ progress: p, repo }),
)
return () => subscription.dispose()
}, [injector, progressObservable, repo])

return (
<div>
Expand Down Expand Up @@ -99,7 +110,7 @@ export const AddButton: React.FunctionComponent<AddButtonProps> = props => {
createFolders: true,
binaryPropertyName: 'Binary',
overwrite: false,
progressObservable: injector.getInstance(UploadTracker).onUploadProgress,
progressObservable,
})
}}
type="file"
Expand Down
29 changes: 14 additions & 15 deletions apps/sensenet/src/components/ContentBreadcrumbs.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
import { useContext } from 'react'
import React from 'react'
import React, { useContext } from 'react'
import { RouteComponentProps, withRouter } from 'react-router'
import { ContentRoutingContext, CurrentAncestorsContext, CurrentContentContext } from '../context'
import { CurrentAncestorsContext, CurrentContentContext } from '../context'
import { useContentRouting } from '../hooks'
import Breadcrumbs, { BreadcrumbItem } from './Breadcrumbs'

export const ContentBreadcrumbsComponent: React.FunctionComponent<
RouteComponentProps & { onItemClick?: (item: BreadcrumbItem) => void }
> = props => {
const ancestors = useContext(CurrentAncestorsContext)
const parent = useContext(CurrentContentContext)
const ctx = useContext(ContentRoutingContext)
const contentRouter = useContentRouting()

return (
<Breadcrumbs
content={ancestors.map(
content =>
({
displayName: content.DisplayName || content.Name,
title: content.Path,
url: ctx.getPrimaryActionUrl(content),
content,
} as BreadcrumbItem),
)}
content={ancestors.map(content => ({
displayName: content.DisplayName || content.Name,
title: content.Path,
url: contentRouter.getPrimaryActionUrl(content),
content,
}))}
currentContent={{
displayName: parent.DisplayName || parent.Name,
title: parent.Path,
url: ctx.getPrimaryActionUrl(parent),
url: contentRouter.getPrimaryActionUrl(parent),
content: parent,
}}
onItemClick={(_ev, item) => {
props.onItemClick ? props.onItemClick(item) : props.history.push(ctx.getPrimaryActionUrl(item.content))
props.onItemClick
? props.onItemClick(item)
: props.history.push(contentRouter.getPrimaryActionUrl(item.content))
}}
/>
)
Expand Down
Loading

0 comments on commit 532b6a2

Please sign in to comment.