Skip to content

Commit

Permalink
fix: adjust styles for all modal window
Browse files Browse the repository at this point in the history
Introduce option `scroll` to `ControllerModal` to set modal window scroll or table body scroll.
Modify templates to fix the style in table headers.
Adjust layout for all modal window.

Refs: #1156
  • Loading branch information
yinanazhou committed Jun 4, 2024
1 parent 9412fe4 commit cda544f
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 9 deletions.
19 changes: 15 additions & 4 deletions rodan-client/code/src/js/Controllers/ControllerModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ export default class ControllerModal extends BaseController
$modalEl.html(this._layoutViewModal.el);
$('.modal-title').text(options.title);
$('.modal-body').append(options.content);
$('#modal-close').on('click', () => Radio.channel('rodan').request(RODAN_EVENTS.REQUEST__MODAL_HIDE));
$modalEl.show();
$('#modal-close').on('click', () => Radio.channel('rodan').request(RODAN_EVENTS.REQUEST__MODAL_HIDE));
}
else
{
Expand All @@ -85,9 +84,21 @@ export default class ControllerModal extends BaseController

$modalEl.html(this._layoutViewModal.el);
$('.modal-title').text(options.title);
$('#modal-close').on('click', () => Radio.channel('rodan').request(RODAN_EVENTS.REQUEST__MODAL_HIDE));
$modalEl.show();
$('#modal-close').on('click', () => Radio.channel('rodan').request(RODAN_EVENTS.REQUEST__MODAL_HIDE));
}

switch (options.scroll) {
case 'modal':
$('.modal-body').addClass('modal-scroll');
break;

case 'table':
$('.modal .table-responsive').css('height', '50vh');
$('.modal .table-responsive>.table>tbody').addClass('tbody-scroll');
break;
}

$modalEl.show();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ export default class ControllerWorkflowBuilder extends BaseController
var collection = new JobCollection();
collection.fetch();
var view = new ViewJobCollection({collection: collection, childViewOptions: {workflow: options.workflow}});
Radio.channel('rodan').request(RODAN_EVENTS.REQUEST__MODAL_SHOW, {content: view, title: 'Jobs'});
Radio.channel('rodan').request(RODAN_EVENTS.REQUEST__MODAL_SHOW, {content: view, title: 'Jobs', scroll: 'table'});
}

/**
Expand Down Expand Up @@ -531,7 +531,7 @@ export default class ControllerWorkflowBuilder extends BaseController
_handleRequestShowWorkflowJobPortsView(options)
{
var view = new LayoutViewControlPorts(options);
Radio.channel('rodan').request(RODAN_EVENTS.REQUEST__MODAL_SHOW, {content: view, title: 'WorkflowJob Ports'});
Radio.channel('rodan').request(RODAN_EVENTS.REQUEST__MODAL_SHOW, {content: view, title: 'WorkflowJob Ports', scroll: 'modal'});
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export default class LayoutViewNavigation extends Marionette.View
serverConfiguration: serverConfig,
date: serverDate,
client: Configuration.CLIENT});
Radio.channel('rodan').request(RODAN_EVENTS.REQUEST__MODAL_SHOW, {title: 'About', content: html});
Radio.channel('rodan').request(RODAN_EVENTS.REQUEST__MODAL_SHOW, {title: 'About', content: html, scroll: 'modal'});
}

/**
Expand All @@ -149,7 +149,7 @@ export default class LayoutViewNavigation extends Marionette.View
var view = new BaseViewCollection({collection: collection,
template: _.template($('#template-resourcetype_collection').text()),
childView: ViewResourceTypeDetailCollectionItem});
Radio.channel('rodan').request(RODAN_EVENTS.REQUEST__MODAL_SHOW, {title: 'Development', content: view});
Radio.channel('rodan').request(RODAN_EVENTS.REQUEST__MODAL_SHOW, {title: 'Development', content: view, scroll: 'table'});
}


Expand Down
8 changes: 7 additions & 1 deletion rodan-client/code/styles/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,7 @@ tbody > tr:hover {
}
.single-project-view-collection-wrapper {
gap: 10px;
overflow: hidden;
}
.resource-upload-container {
height: fit-content;
Expand Down Expand Up @@ -992,6 +993,9 @@ div#main_workflowbuilder
width: fit-content;
height: fit-content;
}
.modal-scroll {
overflow: scroll;
}
/* project-users modal styles */
#admins-and-workers-tables {
align-items: flex-start;
Expand Down Expand Up @@ -1048,7 +1052,9 @@ div#main_workflowbuilder
.table-modal>tbody>tr>td:first-child {
max-width: 180px;
}

.tbody-scroll {
overflow: scroll;
}
/* job settings modal */
#workflowjob-settings:first-child {
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ <h3>Input Ports</h3>
<thead>
<tr>
<th>Label</th>
<th></th>
</tr>
</thead>
<tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ <h3>Input Port Types</h3>
<th>Current</th>
<th>Min</th>
<th>Max</th>
<th></th>
</tr>
</thead>
<tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<th data-name="category">Category</th>
<th data-name="name">Name</th>
<th data-name="interactive">Interactive</th>
<th></th>
</tr>
</thead>
<tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ <h3>Output Ports</h3>
<thead>
<tr>
<th>Label</th>
<th></th>
</tr>
</thead>
<tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ <h3>Output Port Types</h3>
<th>Current</th>
<th>Min</th>
<th>Max</th>
<th></th>
</tr>
</thead>
<tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<th data-name="extension">Extension</th>
<th data-name="description">Description</th>
<th data-name="url">URL</th>
<th></th>
</tr>
</thead>
<tbody>
Expand Down

0 comments on commit cda544f

Please sign in to comment.