Skip to content

Commit

Permalink
Merge pull request fgpv-vpgf#629 from jolevesq/627-version-335
Browse files Browse the repository at this point in the history
fix(many): Bump version to 3.3.5, add param for chart precision, repai…
  • Loading branch information
jolevesq authored and Pewillia committed Jan 21, 2022
2 parents 6b87e98 + f50d77a commit 39707c3
Show file tree
Hide file tree
Showing 14 changed files with 25,564 additions and 577 deletions.
23,674 changes: 23,134 additions & 540 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"mini-css-extract-plugin": "1.6.0",
"net": "1.0.2",
"ngtemplate-loader": "2.0.1",
"node-sass": "^4.14.1",
"node-sass": "^6.0.1",
"protractor": "5.4.2",
"raw-loader": "4.0.2",
"resolve-url-loader": "3.1.2",
Expand Down
4 changes: 2 additions & 2 deletions src/app/core/constant.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ angular
keys: ['coordInfo', 'areasOfInterest', 'rangeSlider', 'chart', 'swiper', 'draw', 'thematicSlider']
}
},
devVersion: '3.3.4',
prodVersion: '3.3.3'
devVersion: '3.3.5',
prodVersion: '3.3.4'
}); // TODO: add new tabs and subtabs as they come, tabs and subtabs listed as they should appear in the interface

function events($rootScope) {
Expand Down
155 changes: 137 additions & 18 deletions src/app/core/stateManager.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,18 @@ function stateManager($translate, events, constants, commonService) {
// Generate state records for area of interest
setAreaOfInterestItemsState(_state[modelName], model, arrKeys);


// Generate state records for charts
if (model.rangeSlider.enable) {console.log('going range slider'); setRangeItemsState(_state[modelName], model, arrKeys); }

// Generate state records for charts
if (model.chart.enable) { setChartItemsState(_state[modelName], model, arrKeys); }
// if (model.chart.enable) { setChartItemsState(_state[modelName], model, arrKeys); }

// Generate state record for thematic slider
if (model.thematicSlider.enable) { setThematicItemsState(_state[modelName], model, arrKeys); }

// Generate state record for swiper
if (model.swiper.enable) { setSwiperItemsState(_state[modelName], model, arrKeys); }
} else if (modelName === 'services') {
setGeoSearchItemState(_state[modelName], model);
}
Expand Down Expand Up @@ -562,6 +569,124 @@ function stateManager($translate, events, constants, commonService) {
}
}

/**
* Set new record for chart items in state model
* @function setRangeItemsState
* @private
* @param {Object} stateModel the stateModel
* @param {Object} model the model
* @param {Array} arrKeys array of object {key: [], valid: true | false}
*/
function setRangeItemsState(stateModel, model, arrKeys) {

const masterLink = constants.schemas
.indexOf(`plugins.[lang].json`) + 1;

const setID = [[0, 'rangeSlider', 'layers']];

const hlink = constants.subTabs.plugins.keys[2].replace(/\./g, '-');

// is there a defined chart layer
if (typeof stateModel.items[2].items !== 'undefined') {
const layers = model[setID[0][1]][setID[0][2]];

let isValid = typeof layers[0].id === 'undefined' ? false : true;

for (let [j, item] of layers.entries()) {
if (typeof stateModel.items[2].items[9] !== 'undefined') {
// the link will not work because layers is present inside map tab. To make this work, we should add tab to the id so there is no
// duplicate. This would involve a major refactor and we are not sure it is worth it so we let it like this for now
// TODO: investigate...

const shlink = 'layers';

if (typeof item.id === 'undefined') { isValid = false; }

const obj = {
'title': item.id,
'stype': 'element',
'items': [],
'hlink': hlink,
'shlink': shlink,
'masterlink': masterLink
}
stateModel.items[2].items[9].items[0].items.push(obj);

}
}
}
}

/**
* Set new record for swiper items in state model
* @function setSwiperItemsState
* @private
* @param {Object} stateModel the stateModel
* @param {Object} model the model
* @param {Array} arrKeys array of object {key: [], valid: true | false}
*/
function setSwiperItemsState(stateModel, model, arrKeys) {

const masterLink = constants.schemas
.indexOf(`plugins.[lang].json`) + 1;

const setID = [[4, 'swiper', 'layers']];

const hlink = constants.subTabs.plugins.keys[4].replace(/\./g, '-');

// is there a defined swiper layer
if (typeof stateModel.items[4].items !== 'undefined') {
const layers = model[setID[0][1]][setID[0][2]];
console.log('--before2undefined err or in swiper?',typeof layers[0].id);

console.log('--before3undefined err or in swiper?',typeof layers[0].id);

let isValid = typeof layers[0].id === 'undefined' ? false : true;
console.log('--after undefined err or in swiper?');
// add layers item as it is not populate by default
stateModel.items[4].items
.push({ 'key': 'layers',
'title': 'layers',
items: [],
'valid': isValid,
'expand': false,
'masterlink': masterLink,
'hlink': hlink,
'advance': 'falseHide',
'stype': isValid === false ? 'bad-element' : '',
'shlink': '',
'type': 'object' });

// set layers validity from number of layers specified then add layer items
for (let [j, item] of layers.entries()) {
if (typeof stateModel.items[4].items[3] !== 'undefined') {
// the link will not work because layers is present inside map tab. To make this work, we should add tab to the id so there is no
// duplicate. This would involve a major refactor and we are not sure it is worth it so we let it like this for now
// TODO: investigate...
const shlink = 'layers';

if (typeof item.id === 'undefined') { isValid = false; }

const obj = {
'title': item.id,
'stype': 'element',
'items': [],
'hlink': hlink,
'shlink': shlink,
'masterlink': masterLink
}
stateModel.items[4].items[3].items.push(obj);
}
}

stateModel.items[4].valid = isValid;
stateModel.items[4].items.valid = isValid;
stateModel.items[4].items.stype = isValid === false ? 'bad-element' : '';
stateModel.items[4].items[3].stype = isValid === false ? 'bad-element' : '';
stateModel.items[4].items[3].valid = isValid;
}
}

/**
* Set new record for chart items in state model
* @function setChartItemsState
Expand All @@ -581,14 +706,18 @@ function stateManager($translate, events, constants, commonService) {
// is there a defined thematic layer
if (typeof stateModel.items[6].items !== 'undefined') {
const layers = model[setID[0][1]][setID[0][2]];
let isValid = typeof layers[0].id === 'undefined' ? false : true;

let pluginVal = true;
// set layers validity from number of layers specified then add layer items
for (let [j, item] of layers.entries()) {
if (typeof stateModel.items[6].items[7] !== 'undefined') {
// the link will not work because layers is present inside map tab. To make this work, we should add tab to the id so there is no
// duplicate. This would involve a major refactor and we are not sure it is worth it so we let it like this for now
// TODO: investigate...
const shlink = setItemId(hlink, j, 'thematicSlider', 'layers');
const shlink = 'layers';

if (typeof item.id === 'undefined') { isValid = false; }
if (item.legend.length > 0 && typeof item.legend[0].url === 'undefined') { isValid = false; }

stateModel.items[6].items[7].items[j].title = item.id;
stateModel.items[6].items[7].items[j].stype = 'element';
Expand All @@ -597,24 +726,14 @@ function stateManager($translate, events, constants, commonService) {
stateModel.items[6].items[7].items[j].shlink = shlink;
stateModel.items[6].items[7].items[j].masterlink = masterLink;

// Because the url required is not trap by the validation, check it here
let valid = true;
if (typeof item.legend !== 'undefined') {
for (let k = 0; k < item.legend.length; k++) {
if (item.legend[k].image.url === '') {
valid = false;
pluginVal = false;
}
}
}

stateModel.items[6].items[7].items[j].valid = valid;
}
}

// Propagate the value to parent if there is an error inside the legend element
stateModel.items[6].items[7].valid = pluginVal;
stateModel.items[6].valid = pluginVal;
stateModel.items[6].valid = isValid;
stateModel.items[6].items.valid = isValid;
stateModel.items[6].items.stype = isValid === false ? 'bad-element' : '';
stateModel.items[6].items[7].stype = isValid === false ? 'bad-element' : '';
stateModel.items[6].items[7].valid = isValid;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/ui/forms/plugins/plugins.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,8 @@ function Controller($scope, $translate, events, modelManager, stateManager, form
{ 'key': 'rangeSlider.params.rangeInterval' },
{ 'key': 'rangeSlider.params.startRangeEnd' }
] },
{ 'type': 'template', 'template': getTimepicker() },
{ 'type': 'fieldset', 'htmlClass': 'av-range-values-section av-none', 'title': $translate.instant('form.plugins.rangesliderrangevalues'), 'items': [
{ 'type': 'template', 'template': getTimepicker() },
{ 'key': 'rangeSlider.params.range', 'notitle': true, 'items': [
{ 'key': 'rangeSlider.params.range.min', 'validationMessage': { 'wrongValues': $translate.instant('form.validation.rangesliderlimit') },
'$validators': { wrongValues: value => (value !== null && value >= $scope.model.rangeSlider.params.range.max) ? false : true } },
Expand All @@ -377,7 +377,6 @@ function Controller($scope, $translate, events, modelManager, stateManager, form
] }
] },
{ 'key': 'rangeSlider.params.limit', 'items': [
{ 'type': 'template', 'template': getTimepicker() },
{ 'key': 'rangeSlider.params.limit.min', 'validationMessage': { 'wrongValues': $translate.instant('form.validation.rangesliderlimit') },
'$validators': { wrongValues: value => (value !== null && value >= $scope.model.rangeSlider.params.limit.max) ? false : true } },
{ 'key': 'rangeSlider.params.limit.max', 'validationMessage': { 'wrongValues': $translate.instant('form.validation.rangesliderlimit') },
Expand Down Expand Up @@ -450,6 +449,7 @@ function Controller($scope, $translate, events, modelManager, stateManager, form
{ value: 'linear', name: $translate.instant('form.plugins.chartlinear') }
] },
{ 'key': 'chart.axis.yAxis.title' },
{ 'key': 'chart.axis.yAxis.precision' },
{ 'key': 'chart.axis.yAxis.values', 'condition': 'model.chart.type !== "line"' },
{ 'key': 'chart.axis.yAxis.split', 'condition': 'model.chart.type !== "line" && model.chart.axis.yAxis.type === "config"' }
] }
Expand Down
2 changes: 1 addition & 1 deletion src/content/samples/config/all-plugins-samplesv01.json
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@
"googleAPIKey": "",
"esriLibUrl": ""
},
"version": "3.3.3",
"version": "3.3.4",
"language": "en-CA",
"plugins": {
"rangeSlider": {
Expand Down
2 changes: 1 addition & 1 deletion src/content/samples/config/canada-world-en.json
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@
"googleAPIKey": "",
"esriLibUrl": ""
},
"version": "3.3.3",
"version": "3.3.4",
"language": "en-CA",
"plugins": {
"rangeSlider": {
Expand Down
2 changes: 1 addition & 1 deletion src/content/samples/config/canada-world-fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@
"googleAPIKey": "",
"esriLibUrl": ""
},
"version": "3.3.3",
"version": "3.3.4",
"language": "fr-CA",
"plugins": {
"rangeSlider": {
Expand Down
4 changes: 2 additions & 2 deletions src/content/samples/frame-preview.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
styles.type = 'text/css';
// TODO remove and keep only the cloud when installed
if (version === '3.3.3') {
if (version === '3.3.4') {
styles.href = 'https://viewer-visualiseur.services.geo.ca/apps/RAMP/fgpv/fgpv-x.x.x/rv-styles.css'.replace('x.x.x', version);
} else {
styles.href = 'https://jolevesq.github.io/contributed-plugins/fgpv/rv-styles.css';
Expand Down Expand Up @@ -49,7 +49,7 @@
addScriptTag('https://viewer-visualiseur.services.geo.ca/apps/RAMP/fgpv/fgpv-x.x.x/core-plugins/ramp-plugin-areas-of-interest.js'.replace('x.x.x', version));
} else {
// TODO: remove and keep only the cloud when installed
if (version === '3.3.3') {
if (version === '3.3.4') {
path = 'https://viewer-visualiseur.services.geo.ca/apps/RAMP/contributed-plugins/' + pluginDash + '/' + pluginDash;
addScriptTag(path + '.js');
addStyleTag(path + '.css');
Expand Down
Loading

0 comments on commit 39707c3

Please sign in to comment.