Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hawtio dependency #316

Merged
merged 1 commit into from
Mar 19, 2018
Merged

Conversation

TheRealJon
Copy link
Member

@TheRealJon TheRealJon commented Mar 12, 2018

Breaking Changes Remove hawtio-core dependency. A pared down version of hawtio-core is now bundled with the dist scripts. Once this is approved and published, catalog and console will need to be adjusted to properly consume the pluginLoader provided by this repo.

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Mar 12, 2018
@openshift-ci-robot
Copy link

New changes are detected. LGTM label has been removed.

Gruntfile.js Outdated
@@ -36,25 +36,51 @@ module.exports = function (grunt) {
},
concat: {
options: {
separator: ';'
separator: '\n'
Copy link
Contributor

Choose a reason for hiding this comment

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

I think since we are post-processing/minifying our js, we want to keep this separator as a ;, just in case. I think its a guard against someone forgetting to end a file with a semi, though a \n may solve the same problem.

Copy link
Member Author

@TheRealJon TheRealJon Mar 13, 2018

Choose a reason for hiding this comment

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

Can we do something like ";\n"? When looking at the resulting concatenated files, at least one newline made it easier to see where one file ended and the next started. I was inspecting the results of the build and they were just a little difficult to read sometimes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup, that works for me.

},
ui: {
src: ['src/**/*UI.module.js', 'dist/scripts/templates.js', 'src/components/**/*.js', 'src/filters/**/*.js', 'src/ui-services/**/*.js'],
src: [
'src/pluginLoader.js',
Copy link
Contributor

Choose a reason for hiding this comment

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

Pondering whether pluginLoader fits better under services over ui, or if it should be in both. We consume the dist, so I don't think it can break the console, loading it twice probably overwrites one version, but its hard to tell if this thing has any internal caches that would cause memory leaks.

Copy link
Member Author

Choose a reason for hiding this comment

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

From what I could tell, these files are intended to be consumed individually and not together. If you only need UI components, you don't have to consume the Services file and vice versa, and if you need both you just consume the origin-web-common.js file.

Copy link
Member Author

Choose a reason for hiding this comment

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

The other option would be to just leave it out of the concatenated files, then leave it to the consumer to load the pluginLoader script before the others.

"bower_components/hawtio-extension-service/dist/hawtio-extension-service.js",
// load up the fixtures first

// load fixtures before source
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we mean to drop kubernetes-container-terminal/dist/container-terminal.js?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I ran this by Sam. It is not used in this repo. I think it was a copy/paste error at some point.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK great, good to drop it then.

@@ -57,13 +64,13 @@ module.exports = function(config) {
},

// web server port
port: 9443,
port: 4443,
Copy link
Contributor

Choose a reason for hiding this comment

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

port change needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think someone else changed the port in another PR, but it was 8443 before, which conflicted with the api server if it was running when you try to run tests.

});
return BootstrapPlugin;
})();

Copy link
Contributor

Choose a reason for hiding this comment

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

So in the end, should we still name this thing hawtioPluginLoader, or leave it globally as pluginLoader or openshiftPluginLoader && manually update all the references? Thinking on this a second. I don't feel strongly either way atm.

Copy link
Member Author

Choose a reason for hiding this comment

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

This was a suggestion from Sam to avoid breaking downstream repos other than our own.

Copy link
Member Author

@TheRealJon TheRealJon Mar 13, 2018

Choose a reason for hiding this comment

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

My original plan was just to use the global pluginLoader variable and refactor in console and catalog. We can still do that, but the alias still might be necessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

Works for me then! @spadgett advice tends to be spot on!

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, we documented hawtioPluginLoader.addModule as the way to add modules, so we have to keep that working to avoid breaking customer extensions. I'm OK renaming and fixing up our code as long as we keep it as an alias (with a comment explaining).

https://docs.openshift.org/latest/install_config/web_console_customization.html

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll add a comment to the LOC where I create the alias. I can also refactor to use 'pluginLoader' in our repos if we want to do that.

Copy link
Contributor

@benjaminapetersen benjaminapetersen left a comment

Choose a reason for hiding this comment

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

Just a few small comments, mainly need to know about that container-terminal script.

@TheRealJon TheRealJon changed the title [WIP] Remove hawtio dependency Remove hawtio dependency Mar 15, 2018
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 15, 2018
@TheRealJon TheRealJon force-pushed the remove-hawtio branch 2 times, most recently from 9e98982 to 5dc7db8 Compare March 16, 2018 16:34
Copy link
Member

@spadgett spadgett left a comment

Choose a reason for hiding this comment

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

Thanks @TheRealJon

I wish we could remove more from plugin loader, but I guess it's working and we should leave well enough alone.

'use strict';

Logger.setLevel(Logger.INFO);
Logger.storagePrefix = 'hawtio';
Copy link
Member

Choose a reason for hiding this comment

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

Hm, I don't see storagePrefix documented in js-logger or used anywhere below. Can we just remove?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll try removing and make sure nothing breaks.

}
// console.log("Using log level: ", logLevel);
Logger.setLevel(logLevel);
if ('showLog' in window.localStorage) {
Copy link
Member

Choose a reason for hiding this comment

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

We're not using showLog so this can be removed.

var answer = Logger.oldGet(name);
Logger.loggers[name] = answer;
return answer;
};
Copy link
Member

Choose a reason for hiding this comment

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

I think we can remove lines 18-24. I don't see where Logger.loggers is ever used.

} else {
window.localStorage['logBuffer'] = window['LogBuffer'];
}
if ('childLoggers' in window.localStorage) {
Copy link
Member

Choose a reason for hiding this comment

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

Let's remove the childLoggers stuff. We're not using it.

}
}
};
}
Copy link
Member

Choose a reason for hiding this comment

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

Let's delete lines 70-97 and use js-logger default handler to add the context name. (I know this is existing hawtio code.)

https://github.com/jonnyreeves/js-logger/blob/46f9df7b946d50574601bb394e5d39c9ebcea338/README.md#default-log-handler-function


Logger.isString = function(obj) {
return obj && Logger.getType(obj) === 'String';
};
Copy link
Member

Choose a reason for hiding this comment

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

I think we can remove 99-118. I'd like to use vanilla js-logger as much as possible.

}
}
onAdd();
postLog.forEach(function (func) { func(); });
Copy link
Member

Choose a reason for hiding this comment

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

In fact, I think we can delete 120-250 also. Doesn't look like we're using any of it, and I'd rather not carry the code.

* plugins from
* @type {Array}
*/
// self.urls = [];
Copy link
Member

Choose a reason for hiding this comment

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

Let's remove this since it's commented out anyway.

return BootstrapPlugin;
})();

var hawtioPluginLoader = pluginLoader;
Copy link
Member

Choose a reason for hiding this comment

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

Let's make it explicitly window.hawtioPluginLoader = pluginLoader so we're sure it's always a global.

@benjaminapetersen
Copy link
Contributor

@spadgett had similar feelings... if it works, & we can drop the dependency, I wasn't sure if we wanted to gut it more or not. I'd kind of like to not see Hawtio obscuring our console.log statements anymore.

@spadgett
Copy link
Member

Thanks @TheRealJon, looks good. Is this ready? Do you mind squashing?

@TheRealJon
Copy link
Member Author

@spadgett Ready for merge.

@spadgett spadgett merged commit bdeada8 into openshift:master Mar 19, 2018
@TheRealJon TheRealJon deleted the remove-hawtio branch March 12, 2019 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants