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

Toxophilist/sprint dev #475

Merged
merged 2 commits into from
Oct 7, 2021
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
2 changes: 1 addition & 1 deletion okitweb/static/okit/js/okit_designer.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ let right_drag_bar_start_x = 0;
let ociRegions = [];

function resetDesigner() {
$("#console_header_view_select").val('designer');
$("#toolbar_view_select").val('designer');
handleSwitchToCompartmentView();
newModel();
newDesignerView();
Expand Down
13 changes: 10 additions & 3 deletions okitweb/static/okit/view/identity/css/okit_identity_view.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
grid-auto-flow: column;
column-gap: 20px;
background: #fff;
padding: 0 0 0 20px;
padding: 0 0 20px 20px;
margin: 0;
height: 100%;
width: 100%;
Expand Down Expand Up @@ -62,6 +62,7 @@
*/
.okit-groups-panel1 {
height: 100%;
overflow-y: scroll;
}

.okit-user-group {
Expand Down Expand Up @@ -92,6 +93,7 @@
*/
.okit-users-panel1 {
height: 100%;
overflow-y: scroll;
}

.okit-user {
Expand Down Expand Up @@ -173,12 +175,17 @@ div.compact div.okit-resource-details {

.okit-identity-details {
display: block;
height: 100%;
padding: 10px;
height: calc(100% - 2em);
padding: 10px 10px 50px 10px;
border: 1px dashed black;
border-radius: 2px;
}

.okit-identity-scroll-panel {
height: 100%;
overflow-y: scroll;
}

.okit-identity-details1:first-child {
margin-left: 20px;
}
Expand Down
4 changes: 2 additions & 2 deletions okitweb/static/okit/view/identity/js/okit_identity_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class OkitIdentityView extends OkitJsonView {

drawUsersPanel(parent) {
const self = this
const users_panel = parent.append('div').attr('id', 'identity_users_panel').attr('class', 'okit-users-grid okit-users-panel')
const users_panel = parent.append('div').attr('class', 'okit-identity-scroll-panel').append('div').attr('id', 'identity_users_panel').attr('class', 'okit-users-grid okit-users-panel')
self.model.getUsers().forEach((user) => self.addUserToPanel(users_panel, user))
}

Expand Down Expand Up @@ -67,7 +67,7 @@ class OkitIdentityView extends OkitJsonView {

drawGroupsPanel(parent) {
const self = this
const groups_panel = parent.append('div').attr('id', 'identity_groups_panel').attr('class', 'okit-group-grid okit-groups-panel')
const groups_panel = parent.append('div').attr('class', 'okit-identity-scroll-panel').append('div').attr('id', 'identity_groups_panel').attr('class', 'okit-group-grid okit-groups-panel')
self.model.getGroups().forEach((group) => self.addGroupToPanel(groups_panel, group))
}

Expand Down
11 changes: 9 additions & 2 deletions visualiser/generators/okitGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1979,7 +1979,10 @@ def renderUser(self, resource):
# ---- Display Name
self.addJinja2Variable("display_name", display_name, standardisedName)
# ---- Description
self.addJinja2Variable("description", resource.get("description", display_name), standardisedName)
description = resource.get("description", display_name)
if len(description) == 0:
description = display_name
self.addJinja2Variable("description", description, standardisedName)
# --- Optional
if resource.get("email", '') != '':
self.addJinja2Variable("email", resource.get("email", ''), standardisedName)
Expand Down Expand Up @@ -2013,7 +2016,11 @@ def renderUserGroup(self, resource):
# ---- Display Name
self.addJinja2Variable("display_name", display_name, standardisedName)
# ---- Description
self.addJinja2Variable("description", resource.get("description", display_name), standardisedName)
# self.addJinja2Variable("description", resource.get("description", display_name), standardisedName)
description = resource.get("description", display_name)
if len(description) == 0:
description = display_name
self.addJinja2Variable("description", description, standardisedName)
# --- Optional
# ---- User Members
if len(resource['user_ids']):
Expand Down
13 changes: 13 additions & 0 deletions visualiser/query/ociQuery.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class OCIQuery(OCIConnection):
"Export",
"ExportSet",
"FileSystem",
"Group",
"Image",
"Instance",
# "InstancePool",
Expand All @@ -73,6 +74,8 @@ class OCIQuery(OCIConnection):
"SecurityList",
"ServiceGateway",
"Subnet",
"User",
"UserGroupMembership",
"Vcn",
"VmCluster",
"VmClusterNetwork",
Expand All @@ -95,6 +98,7 @@ class OCIQuery(OCIConnection):
"Drg": "dynamic_routing_gateways",
"ExadataInfrastructure": "exadata_infrastructures",
"FileSystem": "file_storage_systems",
"Group": "groups",
"Instance": "instances",
"InstancePool": "instance_pools",
"InternetGateway": "internet_gateways",
Expand All @@ -110,6 +114,7 @@ class OCIQuery(OCIConnection):
"SecurityList": "security_lists",
"ServiceGateway": "service_gateways",
"Subnet": "subnets",
"User": "users",
"Vcn": "virtual_cloud_networks",
"VmCluster": "vm_clusters",
"VmClusterNetwork": "vm_cluster_networks",
Expand Down Expand Up @@ -203,7 +208,10 @@ def convert(self, discovery_data, compartments):
resource_list = self.route_tables(resource_list, resources)
elif resource_type == "ServiceGateway":
resource_list = self.service_gateways(resource_list, resources)
elif resource_type == "Group":
resource_list = self.groups(resource_list, resources)
# Check Life Cycle State
# logger.info(f'Processing {resource_type} : {resource_list}')
response_json[self.DISCOVERY_OKIT_MAP[resource_type]] = [r for r in resource_list if "lifecycle_state" not in r or r["lifecycle_state"] in self.VALID_LIFECYCLE_STATES]
#response_json[self.DISCOVERY_OKIT_MAP[resource_type]] = resource_list
return response_json
Expand All @@ -226,6 +234,11 @@ def file_storage_systems(self, file_storage_systems, resources):
mt["export_set"] = ess[0] if len(ess) else {}
return file_storage_systems

def groups(self, groups, resources):
for group in groups:
group["user_ids"] = [m["user_id"] for m in resources.get("UserGroupMembership", []) if m["group_id"] == group["id"]]
return groups

def instances(self, instances, resources):
# Exclude OKE Instances
instances = [i for i in instances if 'oke-cluster-id' not in i['metadata']]
Expand Down