forked from JuanCarniglia/kbn_sankey_vis
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sankey][7.10.2] Update the Plugin to Kibana's new Platform
- Loading branch information
Showing
29 changed files
with
1,138 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
/build | ||
/local | ||
/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
env: | ||
browser: true | ||
es6: true | ||
extends: 'eslint:recommended' | ||
parserOptions: | ||
ecmaVersion: 2018 | ||
sourceType: module | ||
rules: | ||
"prettier/prettier": off | ||
indent: | ||
- error | ||
- 2 | ||
linebreak-style: | ||
- error | ||
- unix | ||
quotes: | ||
- error | ||
- single | ||
semi: | ||
- error | ||
- always | ||
no-trailing-spaces: | ||
- 2 | ||
- skipBlankLines: false | ||
no-console: error | ||
overrides: | ||
- files: ['index.js'] | ||
env: | ||
node: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
node_modules/* | ||
.nyc_output | ||
node_modules/ | ||
build/ | ||
target/ | ||
local | ||
npm-debug.log* | ||
package-lock.json | ||
yarn.lock | ||
.project | ||
*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"id": "kbnSankeyVis", | ||
"version": "7.10.2", | ||
"server": false, | ||
"ui": true, | ||
"requiredPlugins": [ | ||
"visualizations", | ||
"data", | ||
"inspector", | ||
"kibanaLegacy" | ||
], | ||
"requiredBundles": [ | ||
"kibanaUtils", | ||
"visDefaultEditor" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
import React from 'react'; | ||
// For the current version of the Sankey Diagram, we do not need any option | ||
// returning a react component is required | ||
export const SankeyOptions = () => ( | ||
<></> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.enhanced-table-vis-params { | ||
|
||
.computed-columns .euiButtonIcon { | ||
font-size: 0.8rem; | ||
min-width: 12px; | ||
padding: 0px; | ||
} | ||
|
||
.ng-invalid.ng-touched .form-control, .ng-invalid.display-error .form-control { | ||
border-color: #BD271E; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { getFormatService } from './services'; | ||
import { IAggConfig, IFieldFormat, FieldFormatsContentType } from '../../../src/plugins/data/public'; | ||
|
||
/** | ||
* Returns the fieldFormatter function associated to aggConfig, for the requested contentType (html or text). | ||
* Returned fieldFormatter is a function, whose prototype is: fieldFormatter(value, options?) | ||
*/ | ||
export function fieldFormatter(aggConfig: IAggConfig, contentType: FieldFormatsContentType) { | ||
const fieldFormat: IFieldFormat = getFormatService().deserialize(aggConfig.toSerializedFieldFormat()); | ||
return fieldFormat.getConverterFor(contentType); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
// inner angular imports | ||
// these are necessary to bootstrap the local angular. | ||
// They can stay even after NP cutover | ||
import angular from 'angular'; | ||
// required for `ngSanitize` angular module | ||
import 'angular-sanitize'; | ||
import 'angular-recursion'; | ||
import { i18nDirective, i18nFilter, I18nProvider } from '@kbn/i18n/angular'; | ||
import { CoreStart, IUiSettingsClient, PluginInitializerContext } from 'kibana/public'; | ||
import { | ||
initAngularBootstrap, | ||
PaginateDirectiveProvider, | ||
PaginateControlsDirectiveProvider, | ||
PrivateProvider, | ||
watchMultiDecorator, | ||
KbnAccessibleClickProvider, | ||
} from '../../../src/plugins/kibana_legacy/public'; | ||
|
||
initAngularBootstrap(); | ||
|
||
const thirdPartyAngularDependencies = ['ngSanitize', 'ui.bootstrap', 'RecursionHelper']; | ||
|
||
export function getAngularModule(name: string, core: CoreStart, context: PluginInitializerContext) { | ||
const uiModule = getInnerAngular(name, core); | ||
return uiModule; | ||
} | ||
|
||
let initialized = false; | ||
|
||
export function getInnerAngular(name = 'kibana/kbn_sankey_vis', core: CoreStart) { | ||
if (!initialized) { | ||
createLocalPrivateModule(); | ||
createLocalConfigModule(core.uiSettings); | ||
initialized = true; | ||
} | ||
return angular | ||
.module(name, [ | ||
...thirdPartyAngularDependencies, | ||
'tableVisConfig', | ||
'tableVisPrivate', | ||
]) | ||
.config(watchMultiDecorator) | ||
.directive('kbnAccessibleClick', KbnAccessibleClickProvider); | ||
} | ||
|
||
function createLocalPrivateModule() { | ||
angular.module('tableVisPrivate', []).provider('Private', PrivateProvider); | ||
} | ||
|
||
function createLocalConfigModule(uiSettings: IUiSettingsClient) { | ||
angular.module('tableVisConfig', []).provider('config', function () { | ||
return { | ||
$get: () => ({ | ||
get: (value: string) => { | ||
return uiSettings ? uiSettings.get(value) : undefined; | ||
}, | ||
// set method is used in agg_table mocha test | ||
set: (key: string, value: string) => { | ||
return uiSettings ? uiSettings.set(key, value) : undefined; | ||
}, | ||
}), | ||
}; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
visualization.enhanced-table { | ||
padding: 0px 5px; | ||
} | ||
|
||
.enhanced-table-vis { | ||
$euiColorLightestShade: #F5F7FA; | ||
@import 'agg_table/index'; | ||
@import 'paginated_table/index'; | ||
@import 'enhanced-table-vis'; | ||
} | ||
|
||
.theme-dark.enhanced-table-vis { | ||
$euiColorLightestShade: #25262E; | ||
@import 'agg_table/index'; | ||
@import 'paginated_table/index'; | ||
@import 'enhanced-table-vis'; | ||
} | ||
|
||
@import 'enhanced-table-vis-params'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
import { PluginInitializerContext } from 'kibana/public'; | ||
import { EnhancedTablePlugin as Plugin } from './plugin'; | ||
|
||
export function plugin(initializerContext: PluginInitializerContext) { | ||
return new Plugin(initializerContext); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,34 @@ | ||
<div ng-controller="KbnSankeyVisController" class="kbn-sankey" style=" | ||
display: flex; | ||
flex: 1; | ||
flex-direction: column; | ||
overflow: auto; | ||
position: relative; | ||
padding: 8px; | ||
"> | ||
<div class="table-vis-error" ng-if="emptyGraph"> | ||
<h2 aria-hidden="true"><i class="fa fa-meh-o" aria-hidden="true"></i></h2> | ||
<h4>No results found</h4> | ||
<div ng-controller="KbnSankeyVisController" class="kbn-sankey"> | ||
|
||
<div ng-if="!hasSomeRows && hasSomeRows !== null" class="visError"> | ||
<div class="euiText euiText--extraSmall euiTextColor euiTextColor--subdued"> | ||
<icon type="'visualizeApp'" size="'m'" color="'subdued'"></icon> | ||
|
||
<br> | ||
<br> | ||
|
||
<p | ||
i18n-id="visTypeTable.vis.noResultsFoundTitle" | ||
i18n-default-message="No results found"> | ||
</p> | ||
</div> | ||
</div> | ||
|
||
<div ng-if="hasSomeRows" class="table-vis-container" ng-class="tableVisContainerClass" data-test-subj="tableVis"> | ||
pppppp {{hasSomeRows}} | ||
<kbn-enhanced-agg-table-group | ||
filter="vis.API.events.filter" | ||
group="tableGroups" | ||
export-title="visState.title" | ||
per-page="visState.params.perPage" | ||
sort="sort" | ||
show-total="visState.params.showTotal" | ||
total-func="visState.params.totalFunc" | ||
csv-export-with-total="visState.params.csvExportWithTotal && visState.params.showTotal" | ||
csv-full-export="visState.params.csvFullExport && visState.params.computedColumns.length === 0 && !visState.params.linesComputedFilter && !visState.params.hiddenColumns && !visState.params.csvExportWithTotal && !visState.params.addRowNumberColumn" | ||
csv-encoding="visState.params.csvEncoding || 'utf-8'" | ||
field-columns="visState.params.fieldColumns"> | ||
|
||
</kbn-enhanced-agg-table-group> | ||
</div> | ||
<div class="metric-container" ng-model="metrics"></div> | ||
</div> |
Oops, something went wrong.