Skip to content

Commit

Permalink
WIP promote on drop
Browse files Browse the repository at this point in the history
  • Loading branch information
bartaz committed Jun 19, 2019
1 parent 275c5dc commit e4f80b2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
12 changes: 7 additions & 5 deletions static/js/publisher/release/components/releasesTableRow.js
Expand Up @@ -27,11 +27,8 @@ export const ItemTypes = {

const cellSource = {
beginDrag(props) {
console.log("beginDrop", props);
return {
risk: props.risk,
revisions:
props.pendingChannelMap[getChannelName(props.currentTrack, props.risk)]
risk: props.risk
};
}
};
Expand Down Expand Up @@ -346,7 +343,12 @@ const DraggableReleasesTableRow = DragSource(
const DroppableReleasesTableRow = DropTarget(
ItemTypes.RELEASE,
{
drop: () => ({ name: "Dustbin" }),
drop: (props, monitor) => {
props.promoteChannel(
getChannelName(props.currentTrack, monitor.getItem().risk),
getChannelName(props.currentTrack, props.risk)
);
},
canDrop: (props, monitor) => {
//console.log("canDrop", props, monitor.getItem());
// only allow drop on other rows
Expand Down
6 changes: 3 additions & 3 deletions static/js/publisher/release/releasesController.js
@@ -1,9 +1,9 @@
import React, { Component, Fragment } from "react";
import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "react-redux";
import "whatwg-fetch";
import { DndProvider } from 'react-dnd'
import HTML5Backend from 'react-dnd-html5-backend'
import { DndProvider } from "react-dnd";
import HTML5Backend from "react-dnd-html5-backend";

import ReleasesTable from "./components/releasesTable";
import Notification from "./components/notification";
Expand Down

0 comments on commit e4f80b2

Please sign in to comment.