Openshift Web 控制台 - 运行 扩展脚本不起作用
Openshift web console - running an extension script doesn't work
我正在通读 https://docs.openshift.com/container-platform/3.9/install_config/web_console_customization.html#loading-custom-scripts-and-stylesheets,其中要求我执行以下操作,我已经完成了:
oc edit configmap/webconsole-config -n openshift-web-console
// I put in the below (obviously with a correct URL):
scriptURLs:
- https://url-for-a-js-file
// And also tried it with the below:
scriptURLs:['https://url-for-a-js-file']
上面的 JS 文件看起来像这样:
(function() {
console.log('---testing a script!---');
}());
但是,这些方法都不起作用。控制台从不显示记录的语句。
我知道文档说 "Scripts and stylesheets must be served with the correct content type or they will not be run by the browser. Scripts must be served with Content-Type: application/javascript and stylesheets with Content-Type: text/css.",但我不确定如何 'serve' 如果我只是从 HTTPS 服务器(在本例中是 gitlab)链接这样的文件URL).
看起来您正在为脚本指向外部 github 或 gitlab URL。您必须将该文件托管在其他地方。
我正在通读 https://docs.openshift.com/container-platform/3.9/install_config/web_console_customization.html#loading-custom-scripts-and-stylesheets,其中要求我执行以下操作,我已经完成了:
oc edit configmap/webconsole-config -n openshift-web-console
// I put in the below (obviously with a correct URL):
scriptURLs:
- https://url-for-a-js-file
// And also tried it with the below:
scriptURLs:['https://url-for-a-js-file']
上面的 JS 文件看起来像这样:
(function() {
console.log('---testing a script!---');
}());
但是,这些方法都不起作用。控制台从不显示记录的语句。
我知道文档说 "Scripts and stylesheets must be served with the correct content type or they will not be run by the browser. Scripts must be served with Content-Type: application/javascript and stylesheets with Content-Type: text/css.",但我不确定如何 'serve' 如果我只是从 HTTPS 服务器(在本例中是 gitlab)链接这样的文件URL).
看起来您正在为脚本指向外部 github 或 gitlab URL。您必须将该文件托管在其他地方。