Fix template generated by Template Generator

do not stringify get_resource and get_attr, these must continue
to be objects so that they are correctly rendered to YAML.

As a result, `get_resource_string` was removed as no longer used.

Change-Id: I621c55dd9a0c59f7eb8a87ef1f85557bd38b05d1
Story: 2005120
Task: 29769
This commit is contained in:
Pavlo Shchelokovskyy 2024-02-14 15:29:46 +02:00
parent 9d4aa416df
commit d3f61d5618
4 changed files with 4 additions and 13 deletions

View File

@ -128,7 +128,7 @@
connected_options[property] = []; connected_options[property] = [];
} }
connected_options[property].push({ connected_options[property].push({
value: hotgenUtils.get_resource_string(hotgenStates.get_label_by_uuid(node.id)), value: { 'get_resource': hotgenStates.get_label_by_uuid(node.id) },
id: node.id, id: node.id,
resource_type: node.title, resource_type: node.title,
edge: edge edge: edge

View File

@ -131,7 +131,7 @@
var output_key = resource_name + '_' + output_detail[idx].property; var output_key = resource_name + '_' + output_detail[idx].property;
outputs_root[output_key] = { outputs_root[output_key] = {
description: 'The ' + output_detail[idx].property + ' of ' + resource_name +'.', description: 'The ' + output_detail[idx].property + ' of ' + resource_name +'.',
value: '{ get_attr: ['+resource_name+', '+output_detail[idx].property+'] }', value: { 'get_attr': [resource_name, output_detail[idx].property] },
}; };
} }

View File

@ -94,9 +94,6 @@
} }
}]) }])
.factory('hotgenUtils', function(){ .factory('hotgenUtils', function(){
var get_resource_string = function(identity){
return '{ get_resource: '+identity+' }';
}
var filter_and_return_get_resource_element = function(array, property){ var filter_and_return_get_resource_element = function(array, property){
var return_val = []; var return_val = [];
var idx = array.length-1; var idx = array.length-1;
@ -201,7 +198,8 @@
} }
var strip_property = function check_property(resource_data, property){ var strip_property = function check_property(resource_data, property){
if (resource_data[property] == null || resource_data[property] == ''){ // remove empty properties or private Angular properties (start with $$)
if (resource_data[property] == null || resource_data[property] == '' || property.lastIndexOf("$$",0) === 0){
delete resource_data[property]; delete resource_data[property];
} else if (resource_data[property].constructor && resource_data[property].constructor == Object){ } else if (resource_data[property].constructor && resource_data[property].constructor == Object){
extract_dict(resource_data[property]); extract_dict(resource_data[property]);
@ -217,7 +215,6 @@
} }
return { return {
get_resource_string: get_resource_string,
escape_characters: escape_characters, escape_characters: escape_characters,
extract_keyvalue: extract_keyvalue, extract_keyvalue: extract_keyvalue,
extract_list_of_keyvalue: extract_list_of_keyvalue, extract_list_of_keyvalue: extract_list_of_keyvalue,

View File

@ -169,12 +169,6 @@
expect(hotgenUtils).toBeDefined(); expect(hotgenUtils).toBeDefined();
}); });
it('should return string contains get_resource', function(){
var returnValue = hotgenUtils.get_resource_string('identity');
expect(returnValue).toEqual('{ get_resource: identity }');
});
it('should filter elements', function(){ it('should filter elements', function(){
var property = 'name'; var property = 'name';
var array = ['ignore me', 1, '{ get_resource: find me }', var array = ['ignore me', 1, '{ get_resource: find me }',