From YUI to React - Heigvd/Wegas GitHub Wiki

How to import a YUI scenario to create a new React scenario

  1. Export the YUI scenario
  2. In gamemodel.json, change the uiversion 1 → 2
  3. In gamemodel.json, change the "desactivate" → "deactivate"
  4. In gamemodel.json, fix null values
  • "comments" : null → "comments" : ""

  • "addShortcut": null → "addShortcut" : ""

  • "label" : null → "label" : ""

  • "status" : null → "status" : ""

  • "sortable" : null → "sortable" : ""

  • "translation" : null → "translation" : ""

  • "ignorationImpact" : null → "ignorationImpact" : { "@class" : "Script", "content" : "", "language" : "JavaScript" }

  • "impact" : null → "impact" : { "@class" : "Script", "content" : "", "language" : "JavaScript" }

  • "preStateImpact" : null → "preStateImpact" : { "@class" : "Script", "content" : "", "language" : "JavaScript" }

  • "triggerEvent" : null → "triggerEvent" : { "@class" : "Script", "content" : "", "language" : "JavaScript" }

  • "triggerCondition" : null → "triggerCondition" : { "@class" : "Script", "content" : "", "language" : "JavaScript" }

  • "onEnterEvent" : null → "onEnterEvent" : { "@class" : "Script", "content" : "", "language" : "JavaScript" }

  • "postTriggerEvent" : null → "postTriggerEvent" : { "@class" : "Script", "content" : "", "language" : "JavaScript" }

  1. It is possible to rename the refId so that they do not overlap with the YUI ones (not strictly useful)
  2. Create a new empty React scenario
  3. Update from ZIP with the modified gamemodel.json
  4. The scripts can need some changes (typically custom forms, dashboard, impacts)
  5. The layout must be created from scratch

Note : The following null are OK.

  • version

  • GameModel basedOnId

  • GameModel comments

  • GameModel createdById

  • GameModel createdByName

  • GameModel description

  • GameModel logId

  • ChoiceDescriptor defaultInstance currentResultName

  • ChoiceDescriptor maxReplies

  • EventInboxDescriptor defaultInstance lastEventRefId

  • GradeDescriptor maxValue

  • GradeDescriptor minValue

  • NumberDescriptor maxValue

  • NumberDescriptor minValue

  • SingleResultChoiceDescriptor defaultInstance currentResultName

  • SingleResultChoiceDescriptor maxReplies

  • StringDescriptor validationPattern

  • TextDescriptor defaultInstance trValue

  • WhQuestionDescriptor defaultInstance feedback

PMG Specific

  • For step 5 you can use the following regex with a capture group to select all refId fields and append your custom values : ("refId" : "[a-z]:[a-z-A-Z0-9]) image

  • the last refId (this of the gameModel must match the model’s)

  • Update listDescriptor name values for the following :

    • listDescriptor to questionsPeriod3_7
    • listDescriptor_AzFE80 to questionsPeriod3_8
    • listDescriptor_pda00C to questionsPeriod3_9
    • listDescriptor_sjhM2X to questionsPeriod3_10
    • listDescriptor_4GZApk to questionsPeriod3_11
    • listDescriptor_R7aBxe to questionsPeriod3_12
    • listDescriptor_lce8jt to questionsPeriod3_13
    • listDescriptor_RlS7Qe to questionsPeriod3_14
    • listDescriptor_9Q7Tvh to questionsPeriod3_15
    • listDescriptor_c6PTRF to questionsPeriod3_16
  • Remove listDescriptor with editorTag "UI Texts" and all it's contents.

  • remove the YUI CSS

  • remove the YUI pages

  • update pmg.indicators.managementApproval to match managementApproval labels

  • update pmg.indicators.userApproval to match userApproval labels

  • set the homeText as model’s

  • fix P100 trigger (from question has been replied to question’s value greater than 0)

  • update VariablesTypes.d.ts (copy this in Internal Client Script in Wegas to our GitHub code)

  • add a '-R’ to the logID so that it is different

  • check that this data are ok with the scénario

    • indicators labels
    • execution periods nb
    • time unit
    • all trainer properties
    • languages
  • make end popup works

    • edit and save the text in wegas
    • remove the potential / before an file image link