Skip to content

Commit

Permalink
Feature/develop-to-experimental to feature/city-theme-temp (#12)
Browse files Browse the repository at this point in the history
* Fix double encoding City-of-Helsinki#524; with caveat axios/axios#2563

* Display all api results in react select components

* Fix event publisher field name for user rights check

* Fix City-of-Helsinki#530

* Do not try to update deleted subevents

* Do not try to edit past subevents

* Refactor editability check; allow deleting and canceling series that contain deleted, canceled or past subevents

* Remove unnecessary inlined sub_events at cancel to prevent API errors

* Add instructions for internet events

* Update snapshots

* Add remote participation keyword to all internet events

* Add notification about online events to cancel confirmation dialog

* Add postpone button and badge

* Mention postponing in cancel extra text

* Add postpone button to editor too

* Show postponed events in search instead of crashing

* Update user rights managers

* Add missing </p>

* Do not remove subevents at cancel after all; deleted items removed by API PR City-of-Helsinki/linkedevents#407

* Fix removed future time validation; fixes City-of-Helsinki#536, City-of-Helsinki#528

* Update snapshots

* Feature/oidc auth (#8)

* initial oidc integration commit

* Removed Passport from user authentication

Fixed Warning with History import and removed Passport authentications.

* fetchUser and comments for OIDC

Needs proper lifecycle methods.

* Added some missing oidc features and updated tests

* Added oidc settings to production build.

* Added tests for user actions and reducer.

* Updated readme by removing mentions to builtin auth server.

* Updated node-sass package, added more tests and gitignored coverage folder.

Co-authored-by: Ducky07 <[email protected]>

* Revert "Merge branch 'experimental/city-theme' into develop"

This reverts commit f51da9b, reversing
changes made to a06088f.

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch develop
# Your branch is up to date with 'origin/develop'.
#
# You are currently reverting commit a06088f.
#
# Changes to be committed:
#	modified:   config/appConfig.js
#	deleted:    config/assetPath.js
#	modified:   config/webpack/dev.js
#	modified:   config/webpack/prod.js
#	modified:   config_dev.json.example
#	modified:   package.json
#	deleted:    src/assets/default/assets/main.scss
#	deleted:    src/assets/default/i18n/index.js
#	new file:   src/assets/images/turkulogowhite.png
#	modified:   src/components/FormFields/index.js
#	modified:   src/components/FormFields/index.scss
#	deleted:    src/components/Header/LanguageSelector.js
#	deleted:    src/components/Header/LanguageSelector.test.js
#	modified:   src/components/Header/index.scss
#	modified:   src/components/HelFormFields/HelKeywordSelector/HelKeywordSelector.js
#	modified:   src/components/HelFormFields/HelLabeledCheckboxGroup.scss
#	modified:   src/components/HelFormFields/HelOffersField.js
#	modified:   src/components/HelFormFields/HelTextField.js
#	modified:   src/components/ImageEdit/index.js
#	modified:   src/components/ImageEdit/index.scss
#	modified:   src/components/ImagePicker/index.js
#	modified:   src/components/ImagePicker/index.scss
#	modified:   src/components/SearchBar/index.js
#	modified:   src/components/SearchBar/index.scss
#	modified:   src/i18n/index.js
#	modified:   src/index.jade
#	new file:   src/themes/material-ui-tku.js
#	new file:   src/themes/tku/tku-brand-colors.js
#	modified:   src/views/App/index.js
#	modified:   yarn.lock

Manually reverting changes that were accidentally merged into develop.

Weirdly enough Github thought taking commits from develop would be the same as merging the two branches together, while not being able to understand PR reverting (aka only reverting one branch but not the other).

Please don't do that again...

Co-authored-by: Riku Oja <[email protected]>
Co-authored-by: Aleksi Salonen <[email protected]>
Co-authored-by: Riku Oja <[email protected]>
Co-authored-by: aceViilee <[email protected]>
Co-authored-by: Santtu Alatalo <[email protected]>
  • Loading branch information
6 people committed May 13, 2020
1 parent 5f58aaf commit 9989f69
Show file tree
Hide file tree
Showing 48 changed files with 776 additions and 860 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"parser": "babel-eslint",
"globals": {
"_": true,
"appSettings": true
"appSettings": true,
"oidcSettings": true
},
"rules": {
"no-console": "off",
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ server.config
yarn-error.log
config_dev.json
package-lock.json
/coverage/
40 changes: 0 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ The UI is now compatible with the `courses` extension for the Linked Events API.
If you wish to include the extra fields specified in the `courses` extension,
please change the `ui_mode` setting from `events` to `courses`.

Note that authentication server is not nicely configurable. If you wish to
use your own authentication server, you will need code changes in server/auth.js.

## Running development server

```
Expand All @@ -55,10 +52,6 @@ if you'd like to change the base address for Linkedevents API, you would:
export api_base="https://api.hel.fi/linkedevents/v1"
```

Note that the configuration is used in the different phases. Some settings
need to be defined during build and other settings for running the
authentication server (see below)

Most if not all build automation tools provide for setting environment
variables. Check the documentation for the one you are using. If you are
testing locally you can `source config_build_example.sh` to get started.
Expand All @@ -75,36 +68,3 @@ $ yarn build
You should now have the bundled javascript + some non-bundled assets in
`dist`. You can serve these using your favorite web server at whatever
address suits your fancy.

You will still need the source tree for the authentication server (below)

### Setting up the runtime

In addition to serving the files built in previous step, you will need to
run the built-in authentication server (or proxy really). Although
linkedevents-ui runs completely in client, it currently uses authentication
code based OAuth2 Authorization Code flow. This is a historical accident,
that will be remedied one day.

We recommend running the authentication server with some sort of process
manager, possibly one specialized in running Node applications. Your system
process manager, like systemd, is another good candidate

The authentication server will need configuration passed in through
environment variables (see Congiration). If you use a process manager to
run the server, it should provide for setting them.

The server is run by executing `npm run production`. If your process
manager wants to run node by itself, you can also run specify `server` as
the script (that will actually run server/index.js). In this case you will
also need to set environment variable `NODE_ENV=production` by yourself.

After you have the authentication server running, you will need to set up a
web server to serve the files in `dist` and forward authentication requests
to the authentication server. The table below shows what needs to served:
| URL | what is served |
| /auth | forward to authentication server |
| filename | serve from dist-directory |
| unknown files | serve index.html from dist-directory |

The last part is needed for deep linking into the application.
2 changes: 1 addition & 1 deletion config/appConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ nconf.defaults({

/**
* Function to retrieve value from config
* @param {undefined|string|string[]} keys
* @param {undefined|string|string[]} keys
*/
function getConfig(keys) {
// Return all config if no keys provided
Expand Down
43 changes: 0 additions & 43 deletions config/assetPath.js

This file was deleted.

20 changes: 11 additions & 9 deletions config/webpack/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import common from './common.js';
import webpack from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import {readConfig} from '../appConfig';
import assetPath from '../assetPath';

const publicUrl = readConfig('publicUrl')
const ui_mode = readConfig('ui_mode')

Expand All @@ -23,17 +23,12 @@ export default {
resolve: {
modules: [common.paths.ROOT, 'node_modules'],
extensions: ['.', '.webpack.js', '.web.js', '.jsx', '.js'],
alias: {
'@city-assets': assetPath.cityAssets,
'@city-images': assetPath.cityImages,
'@city-i18n': assetPath.cityi18n,
},
},
module: {
rules: [
{
test: /\.(js|jsx)?$/,
exclude: /node_modules/,
test: /\.(js|jsx)?$/,
exclude: /node_modules/,
enforce: 'pre',
use: ['babel-loader', 'eslint-loader'],
},
Expand All @@ -46,7 +41,7 @@ export default {
{
loader: 'sass-loader',
options: {
data: "$ui-mode: " + ui_mode + " !global;",
data: '$ui-mode: ' + ui_mode + ' !global;',
},
},
],
Expand All @@ -72,6 +67,13 @@ export default {
jQuery: 'jquery',
'window.jQuery': 'jquery',
}),
new webpack.DefinePlugin({
oidcSettings: {
client_id: JSON.stringify(readConfig('client_id')),
openid_audience: JSON.stringify(readConfig('openid_audience')),
openid_authority: JSON.stringify(readConfig('openid_authority')),
},
}),
],
mode: 'development',
};
19 changes: 10 additions & 9 deletions config/webpack/prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
const GitRevisionPlugin = require('git-revision-webpack-plugin');
const common = require('./common');
const appConfig = require('../appConfig');
const assetPath = require('../assetPath');

// There are defined in common.js as well, but that is not available without
// transpilation, which is not done for webpack configuration file
Expand Down Expand Up @@ -34,17 +33,12 @@ const config = {
resolve: {
modules: [common.paths.ROOT, 'node_modules'],
extensions: ['.', '.webpack.js', '.web.js', '.jsx', '.js'],
alias: {
'@city-assets': assetPath.cityAssets,
'@city-images': assetPath.cityImages,
'@city-i18n': assetPath.cityi18n,
},
},
module: {
rules: [
{
test: /\.(js|jsx)?$/,
exclude: /node_modules/,
test: /\.(js|jsx)?$/,
exclude: /node_modules/,
enforce: 'pre',
use: ['babel-loader', 'eslint-loader'],
},
Expand All @@ -54,7 +48,7 @@ const config = {
use: [
{loader: 'style-loader'},
{loader: 'css-loader'},
{loader: 'sass-loader', options: {data: "$ui-mode: " + ui_mode + " !global;"}},
{loader: 'sass-loader', options: {data: '$ui-mode: ' + ui_mode + ' !global;'}},
],
},
{test: /\.css$/, use: ['style-loader', 'css-loader']},
Expand All @@ -81,6 +75,13 @@ const config = {
inject: true,
templateContent: indexTemplate,
}),
new webpack.DefinePlugin({
oidcSettings: {
client_id: JSON.stringify(appConfig.readConfig('client_id')),
openid_audience: JSON.stringify(appConfig.readConfig('openid_audience')),
openid_authority: JSON.stringify(appConfig.readConfig('openid_authority')),
},
}),
],
};

Expand Down
2 changes: 1 addition & 1 deletion config_dev.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"publicUrl": "http://localhost:8080",
"sessionSecret": "dev-secret-do-not-use-in-production",
"ui_mode": "events",
"client_id": "CLIENT_ID",
"client_id": "CLIENT_ID",
"openid_audience": "OPENID_AUDIENCE",
"openid_authority": "OPENID_AUTHORITY",
"city_theme": "city_theme"
Expand Down
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,14 @@
"moment": "^2.24.0",
"moment-timezone": "^0.5.27",
"nconf": "^0.9.1",
"node-sass": "^4.14.1",
"object-assign": "^4.1.1",
"passport": "^0.3.2",
"passport-helsinki": "https://github.com/City-of-Helsinki/passport-helsinki.git",
"oidc-client": "^1.10.1",
"progress": "^1.1.8",
"prop-types": "^15.7.2",
"raven-js": "^2.3.0",
"react": "16.12.0",
"react-addons-pure-render-mixin": "^15.6.2",
"react-bootstrap": "^1.0.1",
"react-copy-to-clipboard": "^5.0.1",
"react-dom": "16.12.0",
"react-helmet": "^5.2.1",
Expand All @@ -71,9 +70,9 @@
"react-router-dom": "^4.2.2",
"react-router-redux": "^5.0.0-alpha.9",
"react-select": "^3.0.8",
"reactstrap": "^8.4.1",
"redux": "4.0.4",
"redux-actions": "^0.9.0",
"redux-oidc": "^4.0.0-beta1",
"redux-thunk": "^2.3.0",
"typeahead.js": "^0.11.1"
},
Expand Down Expand Up @@ -106,7 +105,6 @@
"js-yaml": "^3.13.1",
"json-loader": "^0.5.4",
"morgan": "^1.6.1",
"node-sass": "^4.13.1",
"pug": "^2.0.3",
"pug-loader": "^2.4.0",
"react-transform-hmr": "^1.0.4",
Expand All @@ -126,6 +124,7 @@
"jest": {
"setupTestFrameworkScriptFile": "<rootDir>src/setupTests.js",
"testEnvironment": "jsdom",
"testURL": "http://localhost/",
"moduleFileExtensions": [
"js",
"jsx",
Expand All @@ -136,7 +135,7 @@
"node_modules"
],
"moduleNameMapper": {
"^.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$": "identity-obj-proxy"
"^.+\\.(css|styl|less|sass|scss|png|jpg|svg|ttf|woff|woff2)$": "identity-obj-proxy"
},
"snapshotSerializers": [
"enzyme-to-json/serializer"
Expand Down
59 changes: 0 additions & 59 deletions server/auth.js

This file was deleted.

7 changes: 0 additions & 7 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import cookieSession from 'cookie-session'

import getSettings from './getSettings'
import express from 'express'
import {getPassport, addAuth} from './auth'

import webpack from 'webpack'
import webpackMiddleware from 'webpack-dev-middleware'
Expand All @@ -16,17 +15,11 @@ import config from '../config/webpack/dev.js'

const settings = getSettings()
const app = express()
const passport = getPassport(settings)


app.use(cookieParser());
app.use(bodyParser.urlencoded({extended: true}));
app.use(cookieSession({name: 's', secret: settings.sessionSecret, maxAge: 86400 * 1000}));

app.use(passport.initialize());
app.use(passport.session());
addAuth(app, passport, settings);

if(process.env.NODE_ENV !== 'development') {
app.use('/', express.static(path.resolve(__dirname, '..', 'dist')));
app.get('*', function (req, res) {
Expand Down
Loading

0 comments on commit 9989f69

Please sign in to comment.