Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lucky-sideburn committed Aug 20, 2024
1 parent 3801a51 commit fa06ce7
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 18 deletions.
1 change: 1 addition & 0 deletions dev-tools/yamls/deploymentns1ns2.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ddd
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
14 changes: 7 additions & 7 deletions html5/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,13 @@ <h2 class="accordion-header" id="specialkeys-headingThree">
<label for="chaosProgramTextArea"></label>
<textarea class="form-control chaos-prog-area" id="chaosProgramTextArea" rows="50" style="min-width: 100%; font-family: Courier, monospace;">
chaos-codename: CODENAME_PLACEHOLDER
experiments:
- name: cpu_attack_exp
k8s_job: cpu-attack-job
loop: 5
- name: mem_attack_exp
k8s_job: mem-attack-job
loop: 5
k8s_jobs:
cpu-attack-job:
additional-labels:
Expand All @@ -489,13 +496,6 @@ <h2 class="accordion-header" id="specialkeys-headingThree">
command: "stress-ng"
args:
- --version
experiments:
- name: cpu_attack_exp
k8s_job: cpu-attack-job
loop: 5
- name: mem_attack_exp
k8s_job: mem-attack-job
loop: 5
</textarea>
</div>
</form>
Expand Down
2 changes: 2 additions & 0 deletions html5/kubeinvaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ var log_tail_screen = document.getElementById("logTailScreen");
var random_code = (Math.random() + 1).toString(36).substring(7);
var change_codename = false;
var latest_sent_chaos_program = "";
var editor = null;

// nodes list from kubernetes
var nodes = [];

Expand Down
10 changes: 5 additions & 5 deletions html5/mode_controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ function startProgrammingMode() {
game_buttons.style.display = "none";
game_screen.style.display = "none";

// var editor = CodeMirror.fromTextArea(chaosProgramTextArea, {
// lineNumbers: true,
// theme: "dracula"
// });
//editor.setSize("100%", "100%");
editor = CodeMirror.fromTextArea(chaosProgramTextArea, {
lineNumbers: true,
theme: "dracula"
});
editor.setSize("100%", "100%");

}
14 changes: 8 additions & 6 deletions html5/programming_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ function replaceDivWithContent(divId, content) {
}

function getChaosProgTextAreaValue() {
const chaosProgramTextArea = document.getElementById('chaosProgramTextArea');
const textValue = chaosProgramTextArea.value;
return textValue;
return editor.getValue();
// const chaosProgramTextArea = document.getElementById('chaosProgramTextArea');
// const textValue = chaosProgramTextArea.value;
// console.log("[GET-CHAOS-PROGRAM-TEXT-AREA-VALUE] " + textValue);
// return textValue;
}
/* Programming Mode Functions */
function IsJsonString(str) {
Expand Down Expand Up @@ -204,7 +206,7 @@ loop: 5`);

function drawChaosProgramFlow() {
//var chaosProgram = "";
chaosProgram = $('#chaosProgramTextArea').val();
chaosProgram = getChaosProgTextAreaValue();

var oReq = new XMLHttpRequest();
oReq.open("POST", k8s_url + "/chaos/programs/json-flow", true);
Expand All @@ -220,8 +222,8 @@ function drawChaosProgramFlow() {
}

var flow = JSON.parse(this.responseText);
// console.log("[DRAW-PROGRAM-FLOW] Drawing flow for " + codename);
// console.log("[DRAW-PROGRAM-FLOW] Drawing: " + JSON.stringify(flow));
console.log("[DRAW-PROGRAM-FLOW] Drawing flow for " + codename);
console.log("[DRAW-PROGRAM-FLOW] Drawing: " + JSON.stringify(flow));
var flow_html = "";
let i = 0;
var times = "";
Expand Down

0 comments on commit fa06ce7

Please sign in to comment.