-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Ingest Pipelines] Add url generator for ingest pipelines app #77872
Changes from all commits
858da91
2d065d0
65c5f58
14e92c1
833ecd0
2e94ed2
8173db2
7c63503
52f9396
573c9f2
56fa521
9b3e223
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* 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 const MANAGEMENT_APP_ID = 'management'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
const BASE_PATH = '/'; | ||
|
||
const EDIT_PATH = 'edit'; | ||
|
||
const CREATE_PATH = 'create'; | ||
|
||
const _getEditPath = (name: string, encode = true): string => { | ||
return `${BASE_PATH}${EDIT_PATH}/${encode ? encodeURIComponent(name) : name}`; | ||
}; | ||
|
||
const _getCreatePath = (): string => { | ||
return `${BASE_PATH}${CREATE_PATH}`; | ||
}; | ||
|
||
const _getClonePath = (name: string, encode = true): string => { | ||
return `${BASE_PATH}${CREATE_PATH}/${encode ? encodeURIComponent(name) : name}`; | ||
}; | ||
const _getListPath = (name?: string): string => { | ||
return `${BASE_PATH}${name ? `?pipeline=${encodeURIComponent(name)}` : ''}`; | ||
}; | ||
|
||
export const ROUTES = { | ||
list: _getListPath(), | ||
edit: _getEditPath(':name', false), | ||
create: _getCreatePath(), | ||
clone: _getClonePath(':sourceName', false), | ||
}; | ||
|
||
export const getListPath = ({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: what do we gain by exporting adapter functions instead of the original functions? For example: // Setting a default for `encode` supports the simpler consumption pattern of not
// having to specify it, and I don't think we lose anything by allowing the consumer
// to specify `false`.
export const getEditPath = ({ pipelineName, encode = true }: { pipelineName: string, encode?: boolean }): string => {
return `${BASE_PATH}${EDIT_PATH}/${encode ? encodeURIComponent(name) : name}`;
};
/* snip */
export const ROUTES_CONFIG = {
edit: getEditPath({ pipelineName: ':name', encode: false }),
/* snip */
}; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that encoding the parameter is an implementation detail and should not be needed for clients using the navigation service, hence a separate |
||
inspectedPipelineName, | ||
}: { | ||
inspectedPipelineName?: string; | ||
} = {}): string => _getListPath(inspectedPipelineName); | ||
export const getEditPath = ({ pipelineName }: { pipelineName: string }): string => | ||
_getEditPath(pipelineName, true); | ||
export const getCreatePath = (): string => _getCreatePath(); | ||
export const getClonePath = ({ clonedPipelineName }: { clonedPipelineName: string }): string => | ||
_getClonePath(clonedPipelineName, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like something the
management
plugin should define inside acommon/constants.ts
file and export in https://github.com/elastic/kibana/blob/master/src/plugins/management/public/index.ts. Since themanagement
plugin is already a dependency of this plugin, it seems like it would be straightforward to make that change and consume the constant wherever we need it like this:The only slightly invasive change would be you'd have to update the
management
plugin to consume this constant on this line: https://github.com/elastic/kibana/blob/master/src/plugins/management/public/plugin.ts#L75There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was looking at the management app for an exported constant but couldn't find any. So I added an export, do you know maybe who would be a code owner for this plugin? @cjcenizal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be the Kibana App Arch team.