diff --git a/.changes/unreleased/Docs-20241126-230636.yaml b/.changes/unreleased/Docs-20241126-230636.yaml new file mode 100644 index 000000000..7c11760f3 --- /dev/null +++ b/.changes/unreleased/Docs-20241126-230636.yaml @@ -0,0 +1,6 @@ +kind: Docs +body: Add dimensions list to the Semantic Model docs +time: 2024-11-26T23:06:36.7899668+01:00 +custom: + Author: SOVALINUX + Issue: "434" diff --git a/src/app/components/dimension_details/dimension_details.html b/src/app/components/dimension_details/dimension_details.html new file mode 100644 index 000000000..8b64829d3 --- /dev/null +++ b/src/app/components/dimension_details/dimension_details.html @@ -0,0 +1,37 @@ +
+
+
+ Dimension information is not available for this seed +
+
+ + + + + + + + + + + + + + + +
dimensionTypeDescription
+
+ {{ get_dim_name(dimension.name) }} +
+
+ {{ dimension.type }}

+
+ {{ dimension.description }}

+
+
+
+
diff --git a/src/app/components/dimension_details/dimension_details.js b/src/app/components/dimension_details/dimension_details.js new file mode 100644 index 000000000..acda38768 --- /dev/null +++ b/src/app/components/dimension_details/dimension_details.js @@ -0,0 +1,44 @@ +'use strict'; + +const template = require('./dimension_details.html'); + +const _ = require('underscore'); + +angular + .module('dbt') + .directive('dimensionDetails', ['project', function (projectService) { + return { + scope: { + model: '=', + }, + templateUrl: template, + link: function (scope) { + + console.log(scope); + + scope.getState = function (node) { + return 'dbt.' + node.resource_type; + } + + scope.get_dim_name = function (dim_name) { + return projectService.caseColumn(dim_name); + } + + + var dimensions = _.chain(scope.model.dimensions) + .values() + .sortBy('name') + .value(); + + // re-number dimensions because index comes from the catalog, and index may not always be present + // this prevents errors with the view's `track by dimension.index` + _.each(dimensions, function (col, i) { + col.index = i; + }); + + scope.dimensions = dimensions; + + } + } + }]); + diff --git a/src/app/components/index.js b/src/app/components/index.js index 2d01c0946..a53696d33 100644 --- a/src/app/components/index.js +++ b/src/app/components/index.js @@ -6,6 +6,7 @@ require('./model_tree/model_tree_line.js'); require('./search/search.js'); require('./table_details/table_details.js'); require('./column_details/column_details.js'); +require('./dimension_details/dimension_details.js'); require('./code_block/code_block.js'); require('./macro_arguments/'); require('./references/'); diff --git a/src/app/docs/semantic_model.html b/src/app/docs/semantic_model.html index 13e52ded6..a4c12a4e4 100644 --- a/src/app/docs/semantic_model.html +++ b/src/app/docs/semantic_model.html @@ -83,6 +83,15 @@
Entities
+ +
+
+
+
Dimensions
+ + +
+