diff --git a/public/app/features/api-keys/ApiKeysPage.tsx b/public/app/features/api-keys/ApiKeysPage.tsx index 1430da03e50..d6c83c2a566 100644 --- a/public/app/features/api-keys/ApiKeysPage.tsx +++ b/public/app/features/api-keys/ApiKeysPage.tsx @@ -110,7 +110,8 @@ export class ApiKeysPage extends PureComponent { model={{ title: "You haven't added any API Keys yet.", buttonIcon: 'fa fa-plus', - buttonLink: 'org/apikeys/new', + buttonLink: '#', + onClick: this.onToggleAdding, buttonTitle: ' New API Key', proTip: 'Remember you can provide view-only API access to other applications.', proTipLink: '', @@ -118,12 +119,63 @@ export class ApiKeysPage extends PureComponent { proTipTarget: '_blank', }} /> + {this.renderAddApiKeyForm()} ); } - renderApiKeyList() { + renderAddApiKeyForm() { const { newApiKey, isAdding } = this.state; + + return ( + +
+ +
Add API Key
+
+
+
+ Key name + this.onApiKeyStateUpdate(evt, ApiKeyStateProps.Name)} + /> +
+
+ Role + + + +
+
+ +
+
+
+
+
+ ); + } + + renderApiKeyList() { + const { isAdding } = this.state; const { apiKeys, searchQuery } = this.props; return ( @@ -148,49 +200,7 @@ export class ApiKeysPage extends PureComponent { - -
- -
Add API Key
-
-
-
- Key name - this.onApiKeyStateUpdate(evt, ApiKeyStateProps.Name)} - /> -
-
- Role - - - -
-
- -
-
-
-
-
+ {this.renderAddApiKeyForm()}

Existing Keys

diff --git a/public/app/features/api-keys/__snapshots__/ApiKeysPage.test.tsx.snap b/public/app/features/api-keys/__snapshots__/ApiKeysPage.test.tsx.snap index 2d597244a02..fcd22a14479 100644 --- a/public/app/features/api-keys/__snapshots__/ApiKeysPage.test.tsx.snap +++ b/public/app/features/api-keys/__snapshots__/ApiKeysPage.test.tsx.snap @@ -282,8 +282,9 @@ exports[`Render should render CTA if theres are no API keys 1`] = ` model={ Object { "buttonIcon": "fa fa-plus", - "buttonLink": "org/apikeys/new", + "buttonLink": "#", "buttonTitle": " New API Key", + "onClick": [Function], "proTip": "Remember you can provide view-only API access to other applications.", "proTipLink": "", "proTipLinkTitle": "", @@ -292,6 +293,99 @@ exports[`Render should render CTA if theres are no API keys 1`] = ` } } /> + +
+ +
+ Add API Key +
+
+
+
+ + Key name + + +
+
+ + Role + + + + +
+
+ +
+
+ +
+
`;