Spaces:
Running
Running
feat: save agent submissions to localStorage instead of email
Browse files- Remove mailto link functionality
- Save all agent submissions to localStorage for admin review
- Keep auto-scroll and success message display
- src/views/AddAssetView.vue +3 -23
src/views/AddAssetView.vue
CHANGED
|
@@ -178,20 +178,7 @@ export default {
|
|
| 178 |
})
|
| 179 |
localStorage.setItem('agentSubmissions', JSON.stringify(agentSubmissions))
|
| 180 |
|
| 181 |
-
|
| 182 |
-
const subject = encodeURIComponent(`New Agent Submission: ${this.agentForm.name}`)
|
| 183 |
-
const body = encodeURIComponent(
|
| 184 |
-
`Agent Name: ${this.agentForm.name}\n` +
|
| 185 |
-
`Endpoint: ${this.agentForm.endpoint}\n` +
|
| 186 |
-
`Description: ${this.agentForm.description || 'N/A'}\n\n` +
|
| 187 |
-
`Submitted at: ${new Date().toLocaleString()}`
|
| 188 |
-
)
|
| 189 |
-
|
| 190 |
-
// 在后台打开 mailto(不阻塞用户体验)
|
| 191 |
-
const mailtoLink = `mailto:lfqian94@gmail.com?subject=${subject}&body=${body}`
|
| 192 |
-
window.open(mailtoLink, '_blank')
|
| 193 |
-
|
| 194 |
-
this.agentForm.message = 'Agent submitted successfully! An email notification has been sent.'
|
| 195 |
this.agentForm.messageType = 'success'
|
| 196 |
|
| 197 |
// 滚动到消息位置
|
|
@@ -212,8 +199,8 @@ export default {
|
|
| 212 |
|
| 213 |
} catch (error) {
|
| 214 |
console.error('Error submitting agent:', error)
|
| 215 |
-
this.agentForm.message = '
|
| 216 |
-
this.agentForm.messageType = '
|
| 217 |
|
| 218 |
// 滚动到消息位置
|
| 219 |
this.$nextTick(() => {
|
|
@@ -222,13 +209,6 @@ export default {
|
|
| 222 |
messageEl.scrollIntoView({ behavior: 'smooth', block: 'center' })
|
| 223 |
}
|
| 224 |
})
|
| 225 |
-
|
| 226 |
-
setTimeout(() => {
|
| 227 |
-
this.agentForm.name = ''
|
| 228 |
-
this.agentForm.endpoint = ''
|
| 229 |
-
this.agentForm.description = ''
|
| 230 |
-
this.agentForm.message = ''
|
| 231 |
-
}, 5000)
|
| 232 |
} finally {
|
| 233 |
this.agentForm.loading = false
|
| 234 |
}
|
|
|
|
| 178 |
})
|
| 179 |
localStorage.setItem('agentSubmissions', JSON.stringify(agentSubmissions))
|
| 180 |
|
| 181 |
+
this.agentForm.message = 'Agent submitted successfully! We will review it soon.'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
this.agentForm.messageType = 'success'
|
| 183 |
|
| 184 |
// 滚动到消息位置
|
|
|
|
| 199 |
|
| 200 |
} catch (error) {
|
| 201 |
console.error('Error submitting agent:', error)
|
| 202 |
+
this.agentForm.message = 'Failed to submit agent. Please try again.'
|
| 203 |
+
this.agentForm.messageType = 'error'
|
| 204 |
|
| 205 |
// 滚动到消息位置
|
| 206 |
this.$nextTick(() => {
|
|
|
|
| 209 |
messageEl.scrollIntoView({ behavior: 'smooth', block: 'center' })
|
| 210 |
}
|
| 211 |
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
} finally {
|
| 213 |
this.agentForm.loading = false
|
| 214 |
}
|