Skip to content

Commit

Permalink
(temporary) try to restore legacy plugin to check behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Jul 20, 2020
1 parent d65c125 commit 7bdc3c2
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/legacy/core_plugins/status_page/index.js
Original file line number Diff line number Diff line change
@@ -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',
},
},
});
}
4 changes: 4 additions & 0 deletions src/legacy/core_plugins/status_page/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "status_page",
"version": "kibana"
}
41 changes: 41 additions & 0 deletions src/legacy/core_plugins/status_page/public/components/render.js
Original file line number Diff line number Diff line change
@@ -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(<I18nContext>Foo</I18nContext>, node);
}

export function destroyStatusPage() {
const node = document.getElementById(STATUS_PAGE_DOM_NODE_ID);
node && unmountComponentAtNode(node);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div id="createStatusPageReact"></div>
33 changes: 33 additions & 0 deletions src/legacy/core_plugins/status_page/public/status_page.js
Original file line number Diff line number Diff line change
@@ -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);
});
});

0 comments on commit 7bdc3c2

Please sign in to comment.