Skip to content

Commit

Permalink
add model version support
Browse files Browse the repository at this point in the history
  • Loading branch information
emmyoop committed Apr 11, 2023
1 parent 2bdc46c commit afe7da6
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Docs-20230411-141646.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Docs
body: Add support for model versions
time: 2023-04-11T14:16:46.013583-05:00
custom:
Author: emmyoop
Issue: "406"
2 changes: 2 additions & 0 deletions src/app/components/graph/graph-launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ angular
var nodes = graph.showVerticalGraph('exposure:' + node.name, true);
} else if (node && node.resource_type == 'metric') {
var nodes = graph.showVerticalGraph('metric:' + node.name, true);
// } else if (node.resource_type == 'model' && node.version != null) {
// var nodes = graph.showVerticalGraph(node.label, true);
} else {
var nodes = graph.showVerticalGraph(node.name, true);
}
Expand Down
2 changes: 2 additions & 0 deletions src/app/components/search/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ angular
return model.label;
} else if (model.resource_type == 'exposure') {
return model.label;
} else if (model.resource_type == 'model' && model.version != null) {
return model.label;
} else {
return model.name;
}
Expand Down
4 changes: 4 additions & 0 deletions src/app/components/table_details/table_details.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ angular
name: "Access",
value: model.access
},
{
name: "Version",
value: model.version
},
]

return _.filter(stats, function(s) { return s.value !== undefined })
Expand Down
2 changes: 2 additions & 0 deletions src/app/graph/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ angular
return 'exposure:' + node.name;
} else if (node && node.resource_type == 'metric') {
return 'metric:' + node.name;
} else if (node && node.resource_type == 'model' && node.version != null) {
return node.label;
} else if (node.name) {
return node.name;
} else {
Expand Down
14 changes: 12 additions & 2 deletions src/app/services/project_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ angular

// Set node labels
_.each(service.files.manifest.nodes, function(node) {
node.label = node.name;
if (node.resource_type == 'model' && node.version != null) {
node.label = node.name + "_v" + node.version;
} else {
node.label = node.name;
}
});

// Add sources back into nodes to make site logic work
Expand Down Expand Up @@ -630,6 +634,12 @@ angular
var fname = _.last(path);
}

if (node.resource_type == 'model' && node.version != null) {
var display_name = node.name + "_v" + node.version;
} else {
var display_name = node.name;
}

var cur_dir = tree;
_.each(dirpath, function(dir) {
if (!cur_dir[dir]) {
Expand All @@ -646,7 +656,7 @@ angular
})
cur_dir[fname] = {
type: 'file',
name: node.name,
name: display_name,
node: node,
active: is_active,
unique_id: node.unique_id,
Expand Down

0 comments on commit afe7da6

Please sign in to comment.