From 7ea24245df9060df9f0cc9d0cfea52c029c6e3f9 Mon Sep 17 00:00:00 2001 From: Naren Ranjit Date: Fri, 8 Jun 2018 11:44:13 -0700 Subject: [PATCH 01/15] (chore) Fix webpack build to also include login --- Gruntfile.js | 5 +++-- build/webpack.js | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index add034a3..8aa53d33 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -14,12 +14,13 @@ module.exports = function (grunt) { require('./' + task)(grunt); }); + grunt.registerTask('test-dev', ['webpack:edge', 'karma:testList']); - grunt.registerTask('test', ['templates', 'webpack:edge', 'webpack:components', 'karma:testWithCoverage']); + grunt.registerTask('test', ['webpack:edge', 'karma:testWithCoverage']); grunt.registerTask('documentation', ['eslint', 'markdox']); grunt.registerTask('validate', ['eslint', 'test']); grunt.registerTask('concatCometd', ['uglify:cometdMin', 'uglify:cometdDebug']); - grunt.registerTask('components', ['templates', 'webpack:components', 'copy:components']); + grunt.registerTask('components', ['templates', 'webpack:assignment', 'webpack:login', 'copy:components']); grunt.registerTask('production', ['concatCometd', 'validate', 'webpack:mapped', 'webpack:min', 'components', 'documentation']); grunt.registerTask('release', function (type) { diff --git a/build/webpack.js b/build/webpack.js index f3c8cc24..91efcab0 100644 --- a/build/webpack.js +++ b/build/webpack.js @@ -116,7 +116,7 @@ module.exports = function (grunt) { ], devtool: 'source-map', }, - components: { + assignment: { entry: path.resolve('./src/components/assignment/js/index.js'), devtool: 'source-map', output: { @@ -129,6 +129,20 @@ module.exports = function (grunt) { }), new webpack.optimize.UglifyJsPlugin(uglifyOptions) ] + }, + login: { + entry: path.resolve('./src/components/login/login.js'), + devtool: 'source-map', + output: { + path: path.resolve('./dist/components/login'), + filename: 'login.js' + }, + plugins: [ + new webpack.DefinePlugin({ + RELEASE_VERSION: JSON.stringify(version) + }), + new webpack.optimize.UglifyJsPlugin(uglifyOptions) + ] } }); }; From e742244009e43e41a3d7d904ed1bdeef38b81b74 Mon Sep 17 00:00:00 2001 From: Naren Ranjit Date: Fri, 8 Jun 2018 11:46:30 -0700 Subject: [PATCH 02/15] (feat) redirect to fac page for default login component --- dist/components/login/index.html | 1 + dist/components/login/login.js | 10 +++++++++- dist/components/login/login.js.map | 1 + src/components/login/index.html | 1 + src/components/login/login.js | 8 +++++++- src/managers/auth-manager/index.js | 2 +- 6 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 dist/components/login/login.js.map diff --git a/dist/components/login/index.html b/dist/components/login/index.html index 13edf8b4..8308fea4 100644 --- a/dist/components/login/index.html +++ b/dist/components/login/index.html @@ -29,6 +29,7 @@ The login action happens on the submit event for the form. --> +

Please Login to this Simulation

diff --git a/dist/components/login/login.js b/dist/components/login/login.js index b41c38e9..c55bc2e8 100644 --- a/dist/components/login/login.js +++ b/dist/components/login/login.js @@ -97,7 +97,15 @@ $(function () { $('button', form).attr('disabled', null).removeClass('disabled'); }) .then(function () { - window.location = action; + // var pageToRedirectTo = action; + // fac-redirect-page + var session = auth.getCurrentUserSessionInfo(); + var newPage = action; + var facPage = $('#fac-redirect-page').val(); + if ((session.isFac || session.isTeamMember) && facPage) { + newPage = facPage; + } + window.location = newPage; $('.group-selection-dialog').hide(); }); }); diff --git a/dist/components/login/login.js.map b/dist/components/login/login.js.map new file mode 100644 index 00000000..0d5d11cb --- /dev/null +++ b/dist/components/login/login.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///login.js","webpack:///webpack/bootstrap 53064a72e6b9f7528bbe","webpack:///./src/components/login/login.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","$","groupSelectionTemplate","showError","msg","text","show","getAccountProjectFromUrl","url","window","location","href","parts","match","account","project","selectGroup","userName","password","groups","action","dlg","length","appendTo","attr","select","find","remove","each","this","groupId","on","e","val","target","removeClass","removeAttr","addClass","closeDlg","hide","off","preventDefault","stopPropagation","form","fromUrl","prop","console","log","auth","F","manager","AuthManager","login","fail","error","status","type","userGroups","statusText","then","session","getCurrentUserSessionInfo","newPage","facPage","isFac","isTeamMember"],"mappings":"CAAS,SAAUA,SCInB,QAAAC,qBAAAC,UAGA,GAAAC,iBAAAD,UACA,MAAAC,kBAAAD,UAAAE,OAGA,IAAAC,QAAAF,iBAAAD,WACAI,EAAAJ,SACAK,GAAA,EACAH,WAUA,OANAJ,SAAAE,UAAAM,KAAAH,OAAAD,QAAAC,cAAAD,QAAAH,qBAGAI,OAAAE,GAAA,EAGAF,OAAAD,QAvBA,GAAAD,oBA4BAF,qBAAAQ,EAAAT,QAGAC,oBAAAS,EAAAP,iBAGAF,oBAAAU,EAAA,SAAAP,QAAAQ,KAAAC,QACAZ,oBAAAa,EAAAV,QAAAQ,OACAG,OAAAC,eAAAZ,QAAAQ,MACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,UAMAZ,oBAAAmB,EAAA,SAAAf,QACA,GAAAQ,QAAAR,eAAAgB,WACA,WAA2B,MAAAhB,QAAA,SAC3B,WAAiC,MAAAA,QAEjC,OADAJ,qBAAAU,EAAAE,OAAA,IAAAA,QACAA,QAIAZ,oBAAAa,EAAA,SAAAQ,OAAAC,UAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,OAAAC,WAGtDtB,oBAAAyB,EAAA,GAGAzB,wCAAA0B,EAAA,KDMM,SAAUtB,OAAQD,SEnExBwB,EAAA,WACA,YAEA,IAAAC,uBAEA,IAAAC,WAAA,SAAAC,KACAH,EAAA,kBAAAI,KAAAD,KAAAE,OAGA,IAAAC,0BAAA,WACA,GAAAC,KAAAC,OAAAC,SAAAC,IACA,IAAAC,OAAAJ,IAAAK,MAAA,mDACA,QACAC,QAAAF,MAAA,GACAG,QAAAH,MAAA,IAIA,IAAAI,aAAA,SAAAC,SAAAC,SAAAJ,QAAAC,QAAAI,OAAAC,QACA,GAAAC,UAAApB,EAAA,4BA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,KAAA,SAAAC,OACA,MAAAA,MAAAC,OACApD,UAAA,iCAAAmD,MAAAC,QACiB,MAAAD,MAAAC,OACjB,oBAAAD,MAAAE,KACAxC,YAAAC,EAAAC,EAAAJ,EAAAC,EAAAuC,MAAAG,WAAArC,QAEAjB,UADqB,cAAAmD,MAAAE,KACrB,oDAEAF,MAAAI,YAAA,gBAAAJ,MAAAC,QAGApD,UAAA,6CAAAmD,MAAAC,OAAA,KAGAtD,EAAA,SAAA0C,MAAAnB,KAAA,iBAAAW,YAAA,cAEAwB,KAAA,WAGA,GAAAC,SAAAZ,KAAAa,2BACA,IAAAC,SAAA1C,MACA,IAAA2C,SAAA9D,EAAA,sBAAAgC,OACA2B,QAAAI,OAAAJ,QAAAK,eAAAF,UACAD,QAAAC,SAEAtD,OAAAC,SAAAoD,QACA7D,EAAA,2BAAAsC,WAIArC,uBAAAO,OAAAP,uBAAA","file":"login.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\n$(function () {\n 'use strict';\n\n var groupSelectionTemplate;\n\n var showError = function (msg) {\n $('#login-message').text(msg).show();\n };\n\n var getAccountProjectFromUrl = function () {\n var url = window.location.href;\n var parts = url.match(/https?:\\/\\/([^/]*)\\/app\\/([^/]*)\\/([^/]*)/) || [];\n return {\n account: parts[2],\n project: parts[3], //eslint-disable-line\n };\n };\n\n var selectGroup = function (userName, password, account, project, groups, action) {\n var dlg = (dlg = $('.group-selection-dialog')).length ? dlg : $(groupSelectionTemplate).appendTo($('body')); //eslint-disable-line\n dlg.attr('action', action);\n var select = $('#login-group', dlg);\n select.find('[value!=\"\"]').remove();\n $.each(groups, function () {\n $(' \\\n ';\n});\n\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// login.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 53064a72e6b9f7528bbe","$(function () {\n 'use strict';\n\n var groupSelectionTemplate;\n\n var showError = function (msg) {\n $('#login-message').text(msg).show();\n };\n\n var getAccountProjectFromUrl = function () {\n var url = window.location.href;\n var parts = url.match(/https?:\\/\\/([^/]*)\\/app\\/([^/]*)\\/([^/]*)/) || [];\n return {\n account: parts[2],\n project: parts[3], //eslint-disable-line\n };\n };\n\n var selectGroup = function (userName, password, account, project, groups, action) {\n var dlg = (dlg = $('.group-selection-dialog')).length ? dlg : $(groupSelectionTemplate).appendTo($('body')); //eslint-disable-line\n dlg.attr('action', action);\n var select = $('#login-group', dlg);\n select.find('[value!=\"\"]').remove();\n $.each(groups, function () {\n $('