kibana/x-pack/plugins/remote_clusters/public/application/services/api.ts
Yulia Čech 0316787ead
[Remote clusters] Cloud deployment form when adding new cluster (#94450)
* Implemented in-form Cloud deployment url input

* Fixed i18n files and added mode switch back for non-Cloud

* Added cloud docs link to the documentation service, fixed snapshot tests

* Fixed docs build

* Added jest test for the new cloud url input

* Added unit test for cloud validation

* Fixed eslint error

* Fixed ts errors

* Added ts-ignore

* Fixed ts errors

* Refactored connection mode component and component tests

* Fixed import

* Fixed copy

* Fixed copy

* Reverted docs changes

* Reverted docs changes

* Replaced the screenshot with a popover and refactored integration tests

* Added todo for cloud deployments link

* Changed cloud URL help text copy

* Added cloud base url and deleted unnecessary base path

* Fixed es error

* Fixed es error

* Changed wording

* Reverted docs changes

* Updated the help popover

* Deleted unneeded fragment component

* Deleted unneeded fragment component

* Updated tests descriptions to be more detailed

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-04-08 14:18:18 +02:00

32 lines
1 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { UIM_CLUSTER_ADD, UIM_CLUSTER_UPDATE } from '../constants';
import { trackUserRequest } from './ui_metric';
import { sendGet, sendPost, sendPut, sendDelete, SendGetOptions } from './http';
import { Cluster } from '../../../common/lib';
export async function loadClusters(options?: SendGetOptions) {
return await sendGet(undefined, options);
}
export async function addCluster(cluster: Cluster) {
const request = sendPost('', cluster);
return await trackUserRequest(request, UIM_CLUSTER_ADD);
}
export async function editCluster(cluster: Cluster) {
const { name, ...rest } = cluster;
const request = sendPut(name, rest);
return await trackUserRequest(request, UIM_CLUSTER_UPDATE);
}
export function removeClusterRequest(name: string) {
return sendDelete(name);
}