@@ -10,12 +10,10 @@ import kotlinx.html.FlowContent
10
10
import kotlinx.html.FlowOrInteractiveOrPhrasingContent
11
11
import kotlinx.html.a
12
12
import kotlinx.html.button
13
- import kotlinx.html.form
14
13
import kotlinx.html.h1
15
14
import kotlinx.html.i
16
15
import kotlinx.html.onClick
17
16
import kotlinx.html.p
18
- import kotlinx.html.postButton
19
17
import kotlinx.html.script
20
18
import kotlinx.html.span
21
19
import kotlinx.html.table
@@ -42,11 +40,18 @@ class RepositoryOverview(private val repoManager: IRepositoriesManager) {
42
40
unsafe {
43
41
+ """
44
42
function removeBranch(repository, branch) {
45
- if (confirm('Are you sure you want to delete the branch' + branch +' of repository' +repository + '?')) {
43
+ if (confirm('Are you sure you want to delete the branch ' + branch + ' of repository ' +repository + '?')) {
46
44
fetch('../v2/repositories/' + repository + '/branches/' + branch, { method: 'DELETE'})
47
45
.then( _ => location.reload())
48
46
}
49
47
}
48
+
49
+ function removeRepository(repository) {
50
+ if (confirm('Are you sure you want to delete the repository ' + repository + '?')) {
51
+ fetch('../v2/repositories/' + repository + '/delete', { method: 'POST'})
52
+ .then( _ => location.reload())
53
+ }
54
+ }
50
55
""" .trimIndent()
51
56
}
52
57
}
@@ -138,13 +143,11 @@ internal fun FlowOrInteractiveOrPhrasingContent.buildExploreLatestLink(repositor
138
143
}
139
144
140
145
internal fun FlowContent.buildDeleteRepositoryForm (repositoryId : String ) {
141
- form {
142
- postButton {
143
- name = " delete"
144
- formAction = " ../v2/repositories/${repositoryId.encodeURLPathPart()} /delete"
145
- onClick = " return confirm('Are you sure you want to delete the repository $repositoryId ?')"
146
- + " Delete Repository"
147
- }
146
+ button {
147
+ name = " delete"
148
+ formAction = " ../v2/repositories/${repositoryId.encodeURLPathPart()} /delete"
149
+ onClick = " return removeRepository('${repositoryId.encodeURLPathPart()} ')"
150
+ + " Delete Repository"
148
151
}
149
152
}
150
153
0 commit comments