dotCMS / core

Headless/Hybrid Content Management System for Enterprises
http://dotcms.com
Other
853 stars 467 forks source link

Support dateRange in CA queries #30192

Open freddyDOTCMS opened 1 week ago

freddyDOTCMS commented 1 week ago

Parent Issue

30141

Problem Statement

We create a new query sintax for the CA Endpoint and ViewTool, is not really the same CubeJs syntax, let see an example on the filter attribute:

Example to get all the request by day of tis week,

in Cube JS


{
  "measures": [
    "request.count"
  ],
  "dimensions": [
    "request.url"
  ],
  "order": {
    "request.count": "desc"
  },
  "timeDimensions": [
    {
      "dimension": "request.createdAt",
      "granularity": "day",
      "dateRange": "This week"
    }
  ]
}

In our Syntax is something like:


{
  "measures": [
    "request.count"
  ],
  "dimensions": [
    "request.url"
  ],
  "order": {
    "request.count": "desc"
  },
  "timeDimensions": "request.createdAt day This week"
}

but right now we are not supporting the third attribute

Steps to Reproduce


#set ($queryMap = {"measures" : ["request.count"], 
                "orders": "request.createdAt desc",
                "dimensions" : ["request.whatAmI"],
                "timeDimensions": "request.createdAt day Today"
                })

#set($collection = $analytics.runReportFromMap($queryMap).getResults())

Requests Per Day

#foreach($item in $collection)
   -> Type: $item.get("request.whatAmI").get()
   -> Create Date: $item.get("request.createdAt").get()
   -> Count: $item.get("request.count").get()

#end

You are going to get nothing

Acceptance Criteria

The dateRange parameters in the timeDimensions must work

dotCMS Version

latest

Proposed Objective

Core Features

Proposed Priority

Priority 2 - Important

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

No response

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

dsilvam commented 4 days ago

Passed IQA: Simplified syntax for timeDimensions working as described.

Image Image

josemejias11 commented 4 days ago

Approved: Tested on trunk_72dacf7, Docker, macOS 14.5, FF v126.0.1