Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
liu-samuel committed Oct 7, 2024
1 parent ea36e2c commit 0fc99e9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 2 additions & 0 deletions app/controllers/ops_controller/ops_rbac.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ def rbac_role_edit_get
@_params[:id] = obj[0]
end
@hide_bottom_bar = true
require 'byebug'
byebug
role = MiqUserRole.find_by(id: params[:id])
render :json => {
:name => role.name,
Expand Down
4 changes: 4 additions & 0 deletions app/helpers/ops_helper/role_rbac_details_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ def role_rbac_details(role, rbac_menu_tree)
end

def rbac_role_info_view(role, rbac_menu_tree)
require 'byebug'
byebug
rows = [
row_data(_('ID'), role.id),
row_data(_('Name'), role.name),
Expand All @@ -23,6 +25,8 @@ def rbac_role_info_view(role, rbac_menu_tree)
end

def rbac_role_product_features(role, rbac_menu_tree)
require 'byebug'
byebug
cells = row_data(_("Product Features (Read Only)"), {:input => 'component', :component => 'TREE_VIEW_REDUX', :props => rbac_menu_tree.locals_for_render, :name => rbac_menu_tree.name})
cells[:cells][:value][:props]
end
Expand Down
17 changes: 7 additions & 10 deletions app/javascript/components/rbac-role-form/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,16 @@ const RbacRoleForm = (props) => {
const generateId = () => idCounter++;

const findCheck = (productFeature, node) => {
if (!node) {
return '';
}
const result = node.value.split('__')[1].split('#')[0];
if (result === productFeature) {
return node.value;
features.push(node.value);
}

if (node.children) {
for (let child of node.children) {
const res = findCheck(productFeature, child);
if (res != '' && res !== undefined) {
features.push(res);
findCheck(productFeature, child);
}
}
return '';
}
};

const transformTree = (node) => {
Expand All @@ -48,6 +41,9 @@ const RbacRoleForm = (props) => {
label: node.text,
};

if (node.key === 'infra_topology') {
console.log('infra_topology');
}
let icon;
switch (node.icon) {
case 'fa fa-search':
Expand Down Expand Up @@ -138,7 +134,7 @@ const RbacRoleForm = (props) => {
setFormData({
...formData, isLoading: false, initialValues: roleValues, nodes, checked: features,
});
};
}
});
} else {
let uniqueBoxes = [];
Expand All @@ -157,6 +153,7 @@ const RbacRoleForm = (props) => {
};
const bsTree = JSON.parse(customProps.bs_tree);
const nodes = bsTree.map(transformTree);
console.log(nodes);
if (initialValues) {
setFormData({
...formData, isLoading: false, initialValues, nodes, checked: uniqueBoxes,
Expand Down

0 comments on commit 0fc99e9

Please sign in to comment.