up
This commit is contained in:
parent
bcb7070067
commit
1a9e755b11
@ -209,7 +209,7 @@ func PathValidationHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var requestBody struct {
|
var requestBody struct {
|
||||||
Path string `json:"path"`
|
PathName string `json:"pathName"`
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := json.NewDecoder(r.Body).Decode(&requestBody); err != nil {
|
if err := json.NewDecoder(r.Body).Decode(&requestBody); err != nil {
|
||||||
@ -217,9 +217,10 @@ func PathValidationHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err := IsPathValid(requestBody.Path)
|
err := IsPathValid(requestBody.PathName)
|
||||||
|
|
||||||
response := map[string]string{
|
response := map[string]string{
|
||||||
"path": requestBody.Path,
|
"pathName": requestBody.PathName,
|
||||||
"status": "valid",
|
"status": "valid",
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,6 +236,7 @@ func PathValidationHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type StreamPageData struct {
|
type StreamPageData struct {
|
||||||
StreamURL string
|
StreamURL string
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,12 +4,12 @@ async function validatePath() {
|
|||||||
const pathInput = document.getElementById('path-input');
|
const pathInput = document.getElementById('path-input');
|
||||||
const statusIcon = document.getElementById('path-status-icon');
|
const statusIcon = document.getElementById('path-status-icon');
|
||||||
const validateBtn = document.getElementById('validate-btn');
|
const validateBtn = document.getElementById('validate-btn');
|
||||||
|
const inputPathNameHidden = document.getElementById('pathName');
|
||||||
|
const inputNamePathSection = document.getElementById('namePath');
|
||||||
|
|
||||||
|
const pathName = pathInput.value.trim();
|
||||||
|
|
||||||
const inputPath=document.getElementById('path');
|
if (!pathName) {
|
||||||
const inputPathV=document.getElementById('namePath');
|
|
||||||
const path = pathInput.value;
|
|
||||||
|
|
||||||
if (!path) {
|
|
||||||
statusIcon.innerHTML = '<i class="fas fa-times has-text-danger"></i>';
|
statusIcon.innerHTML = '<i class="fas fa-times has-text-danger"></i>';
|
||||||
validateBtn.disabled = true;
|
validateBtn.disabled = true;
|
||||||
return;
|
return;
|
||||||
@ -21,14 +21,14 @@ async function validatePath() {
|
|||||||
const response = await fetch('/validate-path', {
|
const response = await fetch('/validate-path', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ path }),
|
body: JSON.stringify({ pathName: pathName }), // ⚠️ on envoie pathName !
|
||||||
});
|
});
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
statusIcon.innerHTML = '<i class="fas fa-check-square"></i>';
|
statusIcon.innerHTML = '<i class="fas fa-check-square"></i>';
|
||||||
validateBtn.disabled = false;
|
validateBtn.disabled = false;
|
||||||
inputPath.value=path;
|
inputPathNameHidden.value = pathName; // on stocke le PathName dans le hidden pour le form
|
||||||
inputPathV.style.display="block";
|
inputNamePathSection.style.display = "block";
|
||||||
} else {
|
} else {
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
statusIcon.innerHTML = '<i class="fas fa-exclamation-triangle"></i>';
|
statusIcon.innerHTML = '<i class="fas fa-exclamation-triangle"></i>';
|
||||||
@ -41,6 +41,7 @@ async function validatePath() {
|
|||||||
console.error('Request failed:', error);
|
console.error('Request failed:', error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function disableAllInputPath(id){
|
function disableAllInputPath(id){
|
||||||
console.log(this)
|
console.log(this)
|
||||||
var inputs = document.querySelectorAll('#path-'+id+' .fff');
|
var inputs = document.querySelectorAll('#path-'+id+' .fff');
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
<div class="field has-addons">
|
<div class="field has-addons">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label">Enter Path:</label>
|
<label class="label">Nom du dossier :</label>
|
||||||
<div class="control has-icons-right">
|
<div class="control has-icons-right">
|
||||||
<input type="text" id="path-input" class="input" placeholder="Enter path..." oninput="validatePath()" />
|
<input type="text" id="path-input" class="input" placeholder="Enter path..." oninput="validatePath()" />
|
||||||
<span class="icon is-small is-right has-text-success">
|
<span class="icon is-small is-right has-text-success">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user