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

initial skinning migration to 5.5.2 #27

Merged
merged 1 commit into from
Jan 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ dist/
bower_components
node_modules
*.tgz
*.zip
*.swp
25 changes: 13 additions & 12 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
module.exports = function (grunt) {

var releaseBase = 'origin-kibana-';
var releaseTag = 'v' + grunt.file.readJSON('package.json').version;
var releaseFile = releaseBase + releaseTag + ".tgz";

var releaseFile = releaseBase + releaseTag + ".zip";
var distDir = 'dist/kibana/origin-kibana';

grunt.initConfig({

pkg: grunt.file.readJSON('package.json'),
less: {
production: {
Expand All @@ -30,54 +31,54 @@ module.exports = function (grunt) {
expand: true,
cwd: 'lib/',
src: ['**/*', '!**/*.less','!**/fonts/**','!**/fa-fonts/**'],
dest: 'dist/public',
dest: distDir + '/public',
filter: 'isFile'
},
{
expand: true,
flatten: true,
cwd: 'bower_components/patternfly/dist/fonts',
src: '**',
dest: 'dist/public/fonts/'
dest: distDir + '/public/fonts/'
},
{
expand: true,
flatten: true,
cwd: 'bower_components/patternfly/components/font-awesome/fonts',
src: '**',
dest: 'dist/public/fonts/'
dest: distDir + '/public/fonts/'
},
{
expand: true,
flatten: true,
cwd: 'bower_components/patternfly/components/bootstrap/dist/fonts',
src: '**',
dest: 'dist/public/fonts/'
dest: distDir + '/public/fonts/'
},
{
expand: false,
flatten: false,
cwd: '.',
src: 'package.json',
dest: 'dist/'
dest: distDir + '/'
},
{
expand: false,
flatten: false,
cwd: '.',
src: 'index.js',
dest: 'dist/'
dest: distDir + '/'
}
]
}
},
clean: ['dist', releaseBase + '*'],
touch: ['dist/public/styles/overrides.css'],
touch: [distDir + '/public/styles/overrides.css'],
compress: {
options: {
pretty: true,
archive: releaseFile,
mode: 'tgz'
mode: 'zip'
},
files: {
expand: true,
Expand Down
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ by this plugin are:
Overriding Styles
The plugin adds an empty stylesheet `$PLUGIN/public/styles/overrides.css' as a hook
for users to modify the styles. After deployment, you might wish to modify the header
style to include a custer header logo:
style to include a custom header logo:

```
.container-brand {
Expand All @@ -22,21 +22,24 @@ style to include a custer header logo:
```
This stylesheet is loaded after the main stylesheet provided by the plugin.

Currently compatible with the 4.5.x code stream of Kibana
Currently compatible with the **5.5.x** code stream of Kibana

### Hacking the code
* Download and install [Elasticsearch](https://www.elastic.co/downloads/elasticsearch)
* Clone the Openshift `origin-kibana` repo
* Run `npm install` to install node dependencies
* Run `bower install` to install patternfly locally
* Run `grunt` to build main.css
* Copy the contents of the `dist` directory to `<KIBANA_4.5_HOME>/installedPlugins/origin-kibana`
* Start Kibana
* Start Kibana to use this plugin `npm start`

### Current supported fragment parameters
When linking to kibana with the origin-kibana plugin you can control the container name and link back to the main console by setting the following parameters in the document hash:

* `console_container_name` - Used to set the container name text in the header
* `console_back_url` - Used as the URL in the back link to get back to the main console
* `console_auth_token` - Contains the authorization token for the user logged into the main console
| parameter | Description|
| ------ | ------|
| `console_container_name` | Used to set the container name text in the header |
| `console_back_url` | Used as the URL in the back link to get back to the main console |
| `console_auth_token` | Contains the authorization token for the user logged into the main console |

Any parameter in the document hash prefixed with `console_` will be removed from the document hash once the UI is loaded.

Expand Down
Binary file modified console.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
export default function (kibana) {
return new kibana.Plugin({
name: 'origin-kibana',
uiExports: {
visTypes: [
hacks: [
'plugins/origin-kibana/styles/main.css',
'plugins/origin-kibana/styles/overrides.css',
'plugins/origin-kibana/directives',
Expand Down
6 changes: 4 additions & 2 deletions lib/directives.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
define(['require'], function(require){
define(['require'], function(require, Logger){
const plugin = require('ui/modules').get('kibana');
plugin.directive('body', ['$compile', function($compile) {
plugin.directive('body', ['$compile', 'Logger', function($compile, Logger) {
var logger = Logger.get();
const html = angular.element(require('./templates/header.html'));
const linkFn = $compile(html);
logger.debug('returning OpenShift body directive');
return {
restrict: 'E',
link: function(scope, element, attrs) {
Expand Down
3 changes: 2 additions & 1 deletion lib/headerController.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
define(['require'], function (require) {
const plugin = require('ui/modules').get('kibana');
plugin.controller('OSHeaderController', ['$scope', 'UserStore', function ($scope, UserStore) {
plugin.controller('OSHeaderController', ['$scope', 'UserStore', 'Logger', function ($scope, UserStore, Logger) {
var logger = Logger.get();
const user = UserStore.getUser();
$scope.containerName = user.container_name;
$scope.goBack = user.back_url;
Expand Down
28 changes: 22 additions & 6 deletions lib/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,34 @@ define(['require'], function (require) {
const plugin = require('ui/modules').get('kibana');

plugin.provider('Logger', function () {
_level = function() {
return localStorage['OpenShiftLogLevel.main']||'error';
};
var _logger = {
log: function() {
log: function(msg) {
console.log(msg);
},
info: function() {
info: function(msg) {
if (_level() === 'info') {
console.log('[INFO] ', msg);
}
},
debug: function() {
debug: function(msg) {
if (_level() === 'debug') {
console.log('[DEBUG] ', msg);
}
},
warn: function() {
warn: function(msg) {
if (_level() === 'warn') {
console.log('[WARN] ', msg);
}
},
error: function() {
error: function(msg) {
if (_level() === 'error') {
console.log('[ERROR] ', msg);
}
}
};
};
this.$get = function () {
return {
get: function (category) {
Expand Down
20 changes: 17 additions & 3 deletions lib/styles/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
/* Overrides */
@import "variables.less";

.navbar-inverse .logo {
.global-nav .logo.kibana {
background-image: none;
background-size: contain;
height: 45px;
width: 300px;
height: 0;
width: 0;
}

.navbar-inverse .navbar-nav > .active > a:before,
Expand Down Expand Up @@ -121,12 +121,26 @@
height: 7px;
}

.global-nav {
top: 25px;
background: #030303;
}

.global-nav.global-nav__logo {
display: none
}

.app-wrapper {
top: 25px
}

.container-header {
border-top: 3px solid red;
background: #030303;
color: #f1f1f1;
padding-left: 17px;
padding-bottom: 8px;
z-index: 10;
}

.container-brand {
Expand Down
4 changes: 3 additions & 1 deletion lib/userstore.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { QueryString } from 'ui/utils/query_string';

define(['require'], function (require) {
var plugin = require('ui/modules').get('kibana');
var qs = require('ui/utils/query_string');
var qs = QueryString;
//ref: https://github.com/openshift/origin/blob/master/assets/app/scripts/services/userstore.js
plugin.provider('LocalStorageUserStore', function () {
this.$get = function ($location, Logger) {
Expand Down
18 changes: 15 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "origin-kibana",
"version": "4.5.1-2",
"version": "5.5.2-1",
"homepage": "https://github.com/openshift/origin-kibana",
"authors": [
"dev@openshift.redhat.com"
Expand All @@ -20,7 +20,13 @@
],
"main": "index.js",
"scripts": {
"postinstall": "bower install"
"lint": "eslint",
"start": "plugin-helpers start",
"test:server": "plugin-helpers test:server",
"test:browser": "plugin-helpers test:browser",
"build": "plugin-helpers build",
"postinstall": "plugin-helpers postinstall",
"postinstall-orig": "bower install"
},
"devDependencies": {
"bower": "^1.4.1",
Expand All @@ -31,7 +37,13 @@
"grunt-contrib-copy": "~0.8.2",
"grunt-contrib-less": "~1.1.0",
"grunt-github-releaser": "~0.1.18",
"grunt-touch": "^1.0.0"
"grunt-touch": "^1.0.0",
"@elastic/eslint-config-kibana": "0.0.2",
"@elastic/plugin-helpers": "^6.0.0",
"babel-eslint": "4.1.8",
"chai": "^3.5.0",
"eslint": "1.10.3",
"eslint-plugin-mocha": "1.1.0"
},
"repository": {
"type": "git",
Expand Down
1 change: 1 addition & 0 deletions public