1
0
Fork 0
Commit Graph

451 Commits (master)

Author SHA1 Message Date
Mike Gerwitz 3bed93e750 SpoofedNodeHttpImpl: Fix docblocks (User{Session=>Request})
Wrong object!
2018-05-01 09:44:55 -04:00
Mike Gerwitz ae0d9b3862 RatingServiceSubmitNotify: Create dapi dynamically with session
Session information needs to be available for request session spoofing.
2018-05-01 09:44:55 -04:00
Mike Gerwitz d9c442b8e2 QuoteDataApi: Correct constructor argument error 2018-05-01 09:44:55 -04:00
Mike Gerwitz 2d1582059f RatingServiceSubmitNotify: Notify only once
* src/server/db/MongoServerDao.js
  (getDocumentField,setDocumentField): New methods.
* src/server/service/RatingServiceSubmitNotify.js
  (postProcessRaterData): Only notify when notification flag is not set.
  (_getNotifyState, _setNotified): New methods.
* test/server/service/RatingServiceSubmitNotifyTest.js: Modify accordingly.
2018-05-01 09:44:55 -04:00
Mike Gerwitz d8338b50e0 RatingServiceSubmitNotify: Add trait
* src/server/service/RatingServiceSubmitNotify.js: New trait.
* test/server/service/RatingServiceSubmitNotifyTest.js: Respective test.
2018-05-01 09:44:55 -04:00
Jeffrey Fisher 7d0dc97162 Add HttpDataApiUrlData 2018-05-01 09:44:53 -04:00
Jeffrey Fisher 5b410005cd RatingService: ensure #postProcessRaterData is called before save 2018-05-01 09:44:51 -04:00
Mike Gerwitz 9ad8cb96b8 Cmatch: Do not fail given __classes question
* src/client/Cmatch.js (handleClassMatch): Rename from
  _handleClassMatch.  Make protected.  Check for truthy `vis'.
* test/client/CmatchTest.js: Update accordingly.
2018-04-16 15:30:19 -04:00
Mike Gerwitz f5f753d3bb Client: updateFieldData setOptions cur fix
* src/client/Client.js (_createProgram): Properly capture current value in
  closure for `setOptions'.
2018-04-03 16:04:30 -04:00
Mike Gerwitz 6733556582 Remove hard-coded skey
This wasn't intended to make its way into a public repo. :)

The existing key was a long-forgotten kluge that was supposed to be
temporary, allowing internal services to create quotes without
authentication.  The chances of this being practically exploited are minimal
in our environment, and it's auditable using webserver logs.

This moves the skey into a configuration file, which allows it to vary by
server and be rotated until a better solution is made available.  skey is
disabled by default (empty string), and when used by us internally, the keys
are now generated using a CSPRNG rather than a brute-forcable 5-byte key
that was hard-coded.

The fact that this appears in webserver logs is a big issue as well.  I
added a task to address that.

* conf/vanilla-server.json (skey): New key.  Default empty.
* src/server/daemon/Daemon.js (start): Provide skey to `#getRouters'.
  (getRouters): Provide skey to `#getProgramController'.
  (getProgramController): Set skey on `controller'.
* src/server/daemon/controller.js (skey): New mutable export (unideal; quick
    change).
  (has_skey): Use it.
2018-04-03 15:29:47 -04:00
Mike Gerwitz 460a533777 MongoServerDao: Always clear quicksave data
quicksave data wouldn't always be cleared on save, meaning it might not be
cleared until the next _empty_ quicksave from the client.

* src/server/db/MongoServerDao.js (saveQuote): Always clear quicksave.
2018-03-14 11:47:50 -04:00
Mike Gerwitz c33adee21d client: Truncate diff posted to server after first null
Before this change, since `undefined' is encoded as `null' when serialized,
there was no way for the server to disambiguate between unmodified values
and a truncation point.  For example:

  [ undefined, undefined, null, null, null ]

The above array represents two unmodified and three removed indexes.  But
this is serialzed into JSON as:

  [ null, null, null, null, null ]

It isn't possible for the server to determine what the truncation point is
from that diff.  The solution is to therefore truncate the array _before_
sending it to the server, providing a trailing null to indicate that a
truncation has occurred:

  [ null, null, null ]

The above means that the first two indexes are unmodified, and that index 2
and later should all be truncated.

* doc/client.texi (Saving to Server): New section.
* src/client/transport/XhttpQuoteTransport.js (_truncateDiff): New method to
  perform truncation.
  (getBucketDataJson): Use it.
* test/client/transport/XhttpQuoteTransportTest.js: New file with respective
  test case.
2018-03-07 13:46:05 -05:00
Mike Gerwitz 9727b9a157 Support default program id if none provided via URL
* src/client/Client.js (_defaultId): New property.
  (__construct)[default_id]: New parameter.  Set `_defaultId'.
  (_getProgramId): Use `_defaultId' if not found in URL.
* src/ui/nav/HashNav.js (_initUrl): Do not require leading program id.
  This technically worked fine before with our URL scheme, but that is not
  guaranteed to be the case generally.
2018-03-01 12:23:35 -05:00
Mike Gerwitz cfadc217cc DslRater: Correct missing raters error message 2018-03-01 12:23:35 -05:00
Mike Gerwitz 79fc82614e ElementStyler: console.warn{ing=>}
Crap.

* src/ui/ElementStyler.js (setValueByName): console.warn{ing=>}
2018-02-12 10:35:23 -05:00
Mike Gerwitz 3b303e50a9 Cmatch: Fix combined show/hide of same field, multi-index
This is something that managed to slip by (but not unnoticed) for almost
exactly one year to this day (028606242a).  It
can only be reproduced by changing classes that result in visibility changes
differing on the same field by index.  The issue hides itself on first
load (because all fields are shown by default) and on refresh.

The problem is that, when one index shows a field but another hides it, the
hide overrode the show indexes, so only the hide took place.

* src/client/Cmatch.js (markShowHide): Make virtual.  New implementation to
    support concurrent show/hide.
  (_handleClassMatch): Use it.
* test/client/CmatchTest.js: New test.
* npm-shrinkwrap.json: ease.js v0.2.{8=>9}.
2018-02-09 11:55:46 -05:00
Mike Gerwitz 0a50b22496 Cmatch: Extract show/hide marking into own method
This is to give us a fairly easy means of testing this logic for a bugfix.

This refactoring also obviates a pretty nasty bug; see docblock.

* src/client/Cmatch.js (_handleClassMatch): Extract show/hide marking.
  (markShowHide): New method.
2018-02-09 11:20:48 -05:00
Mike Gerwitz 4b114d0137 Client: Extract cmatch methods
This makes the minimal number of changes necessary to ensure that all object
references remain available.  It is a mess.

And despite moving all of this, Client is still a massive clusterfuck.

* src/client/Client.js (system): Add import.
  (_cmatch): Now references new Cmatch class instance.
  (_cmatchHidden, _classMatcher): Remove fields.
  (_forceCmatchAction): Rename to `forceCmatchAction'.
  (_hookClassifier, _postProcessCmatch, _cmatchVisFromUi, _handleClassMatch,
    _mergeCmatchHidden, _clearCmatchFields): Extract methods.  Update
    references as necessary.
  (getCmatchData): Remove unused method.
  (_handleError): Rename to `handleError' to make accessible to
    Cmatch.  Update references.
* src/client/ClientDependencyFactory.js (FieldClassMatcher): Remove import.
  (createFieldClassMatcher): Remove method.  See `system/client'.
* src/client/Cmatch.js: New class.
* src/system/client.js (Cmatch, field): Add imports.
  (cmatch): Add export.
2018-02-09 11:20:45 -05:00
Mike Gerwitz cc7370711d Client: Eliminate old event handling system
All of the old events have been removed!

* src/client/Client.js (handleEvent): Remove remainder of old system (after
  last commit, all that was left was error handling).  Correct docblock.
2018-02-08 16:18:46 -05:00
Mike Gerwitz 58533f6d72 Client: Remove unused `reset' event
This event hasn't seen use in ...possibly ever.

* src/client/Client.js (handleEvent): Remove `reset' event.
  Always return `this'.
2018-02-08 16:13:25 -05:00
Mike Gerwitz de578c6e93 ElementStyler: jQuery BC for radios (bugfix)
Of course, the radios are actually checkboxes...radioboxes.

* src/ui/ElementStyler.js (setValueByName): Recognize both jQuery and DOM
  elements.
2018-02-08 09:28:15 -05:00
Mike Gerwitz 943231ee81 ValueSetEventHandler: New handler for `set' event
The `set' event already existed---this merely extracts it into its own
handler.

* src/client/Client.js (handleEvent): Extract `set' handler.
* src/client/ClientDependencyFactory.js (createClientEventHandler): Add
  `set'.
* src/client/event/ValueSetEventHandler.js: New class.
* test/event/ValueSetEventHandlerTest.js: Associated test case.
2018-02-07 14:59:50 -05:00
Mike Gerwitz f5346bef39 ElementStyler: Ignore noyes/radio/legacyradio when DOM element unknown
* src/ui/ElementStyler.js (setValueByName): Ignore `question' if undefined.
2018-02-07 14:57:51 -05:00
Mike Gerwitz 88e32f3c0d Client: Use last available index for `set' action
This matches the behavior of assertions.

This needs to be refactored into an even handler.

* src/client/Client.js (handleEvent)[set]: Use last available index.
2018-02-07 14:21:02 -05:00
Mike Gerwitz 9d0cd5a3f3 ElementStyler: Fix rendering of noyes, radio, legacyradio
* src/ui/ElementStyler.js (setValueByName): Correctly operate on  DOM
  element rather than jQuery object.
2018-02-07 12:02:28 -05:00
Mike Gerwitz 1325dc9a86 ElementStyler: Re-add change_event check as warning
* src/ui/ElementStyler.js (setValueByName)[change_event]: Re-add
  `change_event' check, but as a warning instead of an Error.  This
  shouldn't be used anymore, but let's be certain _without_ breaking
  things.
2018-02-07 12:01:35 -05:00
Mike Gerwitz 51e8c1428f ElementStyler: Remove change_event error
The intent wasn't go have this be permanant, and apparently it _is_ being
used in generated code!

* src/ui/ElementStyler.js (setValueByName): Remove error on `change_event'.
2018-02-06 16:58:58 -05:00
Jeffrey Fisher 9ae544fcbd dapi: Updated correct field index 2018-02-06 15:20:09 -05:00
Mike Gerwitz d0bbc04218 ElementStyler: Remove jQuery for legacyradio value setting
Continued eradication of jQuery for performance reasons.

* src/ui/ElementStyler.js (setValueByName): Do not use jQuery for
  legacyradio styling.  Throw exception on `change_event' argument set (this
  should no longer be used).
2018-02-02 16:55:50 -05:00
Mike Gerwitz fa9ee5d340 ElementStyler: Remove unused `autochange'
This used to be a thing back when we used Dojo, but it doesn't appear to be
used anymore.

* src/ui/ElementStyler.js (setValueByName): Remove `autochange' check.

 Lines starting
2018-02-02 16:43:34 -05:00
Mike Gerwitz 1f6ea234ff StackedGroupUi: New group
* doc/program.texi (Group Styles): Add `stacked' to table.
* src/client/ClientDependencyFactory.js (createGroupUi): Recognize
  `stacked'.
* src/css/base.css (.stack-header): Style stack header.
* src/ui/group/StackedGroupUi.js: New group class.
2018-02-02 14:48:37 -05:00
Mike Gerwitz 799a74d7a1 NaFieldStylerAnimation: Remove trait
These animations are ugly and slow when there are many questions on a
step.  I've wanted them gone for quite some time, and now we don't have a
disagreement among developers.

* src/client/ClientDependencyFactory.js (createNaFieldStyler): Remove
  NaFieldStylerAnimation mixin.
* src/ui/styler/NaFieldStylerAnimation.js: Remove trait.
2018-02-01 14:23:33 -05:00
Mike Gerwitz af7774a272 dapi: Do not perform static additions in invalid response data
* src/dapi/StaticAdditionDataApi.js (request): Do not unshift data if
    `response' is not an array.
2018-01-15 11:03:46 -05:00
Mike Gerwitz 5f3ad6dbf1 client/debug: Append null to bucket editor field change diff
This is necessary to truncate on index removal; otherwise, it's not possible
to remove indexes through the editor.

* src/client/debug/BucketClientDebugTab.js (_getStagingButtons): Append null
    on value change.
2018-01-15 10:53:25 -05:00
Mike Gerwitz 87c4cf50d2 Use {ch=>em} units for CSS (because of IE)
See comments in base.css.

* src/css/base.css: {ch=>em} for all styles.  Matched sizes approximately;
  it doesn't need to be exact.
2017-11-10 10:20:10 -05:00
Mike Gerwitz f7a320b58c Remove paragraph from dev dialog
It lies now.

* src/client/debug/ClientDebugDialog.js (_createDialog): Remove paragraph.  Adjust case
    on keybinding text.
2017-11-08 14:09:06 -05:00
Mike Gerwitz e1db46ad9e Extract dialog styling into new base.css
* src/client/Client.js (createSideBar): Remove width/height, add
    `dialogClass'.
* src/client/debug/BucketClientDebugTab.js
  (showBucketEditor, _genBucketEditorFields): Remove width/height and other
    CSS, add `dialogClass'.
* src/client/debug/ClientDebugDialog.js (_createDialog): Remove
    width/height, add `dialogClass'.
* src/css/base.css: New file.
* src/ui/dialog/DirtyDialog.js (init): Remove size, set type id.
* src/ui/dialog/EmailDialog.js (init): Remove size, set type id.
* src/ui/dialog/ErrorDialog.js (init): Remove size, set type id.
* src/ui/dialog/NotificationDialog.js (init): Remove size, set type id.
* src/ui/dialog/QuoteNavDialog.js (init): Remove size, set type id.
* src/ui/dialog/UiDialog.js
  (showErrorDialog): Remove size.  Remove width param.
  (showNavErrorDialog): Remove size.
  (showQuoteNumberPrompt): Remove size, set type.
2017-11-08 14:09:03 -05:00
Mike Gerwitz 72783a5f35 Add Dialog type id support for CSS styling
* src/ui/dialog/Dialog.js (setTypeId): Add method.
* src/ui/dialog/DialogDecorator.js (setTypeId): Add method.
* src/ui/dialog/JqueryDialog.js (setTypeId): Add method.
2017-11-08 11:19:02 -05:00
Mike Gerwitz c41d0aa924 GeneralStepUi: Do not try to sort one group
An error was being thrown because there are no siblings to reference when
there is only a single group.  Obviously sorting is not even needed in such
a situation.

src/ui/step/GeneralStepUi.js (_sortGroups): Abort if <= 1 groups.
2017-10-23 14:56:51 -04:00
Mike Gerwitz 2baabf5e7e Output correct HTTP server port on start
Was outputting NaN, because the property that was being used no longer
existed after previous changes.

* src/server/daemon/Daemon.js (_initHttpServer): Use HTTP port number
  in output.
2017-09-08 14:19:58 -04:00
Mike Gerwitz 73354e39d0 Fix restoring of document metadata after clearing
Previous to this change, we'd write the clear to the database, but
then immediately after, the quote save would restore it.  Oops.

* src/server/Server.js (_monitorMetadataPromise): Clear data in
    metabucket rather than directly invoking a DB call.  This will be
    applied when the quote is saved.
2017-09-07 15:31:43 -04:00
Mike Gerwitz 68649dfd9b [DEV-2692] [BC-BREAK] Bucket stability and consistency fixes and non-term nulls
This mixes in support for non-terminating nulls.  It would have been
nice to handle that in a separate commit for clarity, but the
refactoring came as a consequence of trying to provide a working
implementation.

Various inconsistencies and subtle bugs in unlikely situations have
been fixed by this, including modifying objects passed as arguments to
various methods, and inconsistent handling of diff data.

Changes are more consistently recognized.  Perhaps the most noticeable
consequence is that moving between steps no longer prompts to discard
changes---previously calculated values would trigger the dirty flag on
steps even if the user didn't actually change anything.  I (and
others) have wanted this fixed for many years.

This is a very dense commit that touches a core part of the
system.  Hopefully the Changelog below helps.

* src/bucket/Bucket.js
  (setValues): [BC-BREAK] Remove parameters `merge_index' and
    `merge_null' parameters.
* src/bucket/DelayedStagingBucket.js
  (setValues): [BC-BREAK] Remove `merge_index' and `merge_null
    parameters.  Remove distinction between `merge_index' and non-.
* src/bucket/QuoteDataBucket.js
  (setValues): [BC-BREAK] Remove `merge_index' and `merge_null
    parameters.  Remove respective arguments from `_mergeData' call.
  (_mergeData): Remove same parameters.  Remove handling of
    `merge_index' and `merge_null'.
  (overwriteValues): Append `null' to each vector.
* src/bucket/StagingBucket.js
  (_initState): Use `Object.create' instead of explicit prototype
    instantiation (functionally equivalent).
  (merge): Minor comment correction.
  (_hasChanged): Rename to `_parseChanges'.
  (_parseChanges): Rename from `_hasChanged'.  Remove `merge_index'
    parameter.  Generate new object rather than mutation original
    data (prevent dangerous and subtle bugs from side-effects).  Clone
    each vector rather than modifying/referencing directly (this was
    previously done during merge).  Remove `merge_index'
    distinction.  Handle non-terminating `null' values.
  (setValues): [BC-BREAK] Remove `merge_index' and `merge_null'
    parameters.  Use new object generated by `_parseChanges'.  Remove
    cloning of each vector (`_parseChanges' now does that).  Remove
    `merge_index' distinction.
  (overwriteValues): Remove argument to `setValues' call.
  (getFilledDiff): [BC-BREAK] Use `_staged' rather than `_curdata'.
  (commit): Remove second and third arguments of call to `setValues'
    of underlying bucket.
* src/client/Client.js
  (_initStepUi): Remove second argument of calls to quote `setData'.
* src/client/quote/ClientQuote.js
  (setData): [BC-BREAK] Remove `merge_nulls' parameter.  Remove second
    and third arguments of call to staging bucket `setValues'.  Add
    comment indicating a long-standing problem with committing the
    staging bucket contents before save has succeeded.
* src/server/request/DataProcessor.js
  (processDiff): Remove `permit_null' argument of `sanitizeDiff'
    call.
  (sanitizeDiff): Remove `permit_null' parameter.  Hard-code filter
    call's `permit_null' argument to `true'.
  (_determineDapiFields): Properly handle `null's (ignore) rather than
    inadvertently converting them into the string "null".
* test/bucket/StagingBucketTest.js: Modify test cases
    accordingly.  Add tests to verify that updates and diffs operate
    as expected, especially support for non-terminating `null's.
  (createStubBucket): Use `QuoteDataBucket'.  Ideally remove this
    coupling in the future, but this is a more realistic test case for
    the time being.
* test/server/request/DataProcessorTest.js: Update test to account for
    hard-coded `given_null' argument.
2017-09-06 09:03:45 -04:00
Mike Gerwitz 8a1ac4781c [DEV-2692] Store cleaned rate response data separately
I'm not sure if this has ever caused real problems, but this was
dangerous.

* src/server/service/RatingService.js (_performRating): Store cleaned
    rating data in separate variable to ensure cleaned data are not
    saved in place of the actual complete response.
2017-09-05 16:26:59 -04:00
Mike Gerwitz 3fa464bc3a Extract bucket init code into ProgramInit
This represents a portion of the refactoring that I had intended to do
until I realized that there was a simpler solution to the problem that
we were having (having proguic add stored calculated values to the
defaults object).

So ideally we'll continue extracting all quote init code out of
`Server' and into `ProgramInit' in the future.

* doc/server.texi (Liza Server): Mention `ProgramInit'.
* src/program/ProgramInit.js: Add class.
* src/server/DocumentServer.js: Use it.
* src/server/Server.js (_progInit): Add private field.
  (__construct): Accept ProgramInit instance and assign to field.
  (initQuote): Use promise returned by `_getDefaultBucket'.
  (_getDefaultBucket): Proxy to `ProgramInit#init', which returns a
    promise.
2017-08-30 11:20:19 -04:00
Mike Gerwitz 445783c256 [BC BREAK] DataApi config lookup
This was a bit involved because the system had to be made async all
the way up the stack.  No attempt was made to clean up the mess up the
stack---no time.

* src/dapi/DataApiFactory.js
  (fromType): [BC BREAK] Fix docblock.  Add `api_name' param.  Call
    `#descLookup' and return promise.
  (descLookup): Add method.  Return promise resolving to provided
    descriptor.  Intended to be overridden by subtype.
* src/dapi/DataApiManager.js
  (_dataApis): Update docblock to indicate that it now stores
    promises.
  (getApiData): Expect promise for `DataApiFactory#fromType' call.
* src/server/DocumentServer.js: (create): [BC BREAK] Accept
    configuration.  Look up dapi conf and pass to
    `ServerDataApiFactory' ctor.  Return promise.
* src/server/daemon/Daemon.js (_initRouters): Provide configuration.
* src/server/daemon/controller.js
  (init): Accept configuration.  Handle return of promise from
    `_createDocumentServer'.
  (_createDocumentServer): Accept configuration, providing to
    `DocumentServer#create'.  Because of aforementioned change to
    `#create', returns promise.
* src/server/request/ServerDataApiFactory.js: Add StoreMissError
    import.
  (_conf): Add property.
  (constructor): [BC BREAK] Accept configuration.
  (descLookup): Add override.  Look up configuration for provided
    dapi.
2017-08-29 15:11:28 -04:00
Mike Gerwitz 985819c31b [BC BREAK] bin/server.js and associated changes
This is based (very) loosely on an internal script to start the
daemon.  It accepts a configuration and starts the daemon.

To accommodate the configuration, a number of miscellaneous changes
have been made.

The vanilla configuration shows the concept, but it has not yet been
fully implemented; that'll likely happen at a later date.  Until then,
the existing environment-variable-based configuration will be used.

* bin/server.js: Add file.
* conf/vanilla-server.json: Example configuration added.
* src/server/daemon/Daemon.js (_httpPort): Remove field.
  (_conf): Add field.
  (__construct): [BC BREAK] Accept conf instead of port and log
    priority.  Move initialization code into `start'.
  (start): [BC BREAK] Initialization code moved here.  Now returns
    promise for entire daemon, which will error in the event of an
    error starting.  Move existing code into `_startDaemon'.
  (_startDaemon): Old `start' code.  Invoked after `start'
    initialization.
  (_createDebugLog, _createAccessLog): Use configuration.  Return
    promise.
  (_initHttpServer): Use configuration.
  (_httpError): Add function to output error and exit.  Extracted from
    `_initHttpServer'.
* src/server/daemon/scripts.js: [BC BREAK] Append "program/" to
    `LV_LEGACY_PATH' so that it can be re-used for script lookups
    rather than using the cwd.  This removes the need of the cwd being
    the legacy src path.
2017-08-29 14:56:10 -04:00
Mike Gerwitz 464a46abf0 Add ConfStore
* src/conf/ConfStore.js: Add file.
2017-08-29 14:34:41 -04:00
Mike Gerwitz 24e8b51745 Add DelimitedKey Store trait
This will make life much easier and less verbose, especially
considering the verbosity of promises.

* src/store/DelimitedKey.js: Add trait.
* test/store/DelimitedKeyTest.js: Add test case.
2017-08-29 14:34:40 -04:00
Mike Gerwitz c857dcb056 Add ConfLoader
* src/conf/ConfLoader.js: Add class.
* test/conf/ConfLoaderTest.js: Respective test case.
2017-08-28 09:07:28 -04:00
Mike Gerwitz dfcca807de Add AutoObjectStore
* src/store/AutoObjectStore.js: Add class.
* test/store/AutoObjectStoreTest.js: Add test case.
2017-08-28 09:07:26 -04:00
Mike Gerwitz edce23f14b Add Store#populate
* src/store/DiffStore.js (populate): Add method.
* src/store/MemoryStore.js (populate): Add method.
* src/store/Store.js (populate): Add abstract method.
* test/store/DiffStoreTest.js: Add populate tests.
* test/store/MemoryStoreTest.js: Add populate tests.
2017-08-24 14:27:01 -04:00
Mike Gerwitz 6a777c3c51 Auto-reconnect to mongo database
I wish I knew this option existed ~7yr ago.  This should have been
done long ago, but we've had so few problems with it, that it had
never been explored.

This [version of this] mongo library is ancient and needs to be
upgraded.  Until then, this'll do.

* src/server/daemon/controller.js (init): Set `auto_reconnect'.
2017-08-22 16:46:47 -04:00
Mike Gerwitz eb8016364c DataProcessor: minor whitespace fix
* src/server/request/DataProcessor.js (_genClearMetaValues): Fix closing method brace indentation.
2017-08-16 08:52:46 -04:00
Mike Gerwitz 0e1cbe7c34 Clear metadata for pending dapi calls
* src/server/Server.js (_monitorMetadataPromise): Save metadata
  immediately after pending dapi requests (to clear in db).
  (handlePost): Pass clear update to _monitorMetadataPromise.

* src/server/request/DataProcessor.js (processDiff): Return meta clear
  update.
  (_triggerDapis): Call _genClearMetaValues and return results to
  caller.
  (_genClearMetaValues): Add method to calculate bucket update.

* test/server/request/DataProcessorTest.js: Update accordingly.
2017-08-15 15:13:22 -04:00
Mike Gerwitz b09d7ecd60 Don't corrupt PHP session if missing session data
`undefined' was inserted into the session if data could not be
retrieved.

* src/server/request/UserSession.js (_appendSessionData): Do not write
  session data if original data cannot be retrieved.
2017-08-15 12:00:41 -04:00
Mike Gerwitz 8cb23711ce Recognize non-changes in posted data server-side
This is a terrible kluge, but time doesn't permit modifying the
system.  All of this also touches old code that is untested, which is
difficult to modify with confidence.

* src/server/DocumentServer.js (DocumentServer#create): Use
  StagingBucket.
* src/server/Server.js: Remove logic now handled by DataProcessor.
* src/server/request/DataProcessor.js (processDiff): Wrap in
  StagingBucket to filter out values that do not result in changes.
* test/server/request/DataProcessorTest.js: Update failing cases.
2017-08-11 13:40:55 -04:00
Mike Gerwitz 1123bccf71 StagingBucket: Better consideration of nulls for change detection
`null` indicates a truncation.

* src/bucket/StagingBucket.js (_length, _deepEqual): Add methods.
  (_hasChanged): Better consider how nulls affect the bucket.
* test/bucket/StagingBucketTest.js: Modify tests accordingly.
2017-08-11 12:03:34 -04:00
Mike Gerwitz 5078c7d8d9 [DEV-2506] StagingBucket: Add ability to prevent bypass
This is a kluge until time can be spent better factoring this
system (using Traits).

* src/bucket/StagingBucket.js (_noStagingBypass): Add field.
  (forbidBypass): Add method to set field.
  (setCommittedValues): Use field.
2017-08-11 11:57:48 -04:00
Mike Gerwitz 12d3b5b8d0 Calc: Add `index' method
* src/calc/Calc.js (index): Add method.
2017-08-10 14:50:18 -04:00
Mike Gerwitz 874a638c43 Calc: Add repeat{,Concat}
* src/calc/Calc.js (repeat, repeatConcat): Add methods.
2017-08-10 14:49:59 -04:00
Mike Gerwitz 5d95d0eb80 Calc: 0-pad ISO dates as necessary
* src/calc/Calc.js (date, relativeDate): 0-pad output.
2017-08-10 14:46:41 -04:00
Mike Gerwitz 642dd8deb3 Calc: Handle null values
`null' is used to represent a truncation in a diff.

* src/calc/Calc.js (_each): Proper null handling.
2017-08-10 14:46:01 -04:00
Mike Gerwitz 9b3ca7a90a Server: Fix botched logging of metadata promise error
* src/server/Server.js (_monitorMetadataPromise): Fix/remove invalid
  references.
2017-08-10 09:52:07 -04:00
Mike Gerwitz c1b6f796fe Add `quote' Data API type
* src/dapi/DataApiFactory.js (_createDataApi): Add support for
  `quote'.
* src/dapi/http/HttpDataApi.js (__construct): New `enctype' argument.
  (_encodeData, _encodeKeys): Remove former, rename latter to former.
  (encodeData, _urlEncode): Encode based on enctype and method.
  (*): Strict mode, es6 style.
2017-08-10 09:52:07 -04:00
Mike Gerwitz d31e12193a Add ResponseApply
* src/dapi/format/ResponseApply.js: Add trait.
* test/dapi/format/ResponseApplyTest.js: Test it.
2017-08-10 09:52:07 -04:00
Mike Gerwitz e2845b72ec RestrictedDataApi#request: Make virtual
This is a bug (as this prohibits mixin overrides).

* src/dapi/RestrictedDataApi.js (#request): Make method virtual.
2017-08-10 09:52:07 -04:00
Mike Gerwitz 020ca01458 HttpDataApi: Only serialize JSON on POST
* src/dapi/http/HttpDataApi.js (_encodeKeys): JSON.stringify on POST.
* test/dapi/http/HttpDataApiTest.js: Update tests accordingly.
  Add POST test.
2017-08-10 09:52:07 -04:00
Mike Gerwitz ae9c293518 DataApi: Update docblock and strict mode
This just updates the file a bit and provides a more specific
docblock (as used in HttpDataApi).

* src/dapi/DataApi.js: strict mode and var=>const.
  (request): Docblock update for params.
2017-08-10 09:52:07 -04:00
Mike Gerwitz 47cb736387 Add QuoteDataApi 2017-08-10 09:52:03 -04:00
Mike Gerwitz 4522525260 DataApi#request data param docblock correction
* src/dapi/DataApi.js (#request): Correct docblock for `data' param.
2017-08-04 11:45:24 -04:00
Mike Gerwitz 39d4e20e92 Add temporary ITableDialog for ColumnLink workaround
I'm still waiting to release GNU ease.js 0.2.9 because I still (after
months) am trying to secure a copyright waiver from my employer.  The
bugs affecting this were fixed back in December!

This works around the issue of traits extending named classes, and
some internal issues with extending constructors defined by the system
for traits.

https://mikegerwitz.com/projects/easejs/commit/?id=e93f3a70f9a699f1577df6ce3ba9201b2ea97542

So, this commit is temporary; revert after 0.2.9.

* src/ui/dialog/ITableDialog.js: Add interface (temporarily).
* src/ui/dialog/ColumnLink.js: Use it.
2017-07-31 10:26:24 -04:00
Mike Gerwitz 5bd6920588 ProcessManager: SIGHUP reinit method call fix
* src/server/rater/ProcessManager.js (init): Fix re-init method
  call (still referenced `exports'; has since been refactored into a
  class).
2017-07-25 16:06:41 -04:00
Mike Gerwitz 229a356a9a Do not convert non-truthy dapi return values to empty string
* src/dapi/DataApiManager.js (getDataExpansion): Explicit undefined
  check before triggering default (empty string).
* test/dapi/DataApiManagerTest.js: Add associated test cases.
2017-07-21 15:20:55 -04:00
Mike Gerwitz deeb5648b0 ProgramQuoteCleaner: Handle case of missing meta field data
* src/server/quote/ProgramQuoteCleaner.js (_fixMeta): `program.meta'
  does not exist on programs compiled previous to the proguic update.
2017-07-14 15:07:08 -04:00
Mike Gerwitz 2eacd310b2 Process metadata and provide to rate process
Prefixes with "meta:".

* src/server/Server.js (initQuote): Initialze metadata to empty.
* src/server/daemon/controller.js (createQuote): Add metabucket.
* src/server/db/MongoServerDao.js (saveQuote): Add additional
  documentation to docblock.  Save all metadata if no bucket data
  provided (which indicates a full quote save).  This happens on
  version change.
* src/server/rater/ProcessManager.js (_genData): Add method to merge
  metadata into bucket data with "meta:" prefix.
  (byId): Use merged data.
2017-07-10 10:09:24 -04:00
Mike Gerwitz 22c3a21cdf ServerSideQuote: Add metabucket
* src/server/quote/ServerSideQuote.js (_metabucket): Add field.
  (getMetabucket, setMetabucket, setMetadata): Add methods.
2017-07-10 10:09:24 -04:00
Mike Gerwitz 37f84b7da8 Initialize metadata on quote version change
Consequently, on quote load as well.

* src/server/quote/ProgramQuoteCleaner.js (_fixMeta): New method.
  (clean): Use it.
2017-07-10 10:09:22 -04:00
Mike Gerwitz e963761d22 DataProcessor {type=>param} docblock correction
I seem to like messing trivial things up.

* src/server/request/DataProcessor.js (constructor): Docblock fix.
2017-07-06 15:06:57 -04:00
Mike Gerwitz 4d22107a57 Create ProcessManager out of rater/service
* src/server/daemon/Daemon.js (__construct): Reference new class.
* src/server/rater/ProcessManager.js: Add class (extracted from
  service).
* src/server/rater/service.js: Refactored into ProcessManager.
2017-07-06 15:06:57 -04:00
Mike Gerwitz 00f457d3d8 DataProcessor code formatting fix (= alignment)
Was bugging the hell out of me.

* src/server/request/DataProcessor.js (constructor): Align `='s.
2017-07-06 15:06:57 -04:00
Mike Gerwitz 7e4d872db2 Rating s/thread/process/ terminology fix
It never was a thread; it's always been a process.

* src/server/rater/thread.js: Renamed.
* src/server/rater/process.js: Renamed from thread.js.
* src/server/rater/service.js: s/thread/process/.
2017-07-06 15:06:55 -04:00
Mike Gerwitz d961a16420 Shorten "unlock quote" string
A bit arbitrary, but it contains text that's coupled to the layout of
the UI, and it usually pushes the button down off of the bar.

* src/client/Client.js (_showLockedNotification): Remove end of
  "unlock quote" string.
2017-07-05 16:01:15 -04:00
Mike Gerwitz 81a829549c Remove accidentally committed console.log on script filename
* src/server/daemon/scripts.js: Remove console.log.
2017-07-05 11:40:27 -04:00
Mike Gerwitz c20fbbeded Rename {Rating=>Calc}Worksheet
The class was renamed, but not the file.  Whoops.

* src/ui/worksheet/CalcWorksheet.js: Rename from RatingWorksheet.js.
* src/ui/worksheet/RatingWorksheet.js: Remove file.
2017-06-29 16:21:48 -04:00
Mike Gerwitz c0d0f4b463 Revert CapturedUserResponse temporarily
This reverts CapturedUserResponse to the state it was in prior to
being extracted into liza.  The issue was supposed to have been
resolved by now, but I haven't wanted to make an ease.js release until
the company that bought the company I work for signs the copyright
waiver.  Which has been slow-going, to say the least.

The problem is that it is not recognizing a named trait extending a
class as a parameterized trait (it's not seeing __mixin).

* src/server/request/CapturedUserResponse.js: Use interface.
* src/server/request/IProtUserResponse.js: Add temporary interface.
2017-06-29 15:57:22 -04:00
Mike Gerwitz 0401860377 Cast value to string before validating
* src/validate/BucketDataValidator.js (_forEach): Cast data to string
  before passing to formatter, which expects a string.
2017-06-29 14:18:01 -04:00
Mike Gerwitz 0c24e3d280 Populate document metadata using Data APIs
What a cluster.

This was a lot of work to work around existing, bad APIs; there is no
time to refactor at the moment; this already took much longer than
expected.
2017-06-28 16:33:24 -04:00
Mike Gerwitz 65ab92f701 Add SpoofedNodeHttpImpl
Session spoofing is needed for making authenticated requests.
2017-06-28 15:51:18 -04:00
Mike Gerwitz d47d77bb5e Add server.meta.DapiMetaSource
Encapsulates the nasty.

* src/server/meta/DapiMetaSource.js: Add class.
* test/server/meta/DapiMetaSourceTest.js: Add test case.
2017-06-28 14:56:28 -04:00
Mike Gerwitz b3f8ed96dd Fix typo in RestrictedDataApi error
* src/dapi/RestrictedDataApi.js (_requestParamCheck): Unknown param
  error typo fix.
2017-06-28 14:56:28 -04:00
Mike Gerwitz 95c28d4db4 Extract Server construction into DocumentServer
* src/server/DocumentServer.js: Add facade.
* src/server/daemon/controller.js: Use it.
2017-06-28 14:56:26 -04:00
Mike Gerwitz 630af0a062 Add ability to provide origin to NodeHttpImpl
* src/dapi/http/NodeHttpImpl.js (_parseUrl): Add method.
  (__construct): Add argument.
  (requestData): Use it.

* test/dapi/http/NodeHttpImplTest.js: Add tests.
2017-06-21 13:55:15 -04:00
Mike Gerwitz a1d5e7d3c5 Instantiate appropriate HttpImpl
* src/dapi/DataApiFactory.js (fromType): Instantiate NodeHttpImpl when
  XMLHttpRequest is undefined.
2017-06-21 10:52:46 -04:00
Mike Gerwitz 624f35a489 XhrHttpImpl: throw {=>Http}Error
* src/dapi/http/XhrHttpImpl.js (serveError): Throw HttpError instead
  of Error.
* test/dapi/http/XhrHttpImplTest.js: Test updated accordingly.
2017-06-21 10:52:46 -04:00
Mike Gerwitz a3e359a050 Add node dapi HTTP implementation
* src/dapi/http/HttpError.js: Add error subtype.
* src/dapi/http/NodeHttpImpl.js: Add node-based HTTP impl.
* test/dapi/http/HttpErrorTest.js: Add test.
* test/dapi/http/NodeHttpImplTest.js: Add test.
2017-06-21 10:52:46 -04:00
Mike Gerwitz 3be28a7858 Re-add missing Server#_sanitizeBucketData return
During liberation, this was accidentally removed...which breaks stuff.

* src/server/Server.js (_sanitizeBucketData): Re-add missing return statement.
2017-06-21 10:52:41 -04:00
Mike Gerwitz 1bb5191e3e LoVullo Associates => R-T Specialty
Copyright notices updated.  More casual references to "LoVullo
Associates" replaced with "RT Specialty / Lovullo", which will be "RT
Specialty Buffalo" in the future.  Or "RT Specialty", depending on how
this is rolled out.  Or "Ryan Specialty Group".  Who knows.

"R-T Specialty, LLC." is the legal name, which includes the dash.  Not
to be confused with a certain television network.
2017-06-08 14:48:43 -04:00
Mike Gerwitz 657573ab63 Near-complete liberation of liza
I have sat on releasing a lot of this code for years because I wanted
the liza repo to be in a pristine state---tests and all---which
required a great deal of refactoring.  Well, that never happened, and
time is up.

LoVullo Associates---my employer---has been purchased by another
company.  This means that any agreement with LoVullo regarding
releasing free software is going to have to be re-negotiated with this
new company, and I have no idea how those negotiations will go.  So,
I have no choice but to simply release everything in its current state,
or risk it being lost forever.

This represents work over the past 6--7 years, 99.9% of it written by
me.  This project has been my baby for quite some time, and has been
through a number of battles with deadlines and other unfortunate
circumstances; the scars show.  I also didn't really "know" JS when
starting this project.  Perhaps you can help improve upon it.

There are some odds-and-ends that could be committed.  And references
to insurance and LoVullo need to be removed to generalize this.

I hope that this will not be the last public commit for this project.
I'll fight the good fight and we'll see where that takes us.  Maybe
it'll be easy.

Happy hacking.
2017-06-08 14:38:28 -04:00
Mike Gerwitz 7567306123 FieldStyler: Remove classes not added by #addClass
This code assumed that no classes would be removed that were _not_
added by #addClass.  Well, that's false.

* src/ui/styler/FieldStyler.js (removeClass): Consider both spaces and
  boundary preceding class name.

* test/ui/styler/FieldStylerTest.js: Add test case.
2017-03-17 14:11:16 -04:00
Mike Gerwitz 6bba4322bf ValidStateMonitor: Consider scalar diff to affect all indexes
Classifications often yield scalar results.  Since those results are
used directly in the diff, we have the situation where the expected
diff format (an array) is not provided.  Consistent with the rest of
the system, we should consider a scalar to affect every index.

* src/validate/ValidStateMonitor.js (_checkCauseFix): Consider scalar
    diffs to affect every index when checking for fixes.
* test/validate/ValidStateMonitorTest.js: Add test.
2017-03-17 11:17:42 -04:00
Mike Gerwitz 6908e62206 Client: clear validation errors on dapi fieldLoaded
Previously, the system relied on the preStagingUpdate StagingBucket
event to do this implicitly, but that is no longer kicked off when
the diff doesn't produce any bucket changes.

* src/client/Client.js (_createProgram) [dapi]: Clear validation
  failures on dapi fieldLoaded.
2017-02-22 09:54:03 -05:00
Mike Gerwitz 45889f556f DataApiManager: emit fieldLoaded after request completes
The intent of this is to allow for clearing errors after fields
load (e.g. a "field loading" message if the user attempts to continue
past the step when a field hasn't yet finished loading).

* src/dapi/DataApiManager.js (getApiData): Emit fieldLoaded after
  request completes.
* test/dapi/DataApiManagerTest.js: Add test case.

DEV-2299
2017-02-22 09:53:59 -05:00
Mike Gerwitz 2ac393070a DataValidator: properly chain queue
This was not properly chain the promises---it was always chaining on
the original _pending (so, the first request) and never clearing
_pending after that point.

* src/validate/DataValidator.js (_onceReady): Properly chain.
* test/validate/DataValidatorTest.js: Updated test.  Don't ask.
2017-02-21 16:21:18 -05:00
Mike Gerwitz 62996102a8 StagingBucket: Use strict mode (and fix accidental globals)
This fixes accidental global variables and enables strict mode to
prevent it in the future.

* src/bucket/StagingBucket.js: Enable strict mode.  Use const/let where
    appropriate instead of var.
2017-02-20 12:16:49 -05:00
Mike Gerwitz c5194b4ec5 StagingBucket: Do not process non-changes
Since changes trigger any event observers---which can be
expensive---it is ideal to ignore sets that do not result in any
changes to the bucket.

This also resolves issues with systems that are confused by empty
diffs.

* src/bucket/StagingBucket.js
  (_hasChanged): Add method.
  (setValues): Use it.

* test/bucket/StagingBucketTest.js: Add test case.

DEV-2299
2017-02-20 12:16:24 -05:00
Mike Gerwitz 4f7654c7c4 Liberate numerous bucket classes
* src/bucket/DelayedStagingBucket.js: Add class.
* src/bucket/QuoteDataBucket.js: Add class.
* src/bucket/StagingBucket.js: Add class.
* src/bucket/StagingBucketAutoDiscard.js: Add class.
* src/client/ClientDependencyFactory.js: Add class.
2017-02-17 15:14:17 -05:00
Mike Gerwitz ac7ec6c5f2 DataValidator: Hold concurrent requests
Since we maintain state (as a kluge for the time being to integrate
with the rest of the system), we need to be careful to protect against
concurrent requests that might mess with it before the original
request is complete.

* src/validate/DataValidator.js
  (validate, updateFailures): Hold concurrent requests.
  (_onceReady): Add method.

* test/validate/DataValidatorTest.js: Add tests.
2017-02-17 11:31:32 -05:00
Mike Gerwitz eefd268abf Revert "DataValidator: Always clear store state"
This breaks everything. :x

This reverts commit e0c2e4dc86, reversing
changes made to e610372c84.
2017-02-16 16:49:29 -05:00
Mike Gerwitz 71024bd389 DataValidator: Queue validations when incomplete
* src/validate/DataValidator.js (validate): If a validation is
    ongoing, queue requests.

* test/validate/DataValidatorTest.js: Add test.

DEV-2299
2017-02-16 12:37:46 -05:00
Mike Gerwitz d99d1e3bed Program UI testing library 2017-02-16 09:12:44 -05:00
Mike Gerwitz 5f36d9272f Testing utilities for stubbing Program
This allows for testing assertions.  It's fairly primitive, but will
work for the time being.

* src/test/README: Add file.
* src/test/program/DummyClassifier.js: Add module.
* src/test/program/Program.js: Add class.
* src/test/program/util.js: Add module.
2017-02-15 14:19:33 -05:00
Mike Gerwitz 3b1df602e1 DataValidator: Always clear store state
In practice, not clearing the store and allowing it to use previous
state has the effect of instantly "fixing" failures if there happens
to be more than one validation call.

This was a log of debugging for a one-line change.

* src/validate/DataValidator.js (_populateStore): Always clear store.
* test/validate/DataValidatorTest.js: Add test.

DEV-2299
2017-02-13 15:07:26 -05:00
Mike Gerwitz cc79f8e1f3 FieldVisibilityEventHandler: use new DataValidator API
I updated DataValidator but never updated the caller.  Damnit.  It's
an unfortunate side-effect of dynamic, loosely typed languages and
mitigating it requires what should be boilerplate functional tests (in
this case---functional tests are useful for many other integration
aspects).

* src/event/FieldVisibilityEventHandler.js
  (handle): Use updated DataValidator#clearFailures API, which has
    a different descriptor format.

* test/event/FieldVisibilityEventHandlerTest.js: Update test.
2017-02-09 15:20:23 -05:00
Mike Gerwitz 028606242a Integrate field visibility event handler
* src/client/Client.js
  (_hideField): Remove method (extracted into
    FieldVisibilityEventHandler).
  (handleEvent): Remove show/hide handling.
  (_handleClassMatch): Adjust to new class/API.

* src/client/ClientDependencyFactory.js
  (createClientEventHandler): Add show/hide event handlers.
2017-02-08 11:24:56 -05:00
Mike Gerwitz e26a7c3cac FieldVisibilityEventHandler: Add class
This extracts code from internal lovullo repo rating-fw (originally
Client#_hideFields), 5d4019f1973f9271f4b1bd24ce1f55b56ccda09e.

* src/event/FieldVisibilityEventHandler.js: Add class.
* test/event/FieldVisibilityEventHandlerTest.js: Add test case.
2017-02-08 11:24:56 -05:00
Mike Gerwitz ed21707920 DataValidator, ValidStateMonitor: Add #clearFailures argument
This allows clearing only the specified failures.

* src/validate/ValidStateMonitor.js
  (clearFailures): Add `fields' argument.  Make method more concise.
  (_fixFailure): Handle clearing `_failures' record.

* src/validate/DataValidator.js
  (clearFailures): Add `fields' argument.

* test/validate/ValidStateMonitorTest.js: Add test.
* test/validate/DataValidatorTest.js: Add test.
2017-02-08 11:24:56 -05:00
Mike Gerwitz e7700e8b69 Liberate ClientDebug classes
This is a separate program of sorts that sits alongside and hooks the
Client.

* src/client/debug/AssertionClientDebugTab.js: Add class.
* src/client/debug/BucketClientDebugTab.js: Add class.
* src/client/debug/CalcClientDebugTab.js: Add class.
* src/client/debug/ClassifyClientDebugTab.js: Add class.
* src/client/debug/ClientDebug.js: Add class.
* src/client/debug/ClientDebugDialog.js: Add class.
* src/client/debug/ClientDebugTab.js: Add interface.
2017-02-08 11:24:56 -05:00
Mike Gerwitz dd7c2760f4 Client: Extract from internal repo
This thing is an ugly monstrosity that has witheld some pretty rough
development times.  As code is touched, it is being removed.

This depends on many things not yet in the liza repo; they'll be added
in time.

These classes were changed slightly to work within liza (e.g. paths).

* src/client/Client.js: Extract from rating-fw
  as of 5d4019f1973f9271f4b1bd24ce1f55b56ccda09e.

* src/client/ClientDependencyFactory.js: Extract from rating-fw
  as of 5d4019f1973f9271f4b1bd24ce1f55b56ccda09e.
2017-02-07 15:38:33 -05:00
Mike Gerwitz a65f568714 UnknownEventError: use ease.js
ease.js supports Error extending now.

* src/event/UnknownEventError.js: Use easejs.
2017-02-06 16:12:26 -05:00
Mike Gerwitz bd81e2e726 Liberate event handlers
These are extracted from rating-fw commit
5d4019f1973f9271f4b1bd24ce1f55b56ccda09e.
2017-02-06 16:12:26 -05:00
Mike Gerwitz c7b5ce5595 DataValidator, ValidStateMonitor: Add #clearFailures
* src/validate/DataValidator.js (clearFailures): Add public method.
* test/validate/DataValidatorTest.js: Add #clearFailures test.

* src/validate/ValidStateMonitor.js (clearFailures): Add public method.
* test/validate/ValidStateMonitorTest.js: Add #clearFailures test.
2017-02-02 14:01:13 -05:00
Mike Gerwitz 61a59db4e0 system.client: working data.diffStore
* src/system/client.js (data.diffStore): Compose all stores.
* test/system/clientTest.js: Update test case.

DEV-2296
2017-01-30 00:43:13 -05:00
Mike Gerwitz 0dcbd32202 DataValidator: accept classification results
* src/validate/DataValidator.js
  (validate): New `classes' parameter.  API BC break from previous
    commits.
  (populateStore, updateFailures): Generalize methods.

* test/validate/DataValidatorTest.js:
  Add associated test.
  Refactor existing tests to adhere to new API/expectations.

DEV-2206
2017-01-30 00:29:25 -05:00
Mike Gerwitz 28d74d7068 ValidStateMonitor: handle empty diff on past failure
See the description in the test case.  This is a bug fix.

* src/validate/ValidStateMonitor.js
  (_checkCauseFix): Do not consider an empty diff on a past failure to
    be a fix.

* test/validate/ValidStateMonitorTest.js: Add test.

DEV-2296
2017-01-30 00:29:25 -05:00
Mike Gerwitz 24180e704a Add DiffStore
* src/store/DiffStore.js: Add class.
* test/store/DiffStoreTest.js: Add test case.

DEV-2296
2017-01-30 00:29:25 -05:00
Mike Gerwitz 3289e42003 Update MemoryStore syntax to ES6
`#reduce` is much better.

* src/store/MemoryStore.js: Update syntax.

DEV-2296
2017-01-30 00:29:25 -05:00
Mike Gerwitz 282c0acf54 Store#clear to return self
* src/store/MemoryStore.js (clear): Promise resolve to self.
* src/store/Store.js (clear): Update docblock.
* test/store/MemoryStoreTest.js: Update test case accordingly.

DEV-2296
2017-01-30 00:29:25 -05:00
Mike Gerwitz b62673791b Add PatternProxy Store trait
Life is so much less miserable now that the project is supporting ES6.

* src/store/PatternProxy.js: Add trait.
* src/store/StorePatternError.js: Add Error.
* test/store/PatternProxyTest.js: Add test case.

DEV-2296
2017-01-30 00:29:15 -05:00
Mike Gerwitz 29fb75d1a3 ES6-ify ValidStateMonitor
This also helps to demonstrate how the more concise syntax improves
readability.

* src/validate/ValidStateMonitor.js: Syntax to ES6.

DEV-2296
2017-01-29 22:44:35 -05:00
Mike Gerwitz 4d981bd39f Store#add to return self
This allows for Promise chaining (and consequently temporary classes,
great for testing).

* src/store/MemoryStore.js
  (add): Resolve promise to self.
    Modify docblock.
* src/store/Store.js (add): Modify docblock.
* src/store/Cascading.js (add): Modify docblock.

* test/store/MemoryStoreTest.js: Modify test accordingly.

DEV-2296
2017-01-29 22:44:34 -05:00
Mike Gerwitz 38b4a58dde Began system/ with client
This will contain various factories (compounded in some cases) to
instantiate various parts of a coherent system.  It aims to replace
(as one of many pieces) the ClientDependencyFactory that's referenced
in the code, which is still part of rating-fw (internal LoVullo repo
from which liza is being liberated).

* src/system/client.js: Add module.
* test/system/clientTest.js: Add functional test case.

DEV-2296
2017-01-29 22:44:34 -05:00
Mike Gerwitz 2045c76f7e Integrate Store into DataValidator, ValidStateMonitor
ValidStateMonitor now uses a Store in place of the original primitive
object-based diff format.  The original format is translated by
DataValidator.  The code is in a transitional state, and considering
the amount of time we spend on various areas of this project, will
likely stay this way for a while.

* src/validate/DataValidator.js
  (__construct): Accept Store factory parameter.
  (_store_factory): Add field.
  (_createStores): Add method.
  (_validate): Handle Store.
  (updateFailures): Add method.
  (_populateStore): Add method.

* test/validate/DataValidatorTest.js: Add tests.

* src/validate/ValidStateMonitor.js
  (update): Enforce Store diff.
    Wait to process failures until fixes are calculated.
  (_checkFailureFix): Handle asynchronous, Promise-based diff.
  (_checkCauseFix): Extract logic from _checkCauseFix.

* test/validate/ValidStateMonitorTest.js:
  Modify test cases to be Promise-based and handle async calls where
  appropriate.  That was a friggin' expensive mess.

DEV-2296
2017-01-29 22:44:27 -05:00
Mike Gerwitz 203b25f10e Add DataValidator
This extracts some gross code from Client in the rating-fw repo, which
is responsible for gluing change validations together.

* src/validate/DataValidator.js: Add class.
* test/validate/DataValidatorTest.js: Add test case.

DEV-2296
2017-01-27 15:57:43 -05:00
Mike Gerwitz c8d77085ec Make BucketDataValidator public methods virtual
This class is terribly factored and not tested.

* src/validate/BucketDataValidator.js
  (validate,format): Make methods virtual.

DEV-2296
2017-01-27 15:57:43 -05:00
Mike Gerwitz fb3cd11265 ValidStateMonitor#update return Promise
Stepping stone to async. fix checks.

* src/validate/ValidStateMonitor.js
  (update, detectFixes, _checkFailureFix): Return Promise.
* test/validate/ValidStateMonitorTest.js: Update to use promises.

DEV-2296
2017-01-27 15:57:40 -05:00
Mike Gerwitz 0c18a6321a Add StoreMissError
Nice and trivial with the new easejs transparent error subtyping!

* src/store/StoreMissError.js: Add error class.
* src/store/MemoryStore.js (get): Use it.
* test/store/MemoryStoreTest.js (#get): Modify test to expect type.
2017-01-04 16:17:37 -05:00
Mike Gerwitz 7d97569027 Add MissLookup trait
* src/store/MissLookup.js: Add trait.
* test/store/MissLookupTest.js: Add test case.
2017-01-04 16:17:37 -05:00
Mike Gerwitz 0be39adfdb Make {,Memory}Store asynchronous
This isn't terribly useful as a general-purpose cache if it can't
handle async requests.
2017-01-04 16:17:35 -05:00
Mike Gerwitz 29f67bd157 Add store.Cascading
* src/store/Cascading.js: Add trait.
* test/store/CascadingTest.js: Add test case.
2017-01-03 09:11:18 -05:00
Mike Gerwitz d8d44130e8 Add {,Memory}Store
* src/store/Store.js: Add interface.
* src/store/MemoryStore.js: Add class.
* test/store/MemoryStoreTest.js: Add test case.
2017-01-03 09:10:53 -05:00
Mike Gerwitz e883c45e35 Add Currency formatter
* src/validate/formatter/Currency.js: Add class.
2016-12-01 12:44:09 -05:00
Mike Gerwitz 5607bf1927 Replace Currency formatter with StringFormat
This is a much more general solution.

* src/validate/formatter/Currency.js: Remove trait.
* test/validate/formatter/CurrencyTest.js: Remove test case.

* src/validate/formatter/StringFormat.js: Add trait.
* test/validate/formatter/StringFormatTest.js: Add test case.
2016-12-01 08:47:23 -05:00
Mike Gerwitz ab3f5f4cb6 Validate correct Number format
* src/validate/formatter/Number.js
  (parse): Validate number format.

* test/validate/formatter/NumberTest.js: Modify accordingly.
2016-12-01 08:43:51 -05:00
Mike Gerwitz 5947e7646e Add scale to Number formatter
* src/validate/formatter/Number.js
  (__mixin): Add mixin ctor.
  (parse): Handle scale.
  (styleNumber): Handle scale.
  (scale, split): Add methods.

* test/validate/formatter/NumberTest.js: Modified accordingly.
2016-12-01 08:43:46 -05:00
Mike Gerwitz 6db99c8632 Add Currency formatter
* src/validate/formatter/Currency.js: Add trait.
* test/validate/formatter/CurrencyTest.js: Add test case.
2016-11-28 14:01:44 -05:00
Mike Gerwitz 14711cd4c6 Correct Number formatter docblock
* src/validate/formatter/Number.js: Correct trait docblock.
2016-11-28 14:01:09 -05:00
Mike Gerwitz c124086673 Correct and test GeneralStepUi#scrollTo
* src/ui/step/GeneralStepUi.js (scrollTo):
  Will now abort after each error rather than falling through.
  Visibility error message will now show field index.

* test/ui/step/GeneralStepUiTest.js: Added respective test cases
2016-08-05 11:45:09 -04:00
Mike Gerwitz 66f78c8886 Accept jQuery in GeneralStepUi
This defaults to the global jQuery just so we don't break
everything (BC); that'll be removed in the future.

* src/ui/step/GeneralStepUi.js (__construct): Accept jQuery.
  (setContent): Use jQuery instance passed via ctor
2016-08-05 11:41:27 -04:00
Mike Gerwitz 72f29a9734 Corrected GeneralStepUi class name
* src/ui/step/GeneralStepUi.js: Class name {=>General}StepUi
2016-07-28 16:25:47 -04:00
Mike Gerwitz 8d68880712 Remove multitext answer styler
This can now be handled with the existing formatters, specifically the
MultiDimension trait.  Specifically, multitext simply handled the
styling of vectors.

* src/ui/ElementStyler.js (_answerStylers): Remove multilimit
2016-07-20 15:23:35 -04:00
Mike Gerwitz d0768e20ca Remove now-unneeded answer stylers
There are more to be removed; baby steps.

* src/ui/ElementStyler.js
  (_answerStylers.{limit,multilimit,acceptReject,limitReject): Removed
2016-06-28 10:27:59 -04:00
Mike Gerwitz 5ce106710e Add MultiDimension formatter
* src/validate/formatter/MultiDimension.js: Added
* test/validate/formatter/MultiDimensionTest.js: Added
2016-06-28 10:27:59 -04:00
Mike Gerwitz 8feb8f286a Add StandardLimitFormatter
This formats according to common insurance conventions for limits.

* src/validate/formatter/insurance/StandardLimitFormatter.js: Added.
2016-06-28 10:27:59 -04:00
Mike Gerwitz b90f6d7474 Add accept/reject styler
* src/validate/formatter/AcceptReject.js: Added.
* test/validate/formatter/AcceptRejectTest.js: Added.
2016-06-28 10:27:56 -04:00
Mike Gerwitz 31f3ab010e Add Limit formatter
* src/validate/formatter/insurance/Limit.js: Added
* test/validate/formatter/insurance/LimitTest.js: Added
2016-06-27 16:51:25 -04:00
Mike Gerwitz c0df3ef02e Add Number formatter
* src/validate/formatter/Number.js: Added
* test/validate/formatter/NumberTest.js: Added
2016-06-27 16:51:25 -04:00
Mike Gerwitz 8a26406468 Add MultiDelimited formatter trait
This will simplify, through composition, a number of other
validator-formatters.

* src/validate/formatter/MultiDelimited.js: Added
* test/validate/formatter/MultiDelimitedTest.js: Added
2016-06-27 16:51:17 -04:00
Mike Gerwitz 4aa88fc08c UnorderedList{Formatter=>} now a trait
This adds a great deal of flexibility through composition via trait
stacking.

* src/validate/formatter/UnorderedList.js: Renamed from
  UnorderedListFormatter; now a trait.

* test/validate/formatter/UnorderedListTest.js: Renamed from
  UnorderedListFormatterTest and adjusted to instantiate trait.
2016-06-24 15:57:10 -04:00
Mike Gerwitz ac52f42d1c Add EchoFormatter
* src/validate/formatter/EchoFormatter.js: Added.
* test/validate/formatter/EchoFormatterTest.js: Added.
2016-06-23 10:12:59 -04:00
Mike Gerwitz 391a819536 Liberated UnorderedListFormatter
These have been refacored from the original: rather than abusing what is now
the PatternFormatter, it is now its own class.

* src/validate/formatter/UnorderedListFormatter.js: Added.
* test/validate/formatter/UnorderedListFormatterTest.js: Added.
2016-06-23 09:14:05 -04:00
Mike Gerwitz d6cecf1ff6 VFormat => PatternFormatter with added interface
* src/validate/ValidatorFormatter.js: Interface added.
* src/validate/formatter/PatternFormatter.js: Renamed from ../VFormat.js.
* test/validate/formatter/PatternFormatterTest.js: Renamed from
  ../VFormatTest.js.
2016-06-22 15:59:12 -04:00
Mike Gerwitz a509e53a3e Liberate VFormat
This will likely undergo some refactoring.

* src/validate/VFormat.js: Added.
* test/validate/VFormatTest.js: Added.
2016-06-22 15:41:03 -04:00
Mike Gerwitz 2a6b170ac9 Remove unneeded answer stylers
These all have VFormat alternatives.

* src/ui/ElementStyler.js (_answerStylers): Removed
2016-06-21 16:46:21 -04:00
Mike Gerwitz f5549795d5 GeneralStepUi vformat styling
* package.json (devDependencies): Add sinon

* src/ui/step/GeneralStepUi.js (answerDataUpdate): Attempt formatting with
  formatter prior to "old" answer styling.

* test/ui/step/GeneralStepUiTest.js: Added
2016-06-21 16:46:05 -04:00
Mike Gerwitz 91903951c4 Extract direct answer context references into method
This allows overriding for testing (and is a proper abstraction); eventually
this will be moved out of this class entirely.

* src/ui/step/GeneralStepUi.js (getAnswerContext): Added
  Number of methods updated to use.
2016-06-20 10:29:44 -04:00
Mike Gerwitz 7a1e1a68e3 GeneralStepUi answer styling method extraction
This is just to enable some sort of testing without instantiating the entire
class and navigating a maze of methods.

* ui/step/GeneralStepUi.js (answerDataUpdate): Added
  (_processAnswerFields): Extracted function into answerDataUpate
2016-06-17 14:44:49 -04:00
Mike Gerwitz e6ede4ad3a ValidStateMonitor: merge subsequent failures before fixes
* src/validate/ValidStateMonitor.js (mergeFailures):
Another error on a field that previously failed will no longer overwrite the
previous failure, which caused issue when the causes changed (leaving fields
potentially unfixed).

* test/validate/ValidStateMonitorTest.js: Respective tests added.
2016-04-28 11:53:14 -04:00
Mike Gerwitz e406c198d2 Add Failure#merge
* src/validate/Failure.js (merge): Added
* test/validate/FailureTest.js: Respective tests added
2016-04-28 11:31:42 -04:00
Mike Gerwitz b3d3f4b7cd Remove support for string-style validation failures
* src/validate/ValidStateMonitor (_getCauses): Removed
Now requires that each failure be a Failure object.
2016-04-21 16:28:34 -04:00
Mike Gerwitz 0a8329b405 Support multiple validation failure causes
* src/validate/Failure.js (__construct): Takes an array of causes.
(getCauses): Now returns an array of causes.

* src/validate/ValidStateMonitor.js: Recognize fixes on array of causes.

* test/validate/FailureTest.js: Updated

* test/validate/ValidStateMonitorTest.js: Updated
2016-04-21 16:23:41 -04:00
Mike Gerwitz f624710451 Consider field failure cause when checking fixes
This maintains BC with the old string-based system.

* src/validate/ValidStateMonitor.js (_getCause): Added.
(detectFixes): Consider failure cause if available when checking for fixes.
2016-04-20 12:11:17 -04:00
Mike Gerwitz ac5d04e9a4 Add validation Failure
* src/validate/Failure.js: Added
* test/validate/FailureTtest.js: Added
2016-04-20 10:31:49 -04:00
Mike Gerwitz ddffb4e301 No failure event if failures have not changed in ValidStateMonitor
* src/validate/ValidStateMonitor.js (mergeFailures): Return count of new
failures

* test/validate/ValidStateMonitorTest.js: Respective test added
2016-04-19 11:29:14 -04:00
Mike Gerwitz 3a2a5642b6 Add FlatGroupUi
This solves the problem of trying to show/hide indexes that do not even
exist on the DOM.

There are no tests for this due to the complexity of the parent; refactoring
is needed. :(

* src/ui/group/FlatGroupUi: Added
2016-04-19 10:51:15 -04:00
Mike Gerwitz fcce2e814a Fields with index greater than total in group are not visible
* src/ui/group/GroupUi (isFieldVisible): Indexes greater than the current
index count will no longer be considered to be visible.
2016-04-19 10:50:32 -04:00
Mike Gerwitz 6d51dc55eb Add DataApiManager field stale flag
This will allow it to know when a request needs to be re-made at a later
time.

* src/dapi/DataApiManager (fieldStale, isFieldStale): Added
(fieldNotReady): Check stale status of field
2016-04-15 12:24:08 -04:00
Mike Gerwitz 3e84f18c56 Extract Data API management into DataApiManager
This is extracted from a not-yet-liberated Program class (that you really
don't want to see).

* src/dapi/DataApiManager.js: Added
2016-04-15 12:23:31 -04:00
Mike Gerwitz d37a8aab12 Liberate dapis
* src/bucket/Bucket.js: Added
* src/dapi/BucketDataApi.js: Added
* src/dapi/RestrictedDataApi.js: Added
* src/dapi/StaticAdditionDataApi.js: Added
2016-04-14 13:53:35 -04:00
Mike Gerwitz a6115018d2 Add x-www-form-urlencoded header for XhrHttpImpl
It might be the case that we may want to post raw data in the future; in
fact, I can guarantee it.  We'll cross that bridge when we come to it.

* src/dapi/http/XhrHttpImpl.js (openRequest): Set ContentType header
on POST

* test/dapi/http/XhrHttpImplTest.js: Modified accordingly
2016-04-14 12:08:00 -04:00
Mike Gerwitz bc0d230246 Remove trailing comma from ValidStateMonitor
Yes, the reason is IE.

* src/validate/ValidStateMonitor.js: Remove trailing comma after method
definition list.
2016-04-13 08:27:16 -04:00
Mike Gerwitz 9dfc7c04ff Remove ClientFieldValidator
Use ValidStateMonitor instead.

* src/validate/ClientFieldValidator.js: Deleted
2016-04-12 14:06:57 -04:00
Mike Gerwitz 659c820eb6 Add ValidStateMonitor
The intent is to ultimately replace ClientFieldValidator with this and
individual validators that interact with it.

* src/validate/ValidStateMonitor.js: Added
* test/validate/ValidStateMonitorTest.js: Added
2016-04-12 13:57:34 -04:00
Mike Gerwitz 88313c016e Accept full bucket data for ClientFieldValidator#validate
This allows #validate to be used generically for any type of validation, not
just change events.

* src/validate/ClientFieldValidator.js (validate):
Accept and propagate all bucket data to `validate` event listeners.
2016-04-11 11:53:45 -04:00
Mike Gerwitz fefe2dae41 Remove ClientFieldValidator#monitor
* src/validate/ClientFieldValidator.js (monitor): Remove
This just concerns itself with something that it should be concerned about;
let the caller handle monitoring, now that we have a #validate method.
2016-04-11 11:50:27 -04:00
Mike Gerwitz 0ac16a3505 Add ClientFieldValidator#validate
* src/validate/ClientFieldValidator (validate): Added
Extracted logic that previously was exclusive to #monitor; that method will
now simply invoke #validate.
2016-04-11 11:29:34 -04:00
Mike Gerwitz 6f17e704a6 Liberate {ClientField,BucketData}Validator
* src/validate/BucketDataValidator.js: Added
* src/validate/ClientFieldValidator.js: Added
2016-04-11 11:18:18 -04:00
Mike Gerwitz bada152d52 {Error=>DomFieldNotFound} error when DOM field is not found
* src/ui/field/DomField.js (queryElement): {Error=>DomFieldNotFoundError}
when a DOM element cannot be located for the field.

* src/ui/field/DomFieldNotFoundError.js: Added
2016-04-06 10:44:11 -04:00
Mike Gerwitz a145bfe1f8 Use HTMLElement#setAttribute in NaFieldStyler for IE<9
element.style is not supported as an lvalue in IE<9.

All the rest of the sane world that doesn't support IE<9 should be laughing
at me in pity right now.

* src/ui/styler/NaFieldStyler.js (hideField):
Use HTMLElement#setAttribute instead of HTMLElement#style as an lvalue

* test/ui/styler/NaFieldStylerTest.js: Modify test cases to check for
invocation of setAttribute
2016-04-05 11:53:30 -04:00
Mike Gerwitz c29b935f5c NaFieldStylerAnimation properly re-show element in IE
* src/ui/styler/NaFieldStylerAnimation (showField):
The 'display:none' style was retained in certain circumstances after
animation in IE; this fixes that.
2016-04-05 08:59:43 -04:00
Mike Gerwitz 921880cb35 {Tabbed,}GroupUi now show/hide using FieldStyler
Yes, this is a mess; I'm pretty much out of time now.

* src/ui/group/GroupUi.js (doShowField, doHideField):
Use field styler

* src/ui/group/TabbedGroupUi (doShowField, doHideField):
Defer to supertype
2016-04-05 00:07:26 -04:00
Mike Gerwitz d8fc549700 DomFieldFactory falls back to element lookups by id
* src/ui/field/DomFieldFactory (create):
Use ElementStyler#getElementByNameLax
2016-04-05 00:05:07 -04:00
Mike Gerwitz afa14ccc39 Add ElementStyler#getFieldByNameLax
Not that I want to keep adding to this monstrosity; no time to refactor
right now.

* src/ui/ElementStyler.js (getFieldByNameLax): Added
2016-04-05 00:03:47 -04:00
Mike Gerwitz 1e332a5a72 Add NaFieldStylerAnimation
I didn't really want to add this back in, but others in the group
thought that change might be bad for users.  This animation thing is
just so sloppy, I think.

* src/ui/styler/NaFieldStylerAnimation.js: Added
2016-04-05 00:01:08 -04:00
Mike Gerwitz befca68110 Extract NaFieldStyler show/hide actions into protected methods
* src/ui/styler/NaFieldStyler.js (showField, hideField): Added
* test/ui/styler/NaFieldStyler.js: Added respective tests
2016-04-04 23:59:57 -04:00
Mike Gerwitz e1c2194962 DomField will now consider that field element might have changed on DOM
This solves styling and DOM mutation issues.  For now.

* src/ui/field/DomField.js (queryElement, updateElement): Added
(_getElement): Extracted into queryElement and updated to re-query DOM each
time, returning last match if not found.
(applyStyle, revokeStyle): Defers style applied predicate to style itself
2016-04-04 15:35:43 -04:00
Mike Gerwitz 40505c3328 FieldStyler#isApplied added
Field stylers now determine whether they've been applied to the target field
on their own, which solves the problem of the system getting out of sync.

* src/ui/styler/ErrorFieldStyler.js (isApplied): Added
* src/ui/styler/FieldStyler.js (isApplied): Added
* src/ui/styler/NaFieldStyler.js (isApplied): Added
* test/ui/styler/NaFieldStylerTest.js: Test for #isApplied
2016-04-04 15:25:52 -04:00
Mike Gerwitz ae9f2a7cab NaFieldStyler remove subfields from DOM
This is necessarily primarily for a specific case: option elements in IE,
which cannot be styled. >:O

This implementation is not complete: we want to re-attach the field at the
same position it was at before it was detached.  This might not be
trivial---imagine if its sibling was also detached.

* src/ui/styler/NaFieldStyler.js (isSubField): Receive field instead of
element (to check parent)
(applyStyle, revokeStyle): Detach and re-attach field from/to DOM
respectively

* test/ui/styler/NaFieldStylerTest.js: Associated tests
2016-04-04 12:30:21 -04:00
Mike Gerwitz 782e4832af Cache DomField parent element
* src/ui/field/DomField.js (getParentElement):
Renamed from getParent.  Cache parent element in memory so that we have a
reference for re-attaching fields to the DOM.
(getParent): Public API addition; call getParentElement
2016-04-04 12:30:21 -04:00
Mike Gerwitz fa37850408 Proper NaFieldStyler sub-field hiding support
* src/ui/styler/NaFieldStyler.js (_isSubField): Added
(applyStyle, revokeStyle): Will not hide parents of sub-fields
2016-04-04 12:30:21 -04:00
Mike Gerwitz 064fcd00fd Abort TabbedGroupUi hide when deferred
* src/ui/group/TabbedGroupUi.js (doShowField, doHideField):
Return from method after setting deferred operation.  This previously
did not fail because jQuery didn't care if operations are not
performed on field matches.
2016-04-04 12:30:05 -04:00
Mike Gerwitz eb073f5db0 DomField#getParent proper nodeName comparison
* src/ui/field/DomFieldFactory (getParent): Convert parent nodeName to
uppercase before comparison (it might not always be)
2016-04-04 11:17:14 -04:00
Mike Gerwitz edbc45a79b DomField#getContainingRow handling of direct row reference
* src/ui/field/DomField.js (getContainingRow): Return self if DT or DD

Certain types of elements (e.g. statics) are compiled such that the direct
reference is the row itself.
2016-04-04 11:17:14 -04:00
Mike Gerwitz c204a12c19 Add NaFieldStyler
* src/ui/styler/NaFieldStyler.js: Added
* test/ui/styler/NaFieldStylerTest.js: Added
2016-04-04 11:17:12 -04:00
Mike Gerwitz 4cce3759db Rename method todo on DomContext#_dequeue
* src/ui/context/DomContext.js (_dequeue): Add todo
2016-04-02 00:30:42 -04:00
Mike Gerwitz d126f618ae Add FieldStyler docblocks
* src/ui/styler/FieldStyler.js (getId, applyStyle, revokeStyle,
addClass, removeClass): Docblocks added
2016-04-02 00:30:42 -04:00
Mike Gerwitz a3b16f33c9 Liberate ui/styler/
* src/ui/styler/ErrorFieldStyler.js: Added
* src/ui/styler/ErrorStyler.js: Added
* src/ui/styler/FieldStyler.js: Added
* src/ui/styler/SidebarErrorStyler.js: Added
* src/ui/styler/StepErrorStyler.js: Added
* src/ui/styler/Styler.js: Added
2016-04-02 00:30:42 -04:00
Mike Gerwitz 37c74eac48 ElementStyler.js (__construct): Decouple jQuery instance 2016-04-02 00:30:42 -04:00
Mike Gerwitz fea4e151cc Liberated archaic DOM element styler
* src/ui/ElementStyler.js: Added

* src/sort/MultiSort.js: Removed ElementStyler liberation todo
* src/ui/field/DomFieldFactory.js: Same
* src/ui/step/GeneralStepUi.js: Same
* src/ui/step/StepUiBuilder.js: Same

This existed when the framework was very long, and has managed to survive
numerous refactoring attempts; it used to be a small class abstracting
element styling, and it has had crap thrown into it ever since, partially
due to time constraints.  It needs to go away.
2016-04-02 00:30:11 -04:00
Mike Gerwitz 003d527307 Liberate context/
* ui/context/Context.js: Added
* ui/context/DomContext.js: Added
* ui/context/DynamicContext.js: Added
* ui/context/RootDomContext.js: Added
2016-04-01 16:03:52 -04:00
Mike Gerwitz 2fa20c9864 Group support for showing/hiding sub-fields
* src/ui/GroupUi.js (getFieldElements): New method
(showField, hideField): Use GroupUi#getFieldElements

* src/ui/group/TabbedGroupUi (showField, hideField):
Use GroupUi#getFieldElements
2016-03-30 14:16:27 -04:00
Mike Gerwitz 6ab3842015 Proper attribution for src/version.js.in 2016-03-29 14:35:59 -04:00
Arthur Domino 93bff03676 Do not collapse CollapseTableGroups when created. 2016-03-29 09:58:26 -04:00
Mike Gerwitz c56d6ac7b2 GeneralStepUi#_sortGroups: correct group sorting
The modified parent was not the parent of groups, so the group DOM operations failed.
2015-12-04 10:03:52 -05:00
Mike Gerwitz 1a3dd236f8 GeneralStepUi#_sortGroups: maintain DOM order after group sorting
This was affected by 4ce78ebd9e.
2015-12-03 08:27:59 -05:00
Mike Gerwitz a60bf6b52e Liberated Group and its various UIs
The `AccordionGroupUi` was not liberated, because it is my intent to
eliminate it---I did not agree with its needless addition to begin with.  If
we do end up keeping it, then it will be liberated as well.
2015-12-03 00:36:31 -05:00
Mike Gerwitz 3d9780c39e {=>General}StepUi; StepUi interface
This allows us to begin development (and testing) of StepUi subtypes without
having to worry about the convoluted crap that GeneralStepUi is doing.
Specifically, all the jQuery stuff needs to go.
2015-12-03 00:11:53 -05:00
Mike Gerwitz cc21298297 StepUi: Accept and return vanilla DOM content
This encapsulates the use of jQuery which will eventually be entirely
eliminated.
2015-12-03 00:11:53 -05:00
Mike Gerwitz 972856225b Extract StepUi#detach
You can't see where this is going, because there is other code that is not
yet part of Liza.  ...sorry.
2015-12-03 00:11:52 -05:00
Mike Gerwitz 4ce78ebd9e StepUiBuilder do not enclose groups in parent element
This allows the caller to handle how to group and render steps.  But we do
add another container to hold each of the groups.
2015-12-03 00:11:52 -05:00
Mike Gerwitz 44323a0b59 Liberated StepUiBuilder 2015-12-03 00:11:52 -05:00
Mike Gerwitz 9a1dd337eb Liberate {,ui/}field/ 2015-11-30 14:38:42 -05:00
Mike Gerwitz 4cc240e977 Liberate Step 2015-11-30 13:40:33 -05:00
Mike Gerwitz f9b3fa0622 Liberate MultiSort
Step dependency.
2015-11-30 13:40:26 -05:00
Mike Gerwitz 1c4554dd0d Minor StepUi cleanup 2015-11-30 11:57:10 -05:00
Mike Gerwitz 215869e1ea Liberate StepUi
This has a lot of rough code in it, much of which I do not approve of.  But
it'll never be liberated if I make everything pristine beforehand!
2015-11-30 11:37:41 -05:00
Mike Gerwitz 5c2c468183 ECMAScript 3 compatibility fixes
This is crazy, but LoVullo Associates still supports browsers as far back as
IE7, meaning that we need to maintain ES3 support; that will hopefully
change soon.
2015-05-31 23:51:08 -04:00
Mike Gerwitz a383a36bfc HttpDataApi#request permits null data 2015-05-29 12:45:02 -04:00
Mike Gerwitz 0599acc23a Key-value param encoding moved from XhrHttpImpl to HttpDataApi 2015-05-29 12:22:26 -04:00
Mike Gerwitz f122d85938 XhrHttpImpl modify URL for GET request params and encode key-value
Some of this may be more appropriate to move out of XhrHttpImpl into
something like HttpDataApi...
2015-05-29 09:35:21 -04:00
Mike Gerwitz 881e740bb9 JsonResponse returns parse error or combined request/parse on failure 2015-05-28 15:15:41 -04:00
Mike Gerwitz ca68d12370 XhrHttpImpl no longer modifying response text
Status code included with error object
2015-05-28 15:15:41 -04:00
Mike Gerwitz 8f9b8f779f JsonResponse retain output value on request error 2015-05-28 15:15:41 -04:00
Mike Gerwitz e8344e36bb dapi.format.JsonResponse response text output value on parse failure 2015-05-28 15:15:41 -04:00
Mike Gerwitz 1669f9eeda XhrHttpImpl#request invokes XHR send
This should have always been the case; I am not sure what I was thinking,
considering that the object is encapsulated.
2015-05-28 15:15:39 -04:00
Mike Gerwitz 76280b0cac AutoRetry distinction between predicate truth and request failure 2015-05-28 15:03:50 -04:00
Mike Gerwitz 2b92a2c447 JsonResponse#request must be virtual
To suppor trait stacking.
2015-05-28 15:03:48 -04:00
Mike Gerwitz af4a775155 AutoRetry delay implementation 2015-05-27 15:25:43 -04:00
Mike Gerwitz ca5d064455 AutoRetry trait initial implementation 2015-05-27 15:25:42 -04:00
Mike Gerwitz 8fbd4dd220 XhrHttpImpl#serveError 2015-05-12 16:32:49 -04:00
Mike Gerwitz d4328968e8 XhrHttpImpl considers any 2xx status to be successful 2015-05-12 16:32:49 -04:00
Mike Gerwitz 6cc260b443 XhrHttpImpl#isSuccessful determines HTTP response success
May be overridden by subtypes.
2015-05-12 16:32:48 -04:00
Mike Gerwitz b4ef6439e9 JsonDataApi=>JsonResponse trait
This cuts down on the code significantly and makes more sense, since we
would not want to veil the API of any classes that want to use this.
2015-05-12 16:32:43 -04:00
Mike Gerwitz 0e9c511117 HttpDataApi.request is now virtual
Will support mixins
2015-05-12 13:45:19 -04:00
Mike Gerwitz 0a07ad4982 Added JsonDataApi 2015-05-12 13:45:19 -04:00
Mike Gerwitz 6d0acf5916 Initial XhrHttpImpl implementation 2015-05-12 13:45:19 -04:00
Mike Gerwitz e0f1c600ba Began liberating DataApi
The Data API is being heavily refactored and tested; while moving files into the
Liza repository, I noticed some inefficiencies with the design. These are being
heavily improved upon.
2015-05-12 13:45:19 -04:00
Mike Gerwitz 6149649327 jQuery dependency injected into GroupUi 2015-05-01 14:20:13 -04:00
Mike Gerwitz 0fe2df4de3 License header added to GroupUi 2015-05-01 14:20:13 -04:00
Mike Gerwitz ab34cc89b0 GroupUi needs love (cleanup, testing, etc) 2015-05-01 14:20:11 -04:00
Mike Gerwitz 35e1494b9c Extract GroupUi from internal repository
Verbatim.
2015-05-01 11:10:49 -04:00