* ```
*/
-module.directive('kbnTableRow', function ($compile, $httpParamSerializer, kbnUrl) {
+module.directive('kbnTableRow', function ($compile, $httpParamSerializer, kbnUrl, config) {
const cellTemplate = _.template(noWhiteSpace(require('ui/doc_table/components/table_row/cell.html')));
const truncateByHeightTemplate = _.template(noWhiteSpace(require('ui/partials/truncate_by_height.html')));
@@ -139,7 +139,8 @@ module.directive('kbnTableRow', function ($compile, $httpParamSerializer, kbnUrl
];
const mapping = indexPattern.fields.byName;
- if (indexPattern.timeFieldName) {
+ const hideTimeColumn = config.get('doc_table:hideTimeColumn');
+ if (indexPattern.timeFieldName && !hideTimeColumn) {
newHtmls.push(cellTemplate({
timefield: true,
formatted: _displayField(row, indexPattern.timeFieldName),
diff --git a/src/ui/ui_exports/ui_export_types/style_sheet_paths.js b/src/ui/ui_exports/ui_export_types/style_sheet_paths.js
index 81644a494288..016b1b1dd32d 100644
--- a/src/ui/ui_exports/ui_export_types/style_sheet_paths.js
+++ b/src/ui/ui_exports/ui_export_types/style_sheet_paths.js
@@ -18,6 +18,7 @@
*/
import path from 'path';
+import { existsSync } from 'fs';
import { flatConcatAtType } from './reduce';
import { mapSpec, wrap } from './modify_reduce';
@@ -46,16 +47,22 @@ function normalize(localPath, type, pluginSpec) {
);
}
+ // replace the extension of localPath to be .css
+ // publicPath will always point to the css file
+ const localCssPath = localPath.slice(0, -extname.length) + '.css';
+
+ // update localPath to point to the .css file if it exists and
+ // the .scss path does not, which is the case for built plugins
+ if (extname === '.scss' && !existsSync(localPath) && existsSync(localCssPath)) {
+ localPath = localCssPath;
+ }
+
// get the path of the stylesheet relative to the public dir for the plugin
- let relativePath = path.relative(publicDir, localPath);
+ let relativePath = path.relative(publicDir, localCssPath);
// replace back slashes on windows
relativePath = relativePath.split('\\').join('/');
- // replace the extension of relativePath to be .css
- // publicPath will always point to the css file
- relativePath = relativePath.slice(0, -extname.length) + '.css';
-
const publicPath = `plugins/${pluginSpec.getId()}/${relativePath}`;
return {
@@ -64,4 +71,4 @@ function normalize(localPath, type, pluginSpec) {
};
}
-export const styleSheetPaths = wrap(mapSpec(normalize), flatConcatAtType);
\ No newline at end of file
+export const styleSheetPaths = wrap(mapSpec(normalize), flatConcatAtType);
diff --git a/src/ui/ui_render/ui_render_mixin.js b/src/ui/ui_render/ui_render_mixin.js
index 833588a6de53..7ecd0d7af142 100644
--- a/src/ui/ui_render/ui_render_mixin.js
+++ b/src/ui/ui_render/ui_render_mixin.js
@@ -23,6 +23,7 @@ import { resolve } from 'path';
import { i18n } from '@kbn/i18n';
import { AppBootstrap } from './bootstrap';
import { mergeVariables } from './lib';
+import { fromRoot } from '../../utils';
export function uiRenderMixin(kbnServer, server, config) {
function replaceInjectedVars(request, injectedVars) {
@@ -50,6 +51,9 @@ export function uiRenderMixin(kbnServer, server, config) {
// render all views from ./views
server.setupViews(resolve(__dirname, 'views'));
+ // expose built css
+ server.exposeStaticDir('/built_assets/css/{path*}', fromRoot('built_assets/css'));
+
server.route({
path: '/bundles/app/{id}/bootstrap.js',
method: 'GET',
@@ -63,12 +67,19 @@ export function uiRenderMixin(kbnServer, server, config) {
const basePath = config.get('server.basePath');
const regularBundlePath = `${basePath}/bundles`;
- const dllBundlePath = `${basePath}/dlls`;
+ const dllBundlePath = `${basePath}/built_assets/dlls`;
const styleSheetPaths = [
`${dllBundlePath}/vendors.style.dll.css`,
`${regularBundlePath}/commons.style.css`,
`${regularBundlePath}/${app.getId()}.style.css`,
- ].concat(kbnServer.uiExports.styleSheetPaths.map(path => `${basePath}/${path.publicPath}`).reverse());
+ ...kbnServer.uiExports.styleSheetPaths
+ .map(path => (
+ path.localPath.endsWith('.scss')
+ ? `${basePath}/built_assets/css/${path.publicPath}`
+ : `${basePath}/${path.publicPath}`
+ ))
+ .reverse()
+ ];
const bootstrap = new AppBootstrap({
templateData: {
diff --git a/tasks/config/karma.js b/tasks/config/karma.js
index d2ca40cef2b3..5862d69b9fcc 100644
--- a/tasks/config/karma.js
+++ b/tasks/config/karma.js
@@ -85,17 +85,17 @@ module.exports = function (grunt) {
// list of files / patterns to load in the browser
files: [
- 'http://localhost:5610/dlls/vendors.bundle.dll.js',
+ 'http://localhost:5610/built_assets/dlls/vendors.bundle.dll.js',
'http://localhost:5610/bundles/tests.bundle.js',
- 'http://localhost:5610/dlls/vendors.style.dll.css',
+ 'http://localhost:5610/built_assets/dlls/vendors.style.dll.css',
'http://localhost:5610/bundles/tests.style.css'
],
proxies: {
'/tests/': 'http://localhost:5610/tests/',
'/bundles/': 'http://localhost:5610/bundles/',
- '/dlls/': 'http://localhost:5610/dlls/'
+ '/built_assets/dlls/': 'http://localhost:5610/built_assets/dlls/'
},
client: {
@@ -176,10 +176,10 @@ module.exports = function (grunt) {
singleRun: true,
options: {
files: [
- 'http://localhost:5610/dlls/vendors.bundle.dll.js',
+ 'http://localhost:5610/built_assets/dlls/vendors.bundle.dll.js',
`http://localhost:5610/bundles/tests.bundle.js?shards=${TOTAL_CI_SHARDS}&shard_num=${n}`,
- 'http://localhost:5610/dlls/vendors.style.dll.css',
+ 'http://localhost:5610/built_assets/dlls/vendors.style.dll.css',
'http://localhost:5610/bundles/tests.style.css'
]
}
diff --git a/x-pack/plugins/apm/public/components/app/Main/Home.tsx b/x-pack/plugins/apm/public/components/app/Main/Home.tsx
index 53b2be947688..ef185c5f072d 100644
--- a/x-pack/plugins/apm/public/components/app/Main/Home.tsx
+++ b/x-pack/plugins/apm/public/components/app/Main/Home.tsx
@@ -20,12 +20,12 @@ const homeTabs: IHistoryTab[] = [
{
path: '/services',
name: 'Services',
- component: ServiceOverview
+ render: props =>
},
{
path: '/traces',
name: 'Traces',
- component: TraceOverview
+ render: props =>
}
];
diff --git a/x-pack/plugins/apm/public/components/app/Main/__test__/__snapshots__/Home.test.js.snap b/x-pack/plugins/apm/public/components/app/Main/__test__/__snapshots__/Home.test.js.snap
index 87451ecb3743..970d3692b0a8 100644
--- a/x-pack/plugins/apm/public/components/app/Main/__test__/__snapshots__/Home.test.js.snap
+++ b/x-pack/plugins/apm/public/components/app/Main/__test__/__snapshots__/Home.test.js.snap
@@ -39,14 +39,14 @@ exports[`Home component should render 1`] = `
tabs={
Array [
Object {
- "component": [Function],
"name": "Services",
"path": "/services",
+ "render": [Function],
},
Object {
- "component": [Function],
"name": "Traces",
"path": "/traces",
+ "render": [Function],
},
]
}
diff --git a/x-pack/plugins/apm/public/components/app/ServiceDetails/ServiceDetailTabs.tsx b/x-pack/plugins/apm/public/components/app/ServiceDetails/ServiceDetailTabs.tsx
index 435085afe5dd..d83b07d325ab 100644
--- a/x-pack/plugins/apm/public/components/app/ServiceDetails/ServiceDetailTabs.tsx
+++ b/x-pack/plugins/apm/public/components/app/ServiceDetails/ServiceDetailTabs.tsx
@@ -26,7 +26,7 @@ export class ServiceDetailTabs extends React.Component {
name: 'Transactions',
path: `/${serviceName}/transactions/${transactionTypes[0]}`,
routePath: `/${serviceName}/transactions/:transactionType?`,
- component: () => (
+ render: () => (
{
{
name: 'Errors',
path: `/${serviceName}/errors`,
- component: () => {
+ render: () => {
return (
);
@@ -45,7 +45,7 @@ export class ServiceDetailTabs extends React.Component {
{
name: 'Metrics',
path: `/${serviceName}/metrics`,
- component: () =>
+ render: () =>
}
];
diff --git a/x-pack/plugins/apm/public/components/app/ServiceDetails/ServiceIntegrations/MachineLearningFlyout.tsx b/x-pack/plugins/apm/public/components/app/ServiceDetails/ServiceIntegrations/MachineLearningFlyout.tsx
index 9cf82a08cde2..c69ae43c627c 100644
--- a/x-pack/plugins/apm/public/components/app/ServiceDetails/ServiceIntegrations/MachineLearningFlyout.tsx
+++ b/x-pack/plugins/apm/public/components/app/ServiceDetails/ServiceIntegrations/MachineLearningFlyout.tsx
@@ -90,26 +90,19 @@ export class MachineLearningFlyout extends Component {
};
public addErrorToast = () => {
- const { location, urlParams } = this.props;
- const { serviceName = 'unknown', transactionType } = urlParams;
+ const { urlParams } = this.props;
+ const { serviceName = 'unknown' } = urlParams;
if (!serviceName) {
return;
}
toastNotifications.addWarning({
- title: 'Job already exists',
+ title: 'Job creation failed',
text: (
- There's already a job running for anomaly detection on{' '}
- {serviceName} ({transactionType}).{' '}
-
- View existing job
-
+ Your current license may not allow for creating machine learning jobs,
+ or this job may already exist.
)
});
diff --git a/x-pack/plugins/apm/public/components/app/TraceOverview/TraceList.tsx b/x-pack/plugins/apm/public/components/app/TraceOverview/TraceList.tsx
index e587f513a58b..b29387f11933 100644
--- a/x-pack/plugins/apm/public/components/app/TraceOverview/TraceList.tsx
+++ b/x-pack/plugins/apm/public/components/app/TraceOverview/TraceList.tsx
@@ -70,12 +70,13 @@ const traceListColumns: ITableColumn[] = [
];
export function TraceList({ items = [], noItemsMessage, isLoading }: Props) {
- return isLoading ? null : (
+ const noItems = isLoading ? null : noItemsMessage;
+ return (
);
diff --git a/x-pack/plugins/apm/public/components/app/TransactionOverview/__jest__/__snapshots__/TransactionOverview.test.js.snap b/x-pack/plugins/apm/public/components/app/TransactionOverview/__jest__/__snapshots__/TransactionOverview.test.js.snap
index 1f38d5961e4b..d960d846a1da 100644
--- a/x-pack/plugins/apm/public/components/app/TransactionOverview/__jest__/__snapshots__/TransactionOverview.test.js.snap
+++ b/x-pack/plugins/apm/public/components/app/TransactionOverview/__jest__/__snapshots__/TransactionOverview.test.js.snap
@@ -6,6 +6,7 @@ exports[`TransactionOverviewView should render with type filter controls 1`] = `
describedByIds={Array []}
fullWidth={false}
hasEmptyLabelSpace={false}
+ label="Filter by type"
>
{serviceTransactionTypes.length > 1 ? (
-
+ ({
- text: `Filter by type: ${type}`,
+ text: `${type}`,
value: type
}))}
value={transactionType}
diff --git a/x-pack/plugins/apm/public/components/shared/HistoryTabs/__test__/HistoryTabs.test.tsx b/x-pack/plugins/apm/public/components/shared/HistoryTabs/__test__/HistoryTabs.test.tsx
index 312f22d7760e..124d355e19a9 100644
--- a/x-pack/plugins/apm/public/components/shared/HistoryTabs/__test__/HistoryTabs.test.tsx
+++ b/x-pack/plugins/apm/public/components/shared/HistoryTabs/__test__/HistoryTabs.test.tsx
@@ -40,17 +40,17 @@ describe('HistoryTabs', () => {
{
name: 'One',
path: '/one',
- component: () =>
+ render: props =>
},
{
name: 'Two',
path: '/two',
- component: () =>
+ render: () =>
},
{
name: 'Three',
path: '/three',
- component: () =>
+ render: () =>
}
];
diff --git a/x-pack/plugins/apm/public/components/shared/HistoryTabs/__test__/__snapshots__/HistoryTabs.test.tsx.snap b/x-pack/plugins/apm/public/components/shared/HistoryTabs/__test__/__snapshots__/HistoryTabs.test.tsx.snap
index f23eb64416aa..3e4c0b065657 100644
--- a/x-pack/plugins/apm/public/components/shared/HistoryTabs/__test__/__snapshots__/HistoryTabs.test.tsx.snap
+++ b/x-pack/plugins/apm/public/components/shared/HistoryTabs/__test__/__snapshots__/HistoryTabs.test.tsx.snap
@@ -55,19 +55,19 @@ exports[`HistoryTabs should render correctly 1`] = `
size="l"
/>
`;
diff --git a/x-pack/plugins/apm/public/components/shared/HistoryTabs/index.tsx b/x-pack/plugins/apm/public/components/shared/HistoryTabs/index.tsx
index c5f67d440878..ff3f7e79357a 100644
--- a/x-pack/plugins/apm/public/components/shared/HistoryTabs/index.tsx
+++ b/x-pack/plugins/apm/public/components/shared/HistoryTabs/index.tsx
@@ -17,7 +17,7 @@ export interface IHistoryTab {
path: string;
routePath?: string;
name: React.ReactNode;
- component?: React.SFC | React.ComponentClass;
+ render?: (props: RouteComponentProps) => React.ReactNode;
}
export interface HistoryTabsProps extends RouteComponentProps {
@@ -51,10 +51,10 @@ const HistoryTabsWithoutRouter = ({
{tabs.map(tab =>
- tab.component ? (
+ tab.render ? (
) : null
diff --git a/x-pack/plugins/apm/server/lib/status_check/agent_check.js b/x-pack/plugins/apm/server/lib/status_check/agent_check.js
index 65482791e38e..accd7eb84244 100644
--- a/x-pack/plugins/apm/server/lib/status_check/agent_check.js
+++ b/x-pack/plugins/apm/server/lib/status_check/agent_check.js
@@ -6,6 +6,7 @@
import { PROCESSOR_NAME } from '../../../common/constants';
+// Note: this logic is duplicated in tutorials/apm/envs/on_prem
export async function getAgentStatus({ setup }) {
const { client, config } = setup;
@@ -18,11 +19,12 @@ export async function getAgentStatus({ setup }) {
size: 0,
query: {
bool: {
- filter: {
- exists: {
- field: PROCESSOR_NAME
- }
- }
+ should: [
+ { term: { [PROCESSOR_NAME]: 'error' } },
+ { term: { [PROCESSOR_NAME]: 'transaction' } },
+ { term: { [PROCESSOR_NAME]: 'metric' } },
+ { term: { [PROCESSOR_NAME]: 'sourcemap' } }
+ ]
}
}
}
diff --git a/x-pack/plugins/apm/server/lib/status_check/server_check.js b/x-pack/plugins/apm/server/lib/status_check/server_check.js
index 6df2135426d2..d13a63adda61 100644
--- a/x-pack/plugins/apm/server/lib/status_check/server_check.js
+++ b/x-pack/plugins/apm/server/lib/status_check/server_check.js
@@ -4,6 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
+// Note: this logic is duplicated in tutorials/apm/envs/on_prem
export async function getServerStatus({ setup }) {
const { client, config } = setup;
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/alterColumn.js b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/alterColumn.js
index 763fe0fe5720..a9ad20c05c6f 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/alterColumn.js
+++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/alterColumn.js
@@ -79,7 +79,7 @@ describe('alterColumn', () => {
it('throws when converting to an invalid type', () => {
expect(() => fn(testTable, { column: 'name', type: 'foo' })).to.throwException(e => {
- expect(e.message).to.be('Cannot convert to foo');
+ expect(e.message).to.be(`Cannot convert to 'foo'`);
});
});
});
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/axis_config.js b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/axis_config.js
index f74f568080dc..1e4bbccb8ae3 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/axis_config.js
+++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/axis_config.js
@@ -59,7 +59,7 @@ describe('axisConfig', () => {
expect(fn)
.withArgs(testTable, { position: 'foo' })
.to.throwException(e => {
- expect(e.message).to.be('Invalid position foo');
+ expect(e.message).to.be(`Invalid position: 'foo'`);
});
});
});
@@ -83,7 +83,7 @@ describe('axisConfig', () => {
.withArgs(testTable, { min: 'foo' })
.to.throwException(e => {
expect(e.message).to.be(
- `Invalid date string 'foo' found. 'min' must be a number, date in ms, or ISO8601 date string`
+ `Invalid date string: 'foo'. 'min' must be a number, date in ms, or ISO8601 date string`
);
});
});
@@ -108,7 +108,7 @@ describe('axisConfig', () => {
.withArgs(testTable, { max: '20/02/17' })
.to.throwException(e => {
expect(e.message).to.be(
- `Invalid date string '20/02/17' found. 'max' must be a number, date in ms, or ISO8601 date string`
+ `Invalid date string: '20/02/17'. 'max' must be a number, date in ms, or ISO8601 date string`
);
});
});
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/compare.js b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/compare.js
index c7b61be4e4b2..2bd31f5d69ff 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/compare.js
+++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/compare.js
@@ -24,10 +24,14 @@ describe('compare', () => {
it('throws when invalid op is provided', () => {
expect(() => fn(1, { op: 'boo', to: 2 })).to.throwException(e => {
- expect(e.message).to.be('Invalid compare operator. Use eq, ne, lt, gt, lte, or gte.');
+ expect(e.message).to.be(
+ `Invalid compare operator: 'boo'. Use eq, ne, lt, gt, lte, or gte.`
+ );
});
expect(() => fn(1, { op: 'boo' })).to.throwException(e => {
- expect(e.message).to.be('Invalid compare operator. Use eq, ne, lt, gt, lte, or gte.');
+ expect(e.message).to.be(
+ `Invalid compare operator: 'boo'. Use eq, ne, lt, gt, lte, or gte.`
+ );
});
});
});
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/font.js b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/font.js
index b05945c500e1..0bd5871b03ad 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/font.js
+++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/font.js
@@ -105,7 +105,7 @@ describe('font', () => {
it('throws when provided an invalid weight', () => {
expect(() => fn(null, { weight: 'foo' })).to.throwException(e => {
- expect(e.message).to.be('Invalid font weight: foo');
+ expect(e.message).to.be(`Invalid font weight: 'foo'`);
});
});
});
@@ -175,7 +175,7 @@ describe('font', () => {
expect(fn)
.withArgs(null, { align: 'foo' })
.to.throwException(e => {
- expect(e.message).to.be('Invalid text alignment: foo');
+ expect(e.message).to.be(`Invalid text alignment: 'foo'`);
});
});
});
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/getCell.js b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/getCell.js
index 9509c05f9229..7b73dbec4df0 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/getCell.js
+++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/getCell.js
@@ -44,7 +44,7 @@ describe('getCell', () => {
it('throws when invalid column is provided', () => {
expect(() => fn(testTable, { column: 'foo' })).to.throwException(e => {
- expect(e.message).to.be('Column not found: foo');
+ expect(e.message).to.be(`Column not found: 'foo'`);
});
});
});
@@ -66,15 +66,15 @@ describe('getCell', () => {
const invalidRow = testTable.rows.length;
expect(() => fn(testTable, { column: 'name', row: invalidRow })).to.throwException(e => {
- expect(e.message).to.be(`Row not found: ${invalidRow}`);
+ expect(e.message).to.be(`Row not found: '${invalidRow}'`);
});
expect(() => fn(emptyTable, { column: 'foo' })).to.throwException(e => {
- expect(e.message).to.be('Row not found: 0');
+ expect(e.message).to.be(`Row not found: '0'`);
});
expect(() => fn(emptyTable)).to.throwException(e => {
- expect(e.message).to.be('Row not found: 0');
+ expect(e.message).to.be(`Row not found: '0'`);
});
});
});
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/ply.js b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/ply.js
index 0e72cb38885b..54e33de91a47 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/ply.js
+++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/ply.js
@@ -82,12 +82,12 @@ describe('ply', () => {
it('throws when by is an invalid column', () => {
expect(() => fn(testTable, { by: [''], expression: [averagePrice] })).to.throwException(
e => {
- expect(e.message).to.be('No such column: ');
+ expect(e.message).to.be(`Column not found: ''`);
}
);
expect(() => fn(testTable, { by: ['foo'], expression: [averagePrice] })).to.throwException(
e => {
- expect(e.message).to.be('No such column: foo');
+ expect(e.message).to.be(`Column not found: 'foo'`);
}
);
});
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/progress.js b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/progress.js
index 5b16b80ddd74..61df4292e025 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/progress.js
+++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/progress.js
@@ -29,7 +29,7 @@ describe('progress', () => {
expect(fn)
.withArgs(3)
.to.throwException(e => {
- expect(e.message).to.be('Context must be between 0 and 1');
+ expect(e.message).to.be(`Invalid value: '3'. Value must be between 0 and 1`);
});
});
@@ -65,7 +65,7 @@ describe('progress', () => {
expect(fn)
.withArgs(value, { max: -0.5 })
.to.throwException(e => {
- expect(e.message).to.be(`'max' must be greater than 0`);
+ expect(e.message).to.be(`Invalid max value: '-0.5'. 'max' must be greater than 0`);
});
});
});
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/reveal_image.js b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/reveal_image.js
index 3dc00b3c5559..3a3707e7c0b7 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/reveal_image.js
+++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/reveal_image.js
@@ -29,7 +29,7 @@ describe('revealImage', () => {
origin: 'top',
})
.to.throwException(e => {
- expect(e.message).to.be.equal('input must be between 0 and 1');
+ expect(e.message).to.be.equal(`Invalid value: '10'. Percentage must be between 0 and 1`);
});
expect(fn)
@@ -39,7 +39,9 @@ describe('revealImage', () => {
origin: 'top',
})
.to.throwException(e => {
- expect(e.message).to.be.equal('input must be between 0 and 1');
+ expect(e.message).to.be.equal(
+ `Invalid value: '-0.1'. Percentage must be between 0 and 1`
+ );
});
});
});
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/timefilter.js b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/timefilter.js
index a63adc3d0533..70a3a007b889 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/timefilter.js
+++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/__tests__/timefilter.js
@@ -88,7 +88,7 @@ describe('timefilter', () => {
it('throws when provided an invalid date string', () => {
expect(() => fn(emptyFilter, { from: '2018-13-42T15:00:00.950Z' })).to.throwException(e => {
- expect(e.message).to.be.equal('Invalid date/time string 2018-13-42T15:00:00.950Z');
+ expect(e.message).to.be.equal(`Invalid date/time string: '2018-13-42T15:00:00.950Z'`);
});
});
});
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/alterColumn.js b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/alterColumn.js
index 0c706e4d562b..c12056488540 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/alterColumn.js
+++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/alterColumn.js
@@ -74,7 +74,7 @@ export const alterColumn = () => ({
case 'null':
return () => null;
default:
- throw new Error(`Cannot convert to ${type}`);
+ throw new Error(`Cannot convert to '${type}'`);
}
})();
}
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/axisConfig.js b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/axisConfig.js
index a89f2206023a..f2672552f0c3 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/axisConfig.js
+++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/axisConfig.js
@@ -43,7 +43,7 @@ export const axisConfig = () => ({
fn: (context, args) => {
const positions = ['top', 'bottom', 'left', 'right', ''];
if (!positions.includes(args.position)) {
- throw new Error(`Invalid position ${args.position}`);
+ throw new Error(`Invalid position: '${args.position}'`);
}
const min = typeof args.min === 'string' ? moment.utc(args.min).valueOf() : args.min;
@@ -51,16 +51,16 @@ export const axisConfig = () => ({
if (min != null && isNaN(min)) {
throw new Error(
- `Invalid date string '${
+ `Invalid date string: '${
args.min
- }' found. 'min' must be a number, date in ms, or ISO8601 date string`
+ }'. 'min' must be a number, date in ms, or ISO8601 date string`
);
}
if (max != null && isNaN(max)) {
throw new Error(
- `Invalid date string '${
+ `Invalid date string: '${
args.max
- }' found. 'max' must be a number, date in ms, or ISO8601 date string`
+ }'. 'max' must be a number, date in ms, or ISO8601 date string`
);
}
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/compare.js b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/compare.js
index a0c117af7dd8..43d386229e3b 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/compare.js
+++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/compare.js
@@ -61,7 +61,7 @@ export const compare = () => ({
}
return false;
default:
- throw new Error('Invalid compare operator. Use eq, ne, lt, gt, lte, or gte.');
+ throw new Error(`Invalid compare operator: '${op}'. Use eq, ne, lt, gt, lte, or gte.`);
}
return false;
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/font.js b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/font.js
index ec99f19d8d59..7e9a3e9887f2 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/font.js
+++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/font.js
@@ -80,10 +80,10 @@ export const font = () => ({
},
fn: (context, args) => {
if (!weights.includes(args.weight)) {
- throw new Error(`Invalid font weight: ${args.weight}`);
+ throw new Error(`Invalid font weight: '${args.weight}'`);
}
if (!alignments.includes(args.align)) {
- throw new Error(`Invalid text alignment: ${args.align}`);
+ throw new Error(`Invalid text alignment: '${args.align}'`);
}
// the line height shouldn't ever be lower than the size
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/getCell.js b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/getCell.js
index e978c6d64c9f..28232ab0035b 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/getCell.js
+++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/getCell.js
@@ -26,14 +26,14 @@ export const getCell = () => ({
fn: (context, args) => {
const row = context.rows[args.row];
if (!row) {
- throw new Error(`Row not found: ${args.row}`);
+ throw new Error(`Row not found: '${args.row}'`);
}
const { column = context.columns[0].name } = args;
const value = row[column];
if (typeof value === 'undefined') {
- throw new Error(`Column not found: ${column}`);
+ throw new Error(`Column not found: '${column}'`);
}
return value;
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/ply.js b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/ply.js
index c082c5c4c988..94644d976180 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/ply.js
+++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/ply.js
@@ -95,7 +95,7 @@ export const ply = () => ({
byColumns = args.by.map(by => {
const column = context.columns.find(column => column.name === by);
if (!column) {
- throw new Error(`No such column: ${by}`);
+ throw new Error(`Column not found: '${by}'`);
}
return column;
});
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/progress.js b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/progress.js
index 863e606984f7..d78fe4b062aa 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/progress.js
+++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/progress.js
@@ -72,10 +72,10 @@ export const progress = () => ({
},
fn: (value, args) => {
if (args.max <= 0) {
- throw new Error(`'max' must be greater than 0`);
+ throw new Error(`Invalid max value: '${args.max}'. 'max' must be greater than 0`);
}
if (value > args.max || value < 0) {
- throw new Error(`Context must be between 0 and ${args.max}`);
+ throw new Error(`Invalid value: '${value}'. Value must be between 0 and ${args.max}`);
}
let label = '';
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/revealImage.js b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/revealImage.js
index 888f0899978d..a57830bdf9a5 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/revealImage.js
+++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/revealImage.js
@@ -35,7 +35,7 @@ export const revealImage = () => ({
},
fn: (percent, args) => {
if (percent > 1 || percent < 0) {
- throw new Error('input must be between 0 and 1');
+ throw new Error(`Invalid value: '${percent}'. Percentage must be between 0 and 1`);
}
return {
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/timefilter.js b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/timefilter.js
index f9a8b12497ac..88a89233b222 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/timefilter.js
+++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/timefilter.js
@@ -50,7 +50,7 @@ export const timefilter = () => ({
const moment = dateMath.parse(str);
if (!moment || !moment.isValid()) {
- throw new Error(`Invalid date/time string ${str}`);
+ throw new Error(`Invalid date/time string: '${str}'`);
}
return moment.toISOString();
}
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/server/src/__tests__/demodata.js b/x-pack/plugins/canvas/canvas_plugin_src/functions/server/src/__tests__/demodata.js
index 86ca52ebbc4b..1871bc560b79 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/functions/server/src/__tests__/demodata.js
+++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/server/src/__tests__/demodata.js
@@ -36,7 +36,7 @@ describe('demodata', () => {
expect(fn)
.withArgs(null, { type: 'foo' })
.to.throwException(e => {
- expect(e.message).to.be("Invalid data set: foo, use 'ci' or 'shirts'.");
+ expect(e.message).to.be("Invalid data set: 'foo', use 'ci' or 'shirts'.");
});
});
});
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/server/src/demodata/get_demo_rows.js b/x-pack/plugins/canvas/canvas_plugin_src/functions/server/src/demodata/get_demo_rows.js
index 78bb441e242c..e61d800e9e86 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/functions/server/src/demodata/get_demo_rows.js
+++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/server/src/demodata/get_demo_rows.js
@@ -15,5 +15,5 @@ export function getDemoRows(arg) {
if (arg === 'shirts') {
return cloneDeep(shirts);
}
- throw new Error(`Invalid data set: ${arg}, use 'ci' or 'shirts'.`);
+ throw new Error(`Invalid data set: '${arg}', use 'ci' or 'shirts'.`);
}
diff --git a/x-pack/plugins/canvas/common/lib/fonts.ts b/x-pack/plugins/canvas/common/lib/fonts.ts
index 69b3bf2bb71b..b413e1c74d2b 100644
--- a/x-pack/plugins/canvas/common/lib/fonts.ts
+++ b/x-pack/plugins/canvas/common/lib/fonts.ts
@@ -6,52 +6,53 @@
export const americanTypewriter = {
label: 'American Typewriter',
- value: `'American Typewriter', 'Courier New', Courier, Monaco, mono`,
+ value: "'American Typewriter', 'Courier New', Courier, Monaco, mono",
};
-export const arial = { label: 'Arial', value: `Arial, sans-serif` };
+export const arial = { label: 'Arial', value: 'Arial, sans-serif' };
export const baskerville = {
label: 'Baskerville',
- value: `Baskerville, Georgia, Garamond, 'Times New Roman', Times, serif`,
+ value: "Baskerville, Georgia, Garamond, 'Times New Roman', Times, serif",
};
export const bookAntiqua = {
label: 'Book Antiqua',
- value: `'Book Antiqua', Georgia, Garamond, 'Times New Roman', Times, serif`,
+ value: "'Book Antiqua', Georgia, Garamond, 'Times New Roman', Times, serif",
};
export const brushScript = {
label: 'Brush Script',
- value: `'Brush Script MT', 'Comic Sans', sans-serif`,
+ value: "'Brush Script MT', 'Comic Sans', sans-serif",
};
-export const chalkboard = { label: 'Chalkboard', value: `Chalkboard, 'Comic Sans', sans-serif` };
+export const chalkboard = { label: 'Chalkboard', value: "Chalkboard, 'Comic Sans', sans-serif" };
export const didot = {
label: 'Didot',
- value: `Didot, Georgia, Garamond, 'Times New Roman', Times, serif`,
+ value: "Didot, Georgia, Garamond, 'Times New Roman', Times, serif",
};
-export const futura = { label: 'Futura', value: `Futura, Impact, Helvetica, Arial, sans-serif` };
+export const futura = { label: 'Futura', value: 'Futura, Impact, Helvetica, Arial, sans-serif' };
export const gillSans = {
label: 'Gill Sans',
- value: `'Gill Sans', 'Lucida Grande', 'Lucida Sans Unicode', Verdana, Helvetica, Arial, sans-serif`,
+ value:
+ "'Gill Sans', 'Lucida Grande', 'Lucida Sans Unicode', Verdana, Helvetica, Arial, sans-serif",
};
export const helveticaNeue = {
label: 'Helvetica Neue',
- value: `'Helvetica Neue', Helvetica, Arial, sans-serif`,
+ value: "'Helvetica Neue', Helvetica, Arial, sans-serif",
};
export const hoeflerText = {
label: 'Hoefler Text',
- value: `'Hoefler Text', Garamond, Georgia, 'Times New Roman', Times, serif`,
+ value: "'Hoefler Text', Garamond, Georgia, 'Times New Roman', Times, serif",
};
export const lucidaGrande = {
label: 'Lucida Grande',
- value: `'Lucida Grande', 'Lucida Sans Unicode', Lucida, Verdana, Helvetica, Arial, sans-serif`,
+ value: "'Lucida Grande', 'Lucida Sans Unicode', Lucida, Verdana, Helvetica, Arial, sans-serif",
};
-export const myriad = { label: 'Myriad', value: `Myriad, Helvetica, Arial, sans-serif` };
-export const openSans = { label: 'Open Sans', value: `'Open Sans', Helvetica, Arial, sans-serif` };
+export const myriad = { label: 'Myriad', value: 'Myriad, Helvetica, Arial, sans-serif' };
+export const openSans = { label: 'Open Sans', value: "'Open Sans', Helvetica, Arial, sans-serif" };
export const optima = {
label: 'Optima',
- value: `Optima, 'Lucida Grande', 'Lucida Sans Unicode', Verdana, Helvetica, Arial, sans-serif`,
+ value: "Optima, 'Lucida Grande', 'Lucida Sans Unicode', Verdana, Helvetica, Arial, sans-serif",
};
export const palatino = {
label: 'Palatino',
- value: `Palatino, 'Book Antiqua', Georgia, Garamond, 'Times New Roman', Times, serif`,
+ value: "Palatino, 'Book Antiqua', Georgia, Garamond, 'Times New Roman', Times, serif",
};
export const fonts = [
americanTypewriter,
diff --git a/x-pack/plugins/canvas/public/apps/workpad/routes.js b/x-pack/plugins/canvas/public/apps/workpad/routes.js
index 9d8af8cd11b9..727f03a779da 100644
--- a/x-pack/plugins/canvas/public/apps/workpad/routes.js
+++ b/x-pack/plugins/canvas/public/apps/workpad/routes.js
@@ -33,7 +33,7 @@ export const routes = [
notify.error(err, { title: `Couldn't create workpad` });
// TODO: remove this and switch to checking user privileges when canvas loads when granular app privileges are introduced
// https://github.com/elastic/kibana/issues/20277
- if (err.response.status === 403) {
+ if (err.response && err.response.status === 403) {
dispatch(setCanUserWrite(false));
}
router.redirectTo('home');
@@ -61,7 +61,7 @@ export const routes = [
// TODO: remove this and switch to checking user privileges when canvas loads when granular app privileges are introduced
// https://github.com/elastic/kibana/issues/20277
workpadService.update(params.id, fetchedWorkpad).catch(err => {
- if (err.response.status === 403) {
+ if (err.response && err.response.status === 403) {
dispatch(setCanUserWrite(false));
}
});
diff --git a/x-pack/plugins/canvas/public/components/clipboard/clipboard.js b/x-pack/plugins/canvas/public/components/clipboard/clipboard.js
index 72ed24dc5f10..1b516fdc3e9f 100644
--- a/x-pack/plugins/canvas/public/components/clipboard/clipboard.js
+++ b/x-pack/plugins/canvas/public/components/clipboard/clipboard.js
@@ -28,7 +28,7 @@ export class Clipboard extends React.PureComponent {
render() {
return (
-