Skip to content

Commit

Permalink
Merge branch 'feature/#127' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrien Auffredou authored and Adrien Auffredou committed Sep 29, 2017
2 parents 205f934 + c230045 commit 6d31c0c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 8 deletions.
31 changes: 28 additions & 3 deletions src/app/techno/techno.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@
<div layout="row">
<div flex>
<div class="bg-light">
<h3><span> Techno <strong><u>{{techno.name}}</u></strong>, Version <strong><u>{{techno.version}}</u></strong></span>
<h3>
<span> Techno <strong><u>{{techno.name}}</u></strong>, Version <strong><u>{{techno.version}}</u></strong></span>
<span ng-show="isWorkingCopy"> (Working Copy)</span></span>
<md-button id="techno_create-release-button" class="md-raised md-primary"
ng-really-message="{{ 'button.release.create.message' | translate : {version:techno.version} }}"
ng-really-click="create_release(techno.name, techno.version)">
<i class="fa fa-code-fork"> {{ 'button.release.create' | translate }}</i></md-button>
<md-button id="techno_create-associated-properties-button" class="md-raised md-warn"
ng-click="open_associated_properties_dialog(techno)">
<i class="fa fa-list"></i> {{ 'button.associateProperties' | translate }}</md-button>
<i class="fa fa-list"></i> {{ 'button.associateProperties' | translate }}
</md-button>
</h3>
</div>
</div>
Expand All @@ -46,13 +48,36 @@ <h3>{{ 'techno.associateFiles.title' | translate }}</h3>
download="download_template"
edit="edit_template"
delete="delete_template"
is-read-only="isRelease"></hesperides-template-list>
is-read-only="isRelease">
</hesperides-template-list>
</div>
</div>


<!-- fonctionnalité gérée dans techno-modal.html
<div flex class="bg-light">
<h3>Les propriétés associées à la techno</h3>
<hesperides-model model="model"></hesperides-model>
</div>-->
</div>
<div layout="row">
<div flex>
<div class="bg-light" flex>
<h4>{{ 'module.platformList' | translate }}</h4>

<list-of-links items="modules"
label="$item.name + ' [' + $item.version + ']'"
filter="searchInPlatforms"
sorton="$item.name"
selected-item="module"
selectable="true"
editable="false"
css="md-warn"
href="'/module/' + $item.name + '/' + $item.version + '?type=' + ($item.working_copy ? 'workingcopy' : 'release')"
new_tab="true"
tooltip="{{ 'properties.platform.selection.tooltip' | translate }}"
size="small">
</list-of-links>
</div>
</div>
</div>
25 changes: 20 additions & 5 deletions src/app/techno/techno.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
var technoModule = angular.module('hesperides.techno', ['hesperides.template', 'hesperides.properties', 'hesperides.model']);
var technoModule = angular.module('hesperides.techno', ['hesperides.template', 'hesperides.properties', 'hesperides.model','hesperides.module']);

technoModule.controller('TechnoCtrl',
['$scope', '$location', '$mdDialog', '$routeParams', 'Techno', 'Page', 'TechnoService', 'HesperidesTemplateModal', 'Template', 'TemplateEntry', 'FileService', '$translate',
Expand Down Expand Up @@ -48,6 +48,9 @@ technoModule.controller('TechnoCtrl',
TechnoService.get_model($scope.techno.name, $scope.techno.version, $scope.techno.is_working_copy).then(function(model){
$scope.model = model;
});
TechnoService.get_modules($scope.techno).then(function (modules) {
$scope.modules = modules;
})
};

$scope.refreshModel();
Expand Down Expand Up @@ -209,8 +212,8 @@ technoModule.factory('Techno', function () {
});

technoModule.factory('TechnoService',
['$hesperidesHttp', '$q', 'Techno', 'Template', 'TemplateEntry', 'Properties', 'FileService','$translate',
function ($http, $q, Techno, Template, TemplateEntry, Properties, FileService, $translate) {
['$hesperidesHttp', '$q', 'Techno', 'Template', 'TemplateEntry', 'Properties', 'FileService', '$translate', 'Module',
function ($http, $q, Techno, Template, TemplateEntry, Properties, FileService, $translate, Module) {

return {
get_model: function (name, version, isWorkingCopy){
Expand Down Expand Up @@ -297,7 +300,7 @@ technoModule.factory('TechnoService',
}, function (error) {
if (error.status === 409) {
$translate('template.event.error').then(function(label) {
$.notify(label, "error");
$.notify(label, "error");
})
} else {
$.notify(error.data.message, "error");
Expand Down Expand Up @@ -345,7 +348,7 @@ technoModule.factory('TechnoService',
return $http.post('rest/templates/packages?from_package_name=' + encodeURIComponent(from_name) + '&from_package_version=' + encodeURIComponent(from_version) + '&from_is_working_copy=' + is_from_workingcopy, {name:encodeURIComponent(wc_name), version: encodeURIComponent(wc_version), working_copy:true}).then(function (response) {
if (response.status === 201) {
$translate('workingCopy.event.created').then(function(label) {
$.notify(label, "success");
$.notify(label, "success");
})
} else {
$.notify(response.data, "warning");
Expand All @@ -369,6 +372,18 @@ technoModule.factory('TechnoService',
return deferred.promise;
}
}
},
get_modules: function(techno){
console.log('fire in the hole',techno);
return $http.get('rest/modules/using_techno/' + encodeURIComponent(techno.name) + '/' + encodeURIComponent(techno.version) + '/' + (techno.is_working_copy ? "workingcopy" : "release")).then(function(response){
console.log('response',response)
return response.data.map(function(current){
console.log('there too',current);
return new Module(current);
}, function(){
return new Module([]);
});
});
}
}

Expand Down

0 comments on commit 6d31c0c

Please sign in to comment.