Skip to content
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

bulk update separation #356

Merged
merged 9 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions public/components/custom_panels/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,12 @@ import {
ObservabilityPanelAttrs,
PanelType,
} from '../../../common/types/custom_panels';
import { ObservabilitySideBar } from '../common/side_nav';
import { CustomPanelTable } from './custom_panel_table';
import { CustomPanelView } from './custom_panel_view';
import { isNameValid } from './helpers/utils';
import { CustomPanelViewSO } from './custom_panel_view_so';
import { coreRefs } from '../../framework/core_refs';
<<<<<<< HEAD
import { CustomPanelType } from '../../../common/types/custom_panels';
import { deletePanel, fetchPanels } from './redux/panel_slice';
=======
import { fetchPanels } from './redux/panel_slice';
>>>>>>> 5f2b777a2c7963680f4bea3746e6badea65b9303
import { deletePanel, fetchPanels, uuidRx } from './redux/panel_slice';

// import { ObjectFetcher } from '../common/objectFetcher';

Expand Down Expand Up @@ -148,8 +142,6 @@ export const Home = ({
});
};

const uuidRx = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/;

const isUuid = (id) => !!id.match(uuidRx);

const fetchSavedObjectPanel = async (id: string) => {
Expand Down
2 changes: 1 addition & 1 deletion public/components/custom_panels/redux/panel_slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const updateLegacyPanel = (panel: CustomPanelType) =>

const updateSavedObjectPanel = (panel: CustomPanelType) => savedObjectPanelsClient.update(panel);

const uuidRx = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/;
export const uuidRx = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/;

const isUuid = (id) => !!id.match(uuidRx);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { uuidRx } from '../../../../../public/components/custom_panels/redux/panel_slice';
import { SavedQuerySaver } from './saved_query_saver';

export class SaveAsCurrentVisualization extends SavedQuerySaver {
Expand Down Expand Up @@ -46,9 +47,8 @@ export class SaveAsCurrentVisualization extends SavedQuerySaver {
}

addToPanel({ selectedPanels, saveTitle, notifications, visId }) {
const uuidRx = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/;
const soPanels = selectedPanels.filter((id) => id.panel.id.match(uuidRx));
const opsPanels = selectedPanels.filter((id) => !id.panel.id.match(uuidRx));
const soPanels = selectedPanels.filter((panel) => panel.panel.id.test(uuidRx));
const opsPanels = selectedPanels.filter((panel) => !panel.panel.id.test(uuidRx));
derek-ho marked this conversation as resolved.
Show resolved Hide resolved
this.panelClient
.updateBulk({
selectedCustomPanels: opsPanels,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { uuidRx } from '../../../../../public/components/custom_panels/redux/panel_slice';
import {
SAVED_OBJECT_ID,
SAVED_OBJECT_TYPE,
Expand Down Expand Up @@ -76,9 +77,8 @@ export class SaveAsNewVisualization extends SavedQuerySaver {
}

addToPanel({ selectedPanels, saveTitle, notifications, visId }) {
const uuidRx = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/;
const soPanels = selectedPanels.filter((id) => id.panel.id.match(uuidRx));
const opsPanels = selectedPanels.filter((id) => !id.panel.id.match(uuidRx));
const soPanels = selectedPanels.filter((panel) => panel.panel.id.test(uuidRx));
const opsPanels = selectedPanels.filter((panel) => !panel.panel.id.test(uuidRx));
this.panelClient
.updateBulk({
selectedCustomPanels: opsPanels,
Expand Down