Skip to content

Commit db1e2c0

Browse files
committed
fix: public dashboards disabled message
1 parent 42eb34f commit db1e2c0

3 files changed

Lines changed: 20 additions & 6 deletions

File tree

plugins/dashboards/frontend/public/javascripts/countly.views.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -512,12 +512,9 @@
512512
];
513513

514514
var allowPublicDashboards = countlyGlobal.allow_public_dashboards !== false;
515-
var sharingOptions = allowPublicDashboards ? allSharingOptions : allSharingOptions.filter(function(option) {
516-
return option.value !== "all-users";
517-
});
518-
519515
return {
520-
sharingOptions: sharingOptions
516+
sharingOptions: allSharingOptions,
517+
isPublicDisabled: !allowPublicDashboards
521518
};
522519
},
523520
canShare: function() {
@@ -666,6 +663,14 @@
666663
doc.share_with = "none";
667664
}
668665
}
666+
else {
667+
var allowPublicDashboards = countlyGlobal.allow_public_dashboards !== false;
668+
if (!allowPublicDashboards &&
669+
(doc.__action === "create" || doc.__action === "duplicate") &&
670+
doc.share_with === "all-users") {
671+
doc.share_with = "";
672+
}
673+
}
669674
},
670675
onClose: function() {
671676
this.$store.dispatch("countlyDashboards/requests/drawerOpenStatus", false);

plugins/dashboards/frontend/public/localization/dashboards.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ dashboards.access-denied = This dashboard is no longer shared with you or an err
5151
dashbaords.access-denied-title = Access Denied
5252
dashboards.edit-access-denied = You don't have the edit permission for this dashboard. Please ask your global administrator if you think this is due to an issue.
5353
dashboards.sharing-denied = Dashboard sharing has been disabled. Please ask your global administrator if you think this is due to an issue.
54+
dashboards.public-dashboards-disabled-info = Public dashboards are disabled. Contact an administrator to enable this option.
5455
dashboards.widget-warning.time = This widget has data for {0} to {1}. Please select a date range in this period.
5556

5657
systemlogs.action.widget_added = Widget Added

plugins/dashboards/frontend/public/templates/dashboards-drawer.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
{{i18n('dashboards.share-with')}}
2020
<cly-tooltip-icon :tooltip="i18n('dashboards.share-with-tooltip-content')" data-test-id="dashboard-visibility-tooltip"></cly-tooltip-icon>
2121
</div>
22+
<div v-if="constants.isPublicDisabled" class="text-small color-cool-gray-50 bu-mb-2">
23+
{{i18n('dashboards.public-dashboards-disabled-info')}}
24+
</div>
2225
<cly-form-field name="share_with" rules="required">
2326
<el-radio-group :disabled="!canShare" v-model="drawerScope.editedObject.share_with" style="width: 100%;">
2427
<el-radio
@@ -27,9 +30,14 @@
2730
:test-id="'dashboard-visibility-option-' + item.value"
2831
v-for="(item) in constants.sharingOptions"
2932
:label="item.value"
30-
:key="item.value">
33+
:key="item.value"
34+
:disabled="constants.isPublicDisabled && item.value === 'all-users'">
3135
<div>
3236
{{item.name}}
37+
<cly-tooltip-icon
38+
v-if="constants.isPublicDisabled && item.value === 'all-users'"
39+
:tooltip="i18n('dashboards.share.all-users.description') + ' ' + i18n('dashboards.public-dashboards-disabled-info')">
40+
</cly-tooltip-icon>
3341
</div>
3442
<div class="text-small color-cool-gray-50">
3543
{{item.description}}

0 commit comments

Comments
 (0)