-
-
Save punmechanic/a452fa4ad1151dc40e4f51abae4993a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="col-lg-2 text-center" style="margin-top: 57px;"> | |
@if (Model.ShowPushOptions) | |
{ | |
<div style="display: inline; margin-left: 10px;"> | |
@if (needsAction && !string.IsNullOrWhiteSpace(Model.LeftEntity)) | |
{ | |
<button id="pushToRight" class="btn btn-danger">Push <i class="glyphicon glyphicon-arrow-right"></i></button> | |
<br/> | |
} | |
@if (needsAction && !string.IsNullOrWhiteSpace(Model.RightEntity)) | |
{ | |
<button id="pushToLeft" class="btn btn-danger" style="margin: 5px 0 0 6px"><i class="glyphicon glyphicon-arrow-left"></i> Push</button> | |
} | |
<input asp-for="TargetDatabase" type="hidden" /> | |
<input asp-for="LeftAlias" type="hidden" /> | |
<input asp-for="RightAlias" type="hidden" /> | |
<input asp-for="LeftEntity" type="hidden" /> | |
<input asp-for="RightEntity" type="hidden" /> | |
</div> | |
} | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery('#pushToLeft').click(function () { | |
handlePush(this.parent(), 'left') | |
}) | |
jQuery('#pushToRight').click(function () { | |
handlePush(this.parent(), 'right') | |
}) | |
function handlePush(el, direction) { | |
const targetDb = el.find("[name='TargetDatabase']").eq(0); | |
const leftAlias = el.find("[name='LeftAlias']").eq(0); | |
const rightAlias = el.find("[name='RightAlias']").eq(0); | |
const leftEntity = el.find("[name='LeftEntity']").eq(0); | |
const rightEntity = el.find("[name='RightEntity']").eq(0); | |
console.log(targetDb); | |
console.log(leftAlias); | |
console.log(rightAlias); | |
console.log(leftEntity); | |
console.log(rightEntity); | |
const options = { | |
url: '/Comparison/Push', | |
type: 'post', | |
data: { | |
'PushFromLeftToRight': direction === 'right', | |
'PushFromRightToLeft': direction === 'left', | |
'TargetDatabase': targetDb.val(), | |
'LeftAlias': leftAlias.val(), | |
'RightAlias': rightAlias.val(), | |
'LeftEntity': leftEntity.val(), | |
'RightEntity': rightEntity.val() | |
} | |
}; | |
console.log(options); | |
$.ajax(options) | |
.done(function(data) { | |
console.log('received response!'); | |
console.log(data); | |
}); | |
return false; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment