Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-64291] Fix drag & drop issues replacing the drag & drop library #5177

Merged
merged 7 commits into from
Jan 22, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions core/src/main/resources/lib/form/dragdrop/dragdrop.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/* Drag & drop implementation using the SortableJS library */
function initContainerSortable(e) {
if (!Element.hasClassName(e,"with-drag-drop")) return false;

var sortable = new Sortable(e, {
draggable: '.repeated-chunk',
handle: '.dd-handle',
});

return true;
}


/* -------- LEGACY YUI drag & drop -------- */

/*
Drag&Drop implementation for heterogeneous/repeatable lists.
*/
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/resources/lib/form/hetero-list/hetero-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Behaviour.specify("DIV.hetero-list-container", 'hetero-list', -100, function(e)
});
Element.remove(prototypes);

var withDragDrop = initContainerDD(e);
var withDragDrop = initContainerSortable(e);

var menuAlign = (btn.getAttribute("menualign")||"tl-bl");

Expand Down Expand Up @@ -101,7 +101,8 @@ Behaviour.specify("DIV.hetero-list-container", 'hetero-list', -100, function(e)
}
(e.hasClassName("honor-order") ? findInsertionPoint() : insertionPoint).insert({before:nc});

if(withDragDrop) prepareDD(nc);
// if(withDragDrop) prepareDD(nc);
if(withDragDrop) initContainerSortable(nc);

new YAHOO.util.Anim(nc, {
opacity: { to:1 }
Expand Down
6 changes: 4 additions & 2 deletions core/src/main/resources/lib/form/repeatable/repeatable.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ var repeatableSupport = {
this.enableTopButton = false;
}
this.update();
this.withDragDrop = initContainerDD(container);
// this.withDragDrop = initContainerDD(container);
this.withDragDrop = initContainerSortable(container);
},

// insert one more block at the insertion position
Expand All @@ -57,7 +58,8 @@ var repeatableSupport = {
});
this.container.insertBefore(nc, children[0]);
}
if (this.withDragDrop) prepareDD(nc);
// if (this.withDragDrop) prepareDD(nc);
if (this.withDragDrop) initContainerSortable(nc);

new YAHOO.util.Anim(nc, {
opacity: { to:1 }
Expand Down
3 changes: 3 additions & 0 deletions core/src/main/resources/lib/layout/layout.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ THE SOFTWARE.
<script src="${resURL}/jsbundles/vendors.js" type="text/javascript"/>
<script src="${resURL}/jsbundles/page-init.js" type="text/javascript"/>

<!-- Sortable library used in drag & drop -->
<script src="https://cdn.jsdelivr.net/npm/sortablejs@latest/Sortable.min.js"></script>
timja marked this conversation as resolved.
Show resolved Hide resolved

</head>
<body id="jenkins" class="yui-skin-sam ${layoutType} jenkins-${h.version}" data-version="${h.version}" data-model-type="${it.class.name}">

Expand Down
26 changes: 13 additions & 13 deletions war/src/main/js/widgets/config/tabbar.less
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
nav:before, nav:after {
display: none;
}

:hover .noTabs{
color:#bbb;
}
Expand All @@ -25,15 +25,15 @@
opacity: 0.8;
background:#bbb;
color:var(--light-bg-color);
text-shadow:none
text-shadow:none
fqueiruga marked this conversation as resolved.
Show resolved Hide resolved
}

@find-container-width: 200px;
.find-container {
margin:0;
display:none;
}

.showTabs,
.noTabs {
position: absolute;
Expand Down Expand Up @@ -172,14 +172,14 @@
}

.bottom-sticker,
#bottom-sticker{
#bottom-sticker{
width: auto;
margin-left: -10px;
overflow: hidden;
padding-bottom: 10px;
margin: 30px 30px -25px -15px;
z-index:9;

.cover{
position:absolute;
top:0;
Expand Down Expand Up @@ -224,9 +224,9 @@
z-index: 2
}

.repeated-chunk.dragging {
position: static;
}
// .repeated-chunk.dragging {
// position: static;
// }

.repeated-chunk {
border: 1px solid var(--shade);
Expand Down Expand Up @@ -297,11 +297,11 @@
}
}

#ygddfdiv {
background:var(--light-bg-color);
border:1px solid var(--line-blue) !important;
opacity:.5;
}
// #ygddfdiv {
// background:var(--light-bg-color);
// border:1px solid var(--line-blue) !important;
// opacity:.5;
// }

.yui-skin-sam .yuimenu {
z-index: 9999 !important
Expand Down
39 changes: 39 additions & 0 deletions war/src/main/less/base-styles-v2.less
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,42 @@ html {
@import './modules/panes-and-bigtable.less';
@import './modules/manage-jenkins.less';
@import './modules/content-blocks.less';


// .repeated-chunk.dragging {
// position: static;
// }

// .repeated-chunk {
// border: 1px solid var(--shade);
// margin: 2px;
// position: relative;
// }


// .sortable-drag,
.sortable-ghost {
background-color: var(blue);
height: 100px;
width: 100%;
overflow: hidden;
}

// .sortable-drag {
// background-color: red;
// }

// .sortable-chosen {
// background: lightblue;
// }

.sortable-chosen {
height: 100px;
width: 100%;
background-color: transparent;
border: 2px solid var(--medium-grey);

& > * {
display: none;
}
}