Skip to content
This repository was archived by the owner on Jul 26, 2022. It is now read-only.

Commit 5064af3

Browse files
author
Moritz Walter
committed
add create service
1 parent ed78b25 commit 5064af3

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

pages/webinterface/task/task.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ class="h-10 bg-blue-500 text-white rounded-md px-4 py-2 m-2 hover:bg-blue-600 fo
129129
<input placeholder="Count" type="number" name="count"
130130
id="Count-input"
131131
class="my-2 p-2 dark:bg-gray-900 bg-gray-100 flex border dark:border-gray-900 border-gray-100 rounded px-2 appearance-none outline-none w-full dark:text-white text-gray-900 focus:ring-2 focus:ring-blue-600">
132+
133+
<label class="inline-flex items-center mt-3">
134+
<input type="checkbox" name="start" class="form-checkbox h-5 w-5"
135+
checked><span
136+
class="ml-2 dark:text-white text-gray-900">Start on create</span>
137+
</label>
138+
132139
</div>
133140
</div>
134141
<button type="submit"

public/index.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,22 @@
104104

105105
if (isset($_POST['action'])) {
106106
if (!main::validCSRF()) {
107-
header('Location: ' . main::getUrl() . "/tasks?action&success=false&message=csrfFailed");
107+
header('Location: ' . main::getUrl() . "/tasks/".$task_name."?action&success=false&message=csrfFailed");
108108
die();
109109
}
110110
// FUNCTIONS
111111

112112
if($_POST['action'] == "stopService" AND isset($_POST['service_id'])){
113113
$response = $main::buildDefaultRequest("service/".$_POST['service_id'], "DELETE");
114-
header('Location: ' . main::getUrl() . "/tasks?action&success=true&message=stopService");
114+
header('Location: ' . main::getUrl() . "/tasks/".$task_name."?action&success=true&message=stopService");
115115
}
116116
if($_POST['action'] == "startService" AND isset($_POST['count'])){
117117
$i = $_POST['count'];
118118
while ($i != 0) {
119119
$i -= 1;
120-
$response = $main::buildDefaultRequest("service/create", params: $task_name);
121-
print_r($response);
120+
$response = $main::buildDefaultRequest("service/create", params: json_encode(array("start" => isset($_POST['start']), "serviceTaskName" => $task_name)));
122121
}
122+
header('Location: ' . main::getUrl() . "/tasks/".$task_name."?action&success=true&message=startService");
123123
}
124124
}
125125

@@ -137,7 +137,7 @@
137137

138138
$ticket = main::buildDefaultRequest("wsTicket");
139139
if (!$ticket['success']) {
140-
header('Location: ' . main::getUrl() . "/tasks?action&success=false&message=notFound");
140+
header('Location: ' . main::getUrl() . "/tasks/".$task_name."?action&success=false&message=notFound");
141141
die();
142142
}
143143

0 commit comments

Comments
 (0)