瀏覽代碼

fix(query): cannot toggle updated-at and created-at

Fix #10756
Andelf 1 年之前
父節點
當前提交
805b7c9022
共有 1 個文件被更改,包括 11 次插入17 次删除
  1. 11 17
      src/main/frontend/components/query_table.cljs

+ 11 - 17
src/main/frontend/components/query_table.cljs

@@ -106,14 +106,8 @@
         query-properties (if page? (remove #{:block} query-properties) query-properties)
         columns (if (seq query-properties)
                   query-properties
-                  (get-keys result page?))
-        included-columns #{:created-at :updated-at}]
-    (distinct
-     (if (some included-columns columns)
-       (concat (remove included-columns columns)
-               (filter included-columns columns)
-               included-columns)
-       columns))))
+                  (get-keys result page?))]
+    (distinct columns)))
 
 (defn- build-column-value
   "Builds a column's tuple value for a query table given a row, column and
@@ -156,12 +150,12 @@
                    (get-in row [:block/properties column])))]))
 
 (defn build-column-text [row column]
-  (case column 
+  (case column
     :page  (or (get-in row [:block/page :block/original-name])
                (get-in row [:block/original-name])
                (get-in row [:block/content]))
-    :block (or (get-in row [:block/original-name]) 
-               (get-in row [:block/content])) 
+    :block (or (get-in row [:block/original-name])
+               (get-in row [:block/content]))
            (or (get-in row [:block/properties column])
                (get-in row [:block/properties-text-values column])
                (get-in row [(keyword :block column)]))))
@@ -185,27 +179,27 @@
           property-separated-by-commas? (partial text/separated-by-commas? (state/get-config))
           table-version (get-shui-component-version :table config)
           result-as-text (for [row sort-result]
-                           (for [column columns] 
+                           (for [column columns]
                              (build-column-text row column)))
           render-column-value (fn [row-format cell-format value]
-                                (cond 
+                                (cond
                                   ;; elements should be rendered as they are provided
                                   (= :element cell-format) value
                                   ;; collections are treated as a comma separated list of page-cps
                                   (coll? value) (->> (map #(page-cp {} {:block/name %}) value)
                                                      (interpose [:span ", "]))
                                   ;; boolean values need to first be stringified
-                                  (boolean? value) (str value) 
-                                  ;; string values will attempt to be rendered as pages, falling back to 
+                                  (boolean? value) (str value)
+                                  ;; string values will attempt to be rendered as pages, falling back to
                                   ;; inline-text when no page entity is found
                                   (string? value) (if-let [page (db/entity [:block/name (util/page-name-sanity-lc value)])]
                                                     (page-cp {} page)
                                                     (inline-text row-format value))
                                   ;; anything else should just be rendered as provided
                                   :else value))]
-                      
+
       (case table-version
-        2 (shui/table-v2 {:data (conj [[columns]] result-as-text)} 
+        2 (shui/table-v2 {:data (conj [[columns]] result-as-text)}
                          (make-shui-context config inline))
         1 [:div.overflow-x-auto {:on-mouse-down (fn [e] (.stopPropagation e))
                                  :style {:width "100%"}