-
Notifications
You must be signed in to change notification settings - Fork 55
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
Conversation
6c1a7a7
to
06f9bd1
Compare
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' |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
test/karma.conf.js
Outdated
@@ -57,13 +64,13 @@ module.exports = function(config) { | |||
}, | |||
|
|||
// web server port | |||
port: 9443, | |||
port: 4443, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
port change needed?
There was a problem hiding this comment.
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; | ||
})(); | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
06f9bd1
to
79079b4
Compare
9e98982
to
5dc7db8
Compare
There was a problem hiding this 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.
src/pluginLoader.js
Outdated
'use strict'; | ||
|
||
Logger.setLevel(Logger.INFO); | ||
Logger.storagePrefix = 'hawtio'; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
src/pluginLoader.js
Outdated
} | ||
// console.log("Using log level: ", logLevel); | ||
Logger.setLevel(logLevel); | ||
if ('showLog' in window.localStorage) { |
There was a problem hiding this comment.
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.
src/pluginLoader.js
Outdated
var answer = Logger.oldGet(name); | ||
Logger.loggers[name] = answer; | ||
return answer; | ||
}; |
There was a problem hiding this comment.
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.
src/pluginLoader.js
Outdated
} else { | ||
window.localStorage['logBuffer'] = window['LogBuffer']; | ||
} | ||
if ('childLoggers' in window.localStorage) { |
There was a problem hiding this comment.
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.
src/pluginLoader.js
Outdated
} | ||
} | ||
}; | ||
} |
There was a problem hiding this comment.
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.)
src/pluginLoader.js
Outdated
|
||
Logger.isString = function(obj) { | ||
return obj && Logger.getType(obj) === 'String'; | ||
}; |
There was a problem hiding this comment.
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.
src/pluginLoader.js
Outdated
} | ||
} | ||
onAdd(); | ||
postLog.forEach(function (func) { func(); }); |
There was a problem hiding this comment.
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.
src/pluginLoader.js
Outdated
* plugins from | ||
* @type {Array} | ||
*/ | ||
// self.urls = []; |
There was a problem hiding this comment.
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.
src/pluginLoader.js
Outdated
return BootstrapPlugin; | ||
})(); | ||
|
||
var hawtioPluginLoader = pluginLoader; |
There was a problem hiding this comment.
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.
@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 |
Thanks @TheRealJon, looks good. Is this ready? Do you mind squashing? |
548c8bf
to
c335420
Compare
@spadgett Ready for merge. |
c335420
to
0c4408d
Compare
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.