-
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.
- Loading branch information
Showing
68 changed files
with
1,526 additions
and
951 deletions.
There are no files selected for viewing
102 changes: 0 additions & 102 deletions
102
src/plugins/advanced_settings/public/management_app/index.tsx
This file was deleted.
Oops, something went wrong.
82 changes: 82 additions & 0 deletions
82
src/plugins/advanced_settings/public/management_app/mount_management_section.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,82 @@ | ||
/* | ||
* 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 ReactDOM from 'react-dom'; | ||
import { HashRouter, Switch, Route } from 'react-router-dom'; | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
import { I18nProvider } from '@kbn/i18n/react'; | ||
import { StartServicesAccessor } from 'src/core/public'; | ||
|
||
import { AdvancedSettings } from './advanced_settings'; | ||
import { ManagementAppMountParams } from '../../../management/public'; | ||
import { ComponentRegistry } from '../types'; | ||
|
||
const title = i18n.translate('advancedSettings.advancedSettingsLabel', { | ||
defaultMessage: 'Advanced Settings', | ||
}); | ||
const crumb = [{ text: title }]; | ||
|
||
const readOnlyBadge = { | ||
text: i18n.translate('advancedSettings.badge.readOnly.text', { | ||
defaultMessage: 'Read only', | ||
}), | ||
tooltip: i18n.translate('advancedSettings.badge.readOnly.tooltip', { | ||
defaultMessage: 'Unable to save advanced settings', | ||
}), | ||
iconType: 'glasses', | ||
}; | ||
|
||
export async function mountManagementSection( | ||
getStartServices: StartServicesAccessor, | ||
params: ManagementAppMountParams, | ||
componentRegistry: ComponentRegistry['start'] | ||
) { | ||
params.setBreadcrumbs(crumb); | ||
const [{ uiSettings, notifications, docLinks, application, chrome }] = await getStartServices(); | ||
|
||
const canSave = application.capabilities.advancedSettings.save as boolean; | ||
|
||
if (!canSave) { | ||
chrome.setBadge(readOnlyBadge); | ||
} | ||
|
||
ReactDOM.render( | ||
<I18nProvider> | ||
<HashRouter basename={params.basePath}> | ||
<Switch> | ||
<Route path={['/:query', '/']}> | ||
<AdvancedSettings | ||
enableSaving={canSave} | ||
toasts={notifications.toasts} | ||
dockLinks={docLinks.links} | ||
uiSettings={uiSettings} | ||
componentRegistry={componentRegistry} | ||
/> | ||
</Route> | ||
</Switch> | ||
</HashRouter> | ||
</I18nProvider>, | ||
params.element | ||
); | ||
return () => { | ||
ReactDOM.unmountComponentAtNode(params.element); | ||
}; | ||
} |
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
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
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
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.