Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Harmony: Javascript refactoring and overall stability improvements #666

Merged
merged 13 commits into from
Nov 9, 2020

Conversation

antirotor
Copy link
Member

@antirotor antirotor commented Oct 27, 2020

Changes

Apart of changes described in ynput/avalon-core#211 this builds on them. It is moving all javascript code from python files to their separate js files to ease development.

Those can by found under pype/hosts/harmony/js and are organized in similar way as plugins are. Main object is PypeHarmony. As Pype is initialized inside Harmony, all js files are send to Harmony in one batch, evaluated there in global scope. DOM is then like this:

var pype = new PypeHarmony();
pype.Loader.SomeLoaderCode.someLoaderFunction();

it is up to plugin code to inject into proper attribute - PypeHarmony.Loaders for loaders, PypeHarmony.Creators for creators and PypeHarmony.Publish for all other (collectors, extractors, integrators, validators, ...)

It incorporates many changes proposed by @karmakat.

Dependencies

🏴 Depends on: ynput/avalon-core#211 and ynput/pype-config#91

@mkolar mkolar added this to the 2.14 milestone Oct 27, 2020
return;
}

var install_detail_script = oh_install + "/" + item["name"];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

['name'] is better written in dot notation.


var item = m.getItem();
if( !item ){
$.debug( "Failed to install - no item seems to be selected.", $.DEBUG_LEVEL["ERROR"] );
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

['ERROR'] is better written in dot notation.

this.basePath = '';

this.removeAction = function( ev ){
with( context.$.global ){
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use 'with'.

$.debug( err + " ("+err.fileName+" "+err.lineNumber+")", $.DEBUG_LEVEL["ERROR"] );
}
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon.


m.get_tools();
}catch(err){
$.debug( err + " ("+err.fileName+" "+err.lineNumber+")", $.DEBUG_LEVEL["ERROR"] );
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'$' used out of scope.
['ERROR'] is better written in dot notation.

//----------------------------------------------
//-- FILES ARE DOWNLOADED
this.downloadFiles = function( file_download_listing, overwrite ){
with( context.$.global ){
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use 'with'.

}

return true;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon.

var library_base = install_base + '/openHarmony';

var libdir = new Dir(library_base);
var label = new Label;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing '()' invoking a constructor.

//-- STANDARD DIALO CONFIRMATION
this.confirmDialog = function( d_title, d_str, ok_text, cancel_text ){
if (typeof ok_text === 'undefined') var ok_text = "Okay";
if (typeof cancel_text === 'undefined') var cancel_text = "Cancel";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'cancel_text' is already defined.

//----------------------------------------------
//-- STANDARD DIALO CONFIRMATION
this.confirmDialog = function( d_title, d_str, ok_text, cancel_text ){
if (typeof ok_text === 'undefined') var ok_text = "Okay";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'ok_text' is already defined.

@mkolar mkolar merged commit cf438c6 into 2.x/develop Nov 9, 2020
@mkolar mkolar deleted the feature/harmony-refactor branch November 9, 2020 22:12
@mkolar mkolar changed the title Harmony: Javascript improvements Harmony: Javascript refactoring and overall stability improvements Nov 17, 2020
@mkolar mkolar added 2x-dev type: enhancement Enhancements to existing functionality labels Nov 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
host: Harmony type: enhancement Enhancements to existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants