Skip to content

Commit

Permalink
Fix messaging and is populated obj
Browse files Browse the repository at this point in the history
  • Loading branch information
qn895 committed Apr 15, 2023
1 parent 0cea051 commit 3f64b1f
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 17 deletions.
8 changes: 2 additions & 6 deletions x-pack/plugins/transform/common/utils/transform_api_key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import type { GrantAPIKeyResult } from '@kbn/security-plugin/server';
import type { SecurityCreateApiKeyResponse } from '@elastic/elasticsearch/lib/api/types';
import { isPopulatedObject } from '@kbn/ml-is-populated-object';

export interface TransformAPIKey extends GrantAPIKeyResult {
/**
Expand All @@ -20,12 +21,7 @@ export interface SecondaryAuthorizationHeader {
}

export function isTransformApiKey(arg: any): arg is TransformAPIKey {
return (
arg &&
arg.hasOwnProperty('api_key') &&
arg.hasOwnProperty('encoded') &&
typeof arg.encoded === 'string'
);
return isPopulatedObject(arg, ['api_key', 'encoded']) && typeof arg.encoded === 'string';
}

export function generateTransformSecondaryAuthHeaders(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const ReauthorizeActionModal: FC<ReauthorizeAction> = ({
<p>
{i18n.translate('xpack.transform.transformList.reauthorizeModalBody', {
defaultMessage:
'Reauthorize will update and start the transform with the the roles of the user. Starting a transform increases search and indexing load in your cluster. If excessive load is experienced, stop the transform.',
'Your current roles are used to update and start the transform. Starting a transform increases search and indexing load in your cluster. If excessive load is experienced, stop the transform.',
})}
</p>
</EuiConfirmModal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export const useColumns = (
'xpack.transform.transformList.needsReauthorizationBadgeTooltip',
{
defaultMessage:
'This transform was created with insufficient permissions. You must have the transform_admin built-in role or manage_transform cluster privileges to reauthorize and start operations.',
'This transform was created with insufficient permissions. You must have manage_transform cluster privileges to reauthorize and start it.',
}
)}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const TransformManagement: FC = () => {
color="warning"
title={i18n.translate('xpack.transform.transformList.unauthorizedTransformsCallout', {
defaultMessage:
'{unauthorizedCnt, plural, one {A transform was installed but requires} other {# transforms were installed but require}} additional permissions to run. You must have the transform_admin built-in role or manage_transform cluster privileges to reauthorize and start operations.',
'{unauthorizedCnt, plural, one {A transform was installed but requires more permissions to run. You must have manage_transform cluster privileges to start it.} other {# transforms were installed but require more permissions to run. You must have manage_transform cluster privileges to start them.}}',
values: { unauthorizedCnt },
})}
/>
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/transform/server/routes/api/transforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export function registerTransformsRoutes(routeDependencies: RouteDependencies) {
);

/**
* @apiGroup Reauthorize transforms with API key generated from currently logged in suer
* @apiGroup Reauthorize transforms with API key generated from currently logged in user
* @api {post} /api/transform/reauthorize_transforms Post delete transforms
* @apiName Reauthorize Transforms
* @apiDescription Reauthorize transforms by generating an API Key for current user
Expand Down
14 changes: 7 additions & 7 deletions x-pack/plugins/transform/server/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
* 2.0.
*/

import { IRouter, CoreStart } from '@kbn/core/server';
import { PluginStart as DataViewsServerPluginStart } from '@kbn/data-views-plugin/server';
import { LicensingPluginSetup } from '@kbn/licensing-plugin/server';
import { PluginSetupContract as FeaturesPluginSetup } from '@kbn/features-plugin/server';
import type { IRouter, CoreStart } from '@kbn/core/server';
import type { PluginStart as DataViewsServerPluginStart } from '@kbn/data-views-plugin/server';
import type { LicensingPluginSetup } from '@kbn/licensing-plugin/server';
import type { PluginSetupContract as FeaturesPluginSetup } from '@kbn/features-plugin/server';
import type { AlertingPlugin } from '@kbn/alerting-plugin/server';
import { FieldFormatsSetup, FieldFormatsStart } from '@kbn/field-formats-plugin/server';
import { SecurityPluginSetup, SecurityPluginStart } from '@kbn/security-plugin/server';
import { License } from './services';
import type { FieldFormatsSetup, FieldFormatsStart } from '@kbn/field-formats-plugin/server';
import type { SecurityPluginSetup, SecurityPluginStart } from '@kbn/security-plugin/server';
import type { License } from './services';

export interface PluginSetupDependencies {
licensing: LicensingPluginSetup;
Expand Down

0 comments on commit 3f64b1f

Please sign in to comment.