Skip to content

Commit 38c4de8

Browse files
author
dkuffner
committed
Create Version for: Save, Build, Run in Sandbox and Publish into Tournament
1 parent cbb36ed commit 38c4de8

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

Scalatron/webui/client/EditorToolbar.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
})
2121
}
2222

23-
function createPublishBuildAction(text, fn) {
23+
function createPublishBuildAction(text, label, fn) {
2424
return Ext.create('Ext.Action', {
2525
text:text,
2626
handler:function (c) {
@@ -33,7 +33,14 @@
3333
Events.fireEvent("progressUpdate", { message: "Saving sources" });
3434

3535
API.updateSourceFiles({
36-
jsonData:{ files: [ { filename: "Bot.scala", code: botCode} ] },
36+
jsonData:{
37+
versionLabel: label,
38+
versionPolicy: "ifDifferent",
39+
files: [{
40+
filename: "Bot.scala",
41+
code: botCode
42+
}]
43+
},
3744

3845
success:function () {
3946
Events.fireEvent("progressUpdate", { message: "Building sources" });
@@ -67,14 +74,14 @@
6774
});
6875
}
6976

70-
var buildAction = createPublishBuildAction("Build");
77+
var buildAction = createPublishBuildAction("Build", "before Build");
7178

72-
var buildAndPubAction = createPublishBuildAction('Publish into Tournament', function () {
79+
var buildAndPubAction = createPublishBuildAction('Publish into Tournament', "before Publish", function () {
7380
Events.fireEvent("progressUpdate", { message: "Publishing" });
7481
API.publish({});
7582
});
7683

77-
var sandbox = createPublishBuildAction('Run in Sandbox', function () {
84+
var sandbox = createPublishBuildAction('Run in Sandbox', "before Sandbox", function () {
7885
Events.fireEvent("progressUpdate", { message: "Creating new sandbox" });
7986
API.createSandbox({
8087
jsonData:{
@@ -112,6 +119,8 @@
112119
var botCode = Editor.getContent();
113120
if (botCode) {
114121
API.updateSourceFiles({
122+
versionLabel: "before Save",
123+
versionPolicy: "ifDifferent",
115124
jsonData:{ files: [ { filename: "Bot.scala", code: botCode} ] },
116125
success:function () {
117126
disableActions(false);

0 commit comments

Comments
 (0)