1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-20 14:54:15 +01:00

Fix a bug: when machines module disabled, Associated machines is still shown in trainings list

This commit is contained in:
Du Peng 2022-05-13 12:24:52 +02:00
parent 2c80ed25ff
commit e3d2b53767
4 changed files with 7 additions and 3 deletions

View File

@ -2,6 +2,8 @@
## next deploy
- Fix a bug: when machines module disabled, Associated machines is still shown in trainings list
## v5.4.0 2022 May 12
- Option to disable the 'machines' module

View File

@ -187,6 +187,8 @@ Application.Controllers.controller('TrainingsAdminController', ['$scope', '$stat
// default tab: trainings list
$scope.tabs = { active: 0 };
$scope.enableMachinesModule = settingsPromise.machines_module === 'true';
/**
* In the trainings listing tab, return the stringified list of machines associated with the provided training
* @param training {Object} Training object, inherited from $resource

View File

@ -670,7 +670,7 @@ angular.module('application.router', ['ui.router'])
resolve: {
trainingsPromise: ['Training', function (Training) { return Training.query().$promise; }],
machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }],
settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['feature_tour_display']" }).$promise; }]
settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['feature_tour_display', 'machines_module']" }).$promise; }]
}
})
.state('app.admin.trainings_new', {

View File

@ -53,7 +53,7 @@
<thead>
<tr>
<th style="width:20%" translate>{{ 'app.admin.trainings.name' }}</th>
<th style="width:40%" translate>{{ 'app.admin.trainings.associated_machines' }}</th>
<th ng-if="enableMachinesModule" style="width:40%" translate>{{ 'app.admin.trainings.associated_machines' }}</th>
<th style="width:20%" translate>{{ 'app.admin.trainings.number_of_tickets' }}</th>
<th style="width:20%"></th>
</tr>
@ -61,7 +61,7 @@
<tbody>
<tr ng-repeat="training in trainings | filterDisabled:trainingFiltering" ng-class="{'disabled-line' : training.disabled && trainingFiltering === 'all'}">
<td>{{ training.name }}</td>
<td>{{ showMachines(training) }}</td>
<td ng-if="enableMachinesModule">{{ showMachines(training) }}</td>
<td>{{ training.nb_total_places }}</td>
<td>
<div class="buttons" ng-show="isAuthorized('admin')">