Browse Source

Moved validator and ConfigurationSystem to ./lib/shared, and continue with options on error

flowchartTest
jos 9 years ago
parent
commit
88ab094789
6 changed files with 14 additions and 16 deletions
  1. +5
    -6
      lib/network/Network.js
  2. +2
    -2
      lib/network/modules/components/Node.js
  3. +0
    -0
      lib/network/options.js
  4. +2
    -2
      lib/shared/ConfigurationSystem.js
  5. +1
    -1
      lib/shared/Validator.js
  6. +4
    -5
      lib/timeline/Timeline.js

+ 5
- 6
lib/network/Network.js View File

@ -24,10 +24,10 @@ import InteractionHandler from './modules/InteractionHandler';
import SelectionHandler from "./modules/SelectionHandler"; import SelectionHandler from "./modules/SelectionHandler";
import LayoutEngine from "./modules/LayoutEngine"; import LayoutEngine from "./modules/LayoutEngine";
import ManipulationSystem from "./modules/ManipulationSystem"; import ManipulationSystem from "./modules/ManipulationSystem";
import ConfigurationSystem from "./modules/ConfigurationSystem";
import Validator from "./modules/Validator";
import {printStyle} from "./modules/Validator";
import {allOptions, configureOptions} from './modules/components/AllOptions.js';
import ConfigurationSystem from "./../shared/ConfigurationSystem";
import Validator from "./../shared/Validator";
import {printStyle} from "./../shared/Validator";
import {allOptions, configureOptions} from './options.js';
@ -146,8 +146,7 @@ Network.prototype.setOptions = function (options) {
let errorFound = Validator.validate(options, allOptions); let errorFound = Validator.validate(options, allOptions);
if (errorFound === true) { if (errorFound === true) {
options = {};
console.log('%cErrors have been found in the supplied options object. None of the options will be used.', printStyle);
console.log('%cErrors have been found in the supplied options object.', printStyle);
} }
// copy the global fields over // copy the global fields over

+ 2
- 2
lib/network/modules/components/Node.js View File

@ -16,8 +16,8 @@ import Star from './nodes/shapes/Star'
import Text from './nodes/shapes/Text' import Text from './nodes/shapes/Text'
import Triangle from './nodes/shapes/Triangle' import Triangle from './nodes/shapes/Triangle'
import TriangleDown from './nodes/shapes/TriangleDown' import TriangleDown from './nodes/shapes/TriangleDown'
import Validator from "../Validator";
import {printStyle} from "../Validator";
import Validator from "../../../shared/Validator";
import {printStyle} from "../../../shared/Validator";
/** /**

lib/network/modules/components/AllOptions.js → lib/network/options.js View File


lib/network/modules/ConfigurationSystem.js → lib/shared/ConfigurationSystem.js View File

@ -1,6 +1,6 @@
var util = require('../../util');
var util = require('../util');
import ColorPicker from './components/ColorPicker'
import ColorPicker from './../network/modules/components/ColorPicker'
/** /**
* The way this works is for all properties of this.possible options, you can supply the property name in any form to list the options. * The way this works is for all properties of this.possible options, you can supply the property name in any form to list the options.

lib/network/modules/Validator.js → lib/shared/Validator.js View File

@ -1,4 +1,4 @@
var util = require('../../util');
var util = require('../util');
let errorFound = false; let errorFound = false;
let allOptions; let allOptions;

+ 4
- 5
lib/timeline/Timeline.js View File

@ -10,9 +10,9 @@ var CurrentTime = require('./component/CurrentTime');
var CustomTime = require('./component/CustomTime'); var CustomTime = require('./component/CustomTime');
var ItemSet = require('./component/ItemSet'); var ItemSet = require('./component/ItemSet');
var ConfigurationSystem = require('../network/modules/ConfigurationSystem');
var Validator = require('../network/modules/Validator').default;
var printStyle = require('../network/modules/Validator').printStyle;
var ConfigurationSystem = require('../shared/ConfigurationSystem');
var Validator = require('../shared/Validator').default;
var printStyle = require('../shared/Validator').printStyle;
var allOptions = require('./options').allOptions; var allOptions = require('./options').allOptions;
var configureOptions = require('./options').configureOptions; var configureOptions = require('./options').configureOptions;
@ -156,8 +156,7 @@ Timeline.prototype.setOptions = function (options) {
// validate options // validate options
let errorFound = Validator.validate(options, allOptions); let errorFound = Validator.validate(options, allOptions);
if (errorFound === true) { if (errorFound === true) {
options = {};
console.log('%cErrors have been found in the supplied options object. None of the options will be used.', printStyle);
console.log('%cErrors have been found in the supplied options object.', printStyle);
} }
Core.prototype.setOptions.call(this, options); Core.prototype.setOptions.call(this, options);

Loading…
Cancel
Save