progress on migrating all grids.
This commit is contained in:
@@ -1,21 +1,19 @@
|
||||
(ns auto-ap.ssr.company.yodlee
|
||||
(:require
|
||||
[auto-ap.datomic :refer [conn]]
|
||||
[auto-ap.datomic :refer [conn pull-attr]]
|
||||
[auto-ap.datomic.yodlee2 :as yodlee2]
|
||||
[auto-ap.graphql.utils :refer [is-admin?]]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.components :as com]
|
||||
[auto-ap.ssr.svg :as svg]
|
||||
[auto-ap.ssr.ui :refer [base-page]]
|
||||
[auto-ap.ssr.grid-page-helper :as helper]
|
||||
[auto-ap.ssr.svg :as svg]
|
||||
[auto-ap.ssr.utils :refer [html-response]]
|
||||
[auto-ap.time :as atime]
|
||||
[auto-ap.yodlee.core2 :as yodlee]
|
||||
[bidi.bidi :as bidi]
|
||||
[config.core :refer [env]]
|
||||
[datomic.api :as dc]
|
||||
[hiccup2.core :as hiccup]
|
||||
[auto-ap.datomic :refer [pull-attr]]))
|
||||
[hiccup2.core :as hiccup]))
|
||||
|
||||
(def default-read '[:db/id
|
||||
:yodlee-provider-account/last-updated
|
||||
@@ -77,79 +75,88 @@ fastlink.open({fastLinkURL: '%s',
|
||||
(pull-attr (dc/db conn) :yodlee-provider-account/id (Long/parseLong (get form-params "id")))))]]
|
||||
[:div]))))
|
||||
|
||||
(def grid-page {:id "yodlee-table"
|
||||
:nav (com/company-aside-nav)
|
||||
:id-fn :db/id
|
||||
:fetch-page (fn [user args]
|
||||
(yodlee2/get-graphql
|
||||
{:client (:client args)
|
||||
:clients (:clients args)
|
||||
:sort (:sort (:parsed-query-params args))
|
||||
:start (:start (:parsed-query-params args))
|
||||
:per-page (:per-page (:parsed-query-params args))}))
|
||||
:breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes
|
||||
:company)}
|
||||
"My Company"]
|
||||
(def grid-page
|
||||
(helper/build
|
||||
{:id "yodlee-table"
|
||||
:nav (com/company-aside-nav)
|
||||
:id-fn :db/id
|
||||
:fetch-page (fn [request]
|
||||
(println (count (:clients request)))
|
||||
(yodlee2/get-graphql
|
||||
{:client (:client request)
|
||||
:clients (:clients request)
|
||||
:sort (:sort (:parsed-query-params request))
|
||||
:start (:start (:parsed-query-params request))
|
||||
:per-page (:per-page (:parsed-query-params request))}))
|
||||
:breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes
|
||||
:company)}
|
||||
"My Company"]
|
||||
|
||||
[:a {:href (bidi/path-for ssr-routes/only-routes
|
||||
:company-yodlee)}
|
||||
"Yodlee"]]
|
||||
:title "Yodlee Accounts"
|
||||
:entity-name "Yodlee accounts"
|
||||
:route :company-yodlee-table
|
||||
:action-buttons (fn [user _]
|
||||
[(com/button {:color :primary
|
||||
:on-click "openFastlink()"
|
||||
:hx-get (bidi/path-for ssr-routes/only-routes
|
||||
:company-yodlee-fastlink-dialog)
|
||||
:hx-target "#modal-holder"}
|
||||
(com/button-icon {} svg/refresh)
|
||||
"Link new account")])
|
||||
:row-buttons (fn [user e]
|
||||
[
|
||||
(com/button {:hx-put (bidi/path-for ssr-routes/only-routes
|
||||
:company-yodlee-provider-account-reauthenticate)
|
||||
:color :primary
|
||||
:hx-target "#modal-holder"}
|
||||
"Reauthenticate")
|
||||
(when (is-admin? user)
|
||||
(com/icon-button {:hx-put (bidi/path-for ssr-routes/only-routes
|
||||
:company-yodlee-provider-account-refresh)
|
||||
:hx-target "closest tr"}
|
||||
svg/refresh))])
|
||||
:headers [{:key "provider-account"
|
||||
:name "Provider Account"
|
||||
:sort-key "provider-account"
|
||||
:render :yodlee-provider-account/id}
|
||||
{:key "status"
|
||||
:name "Status"
|
||||
:sort-key "status"
|
||||
:render #(when-let [status (:yodlee-provider-account/status %)]
|
||||
(com/pill {:color (if (not= status "SUCCESS")
|
||||
:yellow
|
||||
:primary) }
|
||||
status))}
|
||||
{:key "detailed-status"
|
||||
:name "Detailed Status"
|
||||
:sort-key "detailed-status"
|
||||
:render #(when-let [status (:yodlee-provider-account/detailed-status %)]
|
||||
status)}
|
||||
[:a {:href (bidi/path-for ssr-routes/only-routes
|
||||
:company-yodlee)}
|
||||
"Yodlee"]]
|
||||
:title "Yodlee Accounts"
|
||||
:entity-name "Yodlee accounts"
|
||||
:route :company-yodlee-table
|
||||
:action-buttons (fn [request]
|
||||
[(com/button {:color :primary
|
||||
:on-click "openFastlink()"
|
||||
:hx-get (bidi/path-for ssr-routes/only-routes
|
||||
:company-yodlee-fastlink-dialog)
|
||||
:hx-target "#modal-holder"}
|
||||
(com/button-icon {} svg/refresh)
|
||||
"Link new account")])
|
||||
:row-buttons (fn [request _]
|
||||
[
|
||||
(com/button {:hx-put (bidi/path-for ssr-routes/only-routes
|
||||
:company-yodlee-provider-account-reauthenticate)
|
||||
:color :primary
|
||||
:hx-target "#modal-holder"}
|
||||
"Reauthenticate")
|
||||
(when (is-admin? (:identity request))
|
||||
(com/icon-button {:hx-put (bidi/path-for ssr-routes/only-routes
|
||||
:company-yodlee-provider-account-refresh)
|
||||
:hx-target "closest tr"}
|
||||
svg/refresh))])
|
||||
:headers [{:key "client"
|
||||
:name "Client"
|
||||
:sort-key "client"
|
||||
:hide? (fn [args]
|
||||
(= (count (:clients args)) 1))
|
||||
:render #(-> % :yodlee-provider-account/client :client/code)}
|
||||
{:key "provider-account"
|
||||
:name "Provider Account"
|
||||
:sort-key "provider-account"
|
||||
:render :yodlee-provider-account/id}
|
||||
{:key "status"
|
||||
:name "Status"
|
||||
:sort-key "status"
|
||||
:render #(when-let [status (:yodlee-provider-account/status %)]
|
||||
(com/pill {:color (if (not= status "SUCCESS")
|
||||
:yellow
|
||||
:primary) }
|
||||
status))}
|
||||
{:key "detailed-status"
|
||||
:name "Detailed Status"
|
||||
:sort-key "detailed-status"
|
||||
:render #(when-let [status (:yodlee-provider-account/detailed-status %)]
|
||||
status)}
|
||||
|
||||
{:key "last-updated"
|
||||
:name "Last Updated"
|
||||
:sort-key "last-updated"
|
||||
:render #(atime/unparse-local (:yodlee-provider-account/last-updated %)
|
||||
atime/normal-date)}
|
||||
{:key "accounts"
|
||||
:name "Accounts"
|
||||
:show-starting "md"
|
||||
:render (fn [e]
|
||||
[:ul
|
||||
(for [a (:yodlee-provider-account/accounts e)]
|
||||
[:li (:yodlee-account/name a) " - " (:yodlee-account/number a)])])}]})
|
||||
{:key "last-updated"
|
||||
:name "Last Updated"
|
||||
:sort-key "last-updated"
|
||||
:render #(atime/unparse-local (:yodlee-provider-account/last-updated %)
|
||||
atime/normal-date)}
|
||||
{:key "accounts"
|
||||
:name "Accounts"
|
||||
:show-starting "md"
|
||||
:render (fn [e]
|
||||
[:ul
|
||||
(for [a (:yodlee-provider-account/accounts e)]
|
||||
[:li (:yodlee-account/name a) " - " (:yodlee-account/number a)])])}]}))
|
||||
|
||||
(def page (partial helper/page grid-page))
|
||||
(def table (partial helper/table grid-page))
|
||||
(def page (helper/page-route grid-page))
|
||||
(def table (helper/table-route grid-page))
|
||||
|
||||
;; TODO delete-after-settle
|
||||
(defn refresh-provider-account [{:keys [form-params identity]}]
|
||||
|
||||
Reference in New Issue
Block a user