You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@senssoft.apache.org by cg...@apache.org on 2016/11/21 23:50:14 UTC
[1/3] incubator-senssoft-tap git commit: Update to Node 6.9,
Semantic 2.2.6, fixed .gitignore for Semantic build
Repository: incubator-senssoft-tap
Updated Branches:
refs/heads/master 38af7ed67 -> 839be021d
Update to Node 6.9, Semantic 2.2.6, fixed .gitignore for Semantic build
Project: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/commit/ad759b6c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/tree/ad759b6c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/diff/ad759b6c
Branch: refs/heads/master
Commit: ad759b6cf0a005928669a201c3c8eb0deb018b76
Parents: 38af7ed
Author: Clay Gimenez <ap...@claygimenez.com>
Authored: Sun Nov 20 16:43:36 2016 -0500
Committer: Clay Gimenez <ap...@claygimenez.com>
Committed: Sun Nov 20 16:43:36 2016 -0500
----------------------------------------------------------------------
.gitignore | 6 +-
package.json | 27 +-------
semantic/tasks/build/assets.js | 35 ++++++++++
semantic/tasks/build/css.js | 113 ++++++++++++++++++++++++++++++++
semantic/tasks/build/javascript.js | 77 ++++++++++++++++++++++
5 files changed, 230 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/ad759b6c/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index bba8f85..8272c5c 100755
--- a/.gitignore
+++ b/.gitignore
@@ -21,10 +21,10 @@ static/results/*
npm-debug.log
.tmp
/node_modules/*
-build
+/build
-static/*
-!static/admin/
+/static/*
+/!static/admin/
archive/*
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/ad759b6c/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 883cac9..16a9398 100644
--- a/package.json
+++ b/package.json
@@ -26,41 +26,18 @@
"Tap"
],
"engines": {
- "node": ">= 4.4.5"
+ "node": "^6.9.1"
},
"dependencies": {
- "better-console": "^0.2.4",
"d3": "^4.1.1",
- "extend": "^3.0.0",
- "gulp-chmod": "^1.3.0",
- "gulp-clone": "^1.0.0",
- "gulp-concat-css": "^2.3.0",
- "gulp-copy": "0.0.2",
- "gulp-dedupe": "0.0.2",
- "gulp-flatten": "^0.3.0",
- "gulp-header": "^1.8.7",
- "gulp-help": "^1.6.1",
- "gulp-if": "^2.0.1",
- "gulp-less": "^3.1.0",
- "gulp-minify-css": "^1.2.4",
- "gulp-notify": "^2.2.0",
- "gulp-plumber": "^1.1.0",
- "gulp-print": "^2.0.1",
- "gulp-rename": "^1.2.2",
- "gulp-replace": "^0.5.4",
- "gulp-rtlcss": "^1.0.0",
- "gulp-watch": "^4.3.8",
"lodash": "^4.13.1",
- "map-stream": "0.0.6",
"react": "^15.2.0",
"react-dom": "^15.2.0",
"react-redux": "^4.4.5",
"react-router": "^2.5.2",
"redux": "^3.5.2",
"redux-thunk": "^2.1.0",
- "require-dot-file": "^0.4.0",
- "semantic-ui": "^2.2.1",
- "yamljs": "^0.2.8"
+ "semantic-ui": "^2.2.6"
},
"devDependencies": {
"babel-core": "^6.10.4",
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/ad759b6c/semantic/tasks/build/assets.js
----------------------------------------------------------------------
diff --git a/semantic/tasks/build/assets.js b/semantic/tasks/build/assets.js
new file mode 100644
index 0000000..bc37ad9
--- /dev/null
+++ b/semantic/tasks/build/assets.js
@@ -0,0 +1,35 @@
+/*******************************
+ Build Task
+*******************************/
+
+var
+ gulp = require('gulp'),
+
+ // gulp dependencies
+ chmod = require('gulp-chmod'),
+ gulpif = require('gulp-if'),
+
+ // config
+ config = require('../config/user'),
+ tasks = require('../config/tasks'),
+
+ // shorthand
+ globs = config.globs,
+ assets = config.paths.assets,
+ output = config.paths.output,
+ source = config.paths.source,
+
+ log = tasks.log
+;
+
+module.exports = function(callback) {
+
+ console.info('Building assets');
+
+ // copy assets
+ return gulp.src(source.themes + '/**/assets/**/*.*')
+ .pipe(gulpif(config.hasPermission, chmod(config.permission)))
+ .pipe(gulp.dest(output.themes))
+ ;
+
+};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/ad759b6c/semantic/tasks/build/css.js
----------------------------------------------------------------------
diff --git a/semantic/tasks/build/css.js b/semantic/tasks/build/css.js
new file mode 100644
index 0000000..6f579d8
--- /dev/null
+++ b/semantic/tasks/build/css.js
@@ -0,0 +1,113 @@
+/*******************************
+ Build Task
+*******************************/
+
+var
+ gulp = require('gulp'),
+
+ // node dependencies
+ console = require('better-console'),
+ fs = require('fs'),
+
+ // gulp dependencies
+ autoprefixer = require('gulp-autoprefixer'),
+ chmod = require('gulp-chmod'),
+ clone = require('gulp-clone'),
+ flatten = require('gulp-flatten'),
+ gulpif = require('gulp-if'),
+ less = require('gulp-less'),
+ minifyCSS = require('gulp-clean-css'),
+ plumber = require('gulp-plumber'),
+ print = require('gulp-print'),
+ rename = require('gulp-rename'),
+ replace = require('gulp-replace'),
+ runSequence = require('run-sequence'),
+
+ // config
+ config = require('../config/user'),
+ tasks = require('../config/tasks'),
+ install = require('../config/project/install'),
+
+ // shorthand
+ globs = config.globs,
+ assets = config.paths.assets,
+ output = config.paths.output,
+ source = config.paths.source,
+
+ banner = tasks.banner,
+ comments = tasks.regExp.comments,
+ log = tasks.log,
+ settings = tasks.settings
+;
+
+// add internal tasks (concat release)
+require('../collections/internal')(gulp);
+
+module.exports = function(callback) {
+
+ var
+ tasksCompleted = 0,
+ maybeCallback = function() {
+ tasksCompleted++;
+ if(tasksCompleted === 2) {
+ callback();
+ }
+ },
+
+ stream,
+ compressedStream,
+ uncompressedStream
+ ;
+
+ console.info('Building CSS');
+
+ if( !install.isSetup() ) {
+ console.error('Cannot build files. Run "gulp install" to set-up Semantic');
+ return;
+ }
+
+ // unified css stream
+ stream = gulp.src(source.definitions + '/**/' + globs.components + '.less')
+ .pipe(plumber(settings.plumber.less))
+ .pipe(less(settings.less))
+ .pipe(autoprefixer(settings.prefix))
+ .pipe(replace(comments.variables.in, comments.variables.out))
+ .pipe(replace(comments.license.in, comments.license.out))
+ .pipe(replace(comments.large.in, comments.large.out))
+ .pipe(replace(comments.small.in, comments.small.out))
+ .pipe(replace(comments.tiny.in, comments.tiny.out))
+ .pipe(flatten())
+ ;
+
+ // two concurrent streams from same source to concat release
+ uncompressedStream = stream.pipe(clone());
+ compressedStream = stream.pipe(clone());
+
+ // uncompressed component css
+ uncompressedStream
+ .pipe(plumber())
+ .pipe(replace(assets.source, assets.uncompressed))
+ .pipe(gulpif(config.hasPermission, chmod(config.permission)))
+ .pipe(gulp.dest(output.uncompressed))
+ .pipe(print(log.created))
+ .on('end', function() {
+ runSequence('package uncompressed css', maybeCallback);
+ })
+ ;
+
+ // compressed component css
+ compressedStream = stream
+ .pipe(plumber())
+ .pipe(clone())
+ .pipe(replace(assets.source, assets.compressed))
+ .pipe(minifyCSS(settings.minify))
+ .pipe(rename(settings.rename.minCSS))
+ .pipe(gulpif(config.hasPermission, chmod(config.permission)))
+ .pipe(gulp.dest(output.compressed))
+ .pipe(print(log.created))
+ .on('end', function() {
+ runSequence('package compressed css', maybeCallback);
+ })
+ ;
+
+};
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/ad759b6c/semantic/tasks/build/javascript.js
----------------------------------------------------------------------
diff --git a/semantic/tasks/build/javascript.js b/semantic/tasks/build/javascript.js
new file mode 100644
index 0000000..f99c130
--- /dev/null
+++ b/semantic/tasks/build/javascript.js
@@ -0,0 +1,77 @@
+/*******************************
+ Build Task
+*******************************/
+
+var
+ gulp = require('gulp'),
+
+ // node dependencies
+ console = require('better-console'),
+ fs = require('fs'),
+
+ // gulp dependencies
+ chmod = require('gulp-chmod'),
+ flatten = require('gulp-flatten'),
+ gulpif = require('gulp-if'),
+ plumber = require('gulp-plumber'),
+ print = require('gulp-print'),
+ rename = require('gulp-rename'),
+ replace = require('gulp-replace'),
+ uglify = require('gulp-uglify'),
+
+ // config
+ config = require('../config/user'),
+ tasks = require('../config/tasks'),
+ install = require('../config/project/install'),
+
+ // shorthand
+ globs = config.globs,
+ assets = config.paths.assets,
+ output = config.paths.output,
+ source = config.paths.source,
+
+ banner = tasks.banner,
+ comments = tasks.regExp.comments,
+ log = tasks.log,
+ settings = tasks.settings
+;
+
+// add internal tasks (concat release)
+require('../collections/internal')(gulp);
+
+module.exports = function(callback) {
+
+ var
+ stream,
+ compressedStream,
+ uncompressedStream
+ ;
+
+ console.info('Building Javascript');
+
+ if( !install.isSetup() ) {
+ console.error('Cannot build files. Run "gulp install" to set-up Semantic');
+ return;
+ }
+
+ // copy source javascript
+ gulp.src(source.definitions + '/**/' + globs.components + '.js')
+ .pipe(plumber())
+ .pipe(flatten())
+ .pipe(replace(comments.license.in, comments.license.out))
+ .pipe(gulp.dest(output.uncompressed))
+ .pipe(gulpif(config.hasPermission, chmod(config.permission)))
+ .pipe(print(log.created))
+ .pipe(uglify(settings.uglify))
+ .pipe(rename(settings.rename.minJS))
+ .pipe(gulp.dest(output.compressed))
+ .pipe(gulpif(config.hasPermission, chmod(config.permission)))
+ .pipe(print(log.created))
+ .on('end', function() {
+ gulp.start('package compressed js');
+ gulp.start('package uncompressed js');
+ callback();
+ })
+ ;
+
+};
\ No newline at end of file
[2/3] incubator-senssoft-tap git commit: Tap v0.2 front end
simplification
Posted by cg...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/store/configureStore.js
----------------------------------------------------------------------
diff --git a/public/store/configureStore.js b/public/store/configureStore.js
index 4a3baa5..905949d 100644
--- a/public/store/configureStore.js
+++ b/public/store/configureStore.js
@@ -1,14 +1,29 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import { createStore, applyMiddleware } from 'redux';
-import thunk from 'redux-thunk';
import logger from 'redux-logger';
+import api from './api';
import rootReducer from '../reducers';
export default function configureStore (preloadedState) {
const store = createStore(
rootReducer,
preloadedState,
- applyMiddleware(thunk, logger())
+ applyMiddleware(api, logger())
);
return store;
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/stylesheets/main.scss
----------------------------------------------------------------------
diff --git a/stylesheets/main.scss b/stylesheets/main.scss
index 9381e44..b482ee9 100644
--- a/stylesheets/main.scss
+++ b/stylesheets/main.scss
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
$brown: #A76B00;
$black: #271900;
$background: #FFF5E3;
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/tap/settings.py
----------------------------------------------------------------------
diff --git a/tap/settings.py b/tap/settings.py
index 2e82089..5c7a213 100644
--- a/tap/settings.py
+++ b/tap/settings.py
@@ -136,4 +136,4 @@ STATICFILES_DIRS = (
# SensSoft Distill URL connection
# used in app_mgr/distillviews.py
-DISTILL_URL = "localhost:8090"
\ No newline at end of file
+DISTILL_URL = "localhost:8090"
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/tasks/build.js
----------------------------------------------------------------------
diff --git a/tasks/build.js b/tasks/build.js
index cef2a15..2967b44 100644
--- a/tasks/build.js
+++ b/tasks/build.js
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import gulp from 'gulp';
import gulpLoadPlugins from 'gulp-load-plugins';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/tasks/django.js
----------------------------------------------------------------------
diff --git a/tasks/django.js b/tasks/django.js
index 9ef2523..4a7f635 100644
--- a/tasks/django.js
+++ b/tasks/django.js
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import gulp from 'gulp';
import { exec } from 'child_process';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/tasks/filesystem.js
----------------------------------------------------------------------
diff --git a/tasks/filesystem.js b/tasks/filesystem.js
index 03ee130..fff0551 100644
--- a/tasks/filesystem.js
+++ b/tasks/filesystem.js
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import gulp from 'gulp';
import del from 'del';
// import fs from 'fs-extra';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/tasks/styles.js
----------------------------------------------------------------------
diff --git a/tasks/styles.js b/tasks/styles.js
index 7941d6c..395bcba 100644
--- a/tasks/styles.js
+++ b/tasks/styles.js
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import gulp from 'gulp';
import runSequence from 'run-sequence';
import gulpLoadPlugins from 'gulp-load-plugins';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/tasks/test.js
----------------------------------------------------------------------
diff --git a/tasks/test.js b/tasks/test.js
index 11472e5..3874ae6 100644
--- a/tasks/test.js
+++ b/tasks/test.js
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import gulp from 'gulp';
import runSequence from 'run-sequence';
import gulpLoadPlugins from 'gulp-load-plugins';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/templates/main.html
----------------------------------------------------------------------
diff --git a/templates/main.html b/templates/main.html
index fc706b4..a3b64eb 100644
--- a/templates/main.html
+++ b/templates/main.html
@@ -1,3 +1,20 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
<!DOCTYPE html>
<html lang="en">
<head>
[3/3] incubator-senssoft-tap git commit: Tap v0.2 front end
simplification
Posted by cg...@apache.org.
Tap v0.2 front end simplification
Project: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/commit/839be021
Tree: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/tree/839be021
Diff: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/diff/839be021
Branch: refs/heads/master
Commit: 839be021d88167930b6244feb4d982e4122d305b
Parents: ad759b6
Author: Clay Gimenez <ap...@claygimenez.com>
Authored: Mon Nov 21 18:49:45 2016 -0500
Committer: Clay Gimenez <ap...@claygimenez.com>
Committed: Mon Nov 21 18:49:45 2016 -0500
----------------------------------------------------------------------
app_mgr/views.py | 14 +--
gulpfile.babel.js | 15 +++
package.json | 11 +-
public/actions/ActionTypes.js | 30 ++++++
public/actions/app.js | 26 -----
public/actions/auth.js | 9 --
public/actions/index.js | 91 +++++++++++++++-
public/actions/org.js | 17 ---
public/actions/user.js | 17 ---
public/components/AppCard.jsx | 37 +++++++
public/components/AppProfile.js | 40 -------
public/components/AppProfile.jsx | 15 +++
public/components/AppResults.jsx | 28 +++--
public/components/AppSettings.jsx | 15 +++
public/components/Feed.jsx | 15 +++
public/components/Home.jsx | 15 +++
public/components/OrgProfile.jsx | 15 +++
public/components/OrgSettings.jsx | 15 +++
public/components/Profile.js | 39 -------
public/components/Profile.jsx | 15 +++
public/components/Settings.js | 53 ----------
public/components/Settings.jsx | 15 +++
public/components/Sidebox.jsx | 15 +++
public/components/UserProfile.js | 30 ------
public/components/UserProfile.jsx | 15 +++
public/components/UserSettings.js | 25 -----
public/components/UserSettings.jsx | 15 +++
public/components/visualizations/Counts.jsx | 15 +++
.../components/visualizations/GraphMetrics.jsx | 15 +++
.../components/visualizations/HorizontalBar.jsx | 15 +++
.../components/visualizations/VerticalBar.jsx | 15 +++
public/constants/ActionTypes.js | 16 ---
public/containers/App.js | 40 -------
public/containers/App.jsx | 70 +++++++++----
public/containers/AppList.jsx | 82 +++++++++++++++
public/containers/Login.jsx | 70 +++++++++++++
public/containers/Main.jsx | 92 ++++++++++-------
public/containers/Org.jsx | 15 +++
public/containers/SignUp.jsx | 70 +++++++++++++
public/containers/User.jsx | 15 +++
public/index.jsx | 72 ++++++++-----
public/reducers/app.js | 99 ------------------
public/reducers/apps.js | 96 +++++++++++++++++
public/reducers/auth.js | 17 ---
public/reducers/index.js | 25 +++--
public/reducers/org.js | 15 +++
public/reducers/user.js | 103 ++++++++++++-------
public/store/api.js | 95 +++++++++++++++++
public/store/configureStore.js | 19 +++-
stylesheets/main.scss | 15 +++
tap/settings.py | 2 +-
tasks/build.js | 15 +++
tasks/django.js | 15 +++
tasks/filesystem.js | 15 +++
tasks/styles.js | 15 +++
tasks/test.js | 15 +++
templates/main.html | 17 +++
57 files changed, 1240 insertions(+), 587 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/app_mgr/views.py
----------------------------------------------------------------------
diff --git a/app_mgr/views.py b/app_mgr/views.py
index 4d0c464..10bdd27 100644
--- a/app_mgr/views.py
+++ b/app_mgr/views.py
@@ -45,7 +45,7 @@ from app_mgr.models import UserProfile, Organization, Application, AppVersion
from app_mgr.serializers import UserProfileSerializer, OrganizationSerializer, ApplicationSerializer
import datetime
-import requests
+import requests
#
# RESTFUL VIEWS
@@ -64,7 +64,7 @@ class UserProfileListView(generics.ListCreateAPIView):
def get_queryset(self):
# only used for list
- return get_objects_for_user(self.request.user, "view_userprofile",
+ return get_objects_for_user(self.request.user, "view_userprofile",
UserProfile.objects.all())
class OrganizationListView(generics.ListCreateAPIView):
@@ -79,7 +79,7 @@ class OrganizationListView(generics.ListCreateAPIView):
def get_queryset(self):
# only used for list
- return get_objects_for_user(self.request.user, "view_organization",
+ return get_objects_for_user(self.request.user, "view_organization",
Organization.objects.all())
class ApplicationListView(generics.ListCreateAPIView):
@@ -94,12 +94,12 @@ class ApplicationListView(generics.ListCreateAPIView):
def get_queryset(self):
# only used for list
- owned = get_objects_for_user(self.request.user, "view_application",
+ owned = get_objects_for_user(self.request.user, "view_application",
Application.objects.all())
public = Application.objects.filter(isPublic=True)
viewable = list(set(list(owned) + list(public)))
-
+
return viewable
# SINGLE RETRIEVE/UPDATE/DESTROY
@@ -176,7 +176,7 @@ class ApplicationInstanceView(generics.RetrieveUpdateDestroyAPIView):
# AUTHENTICATION VIEWS
#
-# creates a new user
+# creates a new user
def register(request):
# TODO : add logging back in. Good practice!!
# Like before, get the request's context.
@@ -336,4 +336,4 @@ def view_profile(request):
# return render(request, 'user_profile.html',
# {'user': request.user,
# }
-# )
\ No newline at end of file
+# )
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/gulpfile.babel.js
----------------------------------------------------------------------
diff --git a/gulpfile.babel.js b/gulpfile.babel.js
index 237ba50..2043e13 100644
--- a/gulpfile.babel.js
+++ b/gulpfile.babel.js
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import gulp from 'gulp';
import path from 'path';
import del from 'del';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 16a9398..df9329d 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "tap",
"description": "Tap, The Software as a Sensor portal and visualization component",
- "version": "0.1.0",
+ "version": "0.2.0",
"private": true,
"license": "Apache-2.0",
"author": "Draper",
@@ -14,13 +14,13 @@
"Michelle Beard <mb...@draper.com>",
"Arthi Vezhavendan <av...@draper.com>"
],
- "homepage": "https://github.com/draperlaboratory/tap#readme",
+ "homepage": "https://senssoft.incubator.apache.org",
"repository": {
"type": "git",
- "url": "git+https://github.com/draperlaboratory/tap.git"
+ "url": "https://git-wip-us.apache.org/repos/asf/incubator-senssoft.tap.git"
},
"bugs": {
- "url": "https://github.com/draperlaboratory/tap/issues"
+ "url": "https://issues.apache.org/jira/browse/SENSSOFT"
},
"keywords": [
"Tap"
@@ -30,13 +30,12 @@
},
"dependencies": {
"d3": "^4.1.1",
- "lodash": "^4.13.1",
+ "isomorphic-fetch": "^2.2.1",
"react": "^15.2.0",
"react-dom": "^15.2.0",
"react-redux": "^4.4.5",
"react-router": "^2.5.2",
"redux": "^3.5.2",
- "redux-thunk": "^2.1.0",
"semantic-ui": "^2.2.6"
},
"devDependencies": {
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/actions/ActionTypes.js
----------------------------------------------------------------------
diff --git a/public/actions/ActionTypes.js b/public/actions/ActionTypes.js
new file mode 100644
index 0000000..f58b9cb
--- /dev/null
+++ b/public/actions/ActionTypes.js
@@ -0,0 +1,30 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+export const LOGIN_REQUEST = 'LOGIN_REQUEST';
+export const LOGIN_SUCCESS = 'LOGIN_SUCCESS';
+export const LOGIN_FAILURE = 'LOGIN_FAILURE';
+export const LOGOUT = 'LOGOUT';
+export const SIGNUP_REQUEST = 'SIGNUP_REQUEST';
+export const SIGNUP_SUCCESS = 'SIGNUP_SUCCESS';
+export const SIGNUP_FAILURE = 'SIGNUP_FAILURE';
+
+export const APP_LIST_REQUEST = 'APP_LIST_REQUEST';
+export const APP_LIST_SUCCESS = 'APP_LIST_SUCCESS';
+export const APP_LIST_FAILURE = 'APP_LIST_FAILURE';
+
+export const APP_DETAILS_REQUEST = 'APP_DETAILS_REQUEST';
+export const APP_DETAILS_SUCCESS = 'APP_DETAILS_SUCCESS';
+export const APP_DETAILS_FAILURE = 'APP_DETAILS_FAILURE';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/actions/app.js
----------------------------------------------------------------------
diff --git a/public/actions/app.js b/public/actions/app.js
deleted file mode 100644
index 3badb05..0000000
--- a/public/actions/app.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import { REQUEST_APP, RECEIVE_APP, REQUEST_APP_UPDATE, CONFIRM_APP_UPDATE, REQUEST_APP_RESULTS, RECEIVE_APP_RESULTS }
- from '../constants/ActionTypes';
-
-export function fetchApp () {
- return { type : REQUEST_APP };
-}
-
-export function receivedApp (app) {
- return { type : RECEIVE_APP, app : app };
-}
-
-export function updateApp (update) {
- return { type : REQUEST_APP_UPDATE, update : update };
-}
-
-export function confirmAppUpdate (success) {
- return { type : CONFIRM_APP_UPDATE, saved : success };
-}
-
-export function fetchAppResults () {
- return { type : REQUEST_APP_RESULTS };
-}
-
-export function receivedAppResults (results) {
- return { type : RECEIVE_APP_RESULTS, results : results };
-}
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/actions/auth.js
----------------------------------------------------------------------
diff --git a/public/actions/auth.js b/public/actions/auth.js
deleted file mode 100644
index 8dc9ec6..0000000
--- a/public/actions/auth.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import { LOG_IN, LOG_OUT } from '../constants/ActionTypes';
-
-export function logIn () {
- return { type : LOG_IN };
-}
-
-export function logOut () {
- return { type : LOG_OUT };
-}
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/actions/index.js
----------------------------------------------------------------------
diff --git a/public/actions/index.js b/public/actions/index.js
index 27914c4..72529b0 100644
--- a/public/actions/index.js
+++ b/public/actions/index.js
@@ -1,4 +1,87 @@
-export * from './auth';
-export * from './user';
-export * from './org';
-export * from './app';
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import * as ActionTypes from './ActionTypes';
+import { CALL_API } from '../store/api';
+
+export function login(email, password) {
+ return {
+ [CALL_API]: {
+ endpoint: '/app_mgr/login',
+ types: [
+ ActionTypes.LOGIN_REQUEST,
+ ActionTypes.LOGIN_SUCCESS,
+ ActionTypes.LOGIN_FAILURE,
+ ],
+ body: $.param({
+ email,
+ password,
+ }),
+ method: 'POST',
+ successRedirect: '/apps',
+ },
+ email,
+ };
+}
+
+export function logout() {
+ localStorage.removeItem('tapToken');
+}
+
+export function signup(email, password) {
+ return {
+ [CALL_API]: {
+ endpoint: '/app_mgr/register',
+ types: [
+ ActionTypes.SIGNUP_REQUEST,
+ ActionTypes.SIGNUP_SUCCESS,
+ ActionTypes.SIGNUP_FAILURE,
+ ],
+ body: $.param({
+ email,
+ password,
+ }),
+ method: 'POST',
+ successRedirect: '/apps',
+ },
+ };
+}
+
+export function getAppList() {
+ return {
+ [CALL_API]: {
+ endpoint: 'app_mgr/apps',
+ types: [
+ ActionTypes.APP_LIST_REQUEST,
+ ActionTypes.APP_LIST_SUCCESS,
+ ActionTypes.APP_LIST_FAILURE,
+ ],
+ },
+ };
+}
+
+export function getAppDetails(appId) {
+ return {
+ [CALL_API]: {
+ endpoint: `app_mgr/appresults/${appId}/graph`,
+ types: [
+ ActionTypes.APP_DETAILS_REQUEST,
+ ActionTypes.APP_DETAILS_SUCCESS,
+ ActionTypes.APP_DETAILS_FAILURE,
+ ],
+ },
+ appId,
+ };
+}
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/actions/org.js
----------------------------------------------------------------------
diff --git a/public/actions/org.js b/public/actions/org.js
deleted file mode 100644
index 95091ae..0000000
--- a/public/actions/org.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import { REQUEST_ORG, RECEIVE_ORG, REQUEST_ORG_UPDATE, CONFIRM_ORG_UPDATE } from '../constants/ActionTypes';
-
-export function fetchOrg () {
- return { type : REQUEST_ORG };
-}
-
-export function receivedOrg (org) {
- return { type : RECEIVE_ORG, org : org };
-}
-
-export function updateOrg (update) {
- return { type : REQUEST_ORG_UPDATE, update : update };
-}
-
-export function confirmOrgUpdate (success) {
- return { type : CONFIRM_ORG_UPDATE, saved : success };
-}
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/actions/user.js
----------------------------------------------------------------------
diff --git a/public/actions/user.js b/public/actions/user.js
deleted file mode 100644
index 8bb69a3..0000000
--- a/public/actions/user.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import { REQUEST_USER, RECEIVE_USER, REQUEST_USER_UPDATE, CONFIRM_USER_UPDATE } from '../constants/ActionTypes';
-
-export function fetchUser () {
- return { type : REQUEST_USER };
-}
-
-export function receivedUser (user) {
- return { type : RECEIVE_USER, user : user };
-}
-
-export function updateUser (update) {
- return { type : REQUEST_USER_UPDATE, update : update };
-}
-
-export function confirmUserUpdate (success) {
- return { type : CONFIRM_USER_UPDATE, saved : success };
-}
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/components/AppCard.jsx
----------------------------------------------------------------------
diff --git a/public/components/AppCard.jsx b/public/components/AppCard.jsx
new file mode 100644
index 0000000..3a167b8
--- /dev/null
+++ b/public/components/AppCard.jsx
@@ -0,0 +1,37 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import React, { Component, PropTypes } from 'react';
+import { Link } from 'react-router';
+
+class AppCard extends Component {
+ render() {
+ const { app } = this.props;
+
+ return (
+ <div className='ui segment'>
+ <div className='ui tiny header'>
+ {app.name}
+ </div>
+ </div>
+ );
+ }
+}
+
+AppCard.propTypes = {
+ app: PropTypes.object.isRequired,
+};
+
+export default AppCard;
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/components/AppProfile.js
----------------------------------------------------------------------
diff --git a/public/components/AppProfile.js b/public/components/AppProfile.js
deleted file mode 100644
index 1615194..0000000
--- a/public/components/AppProfile.js
+++ /dev/null
@@ -1,40 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-import { Link } from 'react-router';
-
-import Profile from './Profile';
-
-class AppProfile extends Component {
- render () {
- const { id, name, users } = this.props;
-
- return (
- <div className='ui text container'>
- <div className='ui vertical basic page segment'>
- <div className='ui large header'>
- {name}
- </div>
- <Link to={`/app/${id}/settings`}>
- <div className='ui brown button'>
- Settings
- </div>
- </Link>
- <Link to={`/app/${id}/results`}>
- <div className='ui brown button'>
- Results
- </div>
- </Link>
- </div>
-
- <Profile feed={['a', 1, 'c']} firstSide={users} firstType={'user'} />
- </div>
- );
- }
-}
-
-AppProfile.propTypes = {
- id : PropTypes.number,
- name : PropTypes.string,
- users : PropTypes.array,
-};
-
-export default AppProfile;
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/components/AppProfile.jsx
----------------------------------------------------------------------
diff --git a/public/components/AppProfile.jsx b/public/components/AppProfile.jsx
index 1615194..bbcff77 100644
--- a/public/components/AppProfile.jsx
+++ b/public/components/AppProfile.jsx
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import React, { Component, PropTypes } from 'react';
import { Link } from 'react-router';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/components/AppResults.jsx
----------------------------------------------------------------------
diff --git a/public/components/AppResults.jsx b/public/components/AppResults.jsx
index 6e56475..3b0a9af 100644
--- a/public/components/AppResults.jsx
+++ b/public/components/AppResults.jsx
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import React, { Component, PropTypes } from 'react';
import Counts from './visualizations/Counts';
@@ -68,10 +83,12 @@ class AppResults extends Component {
}
render() {
+ const { name, results } = this.props.app;
+
return(
<div className='ui container'>
<div className='ui large header'>
- Log Analysis for {this.props.name}
+ Log Analysis for {name}
</div>
<div className='ui padded grid'>
@@ -257,19 +274,19 @@ class AppResults extends Component {
case 'graph':
return (
<div>
- <GraphMetrics metric={this.state.metric} element='graph-metrics-viz' data={this.props.results.graph} />
+ <GraphMetrics metric={this.state.metric} element='graph-metrics-viz' data={results.graph} />
{this.state.graphAb ?
<GraphMetrics
metric='betweenness_cent_dir_weighted'
element='graph-metrics-viz-b'
- data={this.props.results.graph}
+ data={results.graph}
/> : null
}
</div>
);
case 'counts':
default:
- return <Counts filters={this.state} data={this.props.results.counts} />;
+ return <Counts filters={this.state} data={results.counts} />;
}
})()}
@@ -282,8 +299,7 @@ class AppResults extends Component {
}
AppResults.propTypes = {
- name : PropTypes.string,
- results : PropTypes.object,
+ app : PropTypes.object,
};
export default AppResults;
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/components/AppSettings.jsx
----------------------------------------------------------------------
diff --git a/public/components/AppSettings.jsx b/public/components/AppSettings.jsx
index 6eb4432..472b699 100644
--- a/public/components/AppSettings.jsx
+++ b/public/components/AppSettings.jsx
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import React, { Component, PropTypes } from 'react';
import Settings from './Settings';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/components/Feed.jsx
----------------------------------------------------------------------
diff --git a/public/components/Feed.jsx b/public/components/Feed.jsx
index f7b15f5..d107eab 100644
--- a/public/components/Feed.jsx
+++ b/public/components/Feed.jsx
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import React, { Component, PropTypes } from 'react';
class Feed extends Component {
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/components/Home.jsx
----------------------------------------------------------------------
diff --git a/public/components/Home.jsx b/public/components/Home.jsx
index be8a2c6..08f6a34 100644
--- a/public/components/Home.jsx
+++ b/public/components/Home.jsx
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import React, { Component } from 'react';
export default class Home extends Component {
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/components/OrgProfile.jsx
----------------------------------------------------------------------
diff --git a/public/components/OrgProfile.jsx b/public/components/OrgProfile.jsx
index 331cb9f..bd33d56 100644
--- a/public/components/OrgProfile.jsx
+++ b/public/components/OrgProfile.jsx
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import React, { Component, PropTypes } from 'react';
import { Link } from 'react-router';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/components/OrgSettings.jsx
----------------------------------------------------------------------
diff --git a/public/components/OrgSettings.jsx b/public/components/OrgSettings.jsx
index e5c2b51..86c7d84 100644
--- a/public/components/OrgSettings.jsx
+++ b/public/components/OrgSettings.jsx
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import React, { Component, PropTypes } from 'react';
import Settings from './Settings';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/components/Profile.js
----------------------------------------------------------------------
diff --git a/public/components/Profile.js b/public/components/Profile.js
deleted file mode 100644
index 528166a..0000000
--- a/public/components/Profile.js
+++ /dev/null
@@ -1,39 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-
-import Feed from './Feed';
-import Sidebox from './Sidebox';
-
-class Profile extends Component {
- render() {
- const { feed, firstSide, secondSide, firstType, secondType } = this.props;
-
- return(
- <div className='ui padded grid'>
- <div className='ten wide column'>
- <Feed feed={feed} />
- </div>
-
- <div className='six wide column'>
- <Sidebox type={firstType} content={firstSide} />
- {(() => {
- if (secondSide) {
- return(
- <Sidebox type={secondType} content={secondSide} />
- );
- }
- })()}
- </div>
- </div>
- );
- }
-}
-
-Profile.propTypes = {
- feed : PropTypes.array,
- firstSide : PropTypes.array,
- firstType : PropTypes.string,
- secondSide : PropTypes.array,
- secondType : PropTypes.string,
-};
-
-export default Profile;
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/components/Profile.jsx
----------------------------------------------------------------------
diff --git a/public/components/Profile.jsx b/public/components/Profile.jsx
index 528166a..ce9f883 100644
--- a/public/components/Profile.jsx
+++ b/public/components/Profile.jsx
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import React, { Component, PropTypes } from 'react';
import Feed from './Feed';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/components/Settings.js
----------------------------------------------------------------------
diff --git a/public/components/Settings.js b/public/components/Settings.js
deleted file mode 100644
index 0194d43..0000000
--- a/public/components/Settings.js
+++ /dev/null
@@ -1,53 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-
-class Settings extends Component {
- componentDidMount() {
- let $settingsControls = $('#settings-menu .item');
- $settingsControls.on('click', (e) => {
- $settingsControls.removeClass('active');
- $(e.target).addClass('active');
- });
- }
-
- render() {
- const { settings } = this.props;
-
- return (
- <div className='ui grid'>
- <div className='four wide column'>
- <div id='settings-menu' className='ui vertical fluid tabular menu'>
- <a className='item active'>
- Account
- </a>
- <a className='item'>
- Notifications
- </a>
- <a className='item'>
- Organizations
- </a>
- </div>
- </div>
-
- <div className='twelve wide stretched column'>
- <div className='ui segment'>
- <ul>
- {Object.keys(settings).map((setting, index) => {
- return (
- <li key={index}>
- {setting}, {settings[setting].toString()}
- </li>
- );
- })}
- </ul>
- </div>
- </div>
- </div>
- );
- }
-}
-
-Settings.propTypes = {
- settings : PropTypes.object,
-};
-
-export default Settings;
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/components/Settings.jsx
----------------------------------------------------------------------
diff --git a/public/components/Settings.jsx b/public/components/Settings.jsx
index 0194d43..17024e9 100644
--- a/public/components/Settings.jsx
+++ b/public/components/Settings.jsx
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import React, { Component, PropTypes } from 'react';
class Settings extends Component {
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/components/Sidebox.jsx
----------------------------------------------------------------------
diff --git a/public/components/Sidebox.jsx b/public/components/Sidebox.jsx
index db4a5ed..db8659a 100644
--- a/public/components/Sidebox.jsx
+++ b/public/components/Sidebox.jsx
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import React, { Component, PropTypes } from 'react';
import { Link } from 'react-router';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/components/UserProfile.js
----------------------------------------------------------------------
diff --git a/public/components/UserProfile.js b/public/components/UserProfile.js
deleted file mode 100644
index 384fe03..0000000
--- a/public/components/UserProfile.js
+++ /dev/null
@@ -1,30 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-import { Link } from 'react-router';
-
-import Profile from './Profile';
-
-class UserProfile extends Component {
- render () {
- const { email, orgs, apps } = this.props;
-
- return (
- <div className='ui text container'>
- <div className='ui vertical basic page segment'>
- <div className='ui large header'>
- {`${email}'s Profile`}
- </div>
- </div>
-
- <Profile feed={['a', 1, 'c']} firstSide={orgs} firstType={'org'} secondSide={apps} secondType={'app'} />
- </div>
- );
- }
-}
-
-UserProfile.propTypes = {
- email : PropTypes.string,
- orgs : PropTypes.array,
- apps : PropTypes.array,
-};
-
-export default UserProfile;
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/components/UserProfile.jsx
----------------------------------------------------------------------
diff --git a/public/components/UserProfile.jsx b/public/components/UserProfile.jsx
index 384fe03..1f110d7 100644
--- a/public/components/UserProfile.jsx
+++ b/public/components/UserProfile.jsx
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import React, { Component, PropTypes } from 'react';
import { Link } from 'react-router';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/components/UserSettings.js
----------------------------------------------------------------------
diff --git a/public/components/UserSettings.js b/public/components/UserSettings.js
deleted file mode 100644
index 51dface..0000000
--- a/public/components/UserSettings.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-
-import Settings from './Settings';
-
-class UserSettings extends Component {
- render () {
- const { email, settings } = this.props;
-
- return (
- <div className='ui text container'>
- <div className='ui large header'>
- Settings for {email}
- </div>
- <Settings settings={settings} />
- </div>
- );
- }
-}
-
-UserSettings.propTypes = {
- email : PropTypes.string,
- settings : PropTypes.object,
-};
-
-export default UserSettings;
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/components/UserSettings.jsx
----------------------------------------------------------------------
diff --git a/public/components/UserSettings.jsx b/public/components/UserSettings.jsx
index 51dface..715656b 100644
--- a/public/components/UserSettings.jsx
+++ b/public/components/UserSettings.jsx
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import React, { Component, PropTypes } from 'react';
import Settings from './Settings';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/components/visualizations/Counts.jsx
----------------------------------------------------------------------
diff --git a/public/components/visualizations/Counts.jsx b/public/components/visualizations/Counts.jsx
index 1540878..c187112 100644
--- a/public/components/visualizations/Counts.jsx
+++ b/public/components/visualizations/Counts.jsx
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import React, { Component, PropTypes } from 'react';
import VerticalBar from './VerticalBar';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/components/visualizations/GraphMetrics.jsx
----------------------------------------------------------------------
diff --git a/public/components/visualizations/GraphMetrics.jsx b/public/components/visualizations/GraphMetrics.jsx
index e489313..fcb566f 100644
--- a/public/components/visualizations/GraphMetrics.jsx
+++ b/public/components/visualizations/GraphMetrics.jsx
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import React, { Component, PropTypes } from 'react';
import * as d3 from 'd3';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/components/visualizations/HorizontalBar.jsx
----------------------------------------------------------------------
diff --git a/public/components/visualizations/HorizontalBar.jsx b/public/components/visualizations/HorizontalBar.jsx
index d47a186..f362029 100644
--- a/public/components/visualizations/HorizontalBar.jsx
+++ b/public/components/visualizations/HorizontalBar.jsx
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import React, { Component, PropTypes } from 'react';
import * as d3 from 'd3';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/components/visualizations/VerticalBar.jsx
----------------------------------------------------------------------
diff --git a/public/components/visualizations/VerticalBar.jsx b/public/components/visualizations/VerticalBar.jsx
index dc8effd..71613d3 100644
--- a/public/components/visualizations/VerticalBar.jsx
+++ b/public/components/visualizations/VerticalBar.jsx
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import React, { Component, PropTypes } from 'react';
import * as d3 from 'd3';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/constants/ActionTypes.js
----------------------------------------------------------------------
diff --git a/public/constants/ActionTypes.js b/public/constants/ActionTypes.js
deleted file mode 100644
index d7ad8ff..0000000
--- a/public/constants/ActionTypes.js
+++ /dev/null
@@ -1,16 +0,0 @@
-export const LOG_IN = 'LOG_IN';
-export const LOG_OUT = 'LOG_OUT';
-export const REQUEST_USER = 'REQUEST_USER';
-export const RECEIVE_USER = 'RECEIVE_USER';
-export const REQUEST_USER_UPDATE = 'REQUEST_USER_UPDATE';
-export const CONFIRM_USER_UPDATE = 'CONFIRM_USER_UPDATE';
-export const REQUEST_ORG = 'REQUEST_ORG';
-export const RECEIVE_ORG = 'RECEIVE_ORG';
-export const REQUEST_ORG_UPDATE = 'REQUEST_ORG_UPDATE';
-export const CONFIRM_ORG_UPDATE = 'CONFIRM_ORG_UPDATE';
-export const REQUEST_APP = 'REQUEST_APP';
-export const RECEIVE_APP = 'RECEIVE_APP';
-export const REQUEST_APP_UPDATE = 'REQUEST_APP_UPDATE';
-export const CONFIRM_APP_UPDATE = 'CONFIRM_APP_UPDATE';
-export const REQUEST_APP_RESULTS = 'REQUEST_APP_RESULTS';
-export const RECEIVE_APP_RESULTS = 'RECEIVE_APP_RESULTS';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/containers/App.js
----------------------------------------------------------------------
diff --git a/public/containers/App.js b/public/containers/App.js
deleted file mode 100644
index 5110ee0..0000000
--- a/public/containers/App.js
+++ /dev/null
@@ -1,40 +0,0 @@
-import React, { Component, PropTypes } from 'react';
-import { connect } from 'react-redux';
-
-class App extends Component {
- render() {
- const { children, id, name, settings, results, users } = this.props;
-
- return(
- <div>
- {React.cloneElement(children, {
- id,
- name,
- settings,
- results,
- users,
- })}
- </div>
- );
- }
-}
-
-App.propTypes = {
- id : PropTypes.number,
- name : PropTypes.string,
- settings : PropTypes.object,
- results : PropTypes.object,
- users : PropTypes.array,
-};
-
-function mapStateToProps(state, ownProps) {
- return {
- id : state.app.id,
- name : state.app.name,
- settings : state.app.settings,
- results : state.app.results,
- users : state.app.users,
- };
-}
-
-export default connect(mapStateToProps)(App);
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/containers/App.jsx
----------------------------------------------------------------------
diff --git a/public/containers/App.jsx b/public/containers/App.jsx
index 5110ee0..3f69887 100644
--- a/public/containers/App.jsx
+++ b/public/containers/App.jsx
@@ -1,40 +1,66 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.s
+
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
+import { getAppDetails } from '../actions';
+
class App extends Component {
+ componentDidMount() {
+ this.props.getAppDetails(this.props.params.id);
+ }
+
+ componentDidUpdate(prevProps) {
+ if (this.props.params.id !== prevProps.params.id) {
+ this.props.getAppDetails(this.props.params.id);
+ }
+ }
+
render() {
- const { children, id, name, settings, results, users } = this.props;
+ const { children, params, apps } = this.props;
+
+ const id = params.id;
+ const app = apps[id];
+
+ console.log(id, app);
return(
- <div>
- {React.cloneElement(children, {
- id,
- name,
- settings,
- results,
- users,
- })}
- </div>
+ <div>
+ {React.cloneElement(children, {
+ id,
+ app,
+ })}
+ </div>
);
}
}
App.propTypes = {
- id : PropTypes.number,
- name : PropTypes.string,
- settings : PropTypes.object,
- results : PropTypes.object,
- users : PropTypes.array,
+ children: PropTypes.node.isRequired,
+ params: PropTypes.object.isRequired,
+ apps: PropTypes.object.isRequired,
+ getAppDetails: PropTypes.func.isRequired,
};
-function mapStateToProps(state, ownProps) {
+function mapStateToProps(state) {
return {
- id : state.app.id,
- name : state.app.name,
- settings : state.app.settings,
- results : state.app.results,
- users : state.app.users,
+ apps: state.apps.apps,
};
}
-export default connect(mapStateToProps)(App);
+export default connect(mapStateToProps, {
+ getAppDetails,
+})(App);
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/containers/AppList.jsx
----------------------------------------------------------------------
diff --git a/public/containers/AppList.jsx b/public/containers/AppList.jsx
new file mode 100644
index 0000000..4f62145
--- /dev/null
+++ b/public/containers/AppList.jsx
@@ -0,0 +1,82 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import React, { Component, PropTypes } from 'react';
+import { Link } from 'react-router';
+import { connect } from 'react-redux';
+
+import { getAppList } from '../actions';
+import AppCard from '../components/AppCard';
+
+class AppList extends Component {
+ componentDidMount() {
+ this.props.getAppList();
+ }
+
+ render() {
+ const { apps, appIds, isDefault } = this.props;
+
+ const defaultApp = !isDefault ? null : (
+ <div>
+ <div className='ui header'>
+ Example App
+ </div>
+ <div className='ui list'>
+ <div className='item'>
+ <Link to='/app/default'>
+ <AppCard app={apps.default} />
+ </Link>
+ </div>
+ </div>
+ </div>
+ );
+
+ return (
+ <div className='ui container'>
+ {defaultApp}
+ <div className='ui header'>
+ Your Apps
+ </div>
+ <div className='ui list'>
+ {appIds.map((id) => (
+ <div key={id} className='item'>
+ <Link to={`/app/${id}`}>
+ <AppCard app={apps[id]} />
+ </Link>
+ </div>
+ ))}
+ </div>
+ </div>
+ );
+ }
+}
+
+AppList.propTypes = {
+ apps: PropTypes.object.isRequired,
+ appIds: PropTypes.array.isRequired,
+ isDefault: PropTypes.bool.isRequired,
+};
+
+function mapStateToProps(state) {
+ return {
+ apps: state.apps.apps,
+ appIds: state.apps.appIds,
+ isDefault: state.apps.apps.hasOwnProperty('default'),
+ };
+}
+
+export default connect(mapStateToProps, {
+ getAppList
+})(AppList);
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/containers/Login.jsx
----------------------------------------------------------------------
diff --git a/public/containers/Login.jsx b/public/containers/Login.jsx
new file mode 100644
index 0000000..0839b0d
--- /dev/null
+++ b/public/containers/Login.jsx
@@ -0,0 +1,70 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import React, { Component, PropTypes } from 'react';
+import { Link } from 'react-router';
+import { connect } from 'react-redux';
+
+import { login } from '../actions';
+
+class Login extends Component {
+ constructor(props) {
+ super(props);
+ this.handleLogin = this.handleLogin.bind(this);
+ }
+
+ handleLogin() {
+ const email = $('input[name=email]').val();
+ const password = $('input[name=password]').val();
+ this.props.login(email, password);
+ }
+
+ render() {
+ return (
+ <div className='ui text container'>
+ <div className='ui form'>
+ <div className='field'>
+ <input type='text' name='email' placeholder="Email" />
+ </div>
+ <div className='field'>
+ <input type='password' name='password' placeholder="Password" />
+ </div>
+ <button className='ui brown button' onClick={this.handleLogin}>
+ Log In
+ </button>
+ <Link to='/signup'>
+ <button className='ui right floated brown button'>
+ Sign Up
+ </button>
+ </Link>
+ </div>
+ </div>
+ );
+ }
+}
+
+Login.propTypes = {
+ login: PropTypes.func.isRequired,
+};
+
+function mapStateToProps(state) {
+ return {
+
+ };
+}
+
+export default connect(mapStateToProps, {
+ login
+})(Login);
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/containers/Main.jsx
----------------------------------------------------------------------
diff --git a/public/containers/Main.jsx b/public/containers/Main.jsx
index e03ecca..22daa70 100644
--- a/public/containers/Main.jsx
+++ b/public/containers/Main.jsx
@@ -1,25 +1,59 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import React, { Component, PropTypes } from 'react';
import { Link } from 'react-router';
import { connect } from 'react-redux';
-import { logIn, logOut } from '../actions';
+import { login, logout } from '../actions';
class Main extends Component {
- constructor(props) {
- super(props);
- this.handleLogin = this.handleLogin.bind(this);
- this.handleLogout = this.handleLogout.bind(this);
- }
- handleLogin () {
- this.props.logIn();
- }
+ buildAuthHeader() {
+ const { email, logout } = this.props;
- handleLogout () {
- this.props.logOut();
+ if (email) {
+ return (
+ <div className='right menu'>
+ <div className='item'>
+ <Link to='/apps'>
+ {email}
+ </Link>
+ </div>
+ <div className='item' onClick={logout}>
+ Logout
+ </div>
+ </div>
+ );
+ } else {
+ return (
+ <div className='right menu'>
+ <div className='item'>
+ <Link to='/login'>
+ Login
+ </Link>
+ </div>
+ </div>
+ );
+ }
}
render () {
- const { children, isLoggedIn, username } = this.props;
+ const { children } = this.props;
+
+ const authHeader = this.buildAuthHeader();
+
return (
<div id='main-container'>
<div className='site-header'>
@@ -30,23 +64,7 @@ class Main extends Component {
<h3 className='ui inverted header item'>Tap</h3>
</Link>
- <div className='right menu'>
- {
- // <div className='item' onClick={isLoggedIn ? this.handleLogout : this.handleLogin }>
- // {isLoggedIn ? 'Log Out' : 'Log In'}
- // </div>
- }
- <div className='item'>
- <Link to='/user'>
- Profile
- </Link>
- </div>
- <div className='item'>
- <Link to='/user/settings'>
- Settings
- </Link>
- </div>
- </div>
+ {authHeader}
</div>
</div>
@@ -60,7 +78,7 @@ class Main extends Component {
<div className='ui container'>
<div className='ui footer page brown inverted segment'>
<div className='ui center aligned container'>
- <div className='footer-text'>Copyright Tap 2016</div>
+ <div className='footer-text'>Copyright Apache SensSoft 2016</div>
</div>
</div>
</div>
@@ -71,19 +89,17 @@ class Main extends Component {
}
Main.propTypes = {
- children : PropTypes.node,
- isLoggedIn : PropTypes.bool.isRequired,
- username : PropTypes.string,
+ children: PropTypes.node,
+ email: PropTypes.string,
+ logout: PropTypes.func.isRequired,
};
-function mapStateToProps(state, ownProps) {
+function mapStateToProps(state) {
return {
- isLoggedIn : state.auth.isLoggedIn,
- email : state.auth.isLoggedIn ? state.user.email : null,
+ email: state.user.email,
};
}
export default connect(mapStateToProps, {
- logIn,
- logOut,
+ logout,
})(Main);
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/containers/Org.jsx
----------------------------------------------------------------------
diff --git a/public/containers/Org.jsx b/public/containers/Org.jsx
index 7c90080..0afa0d4 100644
--- a/public/containers/Org.jsx
+++ b/public/containers/Org.jsx
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/containers/SignUp.jsx
----------------------------------------------------------------------
diff --git a/public/containers/SignUp.jsx b/public/containers/SignUp.jsx
new file mode 100644
index 0000000..6002576
--- /dev/null
+++ b/public/containers/SignUp.jsx
@@ -0,0 +1,70 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import React, { Component, PropTypes } from 'react';
+import { Link } from 'react-router';
+import { connect } from 'react-redux';
+
+import { signup } from '../actions';
+
+class Signup extends Component {
+ constructor(props) {
+ super(props);
+ this.handleSignup = this.handleSignup.bind(this);
+ }
+
+ handleSignup() {
+ const email = $('input[name=email]').val();
+ const password = $('input[name=password]').val();
+ this.props.signup(email, password);
+ }
+
+ render() {
+ return (
+ <div className='ui text container'>
+ <div className='ui form'>
+ <div className='field'>
+ <input type='text' name='email' placeholder="Email" />
+ </div>
+ <div className='field'>
+ <input type='password' name='password' placeholder="Password" />
+ </div>
+ <button className='ui brown button' onClick={this.handleSignup}>
+ Sign Up
+ </button>
+ <Link to='/login'>
+ <button className='ui right floated brown button'>
+ Log In
+ </button>
+ </Link>
+ </div>
+ </div>
+ );
+ }
+}
+
+Signup.propTypes = {
+ signup: PropTypes.func.isRequired,
+};
+
+function mapStateToProps(state) {
+ return {
+
+ };
+}
+
+export default connect(mapStateToProps, {
+ signup
+})(Signup);
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/containers/User.jsx
----------------------------------------------------------------------
diff --git a/public/containers/User.jsx b/public/containers/User.jsx
index 76bb291..bc01552 100644
--- a/public/containers/User.jsx
+++ b/public/containers/User.jsx
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/index.jsx
----------------------------------------------------------------------
diff --git a/public/index.jsx b/public/index.jsx
index 0a94470..2682265 100644
--- a/public/index.jsx
+++ b/public/index.jsx
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import React from 'react';
import { render } from 'react-dom';
import { Router, Route, IndexRoute, Link, browserHistory } from 'react-router';
@@ -7,19 +22,20 @@ import configureStore from './store/configureStore';
import Main from './containers/Main';
import Home from './components/Home';
-// import Login from './containers/Login';
+import Login from './containers/Login';
// import Logout from './containers/Logout';
-// import SignUp from './containers/SignUp';
-import User from './containers/User';
-import UserProfile from './components/UserProfile';
-import UserSettings from './components/UserSettings';
-import Org from './containers/Org';
-import OrgProfile from './components/OrgProfile';
-import OrgSettings from './components/OrgSettings';
+import SignUp from './containers/SignUp';
+// import User from './containers/User';
+// import UserProfile from './components/UserProfile';
+// import UserSettings from './components/UserSettings';
+// import Org from './containers/Org';
+// import OrgProfile from './components/OrgProfile';
+// import OrgSettings from './components/OrgSettings';
// import OrgNew from './containers/OrgNew';
import App from './containers/App';
-import AppProfile from './components/AppProfile';
-import AppSettings from './components/AppSettings';
+import AppList from './containers/AppList';
+// import AppProfile from './components/AppProfile';
+// import AppSettings from './components/AppSettings';
import AppResults from './components/AppResults';
// import AppNew from './containers/AppNew';
@@ -31,29 +47,29 @@ render((
<Route path='/' component={Main}>
<IndexRoute component={Home} />
- {
- // <Route path='login' component={Login} />
- // <Route path='logout' component={Logout} />
- // <Route path='signup' component={SignUp} />
- }
+ <Route path='login' component={Login} />
+ <Route path='signup' component={SignUp} />
- <Route path='user' component={User}>
- <IndexRoute component={UserProfile} />
- <Route path='settings' component={UserSettings} />
- </Route>
+ <Route path='apps' component={AppList} />
- <Route path='org/:id' component={Org}>
- <IndexRoute component={OrgProfile} />
- <Route path='settings' component={OrgSettings} />
- </Route>
-
- <Route path='app/:id' component={App}>
- <IndexRoute component={AppProfile} />
- <Route path='settings' component={AppSettings} />
- <Route path='results' component={AppResults} />
+ <Route path='app' component={App}>
+ <Route path=':id' component={AppResults} />
+ {
+ // <IndexRoute component={AppProfile} />
+ // <Route path='settings' component={AppSettings} />
+ // <Route path='results' component={AppResults} />
+ }
</Route>
{
+ // <Route path='logout' component={Logout} />
+
+ // <Route path='org/:id' component={Org}>
+ // <IndexRoute component={OrgProfile} />
+ // <Route path='settings' component={OrgSettings} />
+ // </Route>
+
+
// <Route path='org/new' component={OrgNew} />
// <Route path='app/new' component={AppNew} />
}
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/reducers/app.js
----------------------------------------------------------------------
diff --git a/public/reducers/app.js b/public/reducers/app.js
deleted file mode 100644
index 852345a..0000000
--- a/public/reducers/app.js
+++ /dev/null
@@ -1,99 +0,0 @@
-import { REQUEST_APP, RECEIVE_APP, REQUEST_APP_UPDATE, CONFIRM_APP_UPDATE, REQUEST_APP_RESULTS, RECEIVE_APP_RESULTS } from '../constants/ActionTypes';
-import merge from 'lodash/merge';
-
-import graphData from '../neon_graph.js';
-import countsData from '../neon_counts.js';
-
-const initialAppState = {
- id : 7,
- name : 'Ale',
- settings : {
- setting1 : 'a setting',
- },
- users : [
- {
- id : 1,
- email : 'test@test.com'
- },
- {
- id : 2,
- email : 'test2@test.com'
- },
- ],
- results : {
- counts : countsData,
- // counts : [
- // {
- // group : 'map',
- // activities : [
- // {
- // id : 'zoom',
- // count : 100,
- // },
- // {
- // id : 'pan',
- // count : 27,
- // },
- // {
- // id : 'resize',
- // count : 74,
- // },
- // ]
- // },
- // {
- // group : 'linechart',
- // activities : [
- // {
- // id : 'tooltip',
- // count : 51,
- // },
- // {
- // id : 'select',
- // count : 88,
- // },
- // {
- // id : 'resize',
- // count : 12,
- // },
- // ]
- // },
- // {
- // group : 'table',
- // activities : [
- // {
- // id : 'reorder',
- // count : 11,
- // },
- // {
- // id : 'resize',
- // count : 16,
- // },
- // {
- // id : 'filter',
- // count : 67,
- // },
- // ]
- // },
- // ],
- graph : graphData,
- },
-};
-
-export default function app (state = initialAppState, action) {
- switch (action.type) {
- case REQUEST_APP:
- return merge({}, state, {});
- case RECEIVE_APP:
- return merge({}, state, action.app);
- case REQUEST_APP_UPDATE:
- return merge({}, state, action.update);
- case CONFIRM_APP_UPDATE:
- return merge({}, state, action.saved);
- case REQUEST_APP_RESULTS:
- return merge({}, state, {});
- case RECEIVE_APP_RESULTS:
- return merge({}, state, action.results);
- default:
- return state;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/reducers/apps.js
----------------------------------------------------------------------
diff --git a/public/reducers/apps.js b/public/reducers/apps.js
new file mode 100644
index 0000000..a00525e
--- /dev/null
+++ b/public/reducers/apps.js
@@ -0,0 +1,96 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import * as ActionTypes from '../actions/ActionTypes';
+
+// If default/example app data is provided, fill in file paths here:
+const defaultAvailable = true;
+const defaultApp = defaultAvailable ? {
+ name: 'Neon',
+ id: 'default',
+ results: {
+ counts: require('../neon_counts.js').default,
+ graph: require('../neon_graph.js').default,
+ },
+} : {};
+
+
+export default function apps (state = {
+ appIds: [],
+ apps: {
+ default: defaultApp,
+ },
+ listPending: false,
+ listSuccess: false,
+ listError: false,
+ detailsPending: false,
+ detailsSuccess: false,
+ detailsError: false,
+}, action) {
+ switch (action.type) {
+ case ActionTypes.APP_LIST_REQUEST:
+ return Object.assign({}, state, {
+ listPending: true,
+ listSuccess: false,
+ });
+ case ActionTypes.APP_LIST_SUCCESS: {
+ const normalizedApps = {};
+ action.response.forEach((a) => {
+ normalizedApps[a.id] = a;
+ });
+
+ return Object.assign({}, state, {
+ apps: Object.assign({}, state.apps, normalizedApps),
+ listPending: false,
+ listSuccess: true,
+ listError: false,
+ });
+ }
+ case ActionTypes.APP_LIST_FAILURE:
+ return Object.assign({}, state, {
+ listPending: false,
+ listSuccess: false,
+ listError: true,
+ });
+ case ActionTypes.APP_DETAILS_REQUEST:
+ return Object.assign({}, state, {
+ detailsPending: true,
+ detailsSuccess: false,
+ });
+ case ActionTypes.APP_DETAILS_SUCCESS: {
+ return Object.assign({}, state, {
+ apps: Object.assign({}, state.apps, {
+ [action.appId]: Object.assign({}, state.apps[action.appId], {
+ results: {
+ counts: [],
+ graph: action.response,
+ },
+ }),
+ }),
+ detailsPending: false,
+ detailsSuccess: true,
+ detailsError: false,
+ });
+ }
+ case ActionTypes.APP_DETAILS_FAILURE:
+ return Object.assign({}, state, {
+ detailsPending: false,
+ detailsSuccess: false,
+ detailsError: true,
+ });
+ default:
+ return state;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/reducers/auth.js
----------------------------------------------------------------------
diff --git a/public/reducers/auth.js b/public/reducers/auth.js
deleted file mode 100644
index 935323d..0000000
--- a/public/reducers/auth.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import { LOG_IN, LOG_OUT } from '../constants/ActionTypes';
-import merge from 'lodash/merge';
-
-const initialAuthState = {
- isLoggedIn : false,
-};
-
-export default function auth (state = initialAuthState, action) {
- switch (action.type) {
- case LOG_IN:
- return merge({}, state, { isLoggedIn : true });
- case LOG_OUT:
- return merge({}, state, { isLoggedIn : false });
- default:
- return state;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/reducers/index.js
----------------------------------------------------------------------
diff --git a/public/reducers/index.js b/public/reducers/index.js
index 873c783..79aaa78 100644
--- a/public/reducers/index.js
+++ b/public/reducers/index.js
@@ -1,15 +1,28 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import { combineReducers } from 'redux';
-import auth from './auth';
import user from './user';
-import org from './org';
-import app from './app';
+// import org from './org';
+import apps from './apps';
const rootReducer = combineReducers({
- auth,
user,
- org,
- app
+ // org,
+ apps
});
export default rootReducer;
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/reducers/org.js
----------------------------------------------------------------------
diff --git a/public/reducers/org.js b/public/reducers/org.js
index 320699d..7fbd8c2 100644
--- a/public/reducers/org.js
+++ b/public/reducers/org.js
@@ -1,3 +1,18 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import { REQUEST_ORG, RECEIVE_ORG, REQUEST_ORG_UPDATE, CONFIRM_ORG_UPDATE } from '../constants/ActionTypes';
import merge from 'lodash/merge';
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/reducers/user.js
----------------------------------------------------------------------
diff --git a/public/reducers/user.js b/public/reducers/user.js
index 3900d2f..1f6e293 100644
--- a/public/reducers/user.js
+++ b/public/reducers/user.js
@@ -1,45 +1,70 @@
-import { REQUEST_USER, RECEIVE_USER, REQUEST_USER_UPDATE, CONFIRM_USER_UPDATE } from '../constants/ActionTypes';
-import merge from 'lodash/merge';
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
-const initialUserState = {
- email : 'test@test.com',
- settings : {
- setting1 : true,
- setting2 : 'hello',
- setting3 : 4,
- },
- orgs : [
- {
- id : 3,
- name : 'Tap',
- },
- {
- id : 2,
- name : 'Distill (fake)',
- }
- ],
- apps : [
- {
- id : 7,
- name : 'Ale',
- },
- {
- id : 1,
- name : 'Stout (fake)',
- },
- ]
-};
+import * as ActionTypes from '../actions/ActionTypes';
-export default function user (state = initialUserState, action) {
+export default function user (state = {
+ email: '',
+ loginPending: false,
+ loginSuccess: false,
+ loginError: false,
+ signupPending: false,
+ signupSuccess: false,
+ signupError: false,
+}, action) {
switch (action.type) {
- case REQUEST_USER:
- return merge({}, state, {});
- case RECEIVE_USER:
- return merge({}, state, action.user);
- case REQUEST_USER_UPDATE:
- return merge({}, state, action.update);
- case CONFIRM_USER_UPDATE:
- return merge({}, state, action.saved);
+ case ActionTypes.LOGIN_REQUEST:
+ return Object.assign({}, state, {
+ loginPending: true,
+ loginSuccess: false,
+ });
+ case ActionTypes.LOGIN_SUCCESS:
+ return Object.assign({}, state, {
+ email: action.email,
+ loginPending: false,
+ loginSuccess: true,
+ loginError: false,
+ });
+ case ActionTypes.LOGIN_FAILURE:
+ return Object.assign({}, state, {
+ loginPending: false,
+ loginSuccess: false,
+ loginError: true,
+ });
+ case ActionTypes.LOGOUT:
+ return Object.assign({}, state, {
+ username: '',
+ loginSuccess: false,
+ });
+ case ActionTypes.SIGNUP_REQUEST:
+ return Object.assign({}, state, {
+ signupPending: true,
+ signupSuccess: false,
+ });
+ case ActionTypes.SIGNUP_SUCCESS:
+ return Object.assign({}, state, {
+ signupPending: false,
+ signupSuccess: true,
+ signupError: false,
+ });
+ case ActionTypes.SIGNUP_FAILURE:
+ return Object.assign({}, state, {
+ signupPending: false,
+ signupSuccess: false,
+ signupError: true,
+ });
default:
return state;
}
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/839be021/public/store/api.js
----------------------------------------------------------------------
diff --git a/public/store/api.js b/public/store/api.js
new file mode 100644
index 0000000..2ca8a89
--- /dev/null
+++ b/public/store/api.js
@@ -0,0 +1,95 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import fetch from 'isomorphic-fetch';
+import { browserHistory } from 'react-router';
+
+const API_ROOT = '';
+
+export const CALL_API = Symbol('CALL_API');
+
+function callApi(apiOpts) {
+ const url = API_ROOT + apiOpts.endpoint;
+ const method = apiOpts.method || 'GET';
+
+ const headers = {};
+ const opts = {
+ method,
+ };
+
+ if (apiOpts.body) {
+ headers['Content-type'] = 'application/x-www-form-urlencoded';
+ opts.body = apiOpts.body;
+ }
+
+ const authToken = localStorage.getItem('tapToken');
+ if (authToken) {
+ headers['Authorization'] = `Token ${authToken}`;
+ }
+
+ opts.headers = new Headers(headers);
+
+ return fetch(url, opts)
+ .then(response =>
+ response.json().then(json => ({ json, response }))
+ ).then(({ json, response }) => {
+ if (!response.ok) {
+ return Promise.reject(json);
+ }
+ return json;
+ });
+}
+
+export default store => next => action => {
+ const opts = action[CALL_API];
+
+ if (typeof opts === 'undefined') {
+ return next(action);
+ }
+
+ function actionWith(data) {
+ const finalAction = Object.assign({}, action, data);
+ delete finalAction[CALL_API];
+ return finalAction;
+ }
+
+ const { types, successRedirect } = opts;
+ const [requestType, successType, failureType] = types;
+ next(actionWith({ type: requestType }));
+
+ return callApi(opts)
+ .then(
+ response => {
+ next(actionWith({
+ type: successType,
+ response,
+ }));
+
+ if (response.token) {
+ localStorage.setItem('tapToken', response.token);
+ }
+
+ if (opts.successRedirect) {
+ browserHistory.push(opts.successRedirect);
+ }
+ },
+ error => {
+ next(actionWith({
+ type: failureType,
+ error,
+ }));
+ }
+ );
+}