Skip to content
Christian Latouche edited this page Jul 19, 2018 · 7 revisions

Guide to upgrade Author version

This is a non-exhaustive guide to help you when it's time to upgrade the Author version. It is recommanded to follow the steps in the proposed order.

1. Update constants

In /src/app/core/constant.service.js change constants value:

Set the new develop and production versions

devVersion: 2.4
prodVersion: 2.3

Back to top

2. Update version.{language}.json

You'll have to both modify the enum[] list and the default value in both version files.

In this example 2.3 becomes de production version and 2.4 the development one. The previous production version is removed (2.2).

 "version": {
  "title": "Version",
  "type": "string",
  "enum": [
   "2.3", "2.2"
   "2.4"
  ],
  "default": "2.3", "2.2"
  "description": "The viewer version used to validate the configuration file."
 }

The English file: src/schemas/schemaForm/version.en-CA.json

The French file: src/schemas/schemaForm/version.fr-CA.json

Back to top

3. Remove development version tags in schemas

Remove existing av-version-dev and av-version-dev-hide tags in forms. Those tags identified the elements that are part of the development version. By removing these tags, the element is now promote as part of the new production version.

{ 'key': 'layers[].refreshInterval', 'htmlClass': 'av-form-advance hidden av-version-dev av-version-dev-hide' },

Back to top

4. Simplify forms if needed

See example

Back to top

5. Add/remove objects in schemas depending on schema modifications

Add/remove element in the proper Author schema file. See example

If an element is required in the new development version, remove it from the required list in the Author schema and put it back when the development version becomes the production version.

IMPORTANT Removing element has not been tested yet.

Back to top

6. Update forms and add classes for added objects

Add av-version-dev and av-version-dev-hide tags to new elements in forms

{ 'key': 'layers[].refreshInterval', 'htmlClass': 'av-form-advance hidden av-version-dev av-version-dev-hide' },

Note: you may also have to add advance parameter class (av-form-advance hidden).

Back to top

7. Add wathever is needed to process new parameters

You can add an onChange function to it or add restriction to a field. There's many ways you may want to modify the behaviour of the Author regarding a new element.

Back to top

8. Update schema(s) on wiki

You can also modify/update the schema documentation here.

Back to top

9. Example

We have a new object called altText which is a new property of the logo object for the new viewer version 2.4.

In the viewer 2.4 schema

  "logo": {
  "type": "object",
  "properties": {
   "enabled": { "type": "boolean", "default": true },
   "altText": { "type": "string", "description": "Alternate text for the image." },
   "value": { "type": "string", "description": "URL for the image." },
   "link": { "type": "string", "description": "URL to go to when clicked." }
  },
  "required": [ "enabled" ],
  "additionalProperties": false
 }

In the form

The parent object logo already exists in the Angular Schema Form form.

  { 'key': 'baseMaps[].attribution.logo' }

You can see an implicit declaration of the logo since none of the logo's properties need special treatment.

9.1 Introduce the new element in the development version

In the Author schema

Add the new object in the proper Author schema and add a property named version with the version number (2.4 in the example) which introduce the new property.

 "logo": {
  "type": "object",
  "properties": {
   "enabled": {
    ...
   },
   "value": {
    ...
   },
   "altText": {
    "type": "string",
    "title": "Alternate text",
    "version": "2.4",
    "description": "Alternate text for the image."
   },
   "link": {
    ...
   }
  },
 ...
 }

In the form

Put in a comment the logo form declaration and add another explaining what you're going to do with the modification in the next version. Then declare explicitly all the properties of logo with the new property.

    // { 'key': 'baseMaps[].attribution.logo' }
    // To be brought back with version 2.5 since we want the
    // new element altext (v2.4) to be hide with prod version (2.3)
        { 'key': 'baseMaps[].attribution.logo', 'items': [
        { 'key': 'baseMaps[].attribution.logo.enabled' },
        { 'key': 'baseMaps[].attribution.logo.value' },
        { 'key': 'baseMaps[].attribution.logo.altText' },
        { 'key': 'baseMaps[].attribution.logo.link' }
        ]}

Add html class av-version-dev and av-version-dev-hide to the new peoperty.

{ 'key': 'baseMaps[].attribution.logo.altText', 'htmlClass': 'av-version-dev av-version-dev-hide' },

To finally obtain:

    // { 'key': 'baseMaps[].attribution.logo' }
    // To be brought back with version 2.5 since we want the
    // new element altext (v2.4) to be hide with prod version (2.3)
           { 'key': 'baseMaps[].attribution.logo', 'items': [
           { 'key': 'baseMaps[].attribution.logo.enabled' },
           { 'key': 'baseMaps[].attribution.logo.value' },
           {
               'key': 'baseMaps[].attribution.logo.altText',
               'htmlClass': 'av-version-dev  av-version-dev-hide'
            },
           { 'key': 'baseMaps[].attribution.logo.link' }
           ]}

9.2 Set the element has a standard element of the production version

The final process get an end with a new viewer version; in our case 2.5.

In the Author schema

Remove version attribute.

 "logo": {
  "type": "object",
  "properties": {
   "enabled": {
    ...
   },
   "value": {
    ...
   },
   "altText": {
    "type": "string",
    "title": "Alternate text",
    "version": "2.4",
    "description": "Alternate text for the image."
   },
   "link": {
    ...
   }
  },
 ...
 }

In the form

Get back to the implicit declaration of the logo object.

From

    // { 'key': 'baseMaps[].attribution.logo' }
    // To be brought back with version 2.5 since we want the
    // new element altext (v2.4) to be hide with prod version (2.3)
           { 'key': 'baseMaps[].attribution.logo', 'items': [
           { 'key': 'baseMaps[].attribution.logo.enabled' },
           { 'key': 'baseMaps[].attribution.logo.value' },
           {
                'key': 'baseMaps[].attribution.logo.altText',
                'htmlClass': 'av-version-dev  av-version-dev-hide'
            },
           { 'key': 'baseMaps[].attribution.logo.link' }
           ]}

To

  { 'key': 'baseMaps[].attribution.logo' }

Back to top