mirror of
https://github.com/penpot/penpot.git
synced 2026-04-27 20:28:11 +00:00
🐛 Fix MCP status is displayed as disabled when setting MCP key without expiration date
Fixes #14058 and #14061 in Taiga
This commit is contained in:
parent
0b6416e53b
commit
a5a8ab5de6
@ -751,13 +751,14 @@
|
||||
mcp (mf/deref refs/mcp)
|
||||
tokens (mf/deref refs/access-tokens)
|
||||
|
||||
expired? (some->> tokens
|
||||
(some #(when (= (:type %) "mcp") %))
|
||||
:expires-at
|
||||
(> (ct/now)))
|
||||
expires-at (some->> tokens
|
||||
(some #(when (= (:type %) "mcp") %))
|
||||
:expires-at)
|
||||
expired? (and (some? expires-at) (> (ct/now) expires-at))
|
||||
|
||||
mcp-enabled? (true? (-> profile :props :mcp-enabled))
|
||||
mcp-connected? (= "connected" (get mcp :connection-status))
|
||||
mcp-enabled? (true? (-> profile :props :mcp-enabled))
|
||||
mcp-connection (get mcp :connection-status)
|
||||
mcp-connected? (= mcp-connection "connected")
|
||||
|
||||
show-enabled? (and mcp-enabled? (false? expired?))
|
||||
|
||||
@ -798,7 +799,7 @@
|
||||
:pos-6 plugins?)
|
||||
:on-close on-close}
|
||||
|
||||
(when show-enabled?
|
||||
(when (and show-enabled? (not expired?))
|
||||
[:> dropdown-menu-item* {:id "mcp-menu-toggle-mcp-plugin"
|
||||
:class (stl/css :base-menu-item :submenu-item)
|
||||
:on-click on-toggle-mcp-plugin
|
||||
@ -988,10 +989,10 @@
|
||||
|
||||
(when (contains? cf/flags :mcp)
|
||||
(let [tokens (mf/deref refs/access-tokens)
|
||||
expired? (some->> tokens
|
||||
(some #(when (= (:type %) "mcp") %))
|
||||
:expires-at
|
||||
(> (ct/now)))
|
||||
expires-at (some->> tokens
|
||||
(some #(when (= (:type %) "mcp") %))
|
||||
:expires-at)
|
||||
expired? (and (some? expires-at) (> (ct/now) expires-at))
|
||||
|
||||
mcp-enabled? (true? (-> profile :props :mcp-enabled))
|
||||
mcp-connection (get mcp :connection-status)
|
||||
@ -1001,6 +1002,9 @@
|
||||
active? (and mcp-enabled? mcp-connected?)
|
||||
failed? (or (and mcp-enabled? mcp-error?)
|
||||
(true? expired?))]
|
||||
|
||||
(print "EXPIRED" expired?)
|
||||
(print "FAILED" mcp-error?)
|
||||
|
||||
[:> dropdown-menu-item* {:class (stl/css :base-menu-item :menu-item)
|
||||
:on-click on-menu-click
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user