Skip to content

Commit

Permalink
Merge pull request #486 from oracle/v0.28.0-sprint-28
Browse files Browse the repository at this point in the history
V0.28.0 sprint 28
  • Loading branch information
toxophilist authored Oct 20, 2021
2 parents ef8e52e + f3a22dc commit 2dc7514
Show file tree
Hide file tree
Showing 169 changed files with 3,686 additions and 2,210 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
# Release Notes


## Version 0.28.0
**Release Date**: 20th October 2021
### Features
1. User / Groups View added
1. Allow the creation / definition of local Users
2. Allow the creation / definition of OCI Groups
2. Bastion as a Service functionality added to main design canvas.
3. Update cache functionality to store based on Configuration & Region.
4. Add "OKIT Reference" Tag to all resources created via OKIT to allow for future expansion / reference.
### Bug Fixes
1. Add missing policy documentation to export to markdown.
2. Fix Save As Template to add .json if not specified.
3. Resolve issue where the default dhcp option would generate terraform with an empty search_domain_names if the server type was changed and then changed back.


## Version 0.27.1
**Release Date**: 1st October 2021
### Bug Fixes
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
FROM oraclelinux:7-slim
LABEL "provider"="Oracle" \
"issues"="https://github.com/oracle/oci-designer-toolkit/issues" \
"version"="0.27.1" \
"version"="0.28.0" \
"description"="OKIT Web Server Container." \
"copyright"="Copyright (c) 2020, 2021, Oracle and/or its affiliates."
SHELL ["/bin/bash", "-c"]
# SHELL ["/bin/bash", "-c"]
ENV PYTHONIOENCODING=utf8 \
PYTHONPATH=":/okit/visualiser:/okit/okitweb:/okit" \
FLASK_APP=okitweb \
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Oracle Cloud Infrastructure Designer and Visualisation Toolkit [0.27.1](CHANGELOG.md#version-0.27.1)
# Oracle Cloud Infrastructure Designer and Visualisation Toolkit [0.28.0](CHANGELOG.md#version-0.28.0)

OCI designer and visualisation toolKIT (OKIT) is a browser based tool that allows the user to [design](https://www.ateam-oracle.com/introduction-to-okit-the-oci-designer-toolkit),
[deploy](https://www.ateam-oracle.com/introduction-to-okit-the-oci-designer-toolkit) and visualise ([introspect/query](https://www.ateam-oracle.com/the-oci-designer-toolkit-query-feature))
Expand Down Expand Up @@ -33,7 +33,7 @@ OCI environments through a graphical web based interface.

## Changes

[Changes for the current release (0.27.1) are documented here.](CHANGELOG.md#version-0.27.1)
[Changes for the current release (0.28.0) are documented here.](CHANGELOG.md#version-0.28.0)


## Releases
Expand Down Expand Up @@ -141,7 +141,7 @@ docker run -d --rm -p 80:80 --volume <USER HOME DIR>/.oci:/root/.oci --volume <U

##### Mount User Templates and Git Directories
```bash
docker run -d --rm -p 80:80 --volume <USER HOME DIR>/.oci:/root/.oci --volume <USER HOME DIR>/.ssh:/root/.ssh --volume <PATH TO USER TEMPLATES DIR>:/okit/instance/user --volume <PATH TO GIT DIR>:/okit/instance/git --volume <PATH TO LOCAL DIR>:/okit/instance/local --name okit okit
docker run -d --rm -p 80:80 --volume <USER HOME DIR>/.oci:/root/.oci --volume <USER HOME DIR>/.ssh:/root/.ssh --volume <PATH TO USER TEMPLATES DIR>:/okit/instance/templates/user --volume <PATH TO GIT DIR>:/okit/instance/git --volume <PATH TO LOCAL DIR>:/okit/instance/local --name okit okit
```

Once started the Designer BUI can be accessed on [http://localhost/okit/designer](http://localhost/okit/designer)
Expand Down
2 changes: 1 addition & 1 deletion containers/docker/8-slim/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LABEL "provider"="Oracle" \
"version"="0.20.0" \
"description"="OKIT Web Server Container." \
"copyright"="Copyright (c) 2020, 2021, Oracle and/or its affiliates."
SHELL ["/bin/bash", "-c"]
# SHELL ["/bin/bash", "-c"]
ENV PYTHONIOENCODING=utf8 \
PYTHONPATH=":/okit/visualiser:/okit/okitweb:/okit" \
FLASK_APP=okitweb \
Expand Down
4 changes: 2 additions & 2 deletions containers/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
FROM oraclelinux:7-slim
LABEL "provider"="Oracle" \
"issues"="https://github.com/oracle/oci-designer-toolkit/issues" \
"version"="0.27.1" \
"version"="0.28.0" \
"description"="OKIT Web Server Container." \
"copyright"="Copyright (c) 2020, 2021, Oracle and/or its affiliates."
SHELL ["/bin/bash", "-c"]
# SHELL ["/bin/bash", "-c"]
ENV PYTHONIOENCODING=utf8 \
PYTHONPATH=":/okit/visualiser:/okit/okitweb:/okit" \
FLASK_APP=okitweb \
Expand Down
6 changes: 3 additions & 3 deletions okitweb/okitOci.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,11 @@ def resourceTypes(profile):
return 'Unknown Method', 500


@bp.route('/dropdown/<string:profile>', methods=(['GET']))
def dropdownQuery(profile):
@bp.route('/dropdown/<string:profile>/<string:region>', methods=(['GET']))
def dropdownQuery(profile, region):
if request.method == 'GET':
dropdown_query = OCIDropdownQuery(profile=profile)
dropdown_json = dropdown_query.executeQuery()
dropdown_json = dropdown_query.executeQuery([region])
return dropdown_json
else:
return 'Unknown Method', 500
Expand Down
10 changes: 6 additions & 4 deletions okitweb/okitWebDesigner.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,12 @@ def template_save():
instance_path = current_app.instance_path
root_dir = request.json["root_dir"].strip('/')
template_filename = request.json["template_file"].strip('/')
if not template_filename.endswith('.json'):
template_filename = f'{template_filename}.json'
okit_json = request.json["okit_json"]
git = request.json.get('git', False)
git_commit_msg = request.json.get('git_commit_msg', '')
logger.info(f'Save Template : {root_dir}')
logger.info(f'Save Template : {root_dir} {template_filename}')

template_dir = os.path.dirname(template_filename)
full_dir = os.path.join(instance_path, root_dir, template_dir)
Expand Down Expand Up @@ -577,13 +579,13 @@ def saveas(savetype):
return str(e), 500


@bp.route('/dropdown/data/<string:profile>', methods=(['GET', 'POST']))
def dropdownData(profile):
@bp.route('/dropdown/data/<string:profile>/<string:region>', methods=(['GET', 'POST']))
def dropdownData(profile, region):
dropdown_dir = os.path.abspath(os.path.join(bp.static_folder, 'json', 'dropdown'))
shipped_dropdown_file = os.path.abspath(os.path.join(dropdown_dir, 'dropdown.json'))
# shipped_dropdown_file = os.path.abspath(os.path.join(bp.static_folder, 'json', 'dropdown', 'dropdown.json'))
profile_dropdown_dir = os.path.abspath(os.path.join(dropdown_dir, 'profiles'))
profile_dropdown_file = os.path.abspath(os.path.join(profile_dropdown_dir, f'{profile}.json'))
profile_dropdown_file = os.path.abspath(os.path.join(profile_dropdown_dir, profile, f'{region}.json'))
# Check if profile specific dropdown file exists if not use the default
if request.method == 'GET':
if os.path.exists(profile_dropdown_file):
Expand Down
2 changes: 1 addition & 1 deletion okitweb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "okitweb",
"version": "0.27.1",
"version": "0.28.0",
"description": "OKIT Web application",
"scripts": {},
"author": "Oracle",
Expand Down
30 changes: 22 additions & 8 deletions okitweb/static/okit/css/okit_console.css
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,11 @@ summary:focus {
}

.hidden {
visibility: hidden;
position: absolute;
display: none;
visibility: hidden;
max-height: 0;
max-width: 0;
}

.okit-pointer-cursor {
Expand All @@ -137,7 +139,19 @@ summary:focus {
background-position: center;
background-repeat: no-repeat;
background-size: 1em;
width: 2em;
width: 1em;
height: 1em;
}

.action-button-column {
min-width: 2em;
}

.cancel-overlay {
position: absolute;
right: 2px;
top: 2px;
z-index: 10;
}

/*
Expand Down Expand Up @@ -458,7 +472,7 @@ summary:focus {
*/

.context-menu {
z-index:102;
z-index: 102;
position: absolute;
border: 1px rgba(37, 49, 65, 0.1) solid;
padding: 2px;
Expand Down Expand Up @@ -607,7 +621,7 @@ li a.parent-item:hover {
overflow: auto;
}

.okit-table .td > input[type="text"] {
.okit-table .td > input[type="text"], input[type="email"], input[type="password"] {
width: 100%;
}

Expand Down Expand Up @@ -706,7 +720,7 @@ li a.parent-item:hover {
right: 0;
bottom: 0;
left: 0;
z-index: 100;
z-index: 1000;
padding: 15px 15px;
background: rgba(0, 0, 0, 0.6);
width: 100%;
Expand All @@ -716,7 +730,7 @@ li a.parent-item:hover {
.okit-modal-dialog {
display: flex;
flex-direction: column;
z-index:1000;
z-index: 1000;
position: absolute;
left: 30%;
top: 20%;
Expand Down Expand Up @@ -936,12 +950,12 @@ li a.parent-item:hover {
}

.okit-slide-hide-right {
/* padding: 0 !important;
padding: 0 !important;
margin: 0 !important;;
overflow: hidden !important;
width: 0 !important;
min-width: 0 !important;
max-width: 0!important; */
max-width: 0!important;
transition: transform 0.25s;
transform: translateX(100%);
}
Expand Down
56 changes: 31 additions & 25 deletions okitweb/static/okit/js/okit.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,65 +75,71 @@ class OkitGITConfig {
class OkitOCIData {
key = "OkitDropdownCache";
day_milliseconds = 86400000;
constructor(profile) {
constructor(profile, region='uk-london-1') {
this.compartments = [];
this.dropdown_data = {}
this.load(profile);
this.load(profile, region);
}

clearLocalStorage() {localStorage.removeItem(this.key)}

storeLocal(profile) {
getCache() {
const local_data = localStorage.getItem(this.key)
return local_data ? JSON.parse(local_data) : {}
}

storeLocal(profile, region='') {
console.info(`Storing Local Dropdown data for ${profile}`);
const local_data = localStorage.getItem(this.key)
let cache = {}
if (local_data) cache = JSON.parse(local_data)
if (profile) cache[profile] = this.dropdown_data
if (profile && !cache.hasOwnProperty(profile)) cache[profile] = {}
if (profile) cache[profile][region] = this.dropdown_data
localStorage.setItem(this.key, JSON.stringify(cache))
}

loadLocal(profile) {
loadLocal(profile, region='') {
const local_data = localStorage.getItem(this.key)
console.info(`Loading Local Dropdown data for ${profile}`);
let cache = {}
if (local_data) cache = JSON.parse(local_data)
if (profile && cache[profile]) {
if (profile && region && cache[profile] && cache[profile][region]) {
// Add test for stale cache && cache[profile].cache_date && ((Date.now() - cache[profile].cache_date) / this.day_milliseconds) <= 7
console.info(`Found Local Dropdown Data for ${profile}`);
this.dropdown_data = cache[profile]
console.info(`Found Local Dropdown Data for ${profile} ${region}`);
this.dropdown_data = cache[profile][region]
return true;
} else {
return false;
}
}

load(profile) {
load(profile, region='') {
console.info('Loading Dropdown data for', profile);
this.compartments = [];
const self = this;
if (!this.loadLocal(profile)) {
if (!this.loadLocal(profile, region)) {
const start = new Date().getTime()
$.getJSON(`dropdown/data/${String(profile)}`, (resp) => {
$.getJSON(`dropdown/data/${String(profile)}/${String(region)}`, (resp) => {
const end = new Date().getTime()
console.info('Load Dropdown Data took', end - start, 'ms')
// $.extend(true, self, resp);
self.dropdown_data = resp;
self.storeLocal(profile);
self.storeLocal(profile, region);
if (resp.shipped && profile !== undefined) {
self.refresh(profile);
self.refresh(profile, region);
}
});
}
}

refresh(profile) {
refresh(profile, region='') {
console.info('Refreshing Dropdown data for', profile);
this.query(profile, false)
this.query(profile, false, region)
}

save(profile) {
save(profile, region='') {
console.info('Saving Dropdown data for', profile);
this.storeLocal(profile);
this.storeLocal(profile, region);
$.ajax({
type: 'post',
url: `dropdown/data/${String(profile)}`,
Expand All @@ -148,26 +154,26 @@ class OkitOCIData {
});
}

cloneForSave(profile) {
cloneForSave(profile, region='') {
let clone = JSON.clone(this);
clone.compartments = [];
return clone;
}

query(profile, save=false) {
console.info('Querying Dropdown data for', profile);
query(profile, save=false, region='') {
console.info('Querying Dropdown data for', profile, region);
const self = this;
const start = new Date().getTime()
$.getJSON(`oci/dropdown/${profile}`, (resp) => {
$.getJSON(`oci/dropdown/${profile}/${region}`, (resp) => {
// Merge with base dropdown overwriting where appropriate with new data
self.dropdown_data = {...self.dropdown_data, ...resp};
delete self.dropdown_data.default
delete self.dropdown_data.shipped
self.dropdown_data.cache_date = Date.now()
const end = new Date().getTime()
console.info('Queried Dropdown Data for', profile, 'took', end - start, 'ms')
if (save) this.save(profile)
else this.storeLocal(profile)
if (save) this.save(profile, region)
else this.storeLocal(profile, region)
});
}

Expand Down Expand Up @@ -394,7 +400,7 @@ class OkitSettings {
this.is_vcn_defaults = true;
this.is_timestamp_files = false;
this.profile = 'DEFAULT';
this.region = ''
this.region = 'uk-london-1'
this.is_always_free = false;
this.is_optional_expanded = true;
this.is_display_grid = false;
Expand All @@ -406,7 +412,7 @@ class OkitSettings {
this.highlight_association = true;
this.show_label = 'none';
this.tooltip_type = 'simple';
this.name_prefix = 'okit-';
this.name_prefix = 'okit';
this.auto_save = false;
this.show_ocids = false;
this.validate_markdown = true;
Expand Down
10 changes: 7 additions & 3 deletions okitweb/static/okit/js/okit_console.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
*/
console.info('Loaded Console Javascript');

const okitVersion = '0.27.1';
const okitReleaseDate = '1st October 2021';

const okitVersion = '0.28.0';
const okitReleaseDate = '20th October 2021';

// Validation
const validate_error_colour = "#ff4d4d";
const validate_warning_colour = "#ffd633";
Expand Down Expand Up @@ -115,7 +117,8 @@ function handleConfigChanged(event) {
console_header_region_select.empty()
console_header_region_select.append($('<option>').attr('value', '').text('Retrieving....'))
okitRegions.load(okitSettings.profile)
okitOciData.load(okitSettings.profile)
okitOciData.load(okitSettings.profile, okitSettings.region)
setOCILink()
}

function loadHeaderRegionsDropDown() {
Expand All @@ -139,6 +142,7 @@ function handleRegionChanged(event) {
event.stopPropagation()
okitSettings.region = $('#console_header_region_select').val()
okitSettings.save()
okitOciData.load(okitSettings.profile, okitSettings.region)
setOCILink()
}

Expand Down
Loading

0 comments on commit 2dc7514

Please sign in to comment.