started work on file deletion functionality
This commit is contained in:
		
							parent
							
								
									9ce18c0ae4
								
							
						
					
					
						commit
						5813061a04
					
				
					 3 changed files with 327 additions and 10 deletions
				
			
		| 
						 | 
					@ -5,6 +5,7 @@ import (
 | 
				
			||||||
	"net/http"
 | 
						"net/http"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"git.jmbit.de/jmb/scanfile/server/internal/database"
 | 
						"git.jmbit.de/jmb/scanfile/server/internal/database"
 | 
				
			||||||
 | 
						"git.jmbit.de/jmb/scanfile/server/internal/store"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func FileViewWebHandler(w http.ResponseWriter, r *http.Request) {
 | 
					func FileViewWebHandler(w http.ResponseWriter, r *http.Request) {
 | 
				
			||||||
| 
						 | 
					@ -39,3 +40,12 @@ func FileViewMSOWebHandler(w http.ResponseWriter, r *http.Request) {
 | 
				
			||||||
		http.Error(w, err.Error(), http.StatusBadRequest)
 | 
							http.Error(w, err.Error(), http.StatusBadRequest)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func FileViewDeleteHandler(w http.ResponseWriter, r *http.Request) {
 | 
				
			||||||
 | 
					  fileID := r.PathValue("uuid")
 | 
				
			||||||
 | 
					  err := store.DeleteFile(fileID)
 | 
				
			||||||
 | 
					  if err != nil {
 | 
				
			||||||
 | 
					    slog.Error("Error deleting File in FileViewDeleteHandler", "error", err, "file-uuid", fileID)
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,11 +3,14 @@ package web
 | 
				
			||||||
import "git.jmbit.de/jmb/scanfile/server/internal/sqlc"
 | 
					import "git.jmbit.de/jmb/scanfile/server/internal/sqlc"
 | 
				
			||||||
import "git.jmbit.de/jmb/scanfile/server/web/templui/components/table"
 | 
					import "git.jmbit.de/jmb/scanfile/server/web/templui/components/table"
 | 
				
			||||||
import "encoding/hex"
 | 
					import "encoding/hex"
 | 
				
			||||||
 | 
					import "git.jmbit.de/jmb/scanfile/server/web/templui/components/button"
 | 
				
			||||||
 | 
					import "git.jmbit.de/jmb/scanfile/server/web/templui/components/modal"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
templ FileView(file sqlc.File, fileProperties sqlc.FileProperty) {
 | 
					templ FileView(file sqlc.File, fileProperties sqlc.FileProperty) {
 | 
				
			||||||
  @Base(file.Name) {
 | 
					  @Base(file.Name) {
 | 
				
			||||||
    <div class="w-full">
 | 
					    <div class="w-full">
 | 
				
			||||||
      <h1 class="text-4xl">File Name: {file.Name}</h1>
 | 
					      <h1 class="text-4xl">File Name: {file.Name}</h1>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      <br/>
 | 
					      <br/>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    @FileViewGenericTable(file, fileProperties)
 | 
					    @FileViewGenericTable(file, fileProperties)
 | 
				
			||||||
| 
						 | 
					@ -101,3 +104,47 @@ templ FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) {
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					templ FileViewDeleteModal() {
 | 
				
			||||||
 | 
					@modal.Trigger(modal.TriggerProps{
 | 
				
			||||||
 | 
						  ModalID: "default-modal",
 | 
				
			||||||
 | 
						}) {
 | 
				
			||||||
 | 
					    @button.Button(button.Props{
 | 
				
			||||||
 | 
						  	Variant: button.VariantDestructive,
 | 
				
			||||||
 | 
						  }) {
 | 
				
			||||||
 | 
						  	Delete
 | 
				
			||||||
 | 
						  }
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						@modal.Modal(modal.Props{
 | 
				
			||||||
 | 
							ID:    "delete-modal",
 | 
				
			||||||
 | 
							Class: "max-w-md",
 | 
				
			||||||
 | 
						}) {
 | 
				
			||||||
 | 
							@modal.Header() {
 | 
				
			||||||
 | 
								Are you sure you want to delete this file?
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							@modal.Body() {
 | 
				
			||||||
 | 
								This action cannot be undone. This will permanently delete the file from the server.				
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							@modal.Footer() {
 | 
				
			||||||
 | 
								<div class="flex gap-2">
 | 
				
			||||||
 | 
									@modal.Close(modal.CloseProps{
 | 
				
			||||||
 | 
										ModalID: "delete-modal",
 | 
				
			||||||
 | 
									}) {
 | 
				
			||||||
 | 
										@button.Button() {
 | 
				
			||||||
 | 
											Cancel
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									@modal.Close(modal.CloseProps{
 | 
				
			||||||
 | 
										ModalID: "delete-modal",
 | 
				
			||||||
 | 
									}) {
 | 
				
			||||||
 | 
										@button.Button(button.Props{
 | 
				
			||||||
 | 
											Variant: button.VariantDestructive,
 | 
				
			||||||
 | 
										}) {
 | 
				
			||||||
 | 
											Delete
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								</div>
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					    @modal.Script()
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,6 +11,8 @@ import templruntime "github.com/a-h/templ/runtime"
 | 
				
			||||||
import "git.jmbit.de/jmb/scanfile/server/internal/sqlc"
 | 
					import "git.jmbit.de/jmb/scanfile/server/internal/sqlc"
 | 
				
			||||||
import "git.jmbit.de/jmb/scanfile/server/web/templui/components/table"
 | 
					import "git.jmbit.de/jmb/scanfile/server/web/templui/components/table"
 | 
				
			||||||
import "encoding/hex"
 | 
					import "encoding/hex"
 | 
				
			||||||
 | 
					import "git.jmbit.de/jmb/scanfile/server/web/templui/components/button"
 | 
				
			||||||
 | 
					import "git.jmbit.de/jmb/scanfile/server/web/templui/components/modal"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func FileView(file sqlc.File, fileProperties sqlc.FileProperty) templ.Component {
 | 
					func FileView(file sqlc.File, fileProperties sqlc.FileProperty) templ.Component {
 | 
				
			||||||
	return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
 | 
						return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
 | 
				
			||||||
| 
						 | 
					@ -52,7 +54,7 @@ func FileView(file sqlc.File, fileProperties sqlc.FileProperty) templ.Component
 | 
				
			||||||
			var templ_7745c5c3_Var3 string
 | 
								var templ_7745c5c3_Var3 string
 | 
				
			||||||
			templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name)
 | 
								templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name)
 | 
				
			||||||
			if templ_7745c5c3_Err != nil {
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
				return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 10, Col: 48}
 | 
									return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 12, Col: 48}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
 | 
								_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
 | 
				
			||||||
			if templ_7745c5c3_Err != nil {
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
| 
						 | 
					@ -166,7 +168,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
 | 
				
			||||||
					var templ_7745c5c3_Var9 string
 | 
										var templ_7745c5c3_Var9 string
 | 
				
			||||||
					templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(file.Size)
 | 
										templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(file.Size)
 | 
				
			||||||
					if templ_7745c5c3_Err != nil {
 | 
										if templ_7745c5c3_Err != nil {
 | 
				
			||||||
						return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 26, Col: 22}
 | 
											return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 29, Col: 22}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
 | 
										_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
 | 
				
			||||||
					if templ_7745c5c3_Err != nil {
 | 
										if templ_7745c5c3_Err != nil {
 | 
				
			||||||
| 
						 | 
					@ -245,7 +247,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
 | 
				
			||||||
					var templ_7745c5c3_Var13 string
 | 
										var templ_7745c5c3_Var13 string
 | 
				
			||||||
					templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(file.Mimetype)
 | 
										templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(file.Mimetype)
 | 
				
			||||||
					if templ_7745c5c3_Err != nil {
 | 
										if templ_7745c5c3_Err != nil {
 | 
				
			||||||
						return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 34, Col: 26}
 | 
											return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 37, Col: 26}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
 | 
										_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
 | 
				
			||||||
					if templ_7745c5c3_Err != nil {
 | 
										if templ_7745c5c3_Err != nil {
 | 
				
			||||||
| 
						 | 
					@ -320,7 +322,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
 | 
				
			||||||
					var templ_7745c5c3_Var17 string
 | 
										var templ_7745c5c3_Var17 string
 | 
				
			||||||
					templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(hex.EncodeToString(file.Blake2))
 | 
										templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(hex.EncodeToString(file.Blake2))
 | 
				
			||||||
					if templ_7745c5c3_Err != nil {
 | 
										if templ_7745c5c3_Err != nil {
 | 
				
			||||||
						return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 43, Col: 44}
 | 
											return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 46, Col: 44}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
 | 
										_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
 | 
				
			||||||
					if templ_7745c5c3_Err != nil {
 | 
										if templ_7745c5c3_Err != nil {
 | 
				
			||||||
| 
						 | 
					@ -395,7 +397,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
 | 
				
			||||||
					var templ_7745c5c3_Var21 string
 | 
										var templ_7745c5c3_Var21 string
 | 
				
			||||||
					templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(hex.EncodeToString(fileProperties.Sha256))
 | 
										templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(hex.EncodeToString(fileProperties.Sha256))
 | 
				
			||||||
					if templ_7745c5c3_Err != nil {
 | 
										if templ_7745c5c3_Err != nil {
 | 
				
			||||||
						return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 51, Col: 54}
 | 
											return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 54, Col: 54}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
 | 
										_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
 | 
				
			||||||
					if templ_7745c5c3_Err != nil {
 | 
										if templ_7745c5c3_Err != nil {
 | 
				
			||||||
| 
						 | 
					@ -470,7 +472,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
 | 
				
			||||||
					var templ_7745c5c3_Var25 string
 | 
										var templ_7745c5c3_Var25 string
 | 
				
			||||||
					templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(hex.EncodeToString(fileProperties.Md5))
 | 
										templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(hex.EncodeToString(fileProperties.Md5))
 | 
				
			||||||
					if templ_7745c5c3_Err != nil {
 | 
										if templ_7745c5c3_Err != nil {
 | 
				
			||||||
						return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 59, Col: 51}
 | 
											return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 62, Col: 51}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
 | 
										_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
 | 
				
			||||||
					if templ_7745c5c3_Err != nil {
 | 
										if templ_7745c5c3_Err != nil {
 | 
				
			||||||
| 
						 | 
					@ -546,7 +548,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
 | 
				
			||||||
						var templ_7745c5c3_Var29 string
 | 
											var templ_7745c5c3_Var29 string
 | 
				
			||||||
						templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(fileProperties.LibmagicMime.String)
 | 
											templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(fileProperties.LibmagicMime.String)
 | 
				
			||||||
						if templ_7745c5c3_Err != nil {
 | 
											if templ_7745c5c3_Err != nil {
 | 
				
			||||||
							return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 68, Col: 49}
 | 
												return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 71, Col: 49}
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
						_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29))
 | 
											_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29))
 | 
				
			||||||
						if templ_7745c5c3_Err != nil {
 | 
											if templ_7745c5c3_Err != nil {
 | 
				
			||||||
| 
						 | 
					@ -623,7 +625,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
 | 
				
			||||||
						var templ_7745c5c3_Var33 string
 | 
											var templ_7745c5c3_Var33 string
 | 
				
			||||||
						templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(fileProperties.LibmagicExtension.String)
 | 
											templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(fileProperties.LibmagicExtension.String)
 | 
				
			||||||
						if templ_7745c5c3_Err != nil {
 | 
											if templ_7745c5c3_Err != nil {
 | 
				
			||||||
							return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 78, Col: 54}
 | 
												return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 81, Col: 54}
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
						_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33))
 | 
											_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33))
 | 
				
			||||||
						if templ_7745c5c3_Err != nil {
 | 
											if templ_7745c5c3_Err != nil {
 | 
				
			||||||
| 
						 | 
					@ -700,7 +702,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
 | 
				
			||||||
						var templ_7745c5c3_Var37 string
 | 
											var templ_7745c5c3_Var37 string
 | 
				
			||||||
						templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(fileProperties.LibmagicApple.String)
 | 
											templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(fileProperties.LibmagicApple.String)
 | 
				
			||||||
						if templ_7745c5c3_Err != nil {
 | 
											if templ_7745c5c3_Err != nil {
 | 
				
			||||||
							return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 88, Col: 50}
 | 
												return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 91, Col: 50}
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
						_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37))
 | 
											_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37))
 | 
				
			||||||
						if templ_7745c5c3_Err != nil {
 | 
											if templ_7745c5c3_Err != nil {
 | 
				
			||||||
| 
						 | 
					@ -776,7 +778,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
 | 
				
			||||||
					var templ_7745c5c3_Var41 string
 | 
										var templ_7745c5c3_Var41 string
 | 
				
			||||||
					templ_7745c5c3_Var41, templ_7745c5c3_Err = templ.JoinStringErrs(file.Created.Time.String())
 | 
										templ_7745c5c3_Var41, templ_7745c5c3_Err = templ.JoinStringErrs(file.Created.Time.String())
 | 
				
			||||||
					if templ_7745c5c3_Err != nil {
 | 
										if templ_7745c5c3_Err != nil {
 | 
				
			||||||
						return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 97, Col: 39}
 | 
											return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 100, Col: 39}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var41))
 | 
										_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var41))
 | 
				
			||||||
					if templ_7745c5c3_Err != nil {
 | 
										if templ_7745c5c3_Err != nil {
 | 
				
			||||||
| 
						 | 
					@ -808,4 +810,262 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func FileViewDeleteModal() templ.Component {
 | 
				
			||||||
 | 
						return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
 | 
				
			||||||
 | 
							templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
 | 
				
			||||||
 | 
							if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
 | 
				
			||||||
 | 
								return templ_7745c5c3_CtxErr
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
 | 
				
			||||||
 | 
							if !templ_7745c5c3_IsBuffer {
 | 
				
			||||||
 | 
								defer func() {
 | 
				
			||||||
 | 
									templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
									if templ_7745c5c3_Err == nil {
 | 
				
			||||||
 | 
										templ_7745c5c3_Err = templ_7745c5c3_BufErr
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}()
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							ctx = templ.InitializeContext(ctx)
 | 
				
			||||||
 | 
							templ_7745c5c3_Var42 := templ.GetChildren(ctx)
 | 
				
			||||||
 | 
							if templ_7745c5c3_Var42 == nil {
 | 
				
			||||||
 | 
								templ_7745c5c3_Var42 = templ.NopComponent
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							ctx = templ.ClearChildren(ctx)
 | 
				
			||||||
 | 
							templ_7745c5c3_Var43 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
 | 
				
			||||||
 | 
								templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
 | 
				
			||||||
 | 
								templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
 | 
				
			||||||
 | 
								if !templ_7745c5c3_IsBuffer {
 | 
				
			||||||
 | 
									defer func() {
 | 
				
			||||||
 | 
										templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
										if templ_7745c5c3_Err == nil {
 | 
				
			||||||
 | 
											templ_7745c5c3_Err = templ_7745c5c3_BufErr
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}()
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								ctx = templ.InitializeContext(ctx)
 | 
				
			||||||
 | 
								templ_7745c5c3_Var44 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
 | 
				
			||||||
 | 
									templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
 | 
				
			||||||
 | 
									templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
 | 
				
			||||||
 | 
									if !templ_7745c5c3_IsBuffer {
 | 
				
			||||||
 | 
										defer func() {
 | 
				
			||||||
 | 
											templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
											if templ_7745c5c3_Err == nil {
 | 
				
			||||||
 | 
												templ_7745c5c3_Err = templ_7745c5c3_BufErr
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
										}()
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									ctx = templ.InitializeContext(ctx)
 | 
				
			||||||
 | 
									templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "Delete")
 | 
				
			||||||
 | 
									if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
										return templ_7745c5c3_Err
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									return nil
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
								templ_7745c5c3_Err = button.Button(button.Props{
 | 
				
			||||||
 | 
									Variant: button.VariantDestructive,
 | 
				
			||||||
 | 
								}).Render(templ.WithChildren(ctx, templ_7745c5c3_Var44), templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								return nil
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
							templ_7745c5c3_Err = modal.Trigger(modal.TriggerProps{
 | 
				
			||||||
 | 
								ModalID: "default-modal",
 | 
				
			||||||
 | 
							}).Render(templ.WithChildren(ctx, templ_7745c5c3_Var43), templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							templ_7745c5c3_Var45 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
 | 
				
			||||||
 | 
								templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
 | 
				
			||||||
 | 
								templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
 | 
				
			||||||
 | 
								if !templ_7745c5c3_IsBuffer {
 | 
				
			||||||
 | 
									defer func() {
 | 
				
			||||||
 | 
										templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
										if templ_7745c5c3_Err == nil {
 | 
				
			||||||
 | 
											templ_7745c5c3_Err = templ_7745c5c3_BufErr
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}()
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								ctx = templ.InitializeContext(ctx)
 | 
				
			||||||
 | 
								templ_7745c5c3_Var46 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
 | 
				
			||||||
 | 
									templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
 | 
				
			||||||
 | 
									templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
 | 
				
			||||||
 | 
									if !templ_7745c5c3_IsBuffer {
 | 
				
			||||||
 | 
										defer func() {
 | 
				
			||||||
 | 
											templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
											if templ_7745c5c3_Err == nil {
 | 
				
			||||||
 | 
												templ_7745c5c3_Err = templ_7745c5c3_BufErr
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
										}()
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									ctx = templ.InitializeContext(ctx)
 | 
				
			||||||
 | 
									templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "Are you sure you want to delete this file?")
 | 
				
			||||||
 | 
									if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
										return templ_7745c5c3_Err
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									return nil
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
								templ_7745c5c3_Err = modal.Header().Render(templ.WithChildren(ctx, templ_7745c5c3_Var46), templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, " ")
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								templ_7745c5c3_Var47 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
 | 
				
			||||||
 | 
									templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
 | 
				
			||||||
 | 
									templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
 | 
				
			||||||
 | 
									if !templ_7745c5c3_IsBuffer {
 | 
				
			||||||
 | 
										defer func() {
 | 
				
			||||||
 | 
											templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
											if templ_7745c5c3_Err == nil {
 | 
				
			||||||
 | 
												templ_7745c5c3_Err = templ_7745c5c3_BufErr
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
										}()
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									ctx = templ.InitializeContext(ctx)
 | 
				
			||||||
 | 
									templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "This action cannot be undone. This will permanently delete the file from the server.\t\t\t\t")
 | 
				
			||||||
 | 
									if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
										return templ_7745c5c3_Err
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									return nil
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
								templ_7745c5c3_Err = modal.Body().Render(templ.WithChildren(ctx, templ_7745c5c3_Var47), templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, " ")
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								templ_7745c5c3_Var48 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
 | 
				
			||||||
 | 
									templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
 | 
				
			||||||
 | 
									templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
 | 
				
			||||||
 | 
									if !templ_7745c5c3_IsBuffer {
 | 
				
			||||||
 | 
										defer func() {
 | 
				
			||||||
 | 
											templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
											if templ_7745c5c3_Err == nil {
 | 
				
			||||||
 | 
												templ_7745c5c3_Err = templ_7745c5c3_BufErr
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
										}()
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									ctx = templ.InitializeContext(ctx)
 | 
				
			||||||
 | 
									templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "<div class=\"flex gap-2\">")
 | 
				
			||||||
 | 
									if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
										return templ_7745c5c3_Err
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									templ_7745c5c3_Var49 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
 | 
				
			||||||
 | 
										templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
 | 
				
			||||||
 | 
										templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
 | 
				
			||||||
 | 
										if !templ_7745c5c3_IsBuffer {
 | 
				
			||||||
 | 
											defer func() {
 | 
				
			||||||
 | 
												templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
												if templ_7745c5c3_Err == nil {
 | 
				
			||||||
 | 
													templ_7745c5c3_Err = templ_7745c5c3_BufErr
 | 
				
			||||||
 | 
												}
 | 
				
			||||||
 | 
											}()
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
										ctx = templ.InitializeContext(ctx)
 | 
				
			||||||
 | 
										templ_7745c5c3_Var50 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
 | 
				
			||||||
 | 
											templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
 | 
				
			||||||
 | 
											templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
 | 
				
			||||||
 | 
											if !templ_7745c5c3_IsBuffer {
 | 
				
			||||||
 | 
												defer func() {
 | 
				
			||||||
 | 
													templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
													if templ_7745c5c3_Err == nil {
 | 
				
			||||||
 | 
														templ_7745c5c3_Err = templ_7745c5c3_BufErr
 | 
				
			||||||
 | 
													}
 | 
				
			||||||
 | 
												}()
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
											ctx = templ.InitializeContext(ctx)
 | 
				
			||||||
 | 
											templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "Cancel")
 | 
				
			||||||
 | 
											if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
												return templ_7745c5c3_Err
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
											return nil
 | 
				
			||||||
 | 
										})
 | 
				
			||||||
 | 
										templ_7745c5c3_Err = button.Button().Render(templ.WithChildren(ctx, templ_7745c5c3_Var50), templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
										if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
											return templ_7745c5c3_Err
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
										return nil
 | 
				
			||||||
 | 
									})
 | 
				
			||||||
 | 
									templ_7745c5c3_Err = modal.Close(modal.CloseProps{
 | 
				
			||||||
 | 
										ModalID: "delete-modal",
 | 
				
			||||||
 | 
									}).Render(templ.WithChildren(ctx, templ_7745c5c3_Var49), templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
									if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
										return templ_7745c5c3_Err
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									templ_7745c5c3_Var51 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
 | 
				
			||||||
 | 
										templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
 | 
				
			||||||
 | 
										templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
 | 
				
			||||||
 | 
										if !templ_7745c5c3_IsBuffer {
 | 
				
			||||||
 | 
											defer func() {
 | 
				
			||||||
 | 
												templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
												if templ_7745c5c3_Err == nil {
 | 
				
			||||||
 | 
													templ_7745c5c3_Err = templ_7745c5c3_BufErr
 | 
				
			||||||
 | 
												}
 | 
				
			||||||
 | 
											}()
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
										ctx = templ.InitializeContext(ctx)
 | 
				
			||||||
 | 
										templ_7745c5c3_Var52 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
 | 
				
			||||||
 | 
											templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
 | 
				
			||||||
 | 
											templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
 | 
				
			||||||
 | 
											if !templ_7745c5c3_IsBuffer {
 | 
				
			||||||
 | 
												defer func() {
 | 
				
			||||||
 | 
													templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
													if templ_7745c5c3_Err == nil {
 | 
				
			||||||
 | 
														templ_7745c5c3_Err = templ_7745c5c3_BufErr
 | 
				
			||||||
 | 
													}
 | 
				
			||||||
 | 
												}()
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
											ctx = templ.InitializeContext(ctx)
 | 
				
			||||||
 | 
											templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "Delete")
 | 
				
			||||||
 | 
											if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
												return templ_7745c5c3_Err
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
											return nil
 | 
				
			||||||
 | 
										})
 | 
				
			||||||
 | 
										templ_7745c5c3_Err = button.Button(button.Props{
 | 
				
			||||||
 | 
											Variant: button.VariantDestructive,
 | 
				
			||||||
 | 
										}).Render(templ.WithChildren(ctx, templ_7745c5c3_Var52), templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
										if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
											return templ_7745c5c3_Err
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
										return nil
 | 
				
			||||||
 | 
									})
 | 
				
			||||||
 | 
									templ_7745c5c3_Err = modal.Close(modal.CloseProps{
 | 
				
			||||||
 | 
										ModalID: "delete-modal",
 | 
				
			||||||
 | 
									}).Render(templ.WithChildren(ctx, templ_7745c5c3_Var51), templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
									if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
										return templ_7745c5c3_Err
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "</div>")
 | 
				
			||||||
 | 
									if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
										return templ_7745c5c3_Err
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									return nil
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
								templ_7745c5c3_Err = modal.Footer().Render(templ.WithChildren(ctx, templ_7745c5c3_Var48), templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
								if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
									return templ_7745c5c3_Err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								return nil
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
							templ_7745c5c3_Err = modal.Modal(modal.Props{
 | 
				
			||||||
 | 
								ID:    "delete-modal",
 | 
				
			||||||
 | 
								Class: "max-w-md",
 | 
				
			||||||
 | 
							}).Render(templ.WithChildren(ctx, templ_7745c5c3_Var45), templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							templ_7745c5c3_Err = modal.Script().Render(ctx, templ_7745c5c3_Buffer)
 | 
				
			||||||
 | 
							if templ_7745c5c3_Err != nil {
 | 
				
			||||||
 | 
								return templ_7745c5c3_Err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return nil
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var _ = templruntime.GeneratedTemplate
 | 
					var _ = templruntime.GeneratedTemplate
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue