Spaces:
Running
Running
Update static/js/project.js
Browse files- static/js/project.js +31 -8
static/js/project.js
CHANGED
@@ -41,18 +41,41 @@ function loadProjectDetails() {
|
|
41 |
.catch(err => console.error(err));
|
42 |
}
|
43 |
|
44 |
-
function
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
}
|
47 |
|
48 |
-
function
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
}
|
51 |
|
52 |
-
function
|
53 |
-
alert('
|
54 |
}
|
55 |
|
56 |
-
function
|
57 |
-
alert(
|
58 |
}
|
|
|
41 |
.catch(err => console.error(err));
|
42 |
}
|
43 |
|
44 |
+
function addIntent() {
|
45 |
+
const project = document.getElementById('project-select').value;
|
46 |
+
const intentName = prompt('Enter new intent name:');
|
47 |
+
if (!intentName) return;
|
48 |
+
|
49 |
+
apiPost('/project/add_intent', { project_name: project, intent_name: intentName })
|
50 |
+
.then(data => {
|
51 |
+
showResult('project-result', data);
|
52 |
+
loadProjectDetails();
|
53 |
+
})
|
54 |
+
.catch(err => {
|
55 |
+
console.error(err);
|
56 |
+
alert('Failed to add intent.');
|
57 |
+
});
|
58 |
}
|
59 |
|
60 |
+
function removeIntent(name) {
|
61 |
+
const project = document.getElementById('project-select').value;
|
62 |
+
if (!confirm(`Are you sure you want to delete intent '${name}'?`)) return;
|
63 |
+
|
64 |
+
apiPost('/project/delete_intent', { project_name: project, intent_name: name })
|
65 |
+
.then(data => {
|
66 |
+
showResult('project-result', data);
|
67 |
+
loadProjectDetails();
|
68 |
+
})
|
69 |
+
.catch(err => {
|
70 |
+
console.error(err);
|
71 |
+
alert('Failed to delete intent.');
|
72 |
+
});
|
73 |
}
|
74 |
|
75 |
+
function saveProject() {
|
76 |
+
alert('Save logic will be implemented here.');
|
77 |
}
|
78 |
|
79 |
+
function publishProject() {
|
80 |
+
alert('Publish logic will be implemented here.');
|
81 |
}
|