mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 17:37:37 -02:30
Merge pull request #5306 from mabashian/4796-workflow-resize
Workflow editor/details graph responsiveness
This commit is contained in:
@@ -46,7 +46,7 @@ angular.module('ModalDialog', ['Utilities', 'ParseHelper'])
|
|||||||
|
|
||||||
return function(params) {
|
return function(params) {
|
||||||
|
|
||||||
var scope = params.scope,
|
let scope = params.scope,
|
||||||
buttonSet = params.buttons,
|
buttonSet = params.buttons,
|
||||||
width = params.width || 500,
|
width = params.width || 500,
|
||||||
height = params.height || 600,
|
height = params.height || 600,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -888,6 +888,10 @@ export default ['$scope', 'WorkflowService', 'generateList', 'TemplateList', 'Pr
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.$on('WorkflowDialogReady', function(){
|
||||||
|
$scope.modalOpen = true;
|
||||||
|
});
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
import workflowMakerController from './workflow-maker.controller';
|
import workflowMakerController from './workflow-maker.controller';
|
||||||
|
|
||||||
export default ['templateUrl', 'CreateDialog', 'Wait', '$state',
|
export default ['templateUrl', 'CreateDialog', 'Wait', '$state', '$window',
|
||||||
function(templateUrl, CreateDialog, Wait, $state) {
|
function(templateUrl, CreateDialog, Wait, $state, $window) {
|
||||||
return {
|
return {
|
||||||
scope: {
|
scope: {
|
||||||
workflowJobTemplateObj: '=',
|
workflowJobTemplateObj: '=',
|
||||||
@@ -17,11 +17,17 @@ export default ['templateUrl', 'CreateDialog', 'Wait', '$state',
|
|||||||
templateUrl: templateUrl('templates/workflows/workflow-maker/workflow-maker'),
|
templateUrl: templateUrl('templates/workflows/workflow-maker/workflow-maker'),
|
||||||
controller: workflowMakerController,
|
controller: workflowMakerController,
|
||||||
link: function(scope) {
|
link: function(scope) {
|
||||||
|
|
||||||
|
let availableHeight = $(window).height(),
|
||||||
|
availableWidth = $(window).width(),
|
||||||
|
minimumWidth = 1300,
|
||||||
|
minimumHeight = 550;
|
||||||
|
|
||||||
CreateDialog({
|
CreateDialog({
|
||||||
id: 'workflow-modal-dialog',
|
id: 'workflow-modal-dialog',
|
||||||
scope: scope,
|
scope: scope,
|
||||||
width: 1400,
|
width: availableWidth > minimumWidth ? availableWidth : minimumWidth,
|
||||||
height: 720,
|
height: availableHeight > minimumHeight ? availableHeight : minimumHeight,
|
||||||
draggable: false,
|
draggable: false,
|
||||||
dialogClass: 'SurveyMaker-dialog',
|
dialogClass: 'SurveyMaker-dialog',
|
||||||
position: ['center', 20],
|
position: ['center', 20],
|
||||||
@@ -34,6 +40,10 @@ export default ['templateUrl', 'CreateDialog', 'Wait', '$state',
|
|||||||
// Let the modal height be variable based on the content
|
// Let the modal height be variable based on the content
|
||||||
// and set a uniform padding
|
// and set a uniform padding
|
||||||
$('#workflow-modal-dialog').css({ 'padding': '20px' });
|
$('#workflow-modal-dialog').css({ 'padding': '20px' });
|
||||||
|
$('#workflow-modal-dialog').parent('.ui-dialog').height(availableHeight > minimumHeight ? availableHeight : minimumHeight);
|
||||||
|
$('#workflow-modal-dialog').parent('.ui-dialog').width(availableWidth > minimumWidth ? availableWidth : minimumWidth);
|
||||||
|
$('#workflow-modal-dialog').outerHeight(availableHeight > minimumHeight ? availableHeight : minimumHeight);
|
||||||
|
$('#workflow-modal-dialog').outerWidth(availableWidth > minimumWidth ? availableWidth : minimumWidth);
|
||||||
|
|
||||||
},
|
},
|
||||||
_allowInteraction: function(e) {
|
_allowInteraction: function(e) {
|
||||||
@@ -55,6 +65,24 @@ export default ['templateUrl', 'CreateDialog', 'Wait', '$state',
|
|||||||
|
|
||||||
$state.go('^');
|
$state.go('^');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function onResize(){
|
||||||
|
availableHeight = $(window).height();
|
||||||
|
availableWidth = $(window).width();
|
||||||
|
$('#workflow-modal-dialog').parent('.ui-dialog').height(availableHeight > minimumHeight ? availableHeight : minimumHeight);
|
||||||
|
$('#workflow-modal-dialog').parent('.ui-dialog').width(availableWidth > minimumWidth ? availableWidth : minimumWidth);
|
||||||
|
$('#workflow-modal-dialog').outerHeight(availableHeight > minimumHeight ? availableHeight : minimumHeight);
|
||||||
|
$('#workflow-modal-dialog').outerWidth(availableWidth > minimumWidth ? availableWidth : minimumWidth);
|
||||||
|
|
||||||
|
scope.$broadcast('workflowMakerModalResized');
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleanUpResize() {
|
||||||
|
angular.element($window).off('resize', onResize);
|
||||||
|
}
|
||||||
|
|
||||||
|
angular.element($window).on('resize', onResize);
|
||||||
|
scope.$on('$destroy', cleanUpResize);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<workflow-chart tree-data="treeData.data" add-node="startAddNode(parent, betweenTwoNodes)" edit-node="startEditNode(nodeToEdit)" delete-node="startDeleteNode(nodeToDelete)" workflow-zoomed="workflowZoomed(zoom)" can-add-workflow-job-template="canAddWorkflowJobTemplate" mode="edit" class="WorkflowMaker-chart"></workflow-chart>
|
<workflow-chart ng-if="modalOpen" tree-data="treeData.data" add-node="startAddNode(parent, betweenTwoNodes)" edit-node="startEditNode(nodeToEdit)" delete-node="startDeleteNode(nodeToDelete)" workflow-zoomed="workflowZoomed(zoom)" can-add-workflow-job-template="canAddWorkflowJobTemplate" mode="edit" class="WorkflowMaker-chart"></workflow-chart>
|
||||||
</div>
|
</div>
|
||||||
<div class="WorkflowMaker-contentRight">
|
<div class="WorkflowMaker-contentRight">
|
||||||
<div class="WorkflowMaker-formTitle">{{(workflowMakerFormConfig.nodeMode === 'edit' && nodeBeingEdited) ? ((nodeBeingEdited.unifiedJobTemplate && nodeBeingEdited.unifiedJobTemplate.name) ? nodeBeingEdited.unifiedJobTemplate.name : "EDIT TEMPLATE") : "ADD A TEMPLATE"}}</div>
|
<div class="WorkflowMaker-formTitle">{{(workflowMakerFormConfig.nodeMode === 'edit' && nodeBeingEdited) ? ((nodeBeingEdited.unifiedJobTemplate && nodeBeingEdited.unifiedJobTemplate.name) ? nodeBeingEdited.unifiedJobTemplate.name : "EDIT TEMPLATE") : "ADD A TEMPLATE"}}</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user