diff --git a/.gitignore b/.gitignore index 2302b6711..7fa64f560 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,5 @@ containers/.oci containers/oci/* !containers/oci/example_config + +!okitweb/static/model diff --git a/CHANGELOG.md b/CHANGELOG.md index b76339142..df21d92c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,26 @@ # Release Notes +## Version 0.9.0 +**Release Date**: 5th August 2020 +### Features +1. Split Designer View functionality from OKIT Model (OKIT-89). +2. Update Json associated with the Fragments to conform to new structure and remove non Reference Architecture templates because these are fragments. (OKIT-101). +3. Check oci config file to identify if the key file exists in the container and if not display error icon with associated click / alert message (OKIT-48 / OKIT-96). +4. Add preferences option (Hide Attached Artefacts) to indicate if Route Tables / Security List should be displayed as part of the Virtual Cloud Networks as well as an attachment. +5. Hide Service CIDR when Service Gateway in Route Rule is selected. + +### Bug Fixes +1. Resolve issue with the "description" for Network Security Groups which was being incorrectly rendered in the generated Terraform. +2. Attached Route Tables / Security List property edits were lost. (OKIT-70). +3. Resolve issue with the "compartment_id" for Compartment which was being incorrectly rendered in the generated Terraform. +4. During query AD specific Subnets return Availability Domain as string not integer value, this is now converted (OKIT-105). +5. Deleting Defined Tags did not remove them from the model (OKIT-106). +6. Instance OS & Version information not retrieved during Query (OKIT-108). +7. DRG Ansible template contains '=' not ':' (GitHub Issue #61). +8. Quotes added to security Ingress / Egress rules (GitHub Issue #65). + + ## Version 0.8.0 **Release Date**: 15th July 2020 ### Features diff --git a/README.md b/README.md index c88c1ad0d..c5f345bd9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# OCI Designer Toolkit [0.8.0](CHANGELOG.md#version-0.8.0) +# OCI Designer Toolkit [0.9.0](CHANGELOG.md#version-0.9.0) OCI designer toolKIT (OKIT) is a set of tools for enabling design, deploy and visualise OCI environments through a graphical web based interface. diff --git a/containers/docker/Dockerfile b/containers/docker/Dockerfile index 9558fadf0..82021ef37 100644 --- a/containers/docker/Dockerfile +++ b/containers/docker/Dockerfile @@ -5,7 +5,7 @@ FROM oraclelinux:7-slim LABEL "provider"="Oracle" \ "issues"="https://github.com/oracle/oci-designer-toolkit/issues" \ - "version"="0.8.0" \ + "version"="0.9.0" \ "description"="OKIT Web Server Container." \ "copyright"="Copyright (c) 2020, Oracle and/or its affiliates." SHELL ["/bin/bash", "-c"] @@ -23,27 +23,25 @@ EXPOSE 443 # Install new yum repos RUN yum install -y \ oracle-softwarecollection-release-el7 \ + oraclelinux-developer-release-el7 \ # Update base image && yum update -y \ # Install additional packages && yum install -y \ python36 \ python3-pip \ +# python36-pyyaml \ +# python36-oci-sdk \ +# rh-nginx114 \ && rm -rf /var/cache/yum \ # Upgrade pip && python3 -m pip install --upgrade pip==20.0.2 \ # Install required python modules && pip3 install --no-cache-dir \ - click==7.0 \ flask==1.1.1 \ gunicorn==20.0.4 \ - itsdangerous==1.1.0 \ - jinja2==2.10.3 \ - markupsafe==1.1.1 \ oci==2.6.0 \ pyyaml==5.2 \ - werkzeug==0.16.0 \ - cryptography==2.8 \ # Create Workspace && mkdir -p /okit/{config,log,visualiser,okitweb,workspace} # Copy source code @@ -51,6 +49,5 @@ COPY okitweb /okit/okitweb COPY visualiser /okit/visualiser COPY containers/oci/* /root/.oci/ # Add entrypoint to automatically start webserver -#ENTRYPOINT gunicorn --workers=2 --limit-request-line 0 --bind=0.0.0.0:80 okitweb.wsgi:app ENTRYPOINT ["gunicorn"] CMD ["--workers=4", "--limit-request-line", "0", "--timeout", "120", "--bind=0.0.0.0:80", "okitweb.wsgi:app"] diff --git a/documentation/Development.md b/documentation/Development.md index ee53acb4f..c40bccb1c 100644 --- a/documentation/Development.md +++ b/documentation/Development.md @@ -36,7 +36,7 @@ to the system. - New Files - Frontend - **[Palette SVG](#palette-svg)** : [okitweb/static/okit/palette/storage/*Block_Storage_Volume*.svg](../okitweb/static/okit/palette/storage/Block_Storage_Volume.svg) - - **[Artifact Javascript](#artifact-javascript)** : [okitweb/static/okit/js/oci_artefacts/*block_storage_volume*.js](../okitweb/static/okit/js/oci_artefacts/block_storage_volume.js) + - **[Artifact Model Javascript](#artifact-javascript)** : [okitweb/static/okit/model/js/artefacts/*block_storage_volume*.js](../okitweb/static/okit/model/js/artefacts/block_storage_volume.js) - **[Properties HTML](#properties-html)** : [okitweb/templates/okit/propertysheets/*block_storage_volume*.html](../okitweb/templates/okit/propertysheets/block_storage_volume.html) - Backend - **[Python OCI Facade](#python-oci-facade)** : [visualiser/facades/oci*BlockStorageVolume*.py](../visualiser/facades/ociBlockStorageVolume.py) @@ -62,7 +62,7 @@ file name will be manipulated (removing the underscore) and used to dynamically ## Palette SVG The palette svg defines the icon that will be displayed in the Drag & Drop palette. A number of existing SVG files can be -downloaded from the confluence page [OCI Icon Set draw.io Stencils](https://confluence.oci.oraclecorp.com/pages/viewpage.action?spaceKey=~scross&title=OCI+Icon+Set+draw.io+Stencils). +downloaded from the confluence page OCI Icon Set draw.io Stencils. One key requirement for this svg file is that all elements that draw the icon be contained within an "g" tag. The reason for this is that the common javascript svg display routine will look for this and extract it to use as the definition for @@ -88,32 +88,22 @@ the icon. Hence the Block Storage Volume would look like the following Although the svg will display in the palette image without the "g" it will cause the designer to fail later if it is missing. ## Artifact Javascript -The artifact javascript file is the key files for the BUI specifying all core code for the creation, drawing and querying +When creating an Artefact you will need to define two artefact specific files that provide the Model Definition and the associated Designer View +functionality. The artifact javascript files are the key files for the BUI specifying all core code for the creation, drawing and querying of the artifact. Each file has a standard set of variable definitions and function definitions which again are based on -the name of the artifact as follows. To add an artifact to the OKIT BUI you should copy the okit_template_artifact.js to -the "oci_artefacts" subdirectory and name it appropriately (In out example that would be block_storage_volume.js). +the name of the artifact as follows. -Once the file has been copied to the oci_artefacts directory then is can be opened and the following global Find/Replace modification applied: +All the example code in the following sections will be based on the **Block Storage Volume** Artefact. -1. 'Okit Template Artifact' replaced by 'Artifact Name' - in our example this would be 'Block Storage Volume'. -2. 'OkitTemplateArtifact' replaced by 'ArtifactName' - in our example this would be 'BlockStorageVolume'. -3. 'template_artifact' replaced by 'artifact_name' - in our example this would be 'block_storage_volume'. -4. 'parent_type_id' replaced by the id field associated with the parent container - in our example this would be 'compartment_id'. -5. 'parent_type_list' replace by the okitJson list element corresponding to the parent - in our example this would be 'compartments'. +### Artefact Model +The Model javascript will be located in [okitweb/static/okit/model/js/artefacts](../okitweb/static/okit/model/js/artefacts) +directory and contains the definition of the Artefact and all properties will be in a structured format. Before fixing your +model check the structure return from an OCI SDK Query of the Artefact. -### Standard Definitions -```javascript -console.log('Loaded Block Storage Javascript'); - -const block_storage_volume_query_cb = "block-storage-volume-query-cb"; -``` -Within this section we will define the target artifact where the new artifact can be dropped. For example the **Block Storage Volume** can be dropped on the *Compartment*. - -### Class Definition +#### Class Definition Each artifact is described by a JavaScript class inherited from the **OkitArtifact** Class and has a number of standard methods associated with the class. for the majority of these you will not need to modify the code because the underlying -super class will do all the work. If you are creating a new container then you will need to modify the class definition -to inherit from **OkitContainerArtifact** class. +super class will do all the work. The following will list the methods that need modification. @@ -122,15 +112,15 @@ The following will list the methods that need modification. /* ** Create */ - constructor (data={}, okitjson={}, parent=null) { + constructor (data={}, okitjson={}) { super(okitjson); - this.parent_id = data.parent_id; // Configure default values this.display_name = this.generateDefaultName(okitjson.block_storage_volumes.length + 1); this.compartment_id = data.parent_id; this.availability_domain = '1'; this.size_in_gbs = 1024; this.backup_policy = 'bronze'; + this.vpus_per_gb = '10'; // Update with any passed data this.merge(data); this.convert(); @@ -139,15 +129,11 @@ The following will list the methods that need modification. this.region_availability_domain = this.availability_domain; this.availability_domain = this.region_availability_domain.slice(-1); } - // Add Get Parent function - if (parent !== null) { - this.getParent = () => {return parent}; - } } ``` This function is used to create a new json element to the OKIT json structure. The elements within this json will match those that are returned from querying OCI. All artifacts will be contained within a top level list with a name that matches that -of the artifact (e.g. block_storage_volumes). Once that new json element has been added it will be drawn on the SVG canvas. +of the artifact (e.g. block_storage_volumes). Once that new json element has been added it will be drawn on the SVG canvas using an appropriate View class. #### Delete Children ```javascript @@ -168,26 +154,11 @@ of the artifact (e.g. block_storage_volumes). Once that new json element has bee Although the main **delete** method will not need modifying the **deleteChildren** will need modification to remove any references within linked artifacts or actual children in the case of a container. -#### Artifact Dimensions -```javascript - // Return Artifact Dimensions - getDimensions() { - console.groupCollapsed('Getting Dimensions of ' + this.getArtifactReference() + ' : ' + this.id); - let dimensions = this.getMinimumDimensions(); - // Calculate Size based on Child Artifacts - // Check size against minimum - dimensions.width = Math.max(dimensions.width, this.getMinimumDimensions().width); - dimensions.height = Math.max(dimensions.height, this.getMinimumDimensions().height); - console.info('Overall Dimensions : ' + JSON.stringify(dimensions)); - console.groupEnd(); - return dimensions; - } - - getMinimumDimensions() { - return {width: icon_width, height:icon_height}; - } -``` +### Artefact View +The Model javascript will be located in [okitweb/static/okit/view/designer/js/artefacts](../okitweb/static/okit/view/designer/js/artefacts) +directory and contains the definition of the SVG representation for the Artefact. +#### Artifact Dimensions The function is used to calculate the dimensions of the artifact and will be called by container function to determine how much space to reserve for drawing this artifact. If you are building a container artifact (e.g. subnet) then this function will call the dimensions function for all contained artifacts to calculate it's dimensions. @@ -195,40 +166,26 @@ function will call the dimensions function for all contained artifacts to calcul #### Draw ```javascript draw() { - console.groupCollapsed('Drawing ' + this.getArtifactReference() + ' : ' + this.id + ' [' + this.parent_id + ']'); - if (this.isAttached()) { - console.groupEnd(); - return; + console.group('Drawing ' + this.getArtifactReference() + ' : ' + this.id + ' [' + this.parent_id + ']'); + console.info(`Hide Attached : ${okitSettings.hide_attached}.`) + console.info(`Is Attached : ${this.attached}.`) + if (!okitSettings.hide_attached || !this.attached) { + console.info(`${this.display_name} is either not attached and we are displaying attached`); + let svg = super.draw(); } - let svg = drawArtifact(this.getSvgDefinition()); - /* - ** Add Properties Load Event to created svg. We require the definition of the local variable "me" so that it can - ** be used in the function dur to the fact that using "this" in the function will refer to the function not the - ** Artifact. - */ - let me = this; - svg.on("click", function() { - me.loadProperties(); - d3.event.stopPropagation(); - }); console.groupEnd(); - return svg; } // Return Artifact Specific Definition. getSvgDefinition() { - console.groupCollapsed('Getting Definition of ' + this.getArtifactReference() + ' : ' + this.id); let definition = this.newSVGDefinition(this, this.getArtifactReference()); - let dimensions = this.getDimensions(); let first_child = this.getParent().getChildOffset(this.getArtifactReference()); definition['svg']['x'] = first_child.dx; definition['svg']['y'] = first_child.dy; - definition['svg']['width'] = dimensions['width']; - definition['svg']['height'] = dimensions['height']; + definition['svg']['width'] = this.dimensions['width']; + definition['svg']['height'] = this.dimensions['height']; definition['rect']['stroke']['colour'] = stroke_colours.bark; definition['rect']['stroke']['dash'] = 1; - console.info(JSON.stringify(definition, null, 2)); - console.groupEnd(); return definition; } ``` @@ -256,33 +213,76 @@ properties sheet into the "properties" pane and then load each of the form field json element. This method will only need modification if the properties sheet needs to select references of other artifacts. For an example of this see the Subnet class which will load Route Table and security list information. -### Query OCI +### OkitJsonView +To enable the Drag & Drop / Creation functionality you will need to modify the [okitweb/static/okit/view/js/okit_view.js](../okitweb/static/okit/view/js/okit_view.js) +adding +```javascript + // Block Storage + dropBlockStorageVolumeView(target) { + console.info('Drop Block Storage Volume View'); + console.info(target); + let view_artefact = this.newBlockStorageVolume(); + view_artefact.getArtefact().compartment_id = target.id; + console.info('View Artefact'); + console.info(view_artefact) + return view_artefact; + } + newBlockStorageVolume(volume) { + this.block_storage_volumes.push(volume ? new BlockStorageVolumeView(volume, this) : new BlockStorageVolumeView(this.okitjson.newBlockStorageVolume(), this)); + return this.block_storage_volumes[this.block_storage_volumes.length - 1]; + } + getBlockStorageVolumes() { + return this.block_storage_volumes; + } + getBlockStorageVolume(id='') { + for (let artefact of this.getBlockStorageVolumes()) { + if (artefact.id === id) { + return artefact; + } + } + return undefined; + } + deleteBlockStorageVolume(id='') { + this.okitjson.deleteBlockStorageVolume(id); + this.update(); + } + loadBlockStorageVolumes(block_storage_volumes) { + for (const artefact of block_storage_volumes) { + this.block_storage_volumes.push(new BlockStorageVolumeView(new BlockStorageVolume(artefact, this.okitjson), this)); + } + } +``` + +### OkitOCIQuery +To enable query functionality the [okitweb/static/okit/query/oci/js/okit_query.js](../okitweb/static/okit/query/oci/js/okit_query.js) will +need to be modified to provide a new function to query the Artefact and an appropriate call from it's parent should be added. + ```javascript - static query(request = {}, region='') { + queryBlockStorageVolumes(request) { console.info('------------- Block Storage Volume Query --------------------'); console.info('------------- Compartment : ' + request.compartment_id); let me = this; + this.region_query_count[request.region]++; $.ajax({ type: 'get', - url: 'oci/artifacts/BlockStorageVolume', + url: 'oci/artefacts/BlockStorageVolume', dataType: 'text', contentType: 'application/json', data: JSON.stringify(request), success: function(resp) { let response_json = JSON.parse(resp); - regionOkitJson[region].load({block_storage_volumes: response_json}); - for (let artifact of response_json) { - console.info(me.getArtifactReference() + ' Query : ' + artifact.display_name); + regionOkitJson[request.region].load({block_storage_volumes: response_json}); + //okitJsonView.loadBlockStorageVolumes(response_json); + for (let artefact of response_json) { + console.info(artefact.display_name); } - redrawSVGCanvas(region); - $('#' + block_storage_volume_query_cb).prop('checked', true); - hideQueryProgressIfComplete(); + if (request.refresh) {okitJsonView.draw();} + me.region_query_count[request.region]-- && me.isComplete(); }, error: function(xhr, status, error) { console.info('Status : ' + status) console.info('Error : ' + error) - $('#' + block_storage_volume_query_cb).prop('checked', true); - hideQueryProgressIfComplete(); + me.region_query_count[request.region]-- && me.isComplete(); } }); } @@ -290,33 +290,6 @@ For an example of this see the Subnet class which will load Route Table and secu Uses Ajax to call the flask url to initiate an asynchronous query of OCI to retrieve all artifacts and then redraw the svg canvas. On completion it will set the query progress for this artifact as complete. -### Ready Function -```javascript -$(document).ready(function() { - // Setup Search Checkbox - let body = d3.select('#query-progress-tbody'); - let row = body.append('tr'); - let cell = row.append('td'); - cell.append('input') - .attr('type', 'checkbox') - .attr('id', block_storage_volume_query_cb); - cell.append('label').text(BlockStorageVolume.getArtifactReference()); - - // Setup Query Display Form - body = d3.select('#query-oci-tbody'); - row = body.append('tr'); - cell = row.append('td') - .text(BlockStorageVolume.getArtifactReference()); - cell = row.append('td'); - let input = cell.append('input') - .attr('type', 'text') - .attr('class', 'query-filter') - .attr('id', 'block_storage_volume_name_filter') - .attr('name', 'block_storage_volume_name_filter'); -}); -``` -Add the query checkbox to the query progress table. - ## Properties HTML The properties html is a simple piece of html that displays the properties associated with the artifact and as a minimum all required properties must be displayed. The htmi 'id' and 'name' attributes of the input will match the property they diff --git a/documentation/Installation.md b/documentation/Installation.md index f4a1bcca0..bad76e208 100644 --- a/documentation/Installation.md +++ b/documentation/Installation.md @@ -22,22 +22,22 @@ python modules are installed and in addition provide a simple flask server that ## Clone Repository Before the building either the Docker or Vagrant Images the project will nee to be cloned from the Git Repository (or downloaded) and it is recommended that the latest Stable Release be cloned. The latest stable version number if shown in the README -and the associated Release tag is in the format vX.Y.Z hence for the version 0.8.0 the Release tag will be -**v0.8.0**. The command shows how this can be cloned to the local machine. +and the associated Release tag is in the format vX.Y.Z hence for the version 0.9.0 the Release tag will be +**v0.9.0**. The command shows how this can be cloned to the local machine. ```bash -git clone -b v0.8.0 --depth 1 git@github.com:oracle/oci-designer-toolkit.git +git clone -b v0.9.0 --depth 1 git@github.com:oracle/oci-designer-toolkit.git ``` or ```bash -git clone -b v0.8.0 --depth 1 https://github.com/oracle/oci-designer-toolkit.git +git clone -b v0.9.0 --depth 1 https://github.com/oracle/oci-designer-toolkit.git ``` ### Download If you do not have git installed locally the current release of OKIT can be retrieved by downloading it as a zip file from -https://github.com/oracle/oci-designer-toolkit/archive/v0.8.0.zip +https://github.com/oracle/oci-designer-toolkit/archive/v0.9.0.zip ## OCI Config File diff --git a/okitweb/okitOci.py b/okitweb/okitOci.py index 446a69aac..44112ba47 100644 --- a/okitweb/okitOci.py +++ b/okitweb/okitOci.py @@ -8,7 +8,7 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# __author__ = ["Andrew Hopkinson (Oracle Cloud Solutions A-Team)"] __version__ = "1.0.0" -__module__ = "okitPriceEstimator" +__module__ = "okitOci" # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# import os @@ -179,7 +179,7 @@ def ociQuery(): return '404' -@bp.route('/artifacts/', methods=(['GET'])) +@bp.route('/artefacts/', methods=(['GET'])) def ociArtifacts(artifact): logger.info('Artifact : {0:s}'.format(str(artifact))) query_string = request.query_string diff --git a/okitweb/okitWebDesigner.py b/okitweb/okitWebDesigner.py index 5902656ce..b18be60b5 100644 --- a/okitweb/okitWebDesigner.py +++ b/okitweb/okitWebDesigner.py @@ -70,6 +70,23 @@ def getConfigFileValue(section, key, config_file='~/.oci/config'): config.read(abs_config_file) return config[section][key] +def validateConfigFile(config_file='~/.oci/config'): + logger.debug('Config File {0!s:s}'.format(config_file)) + abs_config_file = os.path.expanduser(config_file) + logger.debug('Config File {0!s:s}'.format(abs_config_file)) + config = configparser.ConfigParser() + config.read(abs_config_file) + results = [] + if len(config.sections()) == 0: + results.append('OCI Connect Config file is either missing or empty.') + else: + for section in config: + key_file = config[section]['key_file'] + if not os.path.exists(os.path.expanduser(key_file)): + results.append('[{0!s:s}] Key File {1!s:s} does not exist.'.format(section, key_file)) + logger.info(results) + return results + # # Define Error Handlers # @@ -96,10 +113,10 @@ def handle_exception(error): @bp.route('/designer', methods=(['GET'])) def designer(): - # Read Artifact Specific JavaScript Files - oci_assets_js = sorted(os.listdir(os.path.join(bp.static_folder, 'js', 'oci_artefacts'))) + # Read Artifact Model Specific JavaScript Files + artefact_model_js_files = sorted(os.listdir(os.path.join(bp.static_folder, 'model', 'js', 'artefacts'))) # Read Artifact View Specific JavaScript Files - artefact_view_js_files = sorted(os.listdir(os.path.join(bp.static_folder, 'view', 'designer', 'js', 'artefact'))) + artefact_view_js_files = sorted(os.listdir(os.path.join(bp.static_folder, 'view', 'designer', 'js', 'artefacts'))) # Get Palette Icon Groups / Icons svg_files = [] @@ -176,7 +193,7 @@ def designer(): #Render The Template return render_template('okit/okit_designer.html', - oci_assets_js=oci_assets_js, + artefact_model_js_files=artefact_model_js_files, artefact_view_js_files=artefact_view_js_files, palette_icon_groups=palette_icon_groups, fragment_icons=fragment_icons, @@ -278,6 +295,14 @@ def configRegion(section): else: return 'Unknown Method', 500 +@bp.route('config/validate', methods=(['GET'])) +def configValidate(): + if request.method == 'GET': + response = {"results": validateConfigFile()} + return response + else: + return 'Unknown Method', 500 + @bp.route('validate', methods=(['POST'])) def validateJson(): diff --git a/okitweb/static/okit/css/okit_console.css b/okitweb/static/okit/css/okit_console.css index bef3ff0ec..f49724ac6 100644 --- a/okitweb/static/okit/css/okit_console.css +++ b/okitweb/static/okit/css/okit_console.css @@ -161,6 +161,21 @@ textarea { align-items: center; } +.okit-console-header-right { + display: block; + width: 80px; + text-align: right; + align-items: end; +} + +.okit-console-header-right > a { +} + +.config-icon { + width: 32px; + height: 32px; +} + .okit-console-main { } diff --git a/okitweb/static/okit/css/okit_designer.css b/okitweb/static/okit/css/okit_designer.css index 2fa4802c1..3cc2a56cb 100644 --- a/okitweb/static/okit/css/okit_designer.css +++ b/okitweb/static/okit/css/okit_designer.css @@ -294,3 +294,7 @@ rect.highlight { stroke-width: 3; stroke-dasharray: none; } + +rect.highlight-vnic { + fill: #00cc00; +} \ No newline at end of file diff --git a/okitweb/static/okit/fragments/json/bastion_server.json b/okitweb/static/okit/fragments/json/bastion_server.json index 0099f292d..6cb2869b3 100644 --- a/okitweb/static/okit/fragments/json/bastion_server.json +++ b/okitweb/static/okit/fragments/json/bastion_server.json @@ -1,91 +1,156 @@ { - "title": "Bastion Server", - "description": "Bastion Server Fragment.", + "title": "OKIT OCI Visualiser Json", + "description": "OKIT Generic OCI Json which can be used to generate ansible, terraform, .......", + "okit_version": "0.9.0", "compartments": [ { - "id": "okit-comp-86396bd7-50e7-4935-8747-6dd507b3ddf9", - "name": "okit", - "compartment_id": "okit-comp-86396bd7-50e7-4935-8747-6dd507b3ddf9", - "parent_id": "canvas", + "id": "okit.compartment.49f9e05d-9e95-419c-a7d9-4771935f9f6e", + "freeform_tags": {}, + "defined_tags": {}, + "compartment_id": null, + "name": "okit-comp001", "display_name": "okit-comp001" } ], "autonomous_databases": [], "block_storage_volumes": [], + "containers": [], + "database_systems": [], "dynamic_routing_gateways": [], + "fast_connects": [], "file_storage_systems": [], "instances": [ { - "subnet_id": "okit-sn-a2cada96-6f11-436e-b4f1-41ee96f739dd", - "subnet": "okit-bastion-sn", - "compartment_id": "okit-comp-86396bd7-50e7-4935-8747-6dd507b3ddf9", - "availability_domain": "1", - "id": "okit-in-2f526c6d-3d93-442f-bc15-3d05689406f9", + "id": "okit.undefined.00bb10a8-a694-46b7-a461-e19ee26df8c6", + "freeform_tags": {}, + "defined_tags": {}, "display_name": "okit-bastion-server", - "hostname_label": "okit-in001", - "os": "Oracle Linux", - "version": "7.7", + "availability_domain": "1", + "compartment_id": "okit.compartment.49f9e05d-9e95-419c-a7d9-4771935f9f6e", "shape": "VM.Standard.E2.1", - "boot_volume_size_in_gbs": "50", - "authorized_keys": "", - "cloud_init_yaml": "#cloud-config\nwrite_files:\n # Add aliases to bash (Note: At time of writing the append flag does not appear to be working)\n - path: /etc/.bashrc\n append: true\n content: |\n alias lh='ls -lash'\n alias lt='ls -last'\n alias env='/usr/bin/env | sort'\n alias ssh='/usr/bin/ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oConnectTimeout=10 -i /etc/ssh/ssh_host_rsa_key '\n\nssh_keys:\n rsa_private: |\n -----BEGIN OPENSSH PRIVATE KEY-----\n Add Private Key\n -----END OPENSSH PRIVATE KEY-----\n rsa_public: ssh-rsa Add Public Key\n\nruncmd:\n # Set Private Key to read everyone\n - sudo chmod a+r /etc/ssh/ssh_host_rsa_key*\n # Add additional environment information because append does not appear to work in write_file\n - sudo bash -c \"echo 'source /etc/.bashrc' >> /etc/bashrc\"\n\nfinal_message: \"**** The Bastion Instance is finally up, after $UPTIME seconds ****\"\n", + "fault_domain": "", + "agent_config": { + "is_monitoring_disabled": false, + "is_management_disabled": false + }, + "vnics": [ + { + "subnet_id": "okit.subnet.5ce7287f-3c85-4546-81c4-f456850a2a8d", + "hostname_label": "okit-in001", + "assign_public_ip": true, + "skip_source_dest_check": false, + "nsg_ids": [] + } + ], + "source_details": { + "os": "Oracle Linux", + "version": "7.7", + "boot_volume_size_in_gbs": "50", + "source_type": "image" + }, + "metadata": { + "ssh_authorized_keys": "", + "user_data": "#cloud-config\nwrite_files:\n # Add aliases to bash (Note: At time of writing the append flag does not appear to be working)\n - path: /etc/.bashrc\n append: true\n content: |\n alias lh='ls -lash'\n alias lt='ls -last'\n alias env='/usr/bin/env | sort'\n alias ssh='/usr/bin/ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oConnectTimeout=10 -i /etc/ssh/ssh_host_rsa_key '\n\nssh_keys:\n rsa_private: |\n -----BEGIN OPENSSH PRIVATE KEY-----\n Add Private Key\n -----END OPENSSH PRIVATE KEY-----\n rsa_public: ssh-rsa Add Public Key\n\nruncmd:\n # Set Private Key to read everyone\n - sudo chmod a+r /etc/ssh/ssh_host_rsa_key*\n # Add additional environment information because append does not appear to work in write_file\n - sudo bash -c \"echo 'source /etc/.bashrc' >> /etc/bashrc\"\n\nfinal_message: \"**** The Bastion Instance is finally up, after $UPTIME seconds ****\"\n" + }, "block_storage_volume_ids": [], + "object_storage_bucket_ids": [], + "autonomous_database_ids": [], + "preserve_boot_volume": false, + "is_pv_encryption_in_transit_enabled": false, + "subnet": "okit-bastion-sn", "block_storage_volumes": [], - "subnet_ids": [], - "parent_id": "okit-sn-a2cada96-6f11-436e-b4f1-41ee96f739dd" + "primary_vnic": { + "subnet_id": "okit.subnet.5ce7287f-3c85-4546-81c4-f456850a2a8d", + "hostname_label": "okit-in001", + "assign_public_ip": true, + "skip_source_dest_check": false, + "nsg_ids": [] + } } ], "internet_gateways": [ { - "vcn_id": "okit-vcn-a4b9e410-9527-43f2-8d46-d953ab1149b7", - "virtual_cloud_network": "okit-bastion-vcn", - "compartment_id": "okit-comp-86396bd7-50e7-4935-8747-6dd507b3ddf9", - "id": "okit-ig-d77f1212-81d7-4524-8927-722904202641", + "id": "okit.internetgateway.922b0191-85f9-46a2-8309-9d12de9ec8aa", + "freeform_tags": {}, + "defined_tags": {}, "display_name": "okit-bastion-ig", - "parent_id": "okit-vcn-a4b9e410-9527-43f2-8d46-d953ab1149b7" + "compartment_id": "okit.compartment.49f9e05d-9e95-419c-a7d9-4771935f9f6e", + "vcn_id": "okit.virtualcloudnetwork.d7bfcd1f-fb58-43fa-99b7-c8271819ace3", + "enabled": true, + "virtual_cloud_network": "okit-bastion-vcn" } ], "load_balancers": [], + "local_peering_gateways": [], "nat_gateways": [], + "network_security_groups": [], "object_storage_buckets": [], + "remote_peering_gateways": [], "route_tables": [ { - "vcn_id": "okit-vcn-a4b9e410-9527-43f2-8d46-d953ab1149b7", - "virtual_cloud_network": "okit-bastion-vcn", - "compartment_id": "okit-comp-86396bd7-50e7-4935-8747-6dd507b3ddf9", - "id": "okit-rt-0ec379c2-9a1b-4a01-9203-9b5f3cc283c7", + "id": "okit.routetable.04fc2d1b-c707-4456-8a0c-30f8507a0624", + "freeform_tags": {}, + "defined_tags": {}, "display_name": "okit-bastion-rt", + "compartment_id": "okit.compartment.49f9e05d-9e95-419c-a7d9-4771935f9f6e", + "vcn_id": "okit.virtualcloudnetwork.d7bfcd1f-fb58-43fa-99b7-c8271819ace3", "route_rules": [ { "destination_type": "CIDR_BLOCK", "destination": "0.0.0.0/0", - "network_entity_id": "okit-ig-d77f1212-81d7-4524-8927-722904202641" + "network_entity_id": "okit.internetgateway.922b0191-85f9-46a2-8309-9d12de9ec8aa", + "target_type": "internet_gateways" } ], - "parent_id": "okit-vcn-a4b9e410-9527-43f2-8d46-d953ab1149b7" + "virtual_cloud_network": "okit-bastion-vcn" } ], "security_lists": [ { - "vcn_id": "okit-vcn-a4b9e410-9527-43f2-8d46-d953ab1149b7", - "virtual_cloud_network": "okit-bastion-vcn", - "compartment_id": "okit-comp-86396bd7-50e7-4935-8747-6dd507b3ddf9", - "id": "okit-sl-ff510077-a9af-41be-8fad-f6430c2a7732", + "id": "okit.securitylist.6ce13e7b-4609-4f00-b641-7f4a99e6d61f", + "freeform_tags": {}, + "defined_tags": {}, "display_name": "okit-bastion-sl", + "compartment_id": "okit.compartment.49f9e05d-9e95-419c-a7d9-4771935f9f6e", + "vcn_id": "okit.virtualcloudnetwork.d7bfcd1f-fb58-43fa-99b7-c8271819ace3", "egress_security_rules": [ { "destination": "0.0.0.0/0", "destination_type": "CIDR_BLOCK", - "icmp_options": null, + "icmp_options": { + "code": "", + "type": "" + }, "is_stateless": false, "protocol": "all", - "tcp_options": null, - "udp_options": null + "tcp_options": { + "source_port_range": { + "min": "", + "max": "" + }, + "destination_port_range": { + "min": "", + "max": "" + } + }, + "udp_options": { + "source_port_range": { + "min": "", + "max": "" + }, + "destination_port_range": { + "min": "", + "max": "" + } + } } ], "ingress_security_rules": [ { - "icmp_options": null, + "icmp_options": { + "code": "", + "type": "" + }, "is_stateless": false, "protocol": "6", "source": "0.0.0.0/0", @@ -95,9 +160,21 @@ "max": 22, "min": 22 }, - "source_port_range": null + "source_port_range": { + "min": "", + "max": "" + } }, - "udp_options": null + "udp_options": { + "source_port_range": { + "min": "", + "max": "" + }, + "destination_port_range": { + "min": "", + "max": "" + } + } }, { "icmp_options": { @@ -108,8 +185,26 @@ "protocol": "1", "source": "0.0.0.0/0", "source_type": "CIDR_BLOCK", - "tcp_options": null, - "udp_options": null + "tcp_options": { + "source_port_range": { + "min": "", + "max": "" + }, + "destination_port_range": { + "min": "", + "max": "" + } + }, + "udp_options": { + "source_port_range": { + "min": "", + "max": "" + }, + "destination_port_range": { + "min": "", + "max": "" + } + } }, { "icmp_options": { @@ -120,41 +215,66 @@ "protocol": "1", "source": "10.0.0.0/16", "source_type": "CIDR_BLOCK", - "tcp_options": null, - "udp_options": null + "tcp_options": { + "source_port_range": { + "min": "", + "max": "" + }, + "destination_port_range": { + "min": "", + "max": "" + } + }, + "udp_options": { + "source_port_range": { + "min": "", + "max": "" + }, + "destination_port_range": { + "min": "", + "max": "" + } + } } ], - "parent_id": "okit-vcn-a4b9e410-9527-43f2-8d46-d953ab1149b7" + "virtual_cloud_network": "okit-bastion-vcn" } ], "service_gateways": [], "subnets": [ { - "vcn_id": "okit-vcn-a4b9e410-9527-43f2-8d46-d953ab1149b7", - "virtual_cloud_network": "okit-bastion-vcn", - "compartment_id": "okit-comp-86396bd7-50e7-4935-8747-6dd507b3ddf9", - "id": "okit-sn-a2cada96-6f11-436e-b4f1-41ee96f739dd", + "id": "okit.subnet.5ce7287f-3c85-4546-81c4-f456850a2a8d", + "freeform_tags": {}, + "defined_tags": {}, "display_name": "okit-bastion-sn", - "cidr_block": "10.0.0.0/24", + "compartment_id": "okit.compartment.49f9e05d-9e95-419c-a7d9-4771935f9f6e", + "vcn_id": "okit.virtualcloudnetwork.d7bfcd1f-fb58-43fa-99b7-c8271819ace3", + "cidr_block": "10.1.0.0/24", "dns_label": "bastionsn", "prohibit_public_ip_on_vnic": false, - "route_table": "", - "route_table_id": "okit-rt-0ec379c2-9a1b-4a01-9203-9b5f3cc283c7", - "security_lists": [], + "route_table_id": "okit.routetable.04fc2d1b-c707-4456-8a0c-30f8507a0624", "security_list_ids": [ - "okit-sl-ff510077-a9af-41be-8fad-f6430c2a7732" + "okit.securitylist.6ce13e7b-4609-4f00-b641-7f4a99e6d61f" ], - "parent_id": "okit-vcn-a4b9e410-9527-43f2-8d46-d953ab1149b7" + "availability_domain": "0", + "is_ipv6enabled": false, + "ipv6cidr_block": "", + "virtual_cloud_network": "okit-bastion-vcn", + "route_table": "", + "security_lists": [] } ], "virtual_cloud_networks": [ { - "compartment_id": "okit-comp-86396bd7-50e7-4935-8747-6dd507b3ddf9", - "id": "okit-vcn-a4b9e410-9527-43f2-8d46-d953ab1149b7", + "id": "okit.virtualcloudnetwork.d7bfcd1f-fb58-43fa-99b7-c8271819ace3", + "freeform_tags": {}, + "defined_tags": {}, "display_name": "okit-bastion-vcn", - "cidr_block": "10.0.0.0/16", + "compartment_id": "okit.compartment.49f9e05d-9e95-419c-a7d9-4771935f9f6e", + "cidr_block": "10.1.0.0/16", "dns_label": "bastionvcn", - "parent_id": "okit-comp-86396bd7-50e7-4935-8747-6dd507b3ddf9" + "is_ipv6enabled": false, + "ipv6cidr_block": "" } ] } \ No newline at end of file diff --git a/okitweb/static/okit/fragments/json/load_balanced_nginx.json b/okitweb/static/okit/fragments/json/load_balanced_nginx.json index 94830d419..b0ea42341 100644 --- a/okitweb/static/okit/fragments/json/load_balanced_nginx.json +++ b/okitweb/static/okit/fragments/json/load_balanced_nginx.json @@ -1,203 +1,406 @@ { - "title": "Load Balanced Nginx Instances", - "description": "Four load balanced nginx servers", + "title": "OKIT OCI Visualiser Json", + "description": "OKIT Generic OCI Json which can be used to generate ansible, terraform, .......", + "okit_version": "0.9.0", "compartments": [ { - "id": "okit-comp-94636a16-5595-4a4b-b819-6aff3bee6536", - "name": "okit", - "parent_id": "canvas", - "compartment_id": "okit-comp-94636a16-5595-4a4b-b819-6aff3bee6536", + "id": "okit.compartment.87b90aa7-4c56-4800-b4d7-e404b89c6ceb", + "freeform_tags": {}, + "defined_tags": {}, + "compartment_id": null, + "name": "okit-comp001", "display_name": "okit-comp001" } ], - "open_compartment_index": 0, - "virtual_cloud_networks": [ - { - "compartment_id": "okit-comp-94636a16-5595-4a4b-b819-6aff3bee6536", - "id": "okit-vcn-dcb74d63-9ae8-44c5-9913-1ba70e11d2b8", - "display_name": "okit-vcn001", - "cidr_block": "10.0.0.0/16", - "dns_label": "vcn001", - "parent_id": "okit-comp-94636a16-5595-4a4b-b819-6aff3bee6536" - } - ], - "subnets": [ - { - "vcn_id": "okit-vcn-dcb74d63-9ae8-44c5-9913-1ba70e11d2b8", - "virtual_cloud_network": "okit-vcn001", - "compartment_id": "okit-comp-94636a16-5595-4a4b-b819-6aff3bee6536", - "id": "okit-sn-e8536648-721d-473f-828e-e6cfaa5c59eb", - "display_name": "okit-sn001", - "cidr_block": "10.0.0.0/24", - "dns_label": "sn001", - "prohibit_public_ip_on_vnic": false, - "route_table": "", - "route_table_id": "okit-rt-9634a102-9de8-4d3a-8124-821f036e0ac0", - "security_lists": [], - "security_list_ids": [ - "okit-sl-912892db-b457-441e-b2c1-9ef9691154d2" - ], - "parent_id": "okit-vcn-dcb74d63-9ae8-44c5-9913-1ba70e11d2b8" - } - ], - "route_tables": [ - { - "vcn_id": "okit-vcn-dcb74d63-9ae8-44c5-9913-1ba70e11d2b8", - "virtual_cloud_network": "okit-vcn001", - "compartment_id": "okit-comp-94636a16-5595-4a4b-b819-6aff3bee6536", - "id": "okit-rt-9634a102-9de8-4d3a-8124-821f036e0ac0", - "display_name": "okit-rt001", - "route_rules": [ - { - "destination_type": "CIDR_BLOCK", - "destination": "0.0.0.0/0", - "network_entity_id": "okit-ig-9b4a5d64-9346-4c7f-a97a-a0c323500224" - } - ], - "parent_id": "okit-vcn-dcb74d63-9ae8-44c5-9913-1ba70e11d2b8" - } - ], - "security_lists": [ - { - "vcn_id": "okit-vcn-dcb74d63-9ae8-44c5-9913-1ba70e11d2b8", - "virtual_cloud_network": "okit-vcn001", - "compartment_id": "okit-comp-94636a16-5595-4a4b-b819-6aff3bee6536", - "id": "okit-sl-912892db-b457-441e-b2c1-9ef9691154d2", - "display_name": "okit-sl001", - "egress_security_rules": [ - { - "protocol": "all", - "is_stateless": false, - "destination_type": "CIDR_BLOCK", - "destination": "0.0.0.0/0" - } - ], - "ingress_security_rules": [ - { - "protocol": "all", - "is_stateless": false, - "source_type": "CIDR_BLOCK", - "source": "0.0.0.0/0" - } - ], - "parent_id": "okit-vcn-dcb74d63-9ae8-44c5-9913-1ba70e11d2b8" - } - ], + "autonomous_databases": [], + "block_storage_volumes": [], + "containers": [], + "database_systems": [], + "dynamic_routing_gateways": [], + "fast_connects": [], + "file_storage_systems": [], "instances": [ { - "subnet_id": "okit-sn-e8536648-721d-473f-828e-e6cfaa5c59eb", - "subnet": "okit-sn001", - "compartment_id": "okit-comp-94636a16-5595-4a4b-b819-6aff3bee6536", + "id": "okit.undefined.db39f276-9616-47db-8008-d7510e65a41e", + "freeform_tags": {}, + "defined_tags": {}, + "display_name": "nginx-server-01", "availability_domain": "1", - "id": "okit-in-ee74310b-457b-4b18-b566-ae7351a17d7a", - "display_name": "okit-in001", - "hostname_label": "okit-in001", - "os": "Oracle Linux", - "version": "7.7", + "compartment_id": "okit.compartment.87b90aa7-4c56-4800-b4d7-e404b89c6ceb", "shape": "VM.Standard2.1", - "boot_volume_size_in_gbs": "50", - "authorized_keys": "", - "cloud_init_yaml": "#cloud-config\npackages:\n - nginx\n - oci-utils\n - python36\n - python-oci-cli\n\nwrite_files:\n # Add aliases to bash (Note: At time of writing the append flag does not appear to be working)\n - path: /etc/.bashrc\n append: true\n content: |\n alias lh='ls -lash'\n alias lt='ls -last'\n alias env='/usr/bin/env | sort'\n alias whatsmyip='curl -X GET https://www.whatismyip.net | grep ipaddress'\n # Create nginx index.html\n - path: /usr/share/nginx/html/index1.html\n permissions: '0644'\n content: |\n \n \n OCI Loadbalancer backend {hostname}\n \n \n \n \n \n

OCI Regional Subnet Loadbalancer Backend {hostname}

\n \n \n\nruncmd:\n # Enable nginx\n - sudo systemctl enable nginx.service\n - sudo cp -v /usr/share/nginx/html/index1.html /usr/share/nginx/html/index.html\n - sudo sed -i \"s/{hostname}/$(hostname)/g\" /usr/share/nginx/html/index.html\n - sudo systemctl start nginx.service\n # Set Firewall Rules\n - sudo firewall-offline-cmd --add-port=80/tcp\n - sudo systemctl restart firewalld\n # Add additional environment information because append does not appear to work in write_file\n - sudo bash -c \"echo 'source /etc/.bashrc' >> /etc/bashrc\"\n\nfinal_message: \"**** The system is finally up, after $UPTIME seconds ****\"\n", + "fault_domain": "", + "agent_config": { + "is_monitoring_disabled": false, + "is_management_disabled": false + }, + "vnics": [ + { + "subnet_id": "okit.undefined.d3967bc6-40e8-42d3-adaf-9c5f374bca0b", + "hostname_label": "nginx001", + "assign_public_ip": true, + "skip_source_dest_check": false, + "nsg_ids": [] + } + ], + "source_details": { + "os": "Oracle Linux", + "version": "7.7", + "boot_volume_size_in_gbs": "50", + "source_type": "image" + }, + "metadata": { + "ssh_authorized_keys": "", + "user_data": "#cloud-config\npackages:\n - nginx\n - oci-utils\n - python36\n - python-oci-cli\n\nwrite_files:\n # Add aliases to bash (Note: At time of writing the append flag does not appear to be working)\n - path: /etc/.bashrc\n append: true\n content: |\n alias lh='ls -lash'\n alias lt='ls -last'\n alias env='/usr/bin/env | sort'\n alias whatsmyip='curl -X GET https://www.whatismyip.net | grep ipaddress'\n # Create nginx index.html\n - path: /usr/share/nginx/html/index1.html\n permissions: '0644'\n content: |\n \n \n OCI Loadbalancer backend {hostname}\n \n \n \n \n \n

OCI Regional Subnet Loadbalancer Backend {hostname}

\n \n \n\nruncmd:\n # Enable nginx\n - sudo systemctl enable nginx.service\n - sudo cp -v /usr/share/nginx/html/index1.html /usr/share/nginx/html/index.html\n - sudo sed -i \"s/{hostname}/$(hostname)/g\" /usr/share/nginx/html/index.html\n - sudo systemctl start nginx.service\n # Set Firewall Rules\n - sudo firewall-offline-cmd --add-port=80/tcp\n - sudo systemctl restart firewalld\n # Add additional environment information because append does not appear to work in write_file\n - sudo bash -c \"echo 'source /etc/.bashrc' >> /etc/bashrc\"\n\nfinal_message: \"**** The system is finally up, after $UPTIME seconds ****\"\n" + }, "block_storage_volume_ids": [], + "object_storage_bucket_ids": [], + "autonomous_database_ids": [], + "preserve_boot_volume": false, + "is_pv_encryption_in_transit_enabled": false, + "subnet": "okit-sn001", "block_storage_volumes": [], - "parent_id": "okit-sn-e8536648-721d-473f-828e-e6cfaa5c59eb", "virtual_cloud_network": "okit-sn001", - "subnet_ids": [] + "primary_vnic": { + "subnet_id": "okit.undefined.d3967bc6-40e8-42d3-adaf-9c5f374bca0b", + "hostname_label": "nginx001", + "assign_public_ip": true, + "skip_source_dest_check": false, + "nsg_ids": [] + }, + "name": "nginx-server-01" }, { - "subnet_id": "okit-sn-e8536648-721d-473f-828e-e6cfaa5c59eb", - "subnet": "okit-sn001", - "compartment_id": "okit-comp-94636a16-5595-4a4b-b819-6aff3bee6536", + "id": "okit.undefined.00e1e3e6-edf0-4102-ab24-8a47e749c5ea", + "freeform_tags": {}, + "defined_tags": {}, + "display_name": "nginx-server-02", "availability_domain": "1", - "id": "okit-in-6ce3195d-7119-4666-8966-6555874819a8", - "display_name": "okit-in002", - "hostname_label": "okit-in002", - "os": "Oracle Linux", - "version": "7.7", + "compartment_id": "okit.compartment.87b90aa7-4c56-4800-b4d7-e404b89c6ceb", "shape": "VM.Standard.E2.1", - "boot_volume_size_in_gbs": "50", - "authorized_keys": "", - "cloud_init_yaml": "#cloud-config\npackages:\n - nginx\n - oci-utils\n - python36\n - python-oci-cli\n\nwrite_files:\n # Add aliases to bash (Note: At time of writing the append flag does not appear to be working)\n - path: /etc/.bashrc\n append: true\n content: |\n alias lh='ls -lash'\n alias lt='ls -last'\n alias env='/usr/bin/env | sort'\n alias whatsmyip='curl -X GET https://www.whatismyip.net | grep ipaddress'\n # Create nginx index.html\n - path: /usr/share/nginx/html/index1.html\n permissions: '0644'\n content: |\n \n \n OCI Loadbalancer backend {hostname}\n \n \n \n \n \n

OCI Regional Subnet Loadbalancer Backend {hostname}

\n \n \n\nruncmd:\n # Enable nginx\n - sudo systemctl enable nginx.service\n - sudo cp -v /usr/share/nginx/html/index1.html /usr/share/nginx/html/index.html\n - sudo sed -i \"s/{hostname}/$(hostname)/g\" /usr/share/nginx/html/index.html\n - sudo systemctl start nginx.service\n # Set Firewall Rules\n - sudo firewall-offline-cmd --add-port=80/tcp\n - sudo systemctl restart firewalld\n # Add additional environment information because append does not appear to work in write_file\n - sudo bash -c \"echo 'source /etc/.bashrc' >> /etc/bashrc\"\n\nfinal_message: \"**** The system is finally up, after $UPTIME seconds ****\"\n", + "fault_domain": "", + "agent_config": { + "is_monitoring_disabled": false, + "is_management_disabled": false + }, + "vnics": [ + { + "subnet_id": "okit.undefined.d3967bc6-40e8-42d3-adaf-9c5f374bca0b", + "hostname_label": "nginx002", + "assign_public_ip": true, + "skip_source_dest_check": false, + "nsg_ids": [] + } + ], + "source_details": { + "os": "Oracle Linux", + "version": "7.7", + "boot_volume_size_in_gbs": "50", + "source_type": "image" + }, + "metadata": { + "ssh_authorized_keys": "", + "user_data": "#cloud-config\npackages:\n - nginx\n - oci-utils\n - python36\n - python-oci-cli\n\nwrite_files:\n # Add aliases to bash (Note: At time of writing the append flag does not appear to be working)\n - path: /etc/.bashrc\n append: true\n content: |\n alias lh='ls -lash'\n alias lt='ls -last'\n alias env='/usr/bin/env | sort'\n alias whatsmyip='curl -X GET https://www.whatismyip.net | grep ipaddress'\n # Create nginx index.html\n - path: /usr/share/nginx/html/index1.html\n permissions: '0644'\n content: |\n \n \n OCI Loadbalancer backend {hostname}\n \n \n \n \n \n

OCI Regional Subnet Loadbalancer Backend {hostname}

\n \n \n\nruncmd:\n # Enable nginx\n - sudo systemctl enable nginx.service\n - sudo cp -v /usr/share/nginx/html/index1.html /usr/share/nginx/html/index.html\n - sudo sed -i \"s/{hostname}/$(hostname)/g\" /usr/share/nginx/html/index.html\n - sudo systemctl start nginx.service\n # Set Firewall Rules\n - sudo firewall-offline-cmd --add-port=80/tcp\n - sudo systemctl restart firewalld\n # Add additional environment information because append does not appear to work in write_file\n - sudo bash -c \"echo 'source /etc/.bashrc' >> /etc/bashrc\"\n\nfinal_message: \"**** The system is finally up, after $UPTIME seconds ****\"\n" + }, "block_storage_volume_ids": [], + "object_storage_bucket_ids": [], + "autonomous_database_ids": [], + "preserve_boot_volume": false, + "is_pv_encryption_in_transit_enabled": false, + "subnet": "okit-sn001", "block_storage_volumes": [], - "parent_id": "okit-sn-e8536648-721d-473f-828e-e6cfaa5c59eb", "virtual_cloud_network": "okit-sn001", - "subnet_ids": [] + "primary_vnic": { + "subnet_id": "okit.undefined.d3967bc6-40e8-42d3-adaf-9c5f374bca0b", + "hostname_label": "nginx002", + "assign_public_ip": true, + "skip_source_dest_check": false, + "nsg_ids": [] + }, + "name": "nginx-server-02" }, { - "subnet_id": "okit-sn-e8536648-721d-473f-828e-e6cfaa5c59eb", - "subnet": "okit-sn001", - "compartment_id": "okit-comp-94636a16-5595-4a4b-b819-6aff3bee6536", + "id": "okit.undefined.933abf36-5c79-44b8-9b5a-d2f544b7d9f4", + "freeform_tags": {}, + "defined_tags": {}, + "display_name": "nginx-server-03", "availability_domain": "1", - "id": "okit-in-2195d4b3-07bc-4a57-a06b-627cf69b8c46", - "display_name": "okit-in003", - "hostname_label": "okit-in003", - "os": "Oracle Linux", - "version": "7.7", + "compartment_id": "okit.compartment.87b90aa7-4c56-4800-b4d7-e404b89c6ceb", "shape": "VM.Standard.E2.1", - "boot_volume_size_in_gbs": "50", - "authorized_keys": "", - "cloud_init_yaml": "#cloud-config\npackages:\n - nginx\n - oci-utils\n - python36\n - python-oci-cli\n\nwrite_files:\n # Add aliases to bash (Note: At time of writing the append flag does not appear to be working)\n - path: /etc/.bashrc\n append: true\n content: |\n alias lh='ls -lash'\n alias lt='ls -last'\n alias env='/usr/bin/env | sort'\n alias whatsmyip='curl -X GET https://www.whatismyip.net | grep ipaddress'\n # Create nginx index.html\n - path: /usr/share/nginx/html/index1.html\n permissions: '0644'\n content: |\n \n \n OCI Loadbalancer backend {hostname}\n \n \n \n \n \n

OCI Regional Subnet Loadbalancer Backend {hostname}

\n \n \n\nruncmd:\n # Enable nginx\n - sudo systemctl enable nginx.service\n - sudo cp -v /usr/share/nginx/html/index1.html /usr/share/nginx/html/index.html\n - sudo sed -i \"s/{hostname}/$(hostname)/g\" /usr/share/nginx/html/index.html\n - sudo systemctl start nginx.service\n # Set Firewall Rules\n - sudo firewall-offline-cmd --add-port=80/tcp\n - sudo systemctl restart firewalld\n # Add additional environment information because append does not appear to work in write_file\n - sudo bash -c \"echo 'source /etc/.bashrc' >> /etc/bashrc\"\n\nfinal_message: \"**** The system is finally up, after $UPTIME seconds ****\"\n", + "fault_domain": "", + "agent_config": { + "is_monitoring_disabled": false, + "is_management_disabled": false + }, + "vnics": [ + { + "subnet_id": "okit.undefined.d3967bc6-40e8-42d3-adaf-9c5f374bca0b", + "hostname_label": "nginx003", + "assign_public_ip": true, + "skip_source_dest_check": false, + "nsg_ids": [] + } + ], + "source_details": { + "os": "Oracle Linux", + "version": "7.7", + "boot_volume_size_in_gbs": "50", + "source_type": "image" + }, + "metadata": { + "ssh_authorized_keys": "", + "user_data": "#cloud-config\npackages:\n - nginx\n - oci-utils\n - python36\n - python-oci-cli\n\nwrite_files:\n # Add aliases to bash (Note: At time of writing the append flag does not appear to be working)\n - path: /etc/.bashrc\n append: true\n content: |\n alias lh='ls -lash'\n alias lt='ls -last'\n alias env='/usr/bin/env | sort'\n alias whatsmyip='curl -X GET https://www.whatismyip.net | grep ipaddress'\n # Create nginx index.html\n - path: /usr/share/nginx/html/index1.html\n permissions: '0644'\n content: |\n \n \n OCI Loadbalancer backend {hostname}\n \n \n \n \n \n

OCI Regional Subnet Loadbalancer Backend {hostname}

\n \n \n\nruncmd:\n # Enable nginx\n - sudo systemctl enable nginx.service\n - sudo cp -v /usr/share/nginx/html/index1.html /usr/share/nginx/html/index.html\n - sudo sed -i \"s/{hostname}/$(hostname)/g\" /usr/share/nginx/html/index.html\n - sudo systemctl start nginx.service\n # Set Firewall Rules\n - sudo firewall-offline-cmd --add-port=80/tcp\n - sudo systemctl restart firewalld\n # Add additional environment information because append does not appear to work in write_file\n - sudo bash -c \"echo 'source /etc/.bashrc' >> /etc/bashrc\"\n\nfinal_message: \"**** The system is finally up, after $UPTIME seconds ****\"\n" + }, "block_storage_volume_ids": [], + "object_storage_bucket_ids": [], + "autonomous_database_ids": [], + "preserve_boot_volume": false, + "is_pv_encryption_in_transit_enabled": false, + "subnet": "okit-sn001", "block_storage_volumes": [], - "parent_id": "okit-sn-e8536648-721d-473f-828e-e6cfaa5c59eb", "virtual_cloud_network": "okit-sn001", - "subnet_ids": [] + "primary_vnic": { + "subnet_id": "okit.undefined.d3967bc6-40e8-42d3-adaf-9c5f374bca0b", + "hostname_label": "nginx003", + "assign_public_ip": true, + "skip_source_dest_check": false, + "nsg_ids": [] + }, + "name": "nginx-server-03" }, { - "subnet_id": "okit-sn-e8536648-721d-473f-828e-e6cfaa5c59eb", - "subnet": "okit-sn001", - "compartment_id": "okit-comp-94636a16-5595-4a4b-b819-6aff3bee6536", + "id": "okit.undefined.6152088d-4dbb-4d52-bf7c-9c0a2efb5f5d", + "freeform_tags": {}, + "defined_tags": {}, + "display_name": "nginx-server-04", "availability_domain": "1", - "id": "okit-in-f59e4c4c-012f-45de-a81a-8772131f1df1", - "display_name": "okit-in004", - "hostname_label": "okit-in004", - "os": "Oracle Linux", - "version": "7.7", + "compartment_id": "okit.compartment.87b90aa7-4c56-4800-b4d7-e404b89c6ceb", "shape": "VM.Standard.E2.1", - "boot_volume_size_in_gbs": "50", - "authorized_keys": "", - "cloud_init_yaml": "#cloud-config\npackages:\n - nginx\n - oci-utils\n - python36\n - python-oci-cli\n\nwrite_files:\n # Add aliases to bash (Note: At time of writing the append flag does not appear to be working)\n - path: /etc/.bashrc\n append: true\n content: |\n alias lh='ls -lash'\n alias lt='ls -last'\n alias env='/usr/bin/env | sort'\n alias whatsmyip='curl -X GET https://www.whatismyip.net | grep ipaddress'\n # Create nginx index.html\n - path: /usr/share/nginx/html/index1.html\n permissions: '0644'\n content: |\n \n \n OCI Loadbalancer backend {hostname}\n \n \n \n \n \n

OCI Regional Subnet Loadbalancer Backend {hostname}

\n \n \n\nruncmd:\n # Enable nginx\n - sudo systemctl enable nginx.service\n - sudo cp -v /usr/share/nginx/html/index1.html /usr/share/nginx/html/index.html\n - sudo sed -i \"s/{hostname}/$(hostname)/g\" /usr/share/nginx/html/index.html\n - sudo systemctl start nginx.service\n # Set Firewall Rules\n - sudo firewall-offline-cmd --add-port=80/tcp\n - sudo systemctl restart firewalld\n # Add additional environment information because append does not appear to work in write_file\n - sudo bash -c \"echo 'source /etc/.bashrc' >> /etc/bashrc\"\n\nfinal_message: \"**** The system is finally up, after $UPTIME seconds ****\"\n", + "fault_domain": "", + "agent_config": { + "is_monitoring_disabled": false, + "is_management_disabled": false + }, + "vnics": [ + { + "subnet_id": "okit.undefined.d3967bc6-40e8-42d3-adaf-9c5f374bca0b", + "hostname_label": "nginx004", + "assign_public_ip": true, + "skip_source_dest_check": false, + "nsg_ids": [] + } + ], + "source_details": { + "os": "Oracle Linux", + "version": "7.7", + "boot_volume_size_in_gbs": "50", + "source_type": "image" + }, + "metadata": { + "ssh_authorized_keys": "", + "user_data": "#cloud-config\npackages:\n - nginx\n - oci-utils\n - python36\n - python-oci-cli\n\nwrite_files:\n # Add aliases to bash (Note: At time of writing the append flag does not appear to be working)\n - path: /etc/.bashrc\n append: true\n content: |\n alias lh='ls -lash'\n alias lt='ls -last'\n alias env='/usr/bin/env | sort'\n alias whatsmyip='curl -X GET https://www.whatismyip.net | grep ipaddress'\n # Create nginx index.html\n - path: /usr/share/nginx/html/index1.html\n permissions: '0644'\n content: |\n \n \n OCI Loadbalancer backend {hostname}\n \n \n \n \n \n

OCI Regional Subnet Loadbalancer Backend {hostname}

\n \n \n\nruncmd:\n # Enable nginx\n - sudo systemctl enable nginx.service\n - sudo cp -v /usr/share/nginx/html/index1.html /usr/share/nginx/html/index.html\n - sudo sed -i \"s/{hostname}/$(hostname)/g\" /usr/share/nginx/html/index.html\n - sudo systemctl start nginx.service\n # Set Firewall Rules\n - sudo firewall-offline-cmd --add-port=80/tcp\n - sudo systemctl restart firewalld\n # Add additional environment information because append does not appear to work in write_file\n - sudo bash -c \"echo 'source /etc/.bashrc' >> /etc/bashrc\"\n\nfinal_message: \"**** The system is finally up, after $UPTIME seconds ****\"\n" + }, "block_storage_volume_ids": [], + "object_storage_bucket_ids": [], + "autonomous_database_ids": [], + "preserve_boot_volume": false, + "is_pv_encryption_in_transit_enabled": false, + "subnet": "okit-sn001", "block_storage_volumes": [], - "parent_id": "okit-sn-e8536648-721d-473f-828e-e6cfaa5c59eb", "virtual_cloud_network": "okit-sn001", - "subnet_ids": [] + "primary_vnic": { + "subnet_id": "okit.undefined.d3967bc6-40e8-42d3-adaf-9c5f374bca0b", + "hostname_label": "nginx004", + "assign_public_ip": true, + "skip_source_dest_check": false, + "nsg_ids": [] + }, + "name": "nginx-server-04" + } + ], + "internet_gateways": [ + { + "id": "okit.undefined.5aa22dc1-f626-4b67-800b-8c22ae549d05", + "freeform_tags": {}, + "defined_tags": {}, + "display_name": "okit-ig001", + "compartment_id": "okit.compartment.87b90aa7-4c56-4800-b4d7-e404b89c6ceb", + "vcn_id": "okit.undefined.3e3f1f86-16f6-4433-963f-b52d70ba2452", + "enabled": true, + "virtual_cloud_network": "okit-vcn001" } ], "load_balancers": [ { + "id": "okit.undefined.a63bb5a1-197e-4050-bb6c-351f04fdd0c9", + "freeform_tags": {}, + "defined_tags": {}, + "display_name": "okit-lb001", + "compartment_id": "okit.compartment.87b90aa7-4c56-4800-b4d7-e404b89c6ceb", "subnet_ids": [ - "okit-sn-e8536648-721d-473f-828e-e6cfaa5c59eb" + "okit.undefined.d3967bc6-40e8-42d3-adaf-9c5f374bca0b" + ], + "is_private": false, + "shape": "100Mbps", + "protocol": "HTTP", + "port": "80", + "instance_ids": [ + "okit.undefined.db39f276-9616-47db-8008-d7510e65a41e", + "okit.undefined.00e1e3e6-edf0-4102-ab24-8a47e749c5ea", + "okit.undefined.933abf36-5c79-44b8-9b5a-d2f544b7d9f4", + "okit.undefined.6152088d-4dbb-4d52-bf7c-9c0a2efb5f5d" ], + "ip_mode": "", + "network_security_group_ids": [], + "backend_policy": "ROUND_ROBIN", + "health_checker": { + "url_path": "/" + }, "subnets": [ "" ], - "compartment_id": "okit-comp-94636a16-5595-4a4b-b819-6aff3bee6536", - "id": "okit-lb-95c8b99f-3c7b-4e7a-94e8-a4622788f1fa", - "display_name": "okit-lb001", - "is_private": false, - "shape_name": "100Mbps", "instances": [], - "instance_ids": [ - "okit-in-ee74310b-457b-4b18-b566-ae7351a17d7a", - "okit-in-6ce3195d-7119-4666-8966-6555874819a8", - "okit-in-2195d4b3-07bc-4a57-a06b-627cf69b8c46", - "okit-in-f59e4c4c-012f-45de-a81a-8772131f1df1" - ], - "parent_id": "okit-sn-e8536648-721d-473f-828e-e6cfaa5c59eb", + "parent_id": "okit.undefined.d3967bc6-40e8-42d3-adaf-9c5f374bca0b", "virtual_cloud_network": "okit-sn001" } ], - "internet_gateways": [ + "local_peering_gateways": [], + "nat_gateways": [], + "network_security_groups": [], + "object_storage_buckets": [], + "remote_peering_gateways": [], + "route_tables": [ { - "vcn_id": "okit-vcn-dcb74d63-9ae8-44c5-9913-1ba70e11d2b8", + "id": "okit.undefined.ed178ac3-df4d-4a84-a17a-f18dab229e63", + "freeform_tags": {}, + "defined_tags": {}, + "display_name": "okit-lb-rt", + "compartment_id": "okit.compartment.87b90aa7-4c56-4800-b4d7-e404b89c6ceb", + "vcn_id": "okit.undefined.3e3f1f86-16f6-4433-963f-b52d70ba2452", + "route_rules": [ + { + "destination_type": "CIDR_BLOCK", + "destination": "0.0.0.0/0", + "network_entity_id": "okit.undefined.5aa22dc1-f626-4b67-800b-8c22ae549d05", + "target_type": "internet_gateways" + } + ], "virtual_cloud_network": "okit-vcn001", - "compartment_id": "okit-comp-94636a16-5595-4a4b-b819-6aff3bee6536", - "id": "okit-ig-9b4a5d64-9346-4c7f-a97a-a0c323500224", - "display_name": "okit-ig001", - "parent_id": "okit-vcn-dcb74d63-9ae8-44c5-9913-1ba70e11d2b8" + "name": "okit-lb-rt" } ], - "block_storage_volumes": [] + "security_lists": [ + { + "id": "okit.undefined.a9285860-6743-44fb-bd1e-b5cff6e19fad", + "freeform_tags": {}, + "defined_tags": {}, + "display_name": "okit-lb-sl", + "compartment_id": "okit.compartment.87b90aa7-4c56-4800-b4d7-e404b89c6ceb", + "vcn_id": "okit.undefined.3e3f1f86-16f6-4433-963f-b52d70ba2452", + "egress_security_rules": [ + { + "protocol": "all", + "is_stateless": false, + "destination_type": "CIDR_BLOCK", + "destination": "0.0.0.0/0", + "tcp_options": { + "source_port_range": { + "min": "", + "max": "" + }, + "destination_port_range": { + "min": "", + "max": "" + } + }, + "udp_options": { + "source_port_range": { + "min": "", + "max": "" + }, + "destination_port_range": { + "min": "", + "max": "" + } + }, + "icmp_options": { + "code": "", + "type": "" + } + } + ], + "ingress_security_rules": [ + { + "protocol": "all", + "is_stateless": false, + "source_type": "CIDR_BLOCK", + "source": "0.0.0.0/0", + "tcp_options": { + "source_port_range": { + "min": "", + "max": "" + }, + "destination_port_range": { + "min": "", + "max": "" + } + }, + "udp_options": { + "source_port_range": { + "min": "", + "max": "" + }, + "destination_port_range": { + "min": "", + "max": "" + } + }, + "icmp_options": { + "code": "", + "type": "" + } + } + ], + "virtual_cloud_network": "okit-vcn001", + "name": "okit-lb-sl" + } + ], + "service_gateways": [], + "subnets": [ + { + "id": "okit.undefined.d3967bc6-40e8-42d3-adaf-9c5f374bca0b", + "freeform_tags": {}, + "defined_tags": {}, + "display_name": "okit-lb-sn", + "compartment_id": "okit.compartment.87b90aa7-4c56-4800-b4d7-e404b89c6ceb", + "vcn_id": "okit.undefined.3e3f1f86-16f6-4433-963f-b52d70ba2452", + "cidr_block": "10.2.0.0/24", + "dns_label": "sn001", + "prohibit_public_ip_on_vnic": false, + "route_table_id": "okit.undefined.ed178ac3-df4d-4a84-a17a-f18dab229e63", + "security_list_ids": [ + "okit.undefined.a9285860-6743-44fb-bd1e-b5cff6e19fad" + ], + "availability_domain": "0", + "is_ipv6enabled": false, + "ipv6cidr_block": "", + "virtual_cloud_network": "okit-vcn001", + "route_table": "", + "security_lists": [], + "name": "okit-lb-sn" + } + ], + "virtual_cloud_networks": [ + { + "id": "okit.undefined.3e3f1f86-16f6-4433-963f-b52d70ba2452", + "freeform_tags": {}, + "defined_tags": {}, + "display_name": "okit-lb-vcn", + "compartment_id": "okit.compartment.87b90aa7-4c56-4800-b4d7-e404b89c6ceb", + "cidr_block": "10.2.0.0/16", + "dns_label": "vcn001", + "is_ipv6enabled": false, + "ipv6cidr_block": "", + "name": "okit-lb-vcn" + } + ] } \ No newline at end of file diff --git a/okitweb/static/okit/js/oci_artefacts/autonomous_database.js b/okitweb/static/okit/js/oci_artefacts/autonomous_database.js deleted file mode 100644 index 3ea6e137a..000000000 --- a/okitweb/static/okit/js/oci_artefacts/autonomous_database.js +++ /dev/null @@ -1,247 +0,0 @@ -/* -** Copyright (c) 2020, Oracle and/or its affiliates. -** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. -*/ -console.info('Loaded Autonomous Database Javascript'); - -const autonomous_database_query_cb = "autonomous-database-query-cb"; - -/* -** Define Autonomous Database Class - */ -class AutonomousDatabase extends OkitArtifact { - /* - ** Create - */ - constructor (data={}, okitjson={}, parent=null) { - super(okitjson); - this.parent_id = data.parent_id; - // Configure default values - this.display_name = this.generateDefaultName(okitjson.autonomous_databases.length + 1); - this.compartment_id = data.parent_id; - this.db_name = this.display_name.replace('-', ''); - this.admin_password = generatePassword(); - this.data_storage_size_in_tbs = 1; - this.cpu_core_count = 1; - this.db_workload = 'OLTP'; - this.is_auto_scaling_enabled = true; - this.is_free_tier = false; - this.license_model = 'BRING_YOUR_OWN_LICENSE'; - // Update with any passed data - this.merge(data); - this.convert(); - // Add Get Parent function - if (parent !== null) { - this.getParent = () => {return parent}; - } - } - - - /* - ** Clone Functionality - */ - clone() { - return new AutonomousDatabase(this, this.getOkitJson()); - } - - - /* - ** Delete Processing - */ - deleteChildren() { - // Remove Instance references - for (let instance of this.getOkitJson().instances) { - for (let i=0; i < instance['autonomous_database_ids'].length; i++) { - if (instance.autonomous_database_ids[i] === this.id) { - instance.autonomous_database_ids.splice(i, 1); - } - } - } - } - - - /* - ** SVG Processing - */ - draw() { - console.groupCollapsed('Drawing ' + this.getArtifactReference() + ' : ' + this.id + ' [' + this.parent_id + ']'); - if (this.isAttached()) { - console.groupEnd(); - return; - } - let svg = super.draw(); - /* - ** Add Properties Load Event to created svg. We require the definition of the local variable "me" so that it can - ** be used in the function dur to the fact that using "this" in the function will refer to the function not the - ** Artifact. - */ - // Get Inner Rect to attach Connectors - let rect = svg.select("rect[id='" + safeId(this.id) + "']"); - let boundingClientRect = rect.node().getBoundingClientRect(); - // Add Connector Data - svg.attr("data-compartment-id", this.compartment_id) - .attr("data-connector-start-y", boundingClientRect.y + (boundingClientRect.height / 2)) - .attr("data-connector-start-x", boundingClientRect.x) - .attr("data-connector-end-y", boundingClientRect.y + (boundingClientRect.height / 2)) - .attr("data-connector-end-x", boundingClientRect.x) - .attr("data-connector-id", this.id) - .attr("dragable", true) - .selectAll("*") - .attr("data-connector-start-y", boundingClientRect.y + (boundingClientRect.height / 2)) - .attr("data-connector-start-x", boundingClientRect.x) - .attr("data-connector-end-y", boundingClientRect.y + (boundingClientRect.height / 2)) - .attr("data-connector-end-x", boundingClientRect.x) - .attr("data-connector-id", this.id) - .attr("dragable", true); - console.groupEnd(); - return svg; - } - - // Return Artifact Specific Definition. - getSvgDefinition() { - console.groupCollapsed('Getting Definition of ' + this.getArtifactReference() + ' : ' + this.id); - let definition = this.newSVGDefinition(this, this.getArtifactReference()); - let dimensions = this.getDimensions(); - let first_child = this.getParent().getChildOffset(this.getArtifactReference()); - definition['svg']['x'] = first_child.dx; - definition['svg']['y'] = first_child.dy; - definition['svg']['width'] = dimensions['width']; - definition['svg']['height'] = dimensions['height']; - definition['rect']['stroke']['colour'] = stroke_colours.bark; - definition['rect']['stroke']['dash'] = 1; - console.info(JSON.stringify(definition, null, 2)); - console.groupEnd(); - return definition; - } - - // Return Artifact Dimensions - getDimensions() { - console.groupCollapsed('Getting Dimensions of ' + this.getArtifactReference() + ' : ' + this.id); - let dimensions = this.getMinimumDimensions(); - // Calculate Size based on Child Artifacts - // Check size against minimum - dimensions.width = Math.max(dimensions.width, this.getMinimumDimensions().width); - dimensions.height = Math.max(dimensions.height, this.getMinimumDimensions().height); - console.info('Overall Dimensions : ' + JSON.stringify(dimensions)); - console.groupEnd(); - return dimensions; - } - - getMinimumDimensions() { - return {width: icon_width, height:icon_height}; - } - - isAttached() { - for (let instance of this.getOkitJson().instances) { - if (instance.autonomous_database_ids.includes(this.id)) { - console.info(this.display_name + ' attached to instance '+ instance.display_name); - return true; - } - } - return false; - } - - - /* - ** Property Sheet Load function - */ - loadProperties() { - let okitJson = this.getOkitJson(); - let me = this; - $(jqId(PROPERTIES_PANEL)).load("propertysheets/autonomous_database.html", () => { - $('#is_free_tier').on('change', () => { - if($('#is_free_tier').is(':checked')) { - $('#license_model').val("LICENSE_INCLUDED"); - $('#is_auto_scaling_enabled').prop('checked', false); - $('#license_model').attr('disabled', true); - $('#is_auto_scaling_enabled').attr('disabled', true); - } else { - $('#license_model').removeAttr('disabled'); - $('#is_auto_scaling_enabled').removeAttr('disabled'); - } - }); - if (me.is_free_tier) { - me.license_model = "LICENSE_INCLUDED"; - me.is_auto_scaling_enabled = false; - $('#license_model').attr('disabled', true); - $('#is_auto_scaling_enabled').attr('disabled', true); - } - loadPropertiesSheet(me); - }); - } - - loadValueProposition() { - $(jqId(VALUE_PROPOSITION_PANEL)).load("valueproposition/autonomous_database.html"); - } - - - getNamePrefix() { - return super.getNamePrefix() + 'ad'; - } - - /* - ** Static Functionality - */ - static getArtifactReference() { - return 'Autonomous Database'; - } - - static getDropTargets() { - return [Compartment.getArtifactReference()]; - } - - static query(request = {}, region='') { - console.info('------------- Autonomous Database Query --------------------'); - console.info('------------- Compartment : ' + request.compartment_id); - let me = this; - queryCount++; - $.ajax({ - type: 'get', - url: 'oci/artifacts/AutonomousDatabase', - dataType: 'text', - contentType: 'application/json', - data: JSON.stringify(request), - success: function(resp) { - let response_json = JSON.parse(resp); - regionOkitJson[region].load({autonomous_databases: response_json}); - for (let artifact of response_json) { - console.info(me.getArtifactReference() + ' Query : ' + artifact.display_name); - } - redrawSVGCanvas(region); - $('#' + autonomous_database_query_cb).prop('checked', true); - queryCount--; - hideQueryProgressIfComplete(); - }, - error: function(xhr, status, error) { - console.info('Status : ' + status) - console.info('Error : ' + error) - $('#' + autonomous_database_query_cb).prop('checked', true); - queryCount--; - hideQueryProgressIfComplete(); - } - }); - } -} - -$(document).ready(function() { - // Setup Search Checkbox - let body = d3.select('#query-progress-tbody'); - let row = body.append('tr'); - let cell = row.append('td'); - cell.append('input') - .attr('type', 'checkbox') - .attr('id', autonomous_database_query_cb); - cell.append('label').text(AutonomousDatabase.getArtifactReference()); - - // Setup Query Display Form - body = d3.select('#query-oci-tbody'); - row = body.append('tr'); - cell = row.append('td') - .text(AutonomousDatabase.getArtifactReference()); - cell = row.append('td'); - let input = cell.append('input') - .attr('type', 'text') - .attr('class', 'query-filter') - .attr('id', 'autonomous_database_name_filter') - .attr('name', 'autonomous_database_name_filter'); -}); diff --git a/okitweb/static/okit/js/oci_artefacts/block_storage_volume.js b/okitweb/static/okit/js/oci_artefacts/block_storage_volume.js deleted file mode 100644 index 1b378d7d7..000000000 --- a/okitweb/static/okit/js/oci_artefacts/block_storage_volume.js +++ /dev/null @@ -1,205 +0,0 @@ -/* -** Copyright (c) 2020, Oracle and/or its affiliates. -** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. -*/ -console.info('Loaded Block Storage Volume Javascript'); - -const block_storage_volume_query_cb = "block-storage-volume-query-cb"; - -/* -** Define Block Storage Volume Class - */ -class BlockStorageVolume extends OkitArtifact { - /* - ** Create - */ - constructor (data={}, okitjson={}, parent=null) { - super(okitjson); - this.parent_id = data.parent_id; - // Configure default values - this.display_name = this.generateDefaultName(okitjson.block_storage_volumes.length + 1); - this.compartment_id = data.parent_id; - this.availability_domain = '1'; - this.size_in_gbs = 1024; - this.backup_policy = 'bronze'; - this.vpus_per_gb = '10'; - // Update with any passed data - this.merge(data); - this.convert(); - // Check if built from a query - if (this.availability_domain.length > 1) { - this.region_availability_domain = this.availability_domain; - this.availability_domain = this.region_availability_domain.slice(-1); - } - // Add Get Parent function - if (parent !== null) { - this.getParent = () => {return parent}; - } - } - - - /* - ** Clone Functionality - */ - clone() { - return new BlockStorageVolume(this, this.getOkitJson()); - } - - - /* - ** Delete Processing - */ - deleteChildren() { - // Remove Instance references - for (let instance of this.getOkitJson().instances) { - for (let i=0; i < instance.block_storage_volume_ids.length; i++) { - if (instance.block_storage_volume_ids[i] === this.id) { - instance.block_storage_volume_ids.splice(i, 1); - } - } - } - } - - - /* - ** SVG Processing - */ - draw() { - console.groupCollapsed('Drawing ' + this.getArtifactReference() + ' : ' + this.id + ' [' + this.parent_id + ']'); - if (this.isAttached()) { - console.groupEnd(); - return; - } - let svg = super.draw(); - console.groupEnd(); - return svg; - } - - // Return Artifact Specific Definition. - getSvgDefinition() { - console.groupCollapsed('Getting Definition of ' + this.getArtifactReference() + ' : ' + this.id); - let definition = this.newSVGDefinition(this, this.getArtifactReference()); - let dimensions = this.getDimensions(); - let first_child = this.getParent().getChildOffset(this.getArtifactReference()); - definition['svg']['x'] = first_child.dx; - definition['svg']['y'] = first_child.dy; - definition['svg']['width'] = dimensions['width']; - definition['svg']['height'] = dimensions['height']; - definition['rect']['stroke']['colour'] = stroke_colours.bark; - definition['rect']['stroke']['dash'] = 1; - console.info(JSON.stringify(definition, null, 2)); - console.groupEnd(); - return definition; - } - - // Return Artifact Dimensions - getDimensions() { - console.groupCollapsed('Getting Dimensions of ' + this.getArtifactReference() + ' : ' + this.id); - let dimensions = this.getMinimumDimensions(); - // Calculate Size based on Child Artifacts - // Check size against minimum - dimensions.width = Math.max(dimensions.width, this.getMinimumDimensions().width); - dimensions.height = Math.max(dimensions.height, this.getMinimumDimensions().height); - console.info('Overall Dimensions : ' + JSON.stringify(dimensions)); - console.groupEnd(); - return dimensions; - } - - getMinimumDimensions() { - return {width: icon_width, height:icon_height}; - } - - isAttached() { - // Check if this is attached but exclude when parent is the attachment type. - if (this.getParent().getArtifactReference() !== Instance.getArtifactReference()) { - for (let instance of this.getOkitJson().instances) { - if (instance.block_storage_volume_ids.includes(this.id)) { - console.info(this.display_name + ' attached to instance ' + instance.display_name); - return true; - } - } - } - return false; - } - - - /* - ** Property Sheet Load function - */ - loadProperties() { - let okitJson = this.getOkitJson(); - let me = this; - $(jqId(PROPERTIES_PANEL)).load("propertysheets/block_storage_volume.html", () => {loadPropertiesSheet(me);}); - } - - - getNamePrefix() { - return super.getNamePrefix() + 'bsv'; - } - - /* - ** Static Functionality - */ - static getArtifactReference() { - return 'Block Storage Volume'; - } - - static getDropTargets() { - return [Compartment.getArtifactReference()]; - } - - static query(request = {}, region='') { - console.info('------------- Block Storage Volume Query --------------------'); - console.info('------------- Compartment : ' + request.compartment_id); - let me = this; - queryCount++; - $.ajax({ - type: 'get', - url: 'oci/artifacts/BlockStorageVolume', - dataType: 'text', - contentType: 'application/json', - data: JSON.stringify(request), - success: function(resp) { - let response_json = JSON.parse(resp); - regionOkitJson[region].load({block_storage_volumes: response_json}); - for (let artifact of response_json) { - console.info(me.getArtifactReference() + ' Query : ' + artifact.display_name); - } - redrawSVGCanvas(region); - $('#' + block_storage_volume_query_cb).prop('checked', true); - queryCount--; - hideQueryProgressIfComplete(); - }, - error: function(xhr, status, error) { - console.info('Status : ' + status) - console.info('Error : ' + error) - $('#' + block_storage_volume_query_cb).prop('checked', true); - queryCount--; - hideQueryProgressIfComplete(); - } - }); - } -} - -$(document).ready(function() { - // Setup Search Checkbox - let body = d3.select('#query-progress-tbody'); - let row = body.append('tr'); - let cell = row.append('td'); - cell.append('input') - .attr('type', 'checkbox') - .attr('id', block_storage_volume_query_cb); - cell.append('label').text(BlockStorageVolume.getArtifactReference()); - - // Setup Query Display Form - body = d3.select('#query-oci-tbody'); - row = body.append('tr'); - cell = row.append('td') - .text(BlockStorageVolume.getArtifactReference()); - cell = row.append('td'); - let input = cell.append('input') - .attr('type', 'text') - .attr('class', 'query-filter') - .attr('id', 'block_storage_volume_name_filter') - .attr('name', 'block_storage_volume_name_filter'); -}); diff --git a/okitweb/static/okit/js/oci_artefacts/compartment.js b/okitweb/static/okit/js/oci_artefacts/compartment.js deleted file mode 100644 index 83ae61a94..000000000 --- a/okitweb/static/okit/js/oci_artefacts/compartment.js +++ /dev/null @@ -1,305 +0,0 @@ -/* -** Copyright (c) 2020, Oracle and/or its affiliates. -** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. -*/ -console.info('Loaded Compartment Javascript'); - -const compartment_query_cb = "compartment-query-cb"; - -/* -** Define Compartment Artifact Class - */ -class Compartment extends OkitContainerArtifact { - /* - ** Create - */ - constructor (data={}, okitjson={}, parent=null) { - super(okitjson); - // Configure default values - this.parent_id = 'canvas'; - this.compartment_id = null; - this.name = this.generateDefaultName(okitjson.compartments.length + 1); - // Update with any passed data - this.merge(data); - this.convert(); - this.display_name = this.name; - // Add Get Parent function - if (parent !== null) { - this.getParent = () => {return parent}; - } - } - - /* - ** Test If Top Level compartment - */ - - isTopLevel() { - //if (this.compartment_id) { - if (this.getParent()) { - return false; - } - return true; - } - - - /* - ** Clone Functionality - */ - clone() { - return new Compartment(this, this.getOkitJson()); - } - - - /* - ** Delete Processing - */ - deleteChildren() { - console.groupCollapsed('Deleting Children of ' + this.getArtifactReference() + ' : ' + this.display_name); - // Remove Compartments - this.getOkitJson().compartments = this.getOkitJson().compartments.filter(function(child) { - if (child.compartment_id === this.id && child.id !== this.id) { - console.info('Deleting ' + child.display_name); - child.delete(); - return false; // So the filter removes the element - } - return true; - }, this); - // Virtual Cloud Networks - this.getOkitJson().virtual_cloud_networks = this.getOkitJson().virtual_cloud_networks.filter(function(child) { - if (child.compartment_id === this.id) { - console.info('Deleting ' + child.display_name); - child.delete(); - return false; // So the filter removes the element - } - return true; - }, this); - // Block Storage Volumes - this.getOkitJson().block_storage_volumes = this.getOkitJson().block_storage_volumes.filter(function(child) { - if (child.compartment_id === this.id) { - console.info('Deleting ' + child.display_name); - child.delete(); - return false; // So the filter removes the element - } - return true; - }, this); - // Object Storage Buckets - this.getOkitJson().object_storage_buckets = this.getOkitJson().object_storage_buckets.filter(function(child) { - if (child.compartment_id === this.id) { - console.info('Deleting ' + child.display_name); - child.delete(); - return false; // So the filter removes the element - } - return true; - }, this); - // Autonomous Databases - this.getOkitJson().autonomous_databases = this.getOkitJson().autonomous_databases.filter(function(child) { - if (child.compartment_id === this.id) { - console.info('Deleting ' + child.display_name); - child.delete(); - return false; // So the filter removes the element - } - return true; - }, this); - console.groupEnd(); - // Dynamic Routing Gateways - this.getOkitJson().dynamic_routing_gateways = this.getOkitJson().dynamic_routing_gateways.filter(function(child) { - if (child.compartment_id === this.id) { - console.info('Deleting ' + child.display_name); - child.delete(); - return false; // So the filter removes the element - } - return true; - }, this); - } - - - /* - ** SVG Processing - */ - draw() { - console.groupCollapsed('Drawing ' + Compartment.getArtifactReference() + ' : ' + this.id); - let svg = super.draw(); - console.groupEnd(); - } - - getSvgDefinition() { - let dimensions = this.getDimensions(this.id); - let definition = this.newSVGDefinition(this, Compartment.getArtifactReference()); - console.info('>>>>>>>> Parent'); - console.info(this.getParent()); - if (this.getParent()) { - let parent_first_child = this.getParent().getChildOffset(this.getArtifactReference()); - definition['svg']['x'] = parent_first_child.dx; - definition['svg']['y'] = parent_first_child.dy; - } - definition['svg']['width'] = dimensions['width']; - definition['svg']['height'] = dimensions['height']; - definition['rect']['stroke']['colour'] = stroke_colours.bark; - definition['rect']['stroke']['dash'] = 5; - definition['rect']['stroke']['width'] = 2; - definition['icon']['x_translation'] = icon_translate_x_start; - definition['icon']['y_translation'] = icon_translate_y_start; - definition['name']['show'] = true; - definition['label']['show'] = true; - return definition; - } - - getDimensions() { - return super.getDimensions('compartment_id'); - } - - getMinimumDimensions() { - // Check if this is the top level container - //if (this.id === this.compartment_id) { - if (this.isTopLevel()) { - return {width: $('#canvas-div').width(), height: $('#canvas-div').height()}; - } else { - return {width: container_artifact_x_padding * 2, height: container_artifact_y_padding * 2}; - } - } - - - /* - ** Property Sheet Load function - */ - loadProperties() { - let okitJson = this.getOkitJson(); - let me = this; - $(jqId(PROPERTIES_PANEL)).load("propertysheets/compartment.html", () => {loadPropertiesSheet(me);}); - } - - - /* - ** Child Type Functions - */ - getTopArtifacts() { - return [Instance.getArtifactReference()]; - } - - getContainerArtifacts() { - return [Compartment.getArtifactReference(), VirtualCloudNetwork.getArtifactReference()]; - } - - getLeftArtifacts() { - return [BlockStorageVolume.getArtifactReference()]; - } - - getRightArtifacts() { - return [DynamicRoutingGateway.getArtifactReference(), AutonomousDatabase.getArtifactReference(), - ObjectStorageBucket.getArtifactReference(), FastConnect.getArtifactReference()]; - } - - - /* - ** Container Specific Overrides - */ - // return the name of the element used by the child to reference this artifact - getParentKey() { - return 'compartment_id'; - } - - - getNamePrefix() { - return super.getNamePrefix() + 'comp'; - } - - /* - ** Static Functionality - */ - static getArtifactReference() { - return 'Compartment'; - } - - static getDropTargets() { - return [Compartment.getArtifactReference()]; - } - - static queryRoot(request = {}, region='') { - console.info('------------- Compartment Query --------------------'); - let me = this; - queryCount++; - $.ajax({ - type: 'get', - url: 'oci/artifacts/Compartment', - dataType: 'text', - contentType: 'application/json', - data: JSON.stringify(request), - success: function(resp) { - let response_json = JSON.parse(resp); - response_json.parent_id = ROOT_CANVAS_ID; - regionOkitJson[region].load({compartments: [response_json]}); - console.info(me.getArtifactReference() + ' Query : ' + response_json.name); - me.querySubComponents(request, region, response_json.id); - redrawSVGCanvas(region); - $('#' + compartment_query_cb).prop('checked', true); - queryCount--; - hideQueryProgressIfComplete(); - }, - error: function(xhr, status, error) { - console.error('Status : ' + status); - console.error('Error : ' + error); - $('#' + compartment_query_cb).prop('checked', true); - queryCount--; - hideQueryProgressIfComplete(); - } - }); - } - - static query(request = {}, region='') { - console.info('------------- Compartments Query --------------------'); - console.info('------------- Compartment : ' + request.compartment_id); - let me = this; - queryCount++; - $.ajax({ - type: 'get', - url: 'oci/artifacts/Compartments', - dataType: 'text', - contentType: 'application/json', - data: JSON.stringify(request), - success: function(resp) { - let response_json = JSON.parse(resp); - regionOkitJson[region].load({compartments: response_json}); - for (let artifact of response_json) { - console.info(me.getArtifactReference() + 's Query : ' + artifact.display_name); - me.querySubComponents(request, region, artifact.id); - } - redrawSVGCanvas(region); - $('#' + compartment_query_cb).prop('checked', true); - queryCount--; - hideQueryProgressIfComplete(); - }, - error: function(xhr, status, error) { - console.error('Status : ' + status); - console.error('Error : ' + error); - $('#' + compartment_query_cb).prop('checked', true); - queryCount--; - hideQueryProgressIfComplete(); - } - }); - } - - static querySubComponents(request = {}, region='', id='') { - let sub_query_request = JSON.clone(request); - sub_query_request.compartment_id = id; - Compartment.query(sub_query_request, region); - VirtualCloudNetwork.query(sub_query_request, region); - BlockStorageVolume.query(sub_query_request, region); - DynamicRoutingGateway.query(sub_query_request, region); - AutonomousDatabase.query(sub_query_request, region); - ObjectStorageBucket.query(sub_query_request, region); - FastConnect.query(sub_query_request, region); - Instance.query(sub_query_request, region); - DatabaseSystem.query(sub_query_request, region); - FileStorageSystem.query(sub_query_request, region); - } -} - -$(document).ready(function() { - let body = d3.select('#query-progress-tbody'); - let row = body.append('tr'); - let cell = row.append('td'); - cell.append('input') - .attr('type', 'checkbox') - .attr('id', compartment_query_cb); - cell.append('label').text(Compartment.getArtifactReference()); -}); diff --git a/okitweb/static/okit/js/oci_artefacts/fast_connect.js b/okitweb/static/okit/js/oci_artefacts/fast_connect.js deleted file mode 100644 index db4089cea..000000000 --- a/okitweb/static/okit/js/oci_artefacts/fast_connect.js +++ /dev/null @@ -1,189 +0,0 @@ -/* -** Copyright (c) 2020, Oracle and/or its affiliates. -** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. -*/ -console.info('Loaded FastConnect Javascript'); - -const fast_connect_query_cb = "fast-connect-query-cb"; - -/* -** Define FastConnect Class - */ -class FastConnect extends OkitArtifact { - /* - ** Create - */ - constructor (data={}, okitjson={}, parent=null) { - super(okitjson); - this.parent_id = data.parent_id; - // Configure default values - this.display_name = this.generateDefaultName(okitjson.fast_connects.length + 1); - this.compartment_id = data.parent_id; - // Update with any passed data - this.merge(data); - this.convert(); - // Add Get Parent function - if (parent !== null) { - this.getParent = () => {return parent}; - } - } - - - /* - ** Clone Functionality - */ - clone() { - return new FastConnect(this, this.getOkitJson()); - } - - - /* - ** Delete Processing - */ - deleteChildren() {} - - - /* - ** SVG Processing - */ - draw() { - console.groupCollapsed('Drawing ' + this.getArtifactReference() + ' : ' + this.id + ' [' + this.parent_id + ']'); - let me = this; - let svg = super.draw(); - // Get Inner Rect to attach Connectors - let rect = svg.select("rect[id='" + safeId(this.id) + "']"); - let boundingClientRect = rect.node().getBoundingClientRect(); - // Add Connector Data - svg.attr("data-compartment-id", this.compartment_id) - .attr("data-connector-start-y", boundingClientRect.y + (boundingClientRect.height / 2)) - .attr("data-connector-start-x", boundingClientRect.x) - .attr("data-connector-end-y", boundingClientRect.y + (boundingClientRect.height / 2)) - .attr("data-connector-end-x", boundingClientRect.x) - .attr("data-connector-id", this.id) - .attr("dragable", true) - .selectAll("*") - .attr("data-connector-start-y", boundingClientRect.y + (boundingClientRect.height / 2)) - .attr("data-connector-start-x", boundingClientRect.x) - .attr("data-connector-end-y", boundingClientRect.y + (boundingClientRect.height / 2)) - .attr("data-connector-end-x", boundingClientRect.x) - .attr("data-connector-id", this.id) - .attr("dragable", true); - console.groupEnd(); - return svg; - } - - // Return Artifact Specific Definition. - getSvgDefinition() { - console.groupCollapsed('Getting Definition of ' + this.getArtifactReference() + ' : ' + this.id); - let definition = this.newSVGDefinition(this, this.getArtifactReference()); - let dimensions = this.getDimensions(); - let first_child = this.getParent().getChildOffset(this.getArtifactReference()); - definition['svg']['x'] = first_child.dx; - definition['svg']['y'] = first_child.dy; - definition['svg']['width'] = dimensions['width']; - definition['svg']['height'] = dimensions['height']; - definition['rect']['stroke']['colour'] = stroke_colours.purple; - definition['rect']['stroke']['dash'] = 1; - console.info(JSON.stringify(definition, null, 2)); - console.groupEnd(); - return definition; - } - - // Return Artifact Dimensions - getDimensions() { - console.groupCollapsed('Getting Dimensions of ' + this.getArtifactReference() + ' : ' + this.id); - let dimensions = this.getMinimumDimensions(); - // Calculate Size based on Child Artifacts - // Check size against minimum - dimensions.width = Math.max(dimensions.width, this.getMinimumDimensions().width); - dimensions.height = Math.max(dimensions.height, this.getMinimumDimensions().height); - console.info('Overall Dimensions : ' + JSON.stringify(dimensions)); - console.groupEnd(); - return dimensions; - } - - getMinimumDimensions() { - return {width: icon_width, height:icon_height}; - } - - - /* - ** Property Sheet Load function - */ - loadProperties() { - let okitJson = this.getOkitJson(); - let me = this; - $(jqId(PROPERTIES_PANEL)).load("propertysheets/fast_connect.html", () => {loadPropertiesSheet(me);}); - } - - - getNamePrefix() { - return super.getNamePrefix() + 'fc'; - } - - /* - ** Static Functionality - */ - static getArtifactReference() { - return 'Fast Connect'; - } - - static getDropTargets() { - return [Compartment.getArtifactReference()]; - } - - static query(request = {}, region='') { - console.info('------------- Fast Connect Query --------------------'); - console.info('------------- Compartment : ' + request.compartment_id); - let me = this; - queryCount++; - $.ajax({ - type: 'get', - url: 'oci/artifacts/FastConnect', - dataType: 'text', - contentType: 'application/json', - data: JSON.stringify(request), - success: function(resp) { - let response_json = JSON.parse(resp); - regionOkitJson[region].load({fast_connects: response_json}); - for (let artifact of response_json) { - console.info(me.getArtifactReference() + ' Query : ' + artifact.display_name); - } - redrawSVGCanvas(region); - $('#' + fast_connect_query_cb).prop('checked', true); - queryCount--; - hideQueryProgressIfComplete(); - }, - error: function(xhr, status, error) { - console.info('Status : ' + status) - console.info('Error : ' + error) - $('#' + fast_connect_query_cb).prop('checked', true); - queryCount--; - hideQueryProgressIfComplete(); - } - }); - } -} - -$(document).ready(function() { - // Setup Search Checkbox - let body = d3.select('#query-progress-tbody'); - let row = body.append('tr'); - let cell = row.append('td'); - cell.append('input') - .attr('type', 'checkbox') - .attr('id', fast_connect_query_cb); - cell.append('label').text(FastConnect.getArtifactReference()); - - // Setup Query Display Form - body = d3.select('#query-oci-tbody'); - row = body.append('tr'); - cell = row.append('td') - .text(FastConnect.getArtifactReference()); - cell = row.append('td'); - let input = cell.append('input') - .attr('type', 'text') - .attr('class', 'query-filter') - .attr('id', 'fast_connect_name_filter') - .attr('name', 'fast_connect_name_filter'); -}); diff --git a/okitweb/static/okit/js/oci_artefacts/file_storage_system.js b/okitweb/static/okit/js/oci_artefacts/file_storage_system.js deleted file mode 100644 index f4221d8b7..000000000 --- a/okitweb/static/okit/js/oci_artefacts/file_storage_system.js +++ /dev/null @@ -1,261 +0,0 @@ -/* -** Copyright (c) 2020, Oracle and/or its affiliates. -** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. -*/ -console.info('Loaded File Storage System Javascript'); - -const file_storage_system_query_cb = "file-storage-system-query-cb"; - -/* -** Define File Storage System Class - */ -class FileStorageSystem extends OkitArtifact { - /* - ** Create - */ - constructor (data={}, okitjson={}, parent=null) { - super(okitjson); - // Configure default values - this.display_name = this.generateDefaultName(okitjson.file_storage_systems.length + 1); - this.compartment_id = ''; - this.availability_domain = '1'; - this.exports = []; - this.mount_targets = []; - // Update with any passed data - this.merge(data); - // Check if built from a query - if (this.availability_domain.length > 1) { - this.region_availability_domain = this.availability_domain; - this.availability_domain = this.region_availability_domain.slice(-1); - } - if (this.exports.length > 0) { - this.primary_export = this.exports[0]; - } else { - this.primary_export = {path: '/mnt', export_options: {source: this.getOkitJson().getSubnet(data.parent_id)['cidr_block'], access: 'READ_ONLY', anonymous_gid: '', anonymous_uid: '', identity_squash: 'NONE', require_privileged_source_port: true}}; - this.exports[0] = this.primary_export; - } - if (this.mount_targets.length > 0) { - this.primary_mount_target = this.mount_targets[0]; - } else { - this.primary_mount_target = {subnet_id: data.parent_id, hostname_label: this.display_name.toLowerCase(), nsg_ids: [], export_set: {max_fs_stat_bytes: '', max_fs_stat_files: ''}}; - this.mount_targets[0] = this.primary_mount_target; - } - // Add Get Parent function - if (parent !== null) { - this.getParent = () => {return parent}; - } - this.convert(); - this.parent_id = this.primary_mount_target.subnet_id; - } - - - /* - ** Conversion Routine allowing loading of old json - */ - convert() { - // Export Element - if (this.exports === undefined) {this.export = [];} - if (this.exports[0].export_options === undefined) {this.exports[0].export_options = {};} - if (this.path !== undefined) {this.exports[0].path = this.path; delete this.path;} - if (this.source !== undefined) {this.exports[0].export_options.source = this.source; delete this.source;} - if (this.access !== undefined) {this.exports[0].export_options.access = this.access; delete this.access;} - // Mount Target - if (this.mount_targets === undefined) {this.mount_target = [{}];} - if (this.subnet_id !== undefined) {this.mount_targets[0].subnet_id = this.subnet_id; delete this.subnet_id;} - if (this.hostname_label !== undefined) {this.mount_target[0].hostname_label = this.hostname_label; delete this.hostname_label;} - } - - /* - ** Clone Functionality - */ - clone() { - return new FileStorageSystem(this, this.getOkitJson()); - } - - - /* - ** Delete Processing - */ - deleteChildren() {} - - - /* - ** SVG Processing - */ - draw() { - console.groupCollapsed('Drawing ' + this.getArtifactReference() + ' : ' + this.id + ' [' + this.parent_id + ']'); - let me = this; - let svg = super.draw(); - console.groupEnd(); - } - - // Return Artifact Specific Definition. - getSvgDefinition() { - console.groupCollapsed('Getting Definition of ' + this.getArtifactReference() + ' : ' + this.id); - let definition = this.newSVGDefinition(this, this.getArtifactReference()); - let dimensions = this.getDimensions(); - let first_child = this.getParent().getChildOffset(this.getArtifactReference()); - definition['svg']['x'] = first_child.dx; - definition['svg']['y'] = first_child.dy; - definition['svg']['width'] = dimensions['width']; - definition['svg']['height'] = dimensions['height']; - definition['rect']['stroke']['colour'] = stroke_colours.bark; - definition['rect']['stroke']['dash'] = 1; - console.info(JSON.stringify(definition, null, 2)); - console.groupEnd(); - return definition; - } - - // Return Artifact Dimensions - getDimensions() { - console.groupCollapsed('Getting Dimensions of ' + this.getArtifactReference() + ' : ' + this.id); - let dimensions = this.getMinimumDimensions(); - // Calculate Size based on Child Artifacts - // Check size against minimum - dimensions.width = Math.max(dimensions.width, this.getMinimumDimensions().width); - dimensions.height = Math.max(dimensions.height, this.getMinimumDimensions().height); - console.info('Overall Dimensions : ' + JSON.stringify(dimensions)); - console.groupEnd(); - return dimensions; - } - - getMinimumDimensions() { - return {width: icon_width, height:icon_height}; - } - - - /* - ** Property Sheet Load function - */ - loadProperties() { - let okitJson = this.getOkitJson(); - let me = this; - $(jqId(PROPERTIES_PANEL)).load("propertysheets/file_storage_system.html", () => { - // Build Network Security Groups - let nsg_select = $(jqId('nsg_ids')); - this.loadNetworkSecurityGroups(nsg_select, this.primary_mount_target.subnet_id); - // Load Properties - loadPropertiesSheet(me); - }); - } - - loadNetworkSecurityGroups(select, subnet_id) { - $(select).empty(); - let vcn = this.getOkitJson().getVirtualCloudNetwork(this.getOkitJson().getSubnet(subnet_id).vcn_id); - for (let networkSecurityGroup of this.getOkitJson().network_security_groups) { - if (networkSecurityGroup.vcn_id === vcn.id) { - select.append($('