diff --git a/src/legacy/core_plugins/status_page/index.js b/src/legacy/core_plugins/status_page/index.js new file mode 100644 index 0000000000000..d50e4c56c9b35 --- /dev/null +++ b/src/legacy/core_plugins/status_page/index.js @@ -0,0 +1,31 @@ +/* + * 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. + */ + +export default function (kibana) { + return new kibana.Plugin({ + uiExports: { + app: { + title: 'Old Server Status', + main: 'plugins/status_page/status_page', + hidden: true, + url: '/old-status', + }, + }, + }); +} diff --git a/src/legacy/core_plugins/status_page/package.json b/src/legacy/core_plugins/status_page/package.json new file mode 100644 index 0000000000000..cecfe30f1173c --- /dev/null +++ b/src/legacy/core_plugins/status_page/package.json @@ -0,0 +1,4 @@ +{ + "name": "status_page", + "version": "kibana" +} diff --git a/src/legacy/core_plugins/status_page/public/components/render.js b/src/legacy/core_plugins/status_page/public/components/render.js new file mode 100644 index 0000000000000..dca79d783a29a --- /dev/null +++ b/src/legacy/core_plugins/status_page/public/components/render.js @@ -0,0 +1,41 @@ +/* + * 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 { I18nContext } from 'ui/i18n'; +// just to import eui into legacy +import '@elastic/eui'; + +const STATUS_PAGE_DOM_NODE_ID = 'createStatusPageReact'; + +export function renderStatusPage() { + const node = document.getElementById(STATUS_PAGE_DOM_NODE_ID); + + if (!node) { + return; + } + + render(Foo, node); +} + +export function destroyStatusPage() { + const node = document.getElementById(STATUS_PAGE_DOM_NODE_ID); + node && unmountComponentAtNode(node); +} diff --git a/src/legacy/core_plugins/status_page/public/status_page.html b/src/legacy/core_plugins/status_page/public/status_page.html new file mode 100644 index 0000000000000..6e6af4f5bc56d --- /dev/null +++ b/src/legacy/core_plugins/status_page/public/status_page.html @@ -0,0 +1 @@ +
diff --git a/src/legacy/core_plugins/status_page/public/status_page.js b/src/legacy/core_plugins/status_page/public/status_page.js new file mode 100644 index 0000000000000..709164caa9e04 --- /dev/null +++ b/src/legacy/core_plugins/status_page/public/status_page.js @@ -0,0 +1,33 @@ +/* + * 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 'ui/i18n'; +import chrome from 'ui/chrome'; +import { npStart } from 'ui/new_platform'; +import { destroyStatusPage, renderStatusPage } from './components/render'; +import template from 'plugins/status_page/status_page.html'; + +npStart.core.chrome.navLinks.enableForcedAppSwitcherNavigation(); + +chrome.setRootTemplate(template).setRootController('ui', function ($scope, buildNum, buildSha) { + $scope.$$postDigest(() => { + renderStatusPage(buildNum, buildSha.substr(0, 8)); + $scope.$on('$destroy', destroyStatusPage); + }); +});