-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidate force hiding in chrome, add functional tests
- Loading branch information
1 parent
638a804
commit 7d871ce
Showing
9 changed files
with
214 additions
and
14 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
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
8 changes: 8 additions & 0 deletions
8
test/plugin_functional/plugins/core_plugin_chromeless/kibana.json
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,8 @@ | ||
{ | ||
"id": "core_plugin_chromeless", | ||
"version": "0.0.1", | ||
"kibanaVersion": "kibana", | ||
"configPath": ["core_plugin_chromeless"], | ||
"server": false, | ||
"ui": true | ||
} |
17 changes: 17 additions & 0 deletions
17
test/plugin_functional/plugins/core_plugin_chromeless/package.json
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,17 @@ | ||
{ | ||
"name": "core_plugin_chromeless", | ||
"version": "1.0.0", | ||
"main": "target/test/plugin_functional/plugins/core_plugin_chromeless", | ||
"kibana": { | ||
"version": "kibana", | ||
"templateVersion": "1.0.0" | ||
}, | ||
"license": "Apache-2.0", | ||
"scripts": { | ||
"kbn": "node ../../../../scripts/kbn.js", | ||
"build": "rm -rf './target' && tsc" | ||
}, | ||
"devDependencies": { | ||
"typescript": "3.5.3" | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
test/plugin_functional/plugins/core_plugin_chromeless/public/application.tsx
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,74 @@ | ||
/* | ||
* 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'; | ||
import { render, unmountComponentAtNode } from 'react-dom'; | ||
import { BrowserRouter as Router, Route } from 'react-router-dom'; | ||
import { | ||
EuiPage, | ||
EuiPageBody, | ||
EuiPageContent, | ||
EuiPageContentBody, | ||
EuiPageContentHeader, | ||
EuiPageContentHeaderSection, | ||
EuiPageHeader, | ||
EuiPageHeaderSection, | ||
EuiTitle, | ||
} from '@elastic/eui'; | ||
|
||
import { AppMountContext, AppMountParameters } from 'kibana/public'; | ||
|
||
const Home = () => ( | ||
<EuiPageBody data-test-subj="chromelessAppHome"> | ||
<EuiPageHeader> | ||
<EuiPageHeaderSection> | ||
<EuiTitle size="l"> | ||
<h1>Welcome to Chromeless!</h1> | ||
</EuiTitle> | ||
</EuiPageHeaderSection> | ||
</EuiPageHeader> | ||
<EuiPageContent> | ||
<EuiPageContentHeader> | ||
<EuiPageContentHeaderSection> | ||
<EuiTitle> | ||
<h2>Chromeless home page section title</h2> | ||
</EuiTitle> | ||
</EuiPageContentHeaderSection> | ||
</EuiPageContentHeader> | ||
<EuiPageContentBody>Where did all the chrome go?</EuiPageContentBody> | ||
</EuiPageContent> | ||
</EuiPageBody> | ||
); | ||
|
||
const ChromelessApp = ({ basename }: { basename: string; context: AppMountContext }) => ( | ||
<Router basename={basename}> | ||
<EuiPage> | ||
<Route path="/" component={Home} /> | ||
</EuiPage> | ||
</Router> | ||
); | ||
|
||
export const renderApp = ( | ||
context: AppMountContext, | ||
{ appBasePath, element }: AppMountParameters | ||
) => { | ||
render(<ChromelessApp basename={appBasePath} context={context} />, element); | ||
|
||
return () => unmountComponentAtNode(element); | ||
}; |
30 changes: 30 additions & 0 deletions
30
test/plugin_functional/plugins/core_plugin_chromeless/public/index.ts
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,30 @@ | ||
/* | ||
* 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 { PluginInitializer } from 'kibana/public'; | ||
import { | ||
CorePluginChromelessPlugin, | ||
CorePluginChromelessPluginSetup, | ||
CorePluginChromelessPluginStart, | ||
} from './plugin'; | ||
|
||
export const plugin: PluginInitializer< | ||
CorePluginChromelessPluginSetup, | ||
CorePluginChromelessPluginStart | ||
> = () => new CorePluginChromelessPlugin(); |
47 changes: 47 additions & 0 deletions
47
test/plugin_functional/plugins/core_plugin_chromeless/public/plugin.tsx
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,47 @@ | ||
/* | ||
* 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 { Plugin, CoreSetup } from 'kibana/public'; | ||
|
||
export class CorePluginChromelessPlugin | ||
implements Plugin<CorePluginChromelessPluginSetup, CorePluginChromelessPluginStart> { | ||
public setup(core: CoreSetup, deps: {}) { | ||
core.application.register({ | ||
id: 'chromeless', | ||
title: 'Chromeless', | ||
chromeless: true, | ||
async mount(context, params) { | ||
const { renderApp } = await import('./application'); | ||
return renderApp(context, params); | ||
}, | ||
}); | ||
|
||
return { | ||
getGreeting() { | ||
return 'Hello from Plugin Chromeless!'; | ||
}, | ||
}; | ||
} | ||
|
||
public start() {} | ||
public stop() {} | ||
} | ||
|
||
export type CorePluginChromelessPluginSetup = ReturnType<CorePluginChromelessPlugin['setup']>; | ||
export type CorePluginChromelessPluginStart = ReturnType<CorePluginChromelessPlugin['start']>; |
14 changes: 14 additions & 0 deletions
14
test/plugin_functional/plugins/core_plugin_chromeless/tsconfig.json
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,14 @@ | ||
{ | ||
"extends": "../../../../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "./target", | ||
"skipLibCheck": true | ||
}, | ||
"include": [ | ||
"index.ts", | ||
"public/**/*.ts", | ||
"public/**/*.tsx", | ||
"../../../../typings/**/*", | ||
], | ||
"exclude": [] | ||
} |
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