Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature-renaming] moved featureBeautifier method into countlyAuth. #2887

Merged
merged 1 commit into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/*global countlyAuth, app, countlyGlobal, $, groupsModel, CV, countlyVue, countlyUserManagement, countlyCommon, CountlyHelpers */
(function() {
var featureNameMapper = {
'block': 'filtering_rules',
'geo': 'location_targeting'
};

var DataTable = countlyVue.views.create({
template: CV.T("/core/user-management/templates/data-table.html"),
Expand Down Expand Up @@ -153,6 +149,7 @@
};
},
methods: {
featureBeautifier: countlyAuth.featureBeautifier,
generatePassword: function() {
var generatedPassword = CountlyHelpers.generatePassword(countlyGlobal.security.password_min);
this.$refs.userDrawer.editedObject.password = generatedPassword;
Expand Down Expand Up @@ -599,15 +596,6 @@
this.permissionSets.push(permissionSet_);
}
},
// TODO: move this to countlyAuth
featureBeautifier: function(featureName) {
var fa = featureName.split('_');
var ret = '';
for (var i = 0; i < fa.length; i++) {
ret += fa[i].substr(0, 1).toUpperCase() + fa[i].substr(1, fa[i].length - 1) + ' ';
}
return ret;
},
onGroupChange: function(groupVal) {
this.group = groupVal;
},
Expand Down Expand Up @@ -690,14 +678,7 @@
self.users.push(usersObj[user]);
}
self.loading = false;
self.features = countlyUserManagement.getFeatures().map(function(f) {
if (featureNameMapper[f]) {
return featureNameMapper[f];
}
else {
return f;
}
}).sort();
self.features = countlyUserManagement.getFeatures().sort();
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
</div>
<div class="user-management-drawer-content__permission-table-content bu-px-1">
<div class="user-management-drawer-content__permission-row bu-mb-5" v-for="feature in features">
<div class="user-management-drawer-content__feature-name">{{featureBeautifier(feature)}}</div>
<div class="user-management-drawer-content__feature-name">{{ featureBeautifier(feature) }}</div>
<div class="user-management-drawer-content__feature-permissions">
<div class="user-management-drawer-content__permission-box">
<el-checkbox @change="setPermissionByFeature(index, 'c', feature)" v-model="permissionSets[index].c.allowed[feature]"></el-checkbox>
Expand Down
9 changes: 9 additions & 0 deletions frontend/express/public/javascripts/countly/countly.auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,4 +380,13 @@
}
};

countlyAuth.featureBeautifier = function(featureName) {
var fa = featureName.split('_');
var ret = '';
for (var i = 0; i < fa.length; i++) {
ret += fa[i].substr(0, 1).toUpperCase() + fa[i].substr(1, fa[i].length - 1) + ' ';
}
return $.i18n.map[featureName + ".plugin-title"] || $.i18n.map[featureName + ".title"] || ret;
};

})(window.countlyAuth = window.countlyAuth || {});