Skip to content

Commit

Permalink
Support hiding default data quality dashboards by hiding folders.
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrczarnas committed Jul 24, 2024
1 parent 9933568 commit b86f8c7
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 9 deletions.
10 changes: 4 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# 1.6.0
* Fixes to some error sampling templates
* Redesigned data quality check editor to work in a simplified mode
* JDBC drivers are pre-loaded to avoid issues with automatic registration of JDBC drivers by Java
* Delta Lake and Iceberg support
* Global incident screen redesigned to show the counts of incidents
# 1.6.1
* Small fixes in the data quality check editor - styling fixes
* Parallel invocation of notification events
* The calculation logic for counting incidents on the global incident screen modified to use dates correctly
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,13 @@ public DashboardsFolderListSpec merge(DashboardsFolderListSpec otherFolderList)
DashboardsFolderSpec otherFolder = otherFolderList.getFolderByName(folderSpec.getFolderName());
if (otherFolder != null) {
DashboardsFolderSpec mergedFolder = folderSpec.merge(otherFolder);
cloned.add(mergedFolder);
if (mergedFolder != null) {
cloned.add(mergedFolder);
}
} else {
cloned.add(folderSpec);
if (!folderSpec.isHideFolder()) {
cloned.add(folderSpec);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ public DashboardsFolderSpec(String folderName) {
@JsonSerialize(using = IgnoreEmptyYamlSerializer.class)
private DashboardsFolderListSpec folders = new DashboardsFolderListSpec();

@JsonPropertyDescription("Hides the whole folder and all nested dashboards from the navigation tree. If you want to hide some of the build-in folders," +
" update the settings/dashboardslist.dqodashboards.yaml file in the DQOps user home folder, create an empty folder with the same name as a built-in folder, and set the value of this field to true.")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
private boolean hideFolder;

/**
* Returns the folder name.
* @return Folder name.
Expand Down Expand Up @@ -147,6 +152,23 @@ public void setFolders(DashboardsFolderListSpec folders) {
propagateHierarchyIdToField(folders, "folders");
}

/**
* Returns true if the whole folder should be hidden.
* @return True when the folder should be hidden.
*/
public boolean isHideFolder() {
return hideFolder;
}

/**
* Sets a flag to hide a whole folder and all the subfolders and dashboards inside.
* @param hideFolder True when the folder should be hidden.
*/
public void setHideFolder(boolean hideFolder) {
this.setDirtyIf(this.hideFolder != hideFolder);
this.hideFolder = hideFolder;
}

/**
* Returns the child map on the spec class with all fields.
*
Expand Down Expand Up @@ -392,6 +414,10 @@ public void sort() {
* @return Merged folder that includes current folders and dashboards, merged with the other dashboards.
*/
public DashboardsFolderSpec merge(DashboardsFolderSpec otherFolder) {
if (this.hideFolder || otherFolder.hideFolder) {
return null; // hide the folder
}

DashboardsFolderSpec cloned = new DashboardsFolderSpec();
cloned.setFolderName(this.folderName);
cloned.setStandard(this.standard || otherFolder.standard);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ public void initializeDqoUserHome(String userHomePathString) {
Path customDashboardsPath = userHomePath.resolve(BuiltInFolderNames.SETTINGS).resolve(SpecFileNames.DASHBOARDS_SPEC_FILE_NAME_YAML);
if (!Files.exists(customDashboardsPath)) {
DashboardYaml dashboardYaml = new DashboardYaml();
DashboardsFolderListSpec dashboardsFolderListSpec = dashboardYaml.getSpec();
addDefaultDashboardFolders(dashboardsFolderListSpec);
String emptyDashboards = this.yamlSerializer.serialize(dashboardYaml);
Files.writeString(customDashboardsPath, emptyDashboards);
}
Expand Down Expand Up @@ -357,6 +359,18 @@ public void initializeDqoUserHome(String userHomePathString) {
}
}

/**
* Adds default dashboard folders.
* @param dashboardsFolderListSpec Target object to add default dashboard folders.
*/
private void addDefaultDashboardFolders(DashboardsFolderListSpec dashboardsFolderListSpec) {
dashboardsFolderListSpec.getOrCreateChildFolder("Profiling");
dashboardsFolderListSpec.getOrCreateChildFolder("Monitoring");
dashboardsFolderListSpec.getOrCreateChildFolder("Partitions");
dashboardsFolderListSpec.getOrCreateChildFolder("DQOps usage");
dashboardsFolderListSpec.getOrCreateChildFolder("Aggregated results for all check types");
}

/**
* Checks for the existence of <code>.DQO_USER_HOME_NOT_MOUNTED</code> file in DQO_USER_HOME.
* @param userHomePath DQOps User Home path.
Expand Down Expand Up @@ -456,7 +470,9 @@ public void applyDefaultConfigurationWhenMissing() {
}

if (userHome.getDashboards() != null && userHome.getDashboards().getSpec() == null) {
userHome.getDashboards().setSpec(new DashboardsFolderListSpec());
DashboardsFolderListSpec dashboardsFolderListSpec = new DashboardsFolderListSpec();
addDefaultDashboardFolders(dashboardsFolderListSpec);
userHome.getDashboards().setSpec(dashboardsFolderListSpec);
}

if (localSettingsSpec.getInstanceSignatureKey() == null && this.dqoInstanceConfigurationProperties.getSignatureKey() == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33247,6 +33247,10 @@
"items" : {
"$ref" : "#/definitions/DashboardsFolderSpec"
}
},
"hide_folder" : {
"type" : "boolean",
"description" : "Hides the whole folder and all nested dashboards from the navigation tree. If you want to hide some of the build-in folders, update the settings/dashboardslist.dqodashboards.yaml file in the DQOps user home folder, create an empty folder with the same name as a built-in folder, and set the value of this field to true."
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31817,6 +31817,12 @@ definitions:
description: "List of data quality dashboard folders at this level."
items:
$ref: "#/definitions/DashboardsFolderSpec"
hide_folder:
type: "boolean"
description: "Hides the whole folder and all nested dashboards from the navigation\
\ tree. If you want to hide some of the build-in folders, update the settings/dashboardslist.dqodashboards.yaml\
\ file in the DQOps user home folder, create an empty folder with the same\
\ name as a built-in folder, and set the value of this field to true."
DataDeleteResultPartition:
type: "object"
properties:
Expand Down

0 comments on commit b86f8c7

Please sign in to comment.