Skip to content

Commit

Permalink
* Issue #127 Technos should show where they are used corrections suit…
Browse files Browse the repository at this point in the history
…e eslint no-udef error
  • Loading branch information
Bhoye05 authored Oct 15, 2019
1 parent 43fe1bb commit 8cacbb5
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/app/i18n/label_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"techno.modal.version.placeholder": "1.0.0, 1.1.2, ...",
"techno.modalFrom.title": "New techno (working copy) from a previous version",
"techno.modalFrom.origin.placeholder": "Name of the existing techno...",
"techno.modulesList": "List of modules using this techno",
"module.specificFiles": "Files attached to the module",
"module.technoList": "Technos of this module",
"module.platformList": "List of platform using this module",
Expand Down Expand Up @@ -217,6 +218,7 @@
"properties.module.history": "Display history",
"properties.module.delete": "Delete the module",
"properties.module.delete.message": "Delete the module {{name}} and all its instances ?",
"properties.module.selection.tooltip": "Display the module",
"properties.platform.globalProperties.compare.modal.title": "Choose the platform to compare global properties from",
"properties.compare.modal.title": "Choose the platform to compare with",
"properties.compare.modal.toApplicationName": "Application to compare with",
Expand Down
2 changes: 2 additions & 0 deletions src/app/i18n/label_fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"techno.modal.version.placeholder": "1.0.0, 1.1.2, ...",
"techno.modalFrom.title": "Nouvelle techno (working copy) à partir d'une précédente version",
"techno.modalFrom.origin.placeholder": "Nom de la techno existante...",
"techno.modulesList": "Liste des modules qui utilisent cette techno",
"module.specificFiles": "Les fichiers associés au module",
"module.technoList": "Les technos de ce module",
"module.platformList": "Liste des plateformes utilisant ce module",
Expand Down Expand Up @@ -217,6 +218,7 @@
"properties.module.history": "Afficher l'historique",
"properties.module.delete": "Supprimer le module",
"properties.module.delete.message": "Supprimer le module {{name}} et toutes ses instances ?",
"properties.module.selection.tooltip": "Afficher le module",
"properties.platform.globalProperties.compare.modal.title": "Choisir la plateforme à laquelle comparer les propriétés globales de",
"properties.compare.modal.title": "Choisir la plateforme à laquelle comparer",
"properties.compare.modal.toApplicationName": "Application de référence à laquelle comparer",
Expand Down
6 changes: 6 additions & 0 deletions src/app/module/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,3 +469,9 @@ angular.module('hesperides.module', [ 'hesperides.application' ])
};
},
]);

/** global method to get module or techno type : {workingcopy, release} */
/*eslint-disable no-undef*/
getVersionType = function(isWorkingCopy) {
return isWorkingCopy ? 'workingcopy' : 'release';
};
18 changes: 18 additions & 0 deletions src/app/techno/techno.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,21 @@ <h3>{{ 'techno.associateFiles.title' | translate }}</h3>
</div>
</div>
</div>
<div layout="row">
<div class="bg-light" flex>
<h4>{{ 'techno.modulesList' | translate }}</h4>
<list-of-links items="modules"
label="$item.module_name + ' [' + $item.module_version + ']'"
filter="searchInModules"
sorton="$item.module_name"
selected-item="module"
selectable="true"
editable="false"
css="md-warn"
href="getModuleUrl($item)"
new_tab="true"
tooltip="{{ 'properties.module.selection.tooltip' | translate }}"
size="small">
</list-of-links>
</div>
</div>
26 changes: 25 additions & 1 deletion src/app/techno/techno.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ angular.module('hesperides.techno', [ 'hesperides.template', 'hesperides.propert
TechnoService.get_model($scope.techno.name, $scope.techno.version, $scope.techno.is_working_copy).then(function (model) {
$scope.model = model;
});

TechnoService.get_all_modules_using_this_techno($scope.techno).then(function(modules) {
$scope.modules = modules;
});
};

$scope.refreshModel();
Expand Down Expand Up @@ -178,6 +182,16 @@ angular.module('hesperides.techno', [ 'hesperides.template', 'hesperides.propert
scope: modalScope,
});
};

$scope.getModuleUrl = function(module) {
/*eslint-disable no-undef*/
return '/module/'
+ module.module_name
+ '/' + module.module_version
+ '?type='
+ getVersionType(module.is_working_copy);;
};

},
])

Expand Down Expand Up @@ -213,7 +227,7 @@ angular.module('hesperides.techno', [ 'hesperides.template', 'hesperides.propert
})

.factory('TechnoService',
function ($hesperidesHttp, $q, Techno, Template, TemplateEntry, Properties, FileService, $translate, notify) {
function ($hesperidesHttp, $q, Techno, Module, Template, TemplateEntry, Properties, FileService, $translate, notify) {
return {
get_model(name, version, isWorkingCopy) {
return $hesperidesHttp.get(`rest/technos/${ encodeURIComponent(name) }/${ encodeURIComponent(version) }/${ isWorkingCopy ? 'workingcopy' : 'release' }/model`).then(function (response) {
Expand Down Expand Up @@ -292,6 +306,16 @@ angular.module('hesperides.techno', [ 'hesperides.template', 'hesperides.propert
});
});
},
get_all_modules_using_this_techno(techno) {
/*eslint-disable no-undef*/
return $hesperidesHttp.get(`rest/modules/using_techno/${ encodeURIComponent(techno.name) }/${ encodeURIComponent(techno.version) }/${ getVersionType(techno.is_working_copy) }`).then(function (response) {
return response.data.map(function (current) {
return new Module(current);
});
}, function () {
return new Module([]);
});
},
save_template_in_workingcopy(wc_name, wc_version, template) {
template = template.toHesperidesEntity();
if (template.version_id < 0) {
Expand Down

0 comments on commit 8cacbb5

Please sign in to comment.