Skip to content

Commit

Permalink
fix:review changes [CS-16657]
Browse files Browse the repository at this point in the history
  • Loading branch information
Amitkanswal committed Sep 3, 2021
1 parent 58da291 commit 2788d2b
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 90 deletions.
2 changes: 1 addition & 1 deletion optimizely-experiments/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
</tr>`):$(".experiment-list").append(`<tr><td data-toggle="tooltip" title="Type : ${t.type} \n Description : ${t.description}" class="details" id="${t.id}">${t.key}</td>
<td class="edit"><p data-placement="top" data-toggle="tooltip" title="Pause"><button id="pause" class="action" data-title="Pause"><span><i class="fa fa-pause"></i></span></button></p></td>
<td class="result"><p data-placement="top" data-toggle="tooltip" title="Result"><a target="_blank" href="" id="${t.campaign_id}"><button class="result-icon"><span><i class="fa fa-bar-chart"></i></span></button></a></p></td>
</tr>`))}),$("#loader").hide(),$(".container").show(),domChangeListnerOfExperimentsListPage()}function domChangeListnerOfExperimentDetailPage(){$(".goBack").click(()=>{$(".experiment-data, .experiment-key, .audiences").empty(),$(".labell").css({display:"block"}),$(".new-experiment").css({display:"block"}),$(".table-responsive, .refresh-btn").show(),$(".experiment-container").hide(),$(".new-experiment-container").hide()}),$(".audienceLink").click(t=>{var e=`https://app.optimizely.com/v2/projects/${extensionField.config.project_id}/audiences`;$(t.currentTarget).attr("href",e)})}function domChangeListnerOfExperimentsListPage(){$(".details").click(t=>{t=t.currentTarget.id;optimizely.getExperimentDetail(t).then(t=>{renderToShowExperimentDetails(t)}),$(".delete-container, .list, .edit-container, .new-experiment-container, .refresh-btn").hide(),$(".labell").css({display:"none"}),$(".new-experiment").css({display:"none"}),$("#loader").show()}),$(".result-icon").click(t=>{console.log(t.currentTarget,t.current);var e=$(t.currentTarget).parent("a").attr("id"),a=$(t.currentTarget).parent().parent().parent().siblings(".details").attr("id"),a=`https://app.optimizely.com/v2/projects/${extensionField.config.project_id}/results/${e}/experiments/${a}?previousView=EXPERIMENTS`;$(t.currentTarget).parent("a").attr("href",a)}),$(".add").click(t=>{var e=`https://app.optimizely.com/v2/projects/${extensionField.config.project_id}/experiments`;$(t.currentTarget).parent("a").attr("href",e)}),$(".action").click(t=>{let e=t.currentTarget.id;$(t.currentTarget).find("span").html('<i class="fa fa-spinner fa-spin"></i>'),$(t.currentTarget).attr("disabled","disabled");var a=$(t.currentTarget).parent().parent().siblings(".details").attr("id");optimizely.experimentStartOrStop(a,e).then(()=>{$(t.currentTarget).parent().parent().parent().find(".result").find(".result-icon").removeClass("disabled"),"start"===e?($(t.currentTarget).attr("id","pause").attr("data-title","Pause"),$(t.currentTarget).parent().attr("title","Pause"),$(t.currentTarget).find("span").html('<i class="fa fa-pause"></i>')):($(t.currentTarget).attr("id","start").attr("data-title","Run"),$(t.currentTarget).parent().attr("title","Run"),$(t.currentTarget).find("span").html('<i class="fa fa-play">')),$(t.currentTarget).removeAttr("disabled")})}),$(".refresh-btn").click(()=>{$(".container").hide(),$("#loader").show(),optimizely.getAllExperiments().then(t=>{renderToListExperiments(t)})})}$(document).ready(()=>{ContentstackUIExtension.init().then(t=>{extensionField=t,$("#loader").show(),optimizely=new Optimizely(t.config),optimizely.getAllExperiments().then(t=>{renderToListExperiments(t)}),optimizely.getAudiences().then(t=>{audiences=t}),extensionField.window.enableAutoResizing()})});
</tr>`))}),$("#loader").hide(),$(".container").show(),domChangeListnerOfExperimentsListPage()}function domChangeListnerOfExperimentDetailPage(){$(".goBack").click(()=>{$(".experiment-data, .experiment-key, .audiences").empty(),$(".labell").css({display:"block"}),$(".new-experiment").css({display:"block"}),$(".table-responsive, .refresh-btn").show(),$(".experiment-container").hide(),$(".new-experiment-container").hide()}),$(".audienceLink").click(t=>{var e=`https://app.optimizely.com/v2/projects/${extensionField.config.project_id}/audiences`;$(t.currentTarget).attr("href",e)})}function domChangeListnerOfExperimentsListPage(){$(".details").click(t=>{t=t.currentTarget.id;optimizely.getExperimentDetail(t).then(t=>{renderToShowExperimentDetails(t)}),$(".delete-container, .list, .edit-container, .new-experiment-container, .refresh-btn").hide(),$(".labell").css({display:"none"}),$(".new-experiment").css({display:"none"}),$("#loader").show()}),$(".result-icon").click(t=>{var e=$(t.currentTarget).parent("a").attr("id"),a=$(t.currentTarget).parent().parent().parent().siblings(".details").attr("id"),a=`https://app.optimizely.com/v2/projects/${extensionField.config.project_id}/results/${e}/experiments/${a}?previousView=EXPERIMENTS`;$(t.currentTarget).parent("a").attr("href",a)}),$(".add").click(t=>{var e=`https://app.optimizely.com/v2/projects/${extensionField.config.project_id}/experiments`;$(t.currentTarget).parent("a").attr("href",e)}),$(".action").click(t=>{let e=t.currentTarget.id;$(t.currentTarget).find("span").html('<i class="fa fa-spinner fa-spin"></i>'),$(t.currentTarget).attr("disabled","disabled");var a=$(t.currentTarget).parent().parent().siblings(".details").attr("id");optimizely.experimentStartOrStop(a,e).then(()=>{$(t.currentTarget).parent().parent().parent().find(".result").find(".result-icon").removeClass("disabled"),"start"===e?($(t.currentTarget).attr("id","pause").attr("data-title","Pause"),$(t.currentTarget).parent().attr("title","Pause"),$(t.currentTarget).find("span").html('<i class="fa fa-pause"></i>')):($(t.currentTarget).attr("id","start").attr("data-title","Run"),$(t.currentTarget).parent().attr("title","Run"),$(t.currentTarget).find("span").html('<i class="fa fa-play">')),$(t.currentTarget).removeAttr("disabled")})}),$(".refresh-btn").click(()=>{$(".container").hide(),$("#loader").show(),optimizely.getAllExperiments().then(t=>{renderToListExperiments(t)})})}$(document).ready(()=>{ContentstackUIExtension.init().then(t=>{extensionField=t,$("#loader").show(),optimizely=new Optimizely(t.config),optimizely.getAllExperiments().then(t=>{renderToListExperiments(t)}),optimizely.getAudiences().then(t=>{audiences=t}),extensionField.window.enableAutoResizing()})});
</script>
</body>

Expand Down
4 changes: 2 additions & 2 deletions optimizely-experiments/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion optimizely-experiments/src/dist/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ function domChangeListnerOfExperimentsListPage() {
$('#loader').show();
});
$('.result-icon').click(function (e) {
console.log(e.currentTarget, e.current);
var CampaignId = $(e.currentTarget).parent('a').attr('id');
var ExperimentId = $(e.currentTarget).parent().parent().parent().siblings('.details').attr('id');
var url = "https://app.optimizely.com/v2/projects/".concat(extensionField.config.project_id, "/results/").concat(CampaignId, "/experiments/").concat(ExperimentId, "?previousView=EXPERIMENTS");
Expand Down
Loading

0 comments on commit 2788d2b

Please sign in to comment.