Improve repo loading error handling + UI tweaks
This commit is contained in:
parent
1d49767da9
commit
c2065fa973
|
@ -133,10 +133,10 @@
|
|||
[:div.ui.container
|
||||
[:div.ui.grid.stackable
|
||||
[:div.ten.wide.computer.sixteen.wide.tablet.column
|
||||
[:div.ui.container.page-content
|
||||
[:div.ui.container
|
||||
[(pages @(rf/subscribe [:page]))]]]
|
||||
[:div.six.wide.column.computer.only
|
||||
[:div.ui.container.page-content
|
||||
[:div.ui.container
|
||||
[:h3 "Top hunters"]
|
||||
[top-hunters]]]]
|
||||
[:div.ui.divider]]]]))
|
||||
|
|
|
@ -132,12 +132,15 @@
|
|||
:dispatch-n [[:load-user-repos]
|
||||
[:load-owner-bounties]]}))
|
||||
|
||||
(reg-event-db
|
||||
:clear-repos-loading
|
||||
(fn [db [_]]
|
||||
(assoc db :repos-loading? false)))
|
||||
|
||||
(reg-event-db
|
||||
:set-user-repos
|
||||
(fn [db [_ repos]]
|
||||
(-> db
|
||||
(assoc :repos repos)
|
||||
(assoc :repos-loading? false))))
|
||||
(assoc db :repos repos)))
|
||||
|
||||
(reg-event-fx
|
||||
:load-user-repos
|
||||
|
@ -145,7 +148,10 @@
|
|||
{:db (assoc db :repos-loading? true)
|
||||
:http {:method GET
|
||||
:url "/api/user/repositories"
|
||||
:on-success #(dispatch [:set-user-repos (:repositories %)])}}))
|
||||
:on-success #(dispatch [:set-user-repos (:repositories %)])
|
||||
:on-error #(dispatch [:set-flash-message
|
||||
:error "Failed to load repositories"])
|
||||
:finally #(dispatch [:clear-repos-loading])}}))
|
||||
|
||||
|
||||
(defn update-repo-state [all-repos full-name data]
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
(fn []
|
||||
(let [repo-groups (sort-by identity (fn [a _] (= a (:login @user)))
|
||||
(keys @repos))]
|
||||
(println repo-groups)
|
||||
(into [:div]
|
||||
(for [[group group-repos]
|
||||
(map (fn [group] [group (get @repos group)])
|
||||
|
@ -57,6 +56,6 @@
|
|||
(fn []
|
||||
(if @repos-loading?
|
||||
[:div
|
||||
[:div.ui.active.dimmer
|
||||
[:div.ui.loader]]]
|
||||
[:div.ui.active.inverted.dimmer
|
||||
[:div.ui.text.loader "Loading"]]]
|
||||
[repos-list]))))
|
||||
|
|
|
@ -149,6 +149,10 @@ span.dropdown.icon {
|
|||
}
|
||||
}
|
||||
|
||||
.ui.grid {
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
.repo-group-title {
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
|
@ -183,12 +187,6 @@ span.dropdown.icon {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
.page-content {
|
||||
margin-top: 2em;
|
||||
}
|
||||
|
||||
|
||||
.ui.button.repo-added-button {
|
||||
color: white;
|
||||
background-color: #61deb0;
|
||||
|
|
Loading…
Reference in New Issue