From b20592f0fd329144f58e13b92f08b6a48d0f59d8 Mon Sep 17 00:00:00 2001 From: Raphael Hoffmann Date: Sat, 19 Sep 2015 16:01:36 -0700 Subject: [PATCH 1/5] Adds initial version of oauth module --- Makefile | 1 + auth/.module.install | 4 + auth/config/mongod.yml | 0 auth/mindbender-auth | 230 ++++++++++++++++++++++++ auth/start-mongodb | 80 +++++++++ auth/stop-mongodb | 42 +++++ depends/bundle.conf | 1 + depends/bundled/mongodb.sh | 51 ++++++ gui/backend/.module.install | 1 + gui/backend/auth/auth-api.coffee | 22 +++ gui/backend/package.json | 41 +++-- gui/backend/server.coffee | 76 ++++++++ gui/frontend/src/app-navbar-signin.html | 16 ++ gui/frontend/src/app.coffee | 1 + gui/frontend/src/auth.coffee | 34 ++++ gui/frontend/src/search/search.coffee | 3 + gui/frontend/src/search/search.html | 1 + gui/frontend/src/search/searchbar.html | 2 +- gui/frontend/src/search/view.html | 1 + 19 files changed, 588 insertions(+), 19 deletions(-) create mode 100644 auth/.module.install create mode 100644 auth/config/mongod.yml create mode 100755 auth/mindbender-auth create mode 100755 auth/start-mongodb create mode 100755 auth/stop-mongodb create mode 100755 depends/bundled/mongodb.sh create mode 100644 gui/backend/auth/auth-api.coffee create mode 100644 gui/frontend/src/app-navbar-signin.html create mode 100644 gui/frontend/src/auth.coffee diff --git a/Makefile b/Makefile index c819994..bf49d4a 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,7 @@ PACKAGEVERSIONSUFFIX := -$(shell uname)-$(shell uname -m) # list of modules MODULES += dashboard MODULES += search +MODULES += auth MODULES += depends MODULES += depends/nodejs MODULES += gui/backend diff --git a/auth/.module.install b/auth/.module.install new file mode 100644 index 0000000..3159541 --- /dev/null +++ b/auth/.module.install @@ -0,0 +1,4 @@ +mindbender-auth bin/mindbender.d/ +start-mongodb bin/mindbender.d/ +stop-mongodb bin/mindbender.d/ + diff --git a/auth/config/mongod.yml b/auth/config/mongod.yml new file mode 100644 index 0000000..e69de29 diff --git a/auth/mindbender-auth b/auth/mindbender-auth new file mode 100755 index 0000000..bd8ea64 --- /dev/null +++ b/auth/mindbender-auth @@ -0,0 +1,230 @@ +#!/usr/bin/env bash +# mindbender-auth -- Creates and maintains database of authorized users +# +# To launch the database: +# $ mindbender auth start +# +# To update the search index with new searchable data produced by DeepDive, run: +# $ mindbender search update +# You can specify which searchable relations to update: +# $ mindbender search update [RELATION]... +# +# To check the search index status: +# $ mindbender search status +# +# For any reason, to drop the search index, run: +# $ mindbender search drop +# Or specify the relation to drop: +# $ mindbender search drop [RELATION]... +# +# To see internal schema mappings: +# $ mindbender search show-frontend-schema +# $ mindbender search show-elasticsearch-mappings +# +## +# Author: Jaeho Shin +# Created: 2015-07-31 +set -eu +set -o pipefail + +# needs to work on a DeepDive app +#DEEPDIVE_APP=$(find-deepdive-app) +#export DEEPDIVE_APP +#cd "$DEEPDIVE_APP" + +# use the DeepDive app's folder name for the ES index name +#: ${ELASTICSEARCH_INDEX_NAME:=$(basename "$DEEPDIVE_APP")} +#: ${ELASTICSEARCH_BULK_BATCHSIZE:=1000} + +# parse command-line args +case ${1:-} in + start) + ${MONGODB_RUNNING:-false} || + exec start-mongodb + Action=$1; shift + ;; + stop) + exec stop-mongodb + Action=$1; shift + ;; + + +# gui|update|status|drop) +# # make sure elasticsearch is running +# ${ELASTICSEARCH_RUNNING:-false} || +# exec keep-elasticsearch-during -- "$0" "$@" +# Action=$1; shift +# ;; +# show-frontend-schema|show-elasticsearch-mappings) +# # no need for elasticsearch +# Action=$1; shift +# ;; + *) + usage "$0" "Invalid action given: gui, update, status, or drop" +esac + +# # create a temporary space +# tmpdir=$(mktemp -d ${TMPDIR:-/tmp}/mindbender-search.XXXXXXX) +# trap "rm -rf $tmpdir" EXIT +# +# # simple wrapper for elasticsearch HTTP API +# esAPI() { +# local verb=$1 path=$2; shift 2 +# curl -sS -X$verb "$ELASTICSEARCH_BASEURL$path" "$@" +# echo # because ES does not put an EOL +# } +# # shorthand for APIs on the index +# esAPIx() { +# local verb=$1 path=$2; shift 2 +# esAPI "$verb" "/$ELASTICSEARCH_INDEX_NAME$path" "$@" +# } +# esAPIcheck() { +# # translate error response into error messages and exit status +# local errmsg=$(jq -e -r -s ' +# if length == 0 then "empty response" +# else .[] | .error | select(.) +# end | "Elasticsearch error: \(.)" +# ') +# [[ -z "$errmsg" ]] || error "$errmsg" +# } +# jqSchema() { +# if ! [[ -f "${DDLOG_SCHEMA_JSON:-}" ]]; then +# DDLOG_SCHEMA_JSON="$tmpdir"/app.ddlog.json +# # TODO keep this schema exporting under deepdive command? +# ddlog export-schema app.ddlog >"$DDLOG_SCHEMA_JSON" +# fi +# export DDLOG_SCHEMA_JSON +# jqDDlog <"$DDLOG_SCHEMA_JSON" "$@" +# } +# setDDlogRelationsSelected() { +# # use relations specified over command-line to filter target relations +# export DDLOG_RELATIONS_SELECTED +# if [[ $# -eq 0 ]]; then +# # default to all searchable entities discovered from DDlog +# eval set -- $(jqSchema 'relations | .name | @sh') +# else +# # check errors in given names of relations +# DDLOG_RELATIONS_SELECTED=$( +# printf '%s\n' "$@" | jq -R -s -c 'rtrimstr("\n") | split("\n")') +# badNames=$(jqSchema ' +# env.DDLOG_RELATIONS_SELECTED | fromjson[] | +# select( +# ([relationByName] | length == 0) or +# (relationByName | isAnnotated([.name] | inside(["source", "extraction"])) | not) +# ) +# ' -r) +# [[ -z "$badNames" ]] || +# error "$badNames: must be a @source or @extraction relation" +# fi +# # filter down to only @source and @extraction relations +# DDLOG_RELATIONS_SELECTED=$(jqSchema '[ +# relationsSelected | +# annotated([.name] | inside(["source", "extraction"])) | +# .name +# ]' -c) +# [[ "$DDLOG_RELATIONS_SELECTED" != "[]" ]] || +# error "No @source or @extraction relations found" +# } +# +# # perform action on search index +# case $Action in +# gui) +# # derive a schema for search frontend from DDlog +# DDLOG_SEARCH_SCHEMA="$tmpdir"/search-frontend-schema.json +# jqSchema 'searchFrontendSchema' >"$DDLOG_SEARCH_SCHEMA" +# export DDLOG_SEARCH_SCHEMA +# +# # launch the GUI +# exec mindbender-gui "$@" +# ;; +# +# update) +# setDDlogRelationsSelected "$@" +# +# # set up parent-child mapping based on @references annotations +# # (See: https://www.elastic.co/guide/en/elasticsearch/guide/current/parent-child-mapping.html) +# eval set -- $(jqSchema 'relationsSelected | .name | @sh' -r) +# echo >&2 "Deriving mappings for relations $*" +# mappings="$tmpdir"/mappings.json +# jqSchema '[relationsSelected] | elasticsearchMappingsForRelations' >"$mappings" +# if ! esAPIx GET "/" | esAPIcheck &>/dev/null; then +# # create the index +# echo >&2 "Creating index $ELASTICSEARCH_INDEX_NAME" +# jq <"$mappings" '{mappings:.}' | +# esAPIx PUT "/" --data-binary @- | esAPIcheck +# else +# # or update individual relations +# for relation; do +# # show which ones will be indexed first +# echo >&2 "Updating mappings for relation $relation" +# jq <"$tmpdir"/mappings.json "{ $relation: .$relation }" | +# esAPIx PUT "/_mappings/$relation" --data-binary @- | esAPIcheck || +# error "Retry after \`mindbender search drop $relation\`" +# done +# fi +# +# # bulk load to ES from DeepDive database +# update-relation() { +# local relation=$1; shift +# local sqlToUnload=$1; shift +# local jqToFormat=$1; shift +# echo >&2 "Indexing relation $relation" +# # unload data from database in json lines +# deepdive sql eval "$sqlToUnload" format=json | +# # show progress +# pv --line-mode --size="$(deepdive sql eval "SELECT COUNT(*) FROM $relation")" | +# # split records into multiple batches +# # TODO parallelize +# split --lines=$ELASTICSEARCH_BULK_BATCHSIZE --filter="$(escape-args-for-shell sh -euc ' +# jqToFormat=$1 indexURL=$2 +# # produce elasticsearch bulk load action for each JSON record +# jq -c "$jqToFormat" | +# # send them to elasticsearch +# curl -sS -XPUT "$indexURL/_bulk" --data-binary @- | +# # discard all result but the error field +# jq ".errors" +# ' -- "$jqToFormat" "$ELASTICSEARCH_BASEURL/$ELASTICSEARCH_INDEX_NAME/$relation")" | +# # make sure there wasn't any error +# jq -e -s "any | not" >/dev/null || +# error "Error loading relation $relation" +# } +# eval "$(jqSchema ' +# # generate shell commands that index every selected relations +# relationsSelected | +# "update-relation \(.name | @sh) \( +# sqlForRelationNestingAssociated | @sh) \( +# jqForBulkLoadingRelationIntoElasticsearch | @sh +# )" +# ')" +# ;; +# +# status) +# esAPI GET '/_stats' +# ;; +# +# drop) +# if [[ $# -gt 0 ]]; then +# # drop the given relations from the index +# for relation; do +# echo >&2 "Dropping relation $relation" +# esAPIx DELETE "/$relation" | esAPIcheck +# done +# else +# # drop the entire ES index +# echo >&2 "Dropping entire index $ELASTICSEARCH_INDEX_NAME" +# esAPIx DELETE "/" | esAPIcheck +# fi +# ;; +# +# # show some internal schema mappings +# show-frontend-schema) +# jqSchema 'searchFrontendSchema' +# ;; +# show-elasticsearch-mappings) +# setDDlogRelationsSelected "$@" +# jqSchema '[ relationsSelected ] | elasticsearchMappingsForRelations' +# ;; +# +# *) +# error "$Action: unknown action" +# esac diff --git a/auth/start-mongodb b/auth/start-mongodb new file mode 100755 index 0000000..8a89739 --- /dev/null +++ b/auth/start-mongodb @@ -0,0 +1,80 @@ +#!/usr/bin/env bash +# start-mongodb -- Launches mongod instance +# $ start-mongodb +# Sets environment MONGODB_RUNNING=true when running COMMAND. +# +# Modeled after search/keep-elasticsearch-during. +## +# Author: Raphael Hoffmann +# Created: 2015-09-18 +set -eu + +# default settings +: ${MONGODB_BASEURL:=http://localhost:27017} # TODO randomize port? +: ${MONGODB_HOME:="$PWD"/auth} + +# make sure mongodb instance is available +mongodb-is-up() { + STDERR=$(mongo --eval "printjson(db.isMaster())" 2>&1 >/dev/null) + if [[ -z "$STDERR" ]]; then + return 0 # true + else + return 1 # false + fi +} +case $MONGODB_BASEURL in + http://localhost:*) + port=${MONGODB_BASEURL#http://localhost:} + port=${port%%/*} + # make sure search repo is initialized + mkdir -p "$MONGODB_HOME"/{config,data,logs,data/db} + [[ -e "$MONGODB_HOME"/config/mongod.yml ]] || cp -f "$MINDBENDER_HOME"/depends/bundled/mongodb/prefix/*/config/mongod.yml "$MONGODB_HOME"/config/ + terminate-local-mongodb() { + local pidfile="$MONGODB_HOME"/mongodb.pid + local pid=$(cat "$pidfile" 2>/dev/null) + # kill the mongod process + [[ -z "$pid" ]] || kill -TERM $pid || + # or just clean up the stale PID file if can't kill + rm -f "$MONGODB_HOME"/mongodb.pid + } + # terminate if something's running locally but perhaps on a different port + if [[ -e "$MONGODB_HOME"/mongodb.pid ]]; then + mongodb-is-up || terminate-local-mongodb + fi + # if no instance is running here yet + if ! [[ -e "$MONGODB_HOME"/mongodb.pid ]]; then + if mongodb-is-up; then + # port may be occupied + error "$port: port is already used, try another one, e.g.: export MONGODB_BASEURL=http://localhost:270${RANDOM:0:2}" + else + # launch an isolated elasticsearch + msg "Launching Mongodb for $MONGODB_BASEURL from $MONGODB_HOME" + mOpts+=( + #--fork + # in background with a PID file + --pidfilepath "$MONGODB_HOME"/mongodb.pid + + # some paths outside path.home + --config "$MONGODB_HOME"/config/mongod.yml + --dbpath "$MONGODB_HOME"/data/db + --logpath "$MONGODB_HOME"/logs/log + + # override ports + --port $port + ) + mongod "${mOpts[@]:-}" & + fi + fi + # wait until the instance boots up + until mongodb-is-up; do sleep 0.$RANDOM; done + ;; + + *) + # skip setup since MONGODB_BASEURL is not localhost + # make sure the mongodb instance is there + mongodb-is-up || + error "$MONGODB_BASEURL: Mongodb not responding" +esac + +# run given command +export MONGODB_BASEURL MONGODB_HOME MONGODB_RUNNING=true diff --git a/auth/stop-mongodb b/auth/stop-mongodb new file mode 100755 index 0000000..cd8538e --- /dev/null +++ b/auth/stop-mongodb @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# stop-mongodb -- Stops mongod instance +# $ stop-mongodb +# +# Modeled after search/keep-elasticsearch-during. +## +# Author: Raphael Hoffmann +# Created: 2015-09-18 +set -eu + +# default settings +: ${MONGODB_BASEURL:=http://localhost:27017} # TODO randomize port? +: ${MONGODB_HOME:="$PWD"/auth} + +# make sure mongodb instance is available +mongodb-is-up() { + mongo --eval "printjson(db.isMaster())" >/dev/null +} +case $MONGODB_BASEURL in + http://localhost:*) + terminate-local-mongodb() { + local pidfile="$MONGODB_HOME"/mongodb.pid + local pid=$(cat "$pidfile" 2>/dev/null) + echo "terminating pid $pid" + # kill the mongod process + [[ -z "$pid" ]] || { + kill -TERM $pid + rm -f "$MONGODB_HOME"/mongodb.pid + } + } + # terminate if something's running locally but perhaps on a different port + if [[ -e "$MONGODB_HOME"/mongodb.pid ]]; then + terminate-local-mongodb + fi + ;; + + *) + # skip setup since MONGODB_BASEURL is not localhost + # make sure the mongodb instance is there + error "$MONGODB_BASEURL: Not on localhost, cannot stop" +esac + diff --git a/depends/bundle.conf b/depends/bundle.conf index b75dcd4..a6e65bb 100644 --- a/depends/bundle.conf +++ b/depends/bundle.conf @@ -1,5 +1,6 @@ ### List of Embedded Dependencies +mongodb nodejs elasticsearch jq diff --git a/depends/bundled/mongodb.sh b/depends/bundled/mongodb.sh new file mode 100755 index 0000000..4a0a64d --- /dev/null +++ b/depends/bundled/mongodb.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +# install mongo +set -eu + +version=${DEPENDS_ON_MONGODB_VERSION:-3.0.6} + +self=$0 +name=`basename "$0" .sh` + +download() { + local url=$1; shift + local file=$1; shift + [ -s "$file" ] || curl -C- -RLO "$url" +} + +# determine os and arch for downloading +os=$(uname -s) +case $os in + Darwin) os=osx ;; + Linux) os=linux ;; + *) + echo >&2 "$os: Unsupported operating system" + os= +esac +if [ -z "$os" ]; then + arch= +else + arch=$(uname -m) + case $arch in + x86_64|amd64) + arch=x86_64 ;; + i686|i386|i86pc) + arch=i686 ;; + *) + echo >&2 "$arch: Unsupported architecture" + os= arch= + esac +fi + +if [ -n "$os" -a -n "$arch" ]; then + # download binary distribution + fullname="mongodb-${os}-${arch}-${version}" + tarball="${fullname}.tgz" + download "https://fastdl.mongodb.org/${os}/${tarball}" "$tarball" + mkdir -p prefix + tar xf "$tarball" -C prefix +fi + +# place symlinks for commands under $DEPENDS_PREFIX/bin/ +symlink-under-depends-prefix bin -x prefix/"$fullname"/bin/* + diff --git a/gui/backend/.module.install b/gui/backend/.module.install index 174b226..9dc1d66 100644 --- a/gui/backend/.module.install +++ b/gui/backend/.module.install @@ -3,6 +3,7 @@ mindbender-utils.coffee gui/ mindtagger/ gui/ dashboard/ gui/ search/ gui/ +auth/ gui/ extensions.js gui/files/mindbender/ extensions.coffee gui/files/mindbender/ diff --git a/gui/backend/auth/auth-api.coffee b/gui/backend/auth/auth-api.coffee new file mode 100644 index 0000000..2e1c9bb --- /dev/null +++ b/gui/backend/auth/auth-api.coffee @@ -0,0 +1,22 @@ +### +# Auth +### + +fs = require "fs" +util = require "util" +express = require "express" +mongoose = require "mongoose/" + +mongoose.connect "mongodb://localhost/MyDatabase" + +Schema = mongoose.Schema +UserDetail = new Schema { + username: String + password: String + }, { + collection: 'userInfo' + } +UserDetails = mongoose.model 'userInfo', UserDetail + + + diff --git a/gui/backend/package.json b/gui/backend/package.json index 4404b59..ca79c28 100644 --- a/gui/backend/package.json +++ b/gui/backend/package.json @@ -1,20 +1,25 @@ { - "name": "mindbender-gui-backend", - "private": true, - "version": "0.0.0", - "dependencies": { - "express": "4.9.5", - "morgan": "^1.2.2", - "body-parser": "^1.5.2", - "errorhandler": "^1.1.1", - "jade": "1.7.0", - "http-proxy": "1.11.1", - "socket.io": "1.1.0", - "fs-extra": "0.12.0", - "async": "0.9.0", - "tsv": "0.2.0", - "csv": "0.4.0", - "byline": "4.2.1", - "underscore": "1.7.0" - } + "name": "mindbender-gui-backend", + "private": true, + "version": "0.0.0", + "dependencies": { + "async": "0.9.0", + "body-parser": "^1.5.2", + "byline": "4.2.1", + "cookie-parser": "^1.3.5", + "csv": "0.4.0", + "errorhandler": "^1.1.1", + "express": "4.9.5", + "express-session": "^1.11.3", + "fs-extra": "0.12.0", + "http-proxy": "1.11.1", + "jade": "1.7.0", + "mongoose": "^4.1.7", + "morgan": "^1.2.2", + "passport": "^0.3.0", + "passport-google-oauth": "^0.2.0", + "socket.io": "1.1.0", + "tsv": "0.2.0", + "underscore": "1.7.0" + } } diff --git a/gui/backend/server.coffee b/gui/backend/server.coffee index 879fc92..b70c3b6 100755 --- a/gui/backend/server.coffee +++ b/gui/backend/server.coffee @@ -19,6 +19,10 @@ errorHandler = require "errorhandler" bodyParser = require "body-parser" jade = require "jade" socketIO = require "socket.io" +cookieParser = require "cookie-parser" +expressSession = require "express-session" +passport = require "passport" +GoogleStrategy = require("passport-google-oauth").OAuth2Strategy ## express.js server app = module.exports = express() @@ -29,6 +33,7 @@ io = socketIO.listen server app.set "port", (parseInt process.env.PORT ? 8000) app.set "views", "#{__dirname}/views" app.set "view engine", "jade" + # set up logging app.use logger "dev" @@ -47,6 +52,26 @@ process.on "uncaughtException", (err) -> else throw err +## enable authentication ####################################################### + +require "./auth/auth-api" + +app.use cookieParser() +app.use expressSession({ + secret: 'keyboard cat', + resave: true, + saveUninitialized: true +}) +app.use passport.initialize() +app.use passport.session() + +ensureAuthenticated = (req, res, next) -> + if !REQUIRES_LOGIN || req.isAuthenticated() + next() + else + res.redirect '/auth/google' + + # TODO use a more sophisticated command-line parser cmdlnArgs = process.argv[2..] @@ -77,6 +102,57 @@ for component in components ############################################################################### +# Login +REQUIRES_LOGIN = false +GOOGLE_CLIENT_ID = 'INSERT_GOOGLE_CLIENT_ID_HERE' +GOOGLE_CLIENT_SECRET = 'INSERT_GOOGLE_CLIENT_SECRET_HERE' +GOOGLE_CALLBACK_ENDPOINT = 'http://localhost:8000' + +passport.serializeUser (user,done) -> + console.log "serializeUser" + console.log user + done null, user + +passport.deserializeUser (obj, done) -> + console.log "deserializeUser" + console.log obj + done null, obj + +passport.use new GoogleStrategy({ + clientID: GOOGLE_CLIENT_ID, + clientSecret: GOOGLE_CLIENT_SECRET, + callbackURL: "#{GOOGLE_CALLBACK_ENDPOINT}/auth/google/callback" + }, + (accessToken, refreshToken, profile, done) -> + process.nextTick () -> + return done null, profile + ) + +app.get '/auth/google', + passport.authenticate('google', { prompt:'select_account', scope: ['https://www.googleapis.com/auth/plus.login'] }), + (req, res) -> '' + # The request will be redirected to Google for authentication, so this + # function will not be called. + +app.get '/auth/google/callback', + passport.authenticate('google', { failureRedirect: '/login' }), + (req, res) -> + req.session.save (err) -> + return res.redirect '/' + +app.get '/user', (req, res) -> + res.send req.user + +app.get '/logout', (req, res) -> + req.logout() + req.session.destroy (err) -> + res.redirect '/' + + +app.get '/', ensureAuthenticated + +############################################################################### + # user defined extensions can be put under $PWD/mindbender/extensions.{js,coffee} extensionsDirPath = "#{process.cwd()}/mindbender" app.get "/mindbender/extensions.js", (req, res, next) -> diff --git a/gui/frontend/src/app-navbar-signin.html b/gui/frontend/src/app-navbar-signin.html new file mode 100644 index 0000000..3f939e0 --- /dev/null +++ b/gui/frontend/src/app-navbar-signin.html @@ -0,0 +1,16 @@ + + + + + + + + + + + diff --git a/gui/frontend/src/app.coffee b/gui/frontend/src/app.coffee index f4f2bcf..61855fd 100644 --- a/gui/frontend/src/app.coffee +++ b/gui/frontend/src/app.coffee @@ -5,6 +5,7 @@ angular.module 'mindbender', [ 'mindbender.dashboard' 'mindbender.search' 'mindbender.extensions' + 'mindbender.auth' ] .config ($routeProvider) -> $routeProvider.when '/', diff --git a/gui/frontend/src/auth.coffee b/gui/frontend/src/auth.coffee new file mode 100644 index 0000000..a290b58 --- /dev/null +++ b/gui/frontend/src/auth.coffee @@ -0,0 +1,34 @@ +angular.module "mindbender.auth", [ + 'ngRoute' +] +.directive 'signInOutMenu', -> + scope: true + templateUrl: 'app-navbar-signin.html' + controller: ($scope, $routeParams, $location, Authentication) -> + $scope.user = Authentication.user + + +.service "Authentication", ($http, $q) -> + class Authentication + constructor: -> + @user = { + isSignedIn : false + name : '' + photo : '' + } + $http.get "/user" + .success (data) => + if data != '' + @user.isSignedIn = true + @user.name = data.displayName + if data.photos.length == 0 + @user.thumb = '' + else + @user.thumb = data.photos[0].value + else + @user.isSignedIn = false + .error (err) => + console.error err.message + init: () => + new Authentication() + diff --git a/gui/frontend/src/search/search.coffee b/gui/frontend/src/search/search.coffee index 62a14ed..6aac3b2 100644 --- a/gui/frontend/src/search/search.coffee +++ b/gui/frontend/src/search/search.coffee @@ -2,6 +2,7 @@ angular.module "mindbender.search", [ 'elasticsearch' 'json-tree' 'ngSanitize' + 'mindbender.auth' ] .config ($routeProvider) -> @@ -259,8 +260,10 @@ angular.module "mindbender.search", [ tags_schema: "styled" fields: _.object ([f,{}] for f in fieldsSearchable) @queryRunning = query + console.log JSON.stringify(query) elasticsearch.search query .then (data) => + console.log JSON.stringify(data) @error = null @queryRunning = null @query = query diff --git a/gui/frontend/src/search/search.html b/gui/frontend/src/search/search.html index 1d20d0f..b41d6f0 100644 --- a/gui/frontend/src/search/search.html +++ b/gui/frontend/src/search/search.html @@ -3,6 +3,7 @@ diff --git a/gui/frontend/src/search/searchbar.html b/gui/frontend/src/search/searchbar.html index c6315d7..115ea77 100644 --- a/gui/frontend/src/search/searchbar.html +++ b/gui/frontend/src/search/searchbar.html @@ -1,4 +1,4 @@ -