Skip to content

Commit

Permalink
Copy paste data Paste data in incoming libraries and samples (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
hash-bash authored Oct 4, 2024
1 parent 04a5717 commit e9aff23
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
14 changes: 14 additions & 0 deletions backend/static/main-hub/app/overrides/grid/plugin/Clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,20 @@ Ext.define("MainHub.overrides.grid.plugin.Clipboard", {
destination.setPosition(destination.rowIdx + 1, destinationStartColumn);
}

// Sync the store after all records have been updated
var store = view.getStore();
store.sync({
success: function () {
new Noty({
text: "Data has been pasted and saved successfully.",
type: "success"
}).show();
},
failure: function () {
new Noty({ text: "Failed to paste the data.", type: "error" }).show();
}
});

// BatchAdd: Trigger grid validation after pasting
if (this.cmp.id === "batchAddGrid") {
this.cmp.fireEvent("validate");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ Ext.define("MainHub.view.incominglibraries.IncomingLibraries", {
anchor: "100% -1",
layout: "fit",

initComponent: function () {
this.callParent(arguments);
var style = document.createElement("style");
style.type = "text/css";
style.innerHTML =
".x-grid-cell-selected { color: #404040 !important; background-color: #ffefbb !important; }";
document.getElementsByTagName("head")[0].appendChild(style);
},

items: [
{
xtype: "basegrid",
Expand Down Expand Up @@ -68,15 +77,13 @@ Ext.define("MainHub.view.incominglibraries.IncomingLibraries", {
menuDisabled: true,
hideable: false,
tdCls: "no-dirty userEntry",
// locked: true,
width: 35
},
{
text: "Name",
dataIndex: "name",
minWidth: 250,
hideable: false,
// locked: true,
flex: 1,
tdCls: "userEntry",
renderer: function (value, meta) {
Expand Down Expand Up @@ -292,7 +299,6 @@ Ext.define("MainHub.view.incominglibraries.IncomingLibraries", {
store: "rnaQualityStore",
regex: new RegExp("^(11|10|[1-9]?(.[0-9]+)?|.[0-9]+)$"),
regexText: "Only values between 1 and 10 are allowed."
// matchFieldWidth: false,
},
renderer: function (value) {
return value === 11 ? "Determined by Facility" : value;
Expand Down Expand Up @@ -325,10 +331,8 @@ Ext.define("MainHub.view.incominglibraries.IncomingLibraries", {
'<span data-qtip="Samples submitted" style="margin-right:5px">',
'<input type="checkbox" class="group-checkbox" {children:this.getChecked}>',
"</span>",
// '<div data-qtip="{children:this.getTooltip}" class="incoming-libraries-group-header">',
"<strong>Request: {children:this.getName}</strong> ",
"(#: {rows.length}, Total Depth: {children:this.getTotalDepth} M)",
// '</div>',
{
getName: function (children) {
return children[0].get("request_name");
Expand All @@ -346,15 +350,6 @@ Ext.define("MainHub.view.incominglibraries.IncomingLibraries", {
? "checked"
: "";
}
// getTooltip: function (children) {
// var totalDepth = Ext.Array.sum(Ext.Array.pluck(Ext.Array.pluck(
// children, 'data'), 'sequencing_depth'));

// return Ext.String.format(
// '<strong># of Libraries/Samples:</strong> {0}<br/>' +
// '<strong>Total Sequencing Depth:</strong> {1}',
// children.length, totalDepth);
// }
}
]
}
Expand Down

0 comments on commit e9aff23

Please sign in to comment.