Skip to content

Commit

Permalink
Merge branch 'master' into feature/table-vis-translations
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel06081991 committed Oct 3, 2018
2 parents 7ebffe1 + 1311d89 commit 249feb8
Show file tree
Hide file tree
Showing 204 changed files with 4,542 additions and 2,240 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,9 @@
"@kbn/eslint-plugin-license-header": "link:packages/kbn-eslint-plugin-license-header",
"@kbn/plugin-generator": "link:packages/kbn-plugin-generator",
"@kbn/test": "link:packages/kbn-test",
"@types/angular": "^1.6.50",
"@types/angular-mocks": "^1.7.0",
"@octokit/rest": "^15.10.0",
"@types/angular": "^1.6.45",
"@types/babel-core": "^6.25.5",
"@types/bluebird": "^3.1.1",
"@types/boom": "^7.2.0",
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-es/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"@kbn/dev-utils": "link:../kbn-dev-utils",
"chalk": "^2.4.1",
"dedent": "^0.7.0",
"elasticsearch": "^14.1.0",
"execa": "^0.10.0",
"getopts": "^2.0.6",
"glob": "^7.1.2",
Expand Down
79 changes: 1 addition & 78 deletions packages/kbn-es/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,6 @@
version "0.0.0"
uid ""

agentkeepalive@^3.4.1:
version "3.4.1"
resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-3.4.1.tgz#aa95aebc3a749bca5ed53e3880a09f5235b48f0c"
dependencies:
humanize-ms "^1.2.1"

ansi-regex@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"

ansi-styles@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"

ansi-styles@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
Expand Down Expand Up @@ -47,16 +33,6 @@ buffer-crc32@~0.2.3:
version "0.2.13"
resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242"

chalk@^1.0.0:
version "1.1.3"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
dependencies:
ansi-styles "^2.2.1"
escape-string-regexp "^1.0.2"
has-ansi "^2.0.0"
strip-ansi "^3.0.0"
supports-color "^2.0.0"

chalk@^2.4.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e"
Expand Down Expand Up @@ -107,24 +83,13 @@ dedent@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c"

elasticsearch@^14.1.0:
version "14.2.0"
resolved "https://registry.yarnpkg.com/elasticsearch/-/elasticsearch-14.2.0.tgz#ef7c6e505cb41525a0751b5156e8c0fbd1f02d62"
dependencies:
agentkeepalive "^3.4.1"
chalk "^1.0.0"
lodash "2.4.2"
lodash.get "^4.4.2"
lodash.isempty "^4.4.0"
lodash.trimend "^4.5.1"

end-of-stream@^1.0.0, end-of-stream@^1.1.0:
version "1.4.1"
resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43"
dependencies:
once "^1.4.0"

escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
escape-string-regexp@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"

Expand Down Expand Up @@ -169,22 +134,10 @@ glob@^7.1.2:
once "^1.3.0"
path-is-absolute "^1.0.0"

has-ansi@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
dependencies:
ansi-regex "^2.0.0"

has-flag@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"

humanize-ms@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed"
dependencies:
ms "^2.0.0"

inflight@^1.0.4:
version "1.0.6"
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
Expand All @@ -208,22 +161,6 @@ isexe@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"

lodash.get@^4.4.2:
version "4.4.2"
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"

lodash.isempty@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.isempty/-/lodash.isempty-4.4.0.tgz#6f86cbedd8be4ec987be9aaf33c9684db1b31e7e"

lodash.trimend@^4.5.1:
version "4.5.1"
resolved "https://registry.yarnpkg.com/lodash.trimend/-/lodash.trimend-4.5.1.tgz#12804437286b98cad8996b79414e11300114082f"

lodash@2.4.2:
version "2.4.2"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-2.4.2.tgz#fadd834b9683073da179b3eae6d9c0d15053f73e"

minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
Expand Down Expand Up @@ -252,10 +189,6 @@ ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"

ms@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a"

nice-try@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.4.tgz#d93962f6c52f2c1558c0fbda6d512819f1efe1c4"
Expand Down Expand Up @@ -355,20 +288,10 @@ string_decoder@~1.0.3:
dependencies:
safe-buffer "~5.1.0"

strip-ansi@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf"
dependencies:
ansi-regex "^2.0.0"

strip-eof@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf"

supports-color@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"

supports-color@^5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.3.0.tgz#5b24ac15db80fa927cf5227a4a33fd3c4c7676c0"
Expand Down
10 changes: 0 additions & 10 deletions packages/kbn-i18n/.babelrc

This file was deleted.

3 changes: 2 additions & 1 deletion packages/kbn-i18n/angular/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"browser": "../target/web/angular",
"main": "../target/node/angular"
"main": "../target/node/angular",
"types": "./target/types/angular/index.d.ts"
}
51 changes: 51 additions & 0 deletions packages/kbn-i18n/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* 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.
*/

// We can't use common Kibana presets here because of babel versions incompatibility
module.exports = {
plugins: ['@babel/plugin-proposal-class-properties', '@babel/plugin-proposal-object-rest-spread'],
presets: ['@babel/preset-react', '@babel/typescript'],
env: {
web: {
presets: [
[
'@babel/preset-env',
{
targets: {
browsers: ['last 2 versions', '> 5%', 'Safari 7'],
},
},
],
],
},
node: {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
],
},
},
ignore: ['**/*.test.ts', '**/*.test.tsx'],
};
30 changes: 20 additions & 10 deletions packages/kbn-i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,40 @@
"name": "@kbn/i18n",
"browser": "./target/web/browser.js",
"main": "./target/node/index.js",
"types": "./target/types/index.d.ts",
"module": "./src/index.js",
"version": "1.0.0",
"license": "Apache-2.0",
"private": true,
"scripts": {
"build": "yarn build:web && yarn build:node",
"build:web": "cross-env BABEL_ENV=web babel src --out-dir target/web",
"build:node": "cross-env BABEL_ENV=node babel src --out-dir target/node",
"build": "yarn build:web && yarn build:node && yarn build:types",
"build:types": "tsc --emitDeclarationOnly",
"build:web": "cross-env BABEL_ENV=web babel src --config-file ./babel.config.js --out-dir target/web --extensions \".ts,.js,.tsx\"",
"build:node": "cross-env BABEL_ENV=node babel src --config-file ./babel.config.js --out-dir target/node --extensions \".ts,.js,.tsx\"",
"kbn:bootstrap": "yarn build",
"kbn:watch": "yarn build --watch"
},
"devDependencies": {
"@kbn/babel-preset": "link:../kbn-babel-preset",
"@kbn/dev-utils": "link:../kbn-dev-utils",
"babel-cli": "^6.26.0",
"cross-env": "^5.2.0"
"@babel/cli": "^7.1.0",
"@babel/core": "^7.1.0",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.1.0",
"@types/intl-relativeformat": "^2.1.0",
"@types/json5": "^0.0.30",
"@types/react-intl": "^2.3.11",
"cross-env": "^5.2.0",
"typescript": "^3.0.3"
},
"dependencies": {
"intl-format-cache": "^2.1.0",
"intl-messageformat": "^2.2.0",
"intl-relativeformat": "^2.1.0",
"json5": "^1.0.1",
"prop-types": "^15.5.8",
"json5": "^2.0.1",
"prop-types": "^15.6.2",
"react": "^16.3.0",
"react-intl": "^2.4.0"
"react-intl": "^2.7.0"
}
}
3 changes: 2 additions & 1 deletion packages/kbn-i18n/react/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"browser": "../target/web/react",
"main": "../target/node/react"
"main": "../target/node/react",
"types": "./target/types/react/index.d.ts"
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,30 @@

import angular from 'angular';
import 'angular-mocks';

import { i18nDirective } from './directive';
import { i18nProvider } from './provider';
import { I18nProvider } from './provider';

angular
.module('app', [])
.provider('i18n', i18nProvider)
.provider('i18n', I18nProvider)
.directive('i18nId', i18nDirective);

describe('i18nDirective', () => {
let compile;
let scope;
let compile: angular.ICompileService;
let scope: angular.IRootScopeService;

beforeEach(angular.mock.module('app'));
beforeEach(
angular.mock.inject(($compile, $rootScope) => {
compile = $compile;
scope = $rootScope.$new();
})
angular.mock.inject(
($compile: angular.ICompileService, $rootScope: angular.IRootScopeService) => {
compile = $compile;
scope = $rootScope.$new();
}
)
);

it('inserts correct translation html content', () => {
test('inserts correct translation html content', () => {
const id = 'id';
const defaultMessage = 'default-message';

Expand All @@ -56,7 +59,7 @@ describe('i18nDirective', () => {
expect(element.html()).toEqual(defaultMessage);
});

it('inserts correct translation html content with values', () => {
test('inserts correct translation html content with values', () => {
const id = 'id';
const defaultMessage = 'default-message {word}';
const compiledContent = 'default-message word';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,30 @@
* under the License.
*/

export function i18nDirective(i18n) {
import { IDirective, IRootElementService, IScope } from 'angular';

import { I18nServiceType } from './provider';

export function i18nDirective(i18n: I18nServiceType): IDirective {
return {
restrict: 'A',
scope: {
id: '@i18nId',
defaultMessage: '@i18nDefaultMessage',
values: '=i18nValues',
},
link: function($scope, $element) {
$scope.$watchGroup(['id', 'defaultMessage', 'values'], function([
id,
defaultMessage = '',
values = {},
]) {
$element.html(
i18n(id, {
values,
defaultMessage,
})
);
});
link($scope: IScope, $element: IRootElementService) {
$scope.$watchGroup(
['id', 'defaultMessage', 'values'],
([id, defaultMessage = '', values = {}]) => {
$element.html(
i18n(id, {
values,
defaultMessage,
})
);
}
);
},
};
}
Loading

0 comments on commit 249feb8

Please sign in to comment.