0 ? '' : 'wz-no-display'
- }
- >
-
-
-
+ {dataSource && results?.hits?.total === 0 ? (
+
+ ) : null}
+
0 ? '' : 'wz-no-display'
+ }
+ >
+
+
+
+
-
- >
+ >
+ )}
>
);
diff --git a/plugins/main/public/components/overview/virustotal/dashboard/dashboard.tsx b/plugins/main/public/components/overview/virustotal/dashboard/dashboard.tsx
index f834d90d95..29cf0cff74 100644
--- a/plugins/main/public/components/overview/virustotal/dashboard/dashboard.tsx
+++ b/plugins/main/public/components/overview/virustotal/dashboard/dashboard.tsx
@@ -20,7 +20,7 @@ import {
tParsedIndexPattern,
useDataSource,
} from '../../../common/data-source';
-import { LoadingSpinner } from '../../../common/loading-spinner/loading-spinner';
+import { LoadingSearchbarProgress } from '../../../common/loading-searchbar-progress/loading-searchbar-progress';
import { DiscoverNoResults } from '../../../common/no-results/no-results';
import { VirusTotalDataSource } from '../../../common/data-source/pattern/alerts/virustotal/virustotal-data-source';
import './virustotal_dashboard.scss';
@@ -91,10 +91,10 @@ const DashboardVT: React.FC = () => {
return (
- <>
- {isDataSourceLoading && !dataSource ? (
-
- ) : (
+ {isDataSourceLoading && !dataSource ? (
+
+ ) : (
+ <>
{
showQueryBar={true}
showSaveQuery={true}
/>
- )}
- {!isDataSourceLoading && dataSource && results?.hits?.total > 0 ? (
-
- ) : null}
- {dataSource && results?.hits?.total === 0 ? (
-
- ) : null}
- 0
- ? ''
- : 'wz-no-display'
- }`}
- >
-
-
-
- >
+ {!isDataSourceLoading && dataSource && results?.hits?.total > 0 ? (
+
+ ) : null}
+ {dataSource && results?.hits?.total === 0 ? (
+
+ ) : null}
+ 0
+ ? ''
+ : 'wz-no-display'
+ }`}
+ >
+
+
+
+ >
+ )}
);
};
diff --git a/plugins/main/public/components/overview/vulnerabilities/common/components/loading_spinner.scss b/plugins/main/public/components/overview/vulnerabilities/common/components/loading_spinner.scss
deleted file mode 100644
index 051ab642c1..0000000000
--- a/plugins/main/public/components/overview/vulnerabilities/common/components/loading_spinner.scss
+++ /dev/null
@@ -1,4 +0,0 @@
-.discoverNoResults {
- display: flex;
- align-items: center;
-}
diff --git a/plugins/main/public/components/overview/vulnerabilities/common/components/loading_spinner.tsx b/plugins/main/public/components/overview/vulnerabilities/common/components/loading_spinner.tsx
deleted file mode 100644
index 7f505e6167..0000000000
--- a/plugins/main/public/components/overview/vulnerabilities/common/components/loading_spinner.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import './loading_spinner.scss';
-import React from 'react';
-import { EuiTitle, EuiPanel, EuiEmptyPrompt, EuiLoadingSpinner } from '@elastic/eui';
-import { FormattedMessage } from '@osd/i18n/react';
-
-export function LoadingSpinner() {
- return (
-
- }
- title={
-
-
-
-
-
- }
- />
-
- );
-}
diff --git a/plugins/main/public/components/overview/vulnerabilities/dashboards/inventory/inventory.tsx b/plugins/main/public/components/overview/vulnerabilities/dashboards/inventory/inventory.tsx
index 377438dc3e..ecef54dd3a 100644
--- a/plugins/main/public/components/overview/vulnerabilities/dashboards/inventory/inventory.tsx
+++ b/plugins/main/public/components/overview/vulnerabilities/dashboards/inventory/inventory.tsx
@@ -30,7 +30,7 @@ import {
getAllCustomRenders,
} from '../../../../common/data-grid/data-grid-service';
import { DiscoverNoResults } from '../../common/components/no_results';
-import { LoadingSpinner } from '../../common/components/loading_spinner';
+import { LoadingSearchbarProgress } from '../../../../../../public/components/common/loading-searchbar-progress/loading-searchbar-progress';
// common components/hooks
import useSearchBar from '../../../../common/search-bar/use-search-bar';
import { useDataGrid } from '../../../../common/data-grid/use-data-grid';
@@ -185,7 +185,7 @@ const InventoryVulsComponent = () => {
>
<>
{isDataSourceLoading ? (
-
+
) : (
= ({
<>
{isDataSourceLoading && !dataSource ? (
-
+
) : (
),
() => (
- {
- var reg = /(>)\s*(<)(\/*)/g;
- var wsexp = / *(.*) +\n/g;
- var contexp = /(<.+>)(.+\n)/g;
- xml = xml
- .replace(reg, '$1\n$2$3')
- .replace(wsexp, '$1\n')
- .replace(contexp, '$1\n$2');
- var formatted = '';
- var lines = xml.split('\n');
- var indent = 0;
- var lastType = 'other';
- var transitions = {
- 'single->single': 0,
- 'single->closing': -1,
- 'single->opening': 0,
- 'single->other': 0,
- 'closing->single': 0,
- 'closing->closing': -1,
- 'closing->opening': 0,
- 'closing->other': 0,
- 'opening->single': 1,
- 'opening->closing': 0,
- 'opening->opening': 1,
- 'opening->other': 1,
- 'other->single': 0,
- 'other->closing': -1,
- 'other->opening': 0,
- 'other->other': 0,
- };
-
- for (var i = 0; i < lines.length; i++) {
- var ln = lines[i];
- if (ln.match(/\s*<\?xml/)) {
- formatted += ln + '\n';
- continue;
- }
- var single = Boolean(ln.match(/<.+\/>/)); // is this line a single tag? ex.
- var closing = Boolean(ln.match(/<\/.+>/)); // is this a closing tag? ex.
- var opening = Boolean(ln.match(/<[^!].*>/)); // is this even a tag (that's not )
- var type = single
- ? 'single'
- : closing
- ? 'closing'
- : opening
- ? 'opening'
- : 'other';
- var fromTo = lastType + '->' + type;
- lastType = type;
- var padding = '';
-
- indent += transitions[fromTo];
- for (var j = 0; j < indent; j++) {
- padding += '\t';
- }
- if (fromTo == 'opening->closing')
- formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
- // substr removes line break (\n) from prev loop
- else formatted += padding + ln + '\n';
- }
- return formatted.trim();
- };
-
async showGroupConfiguration() {
const { itemDetail } = this.props.state;
let result = await this.groupsHandler.getFileContent(
@@ -104,7 +41,7 @@ class WzGroupsActionButtonsFiles extends Component {
result = '';
}
- const data = this.autoFormat(result);
+ const data = result?.toString();
const file = {
name: 'agent.conf',
diff --git a/plugins/main/public/controllers/management/components/management/groups/groups-overview.js b/plugins/main/public/controllers/management/components/management/groups/groups-overview.js
index 826cd71d78..3e1bc7f471 100644
--- a/plugins/main/public/controllers/management/components/management/groups/groups-overview.js
+++ b/plugins/main/public/controllers/management/components/management/groups/groups-overview.js
@@ -173,76 +173,13 @@ export class WzGroupsOverview extends Component {
const file = {
name: 'agent.conf',
- content: this.autoFormat(result),
+ content: result?.toString(),
isEditable: true,
groupName: groupId,
};
this.props.updateFileContent(file);
}
- autoFormat = xml => {
- var reg = /(>)\s*(<)(\/*)/g;
- var wsexp = / *(.*) +\n/g;
- var contexp = /(<.+>)(.+\n)/g;
- xml = xml
- .replace(reg, '$1\n$2$3')
- .replace(wsexp, '$1\n')
- .replace(contexp, '$1\n$2');
- var formatted = '';
- var lines = xml.split('\n');
- var indent = 0;
- var lastType = 'other';
- var transitions = {
- 'single->single': 0,
- 'single->closing': -1,
- 'single->opening': 0,
- 'single->other': 0,
- 'closing->single': 0,
- 'closing->closing': -1,
- 'closing->opening': 0,
- 'closing->other': 0,
- 'opening->single': 1,
- 'opening->closing': 0,
- 'opening->opening': 1,
- 'opening->other': 1,
- 'other->single': 0,
- 'other->closing': -1,
- 'other->opening': 0,
- 'other->other': 0,
- };
-
- for (var i = 0; i < lines.length; i++) {
- var ln = lines[i];
- if (ln.match(/\s*<\?xml/)) {
- formatted += ln + '\n';
- continue;
- }
- var single = Boolean(ln.match(/<.+\/>/)); // is this line a single tag? ex.
- var closing = Boolean(ln.match(/<\/.+>/)); // is this a closing tag? ex.
- var opening = Boolean(ln.match(/<[^!].*>/)); // is this even a tag (that's not )
- var type = single
- ? 'single'
- : closing
- ? 'closing'
- : opening
- ? 'opening'
- : 'other';
- var fromTo = lastType + '->' + type;
- lastType = type;
- var padding = '';
-
- indent += transitions[fromTo];
- for (var j = 0; j < indent; j++) {
- padding += '\t';
- }
- if (fromTo == 'opening->closing')
- formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
- // substr removes line break (\n) from prev loop
- else formatted += padding + ln + '\n';
- }
- return formatted.trim();
- };
-
render() {
const actionButtons = [
,
diff --git a/plugins/main/public/controllers/management/components/management/groups/utils/columns-files.js b/plugins/main/public/controllers/management/components/management/groups/utils/columns-files.js
index 396d3e9632..4cb85cb1e4 100644
--- a/plugins/main/public/controllers/management/components/management/groups/utils/columns-files.js
+++ b/plugins/main/public/controllers/management/components/management/groups/utils/columns-files.js
@@ -21,7 +21,7 @@ export default class GroupsFilesColumns {
}
const data = edit
- ? this.autoFormat(result)
+ ? result?.toString()
: typeof result === 'object'
? JSON.stringify(result, null, 2)
: result.toString();
@@ -94,67 +94,4 @@ export default class GroupsFilesColumns {
this.buildColumns();
}
-
- autoFormat = xml => {
- var reg = /(>)\s*(<)(\/*)/g;
- var wsexp = / *(.*) +\n/g;
- var contexp = /(<.+>)(.+\n)/g;
- xml = xml
- .replace(reg, '$1\n$2$3')
- .replace(wsexp, '$1\n')
- .replace(contexp, '$1\n$2');
- var formatted = '';
- var lines = xml.split('\n');
- var indent = 0;
- var lastType = 'other';
- var transitions = {
- 'single->single': 0,
- 'single->closing': -1,
- 'single->opening': 0,
- 'single->other': 0,
- 'closing->single': 0,
- 'closing->closing': -1,
- 'closing->opening': 0,
- 'closing->other': 0,
- 'opening->single': 1,
- 'opening->closing': 0,
- 'opening->opening': 1,
- 'opening->other': 1,
- 'other->single': 0,
- 'other->closing': -1,
- 'other->opening': 0,
- 'other->other': 0,
- };
-
- for (var i = 0; i < lines.length; i++) {
- var ln = lines[i];
- if (ln.match(/\s*<\?xml/)) {
- formatted += ln + '\n';
- continue;
- }
- var single = Boolean(ln.match(/<.+\/>/)); // is this line a single tag? ex.
- var closing = Boolean(ln.match(/<\/.+>/)); // is this a closing tag? ex.
- var opening = Boolean(ln.match(/<[^!].*>/)); // is this even a tag (that's not )
- var type = single
- ? 'single'
- : closing
- ? 'closing'
- : opening
- ? 'opening'
- : 'other';
- var fromTo = lastType + '->' + type;
- lastType = type;
- var padding = '';
-
- indent += transitions[fromTo];
- for (var j = 0; j < indent; j++) {
- padding += '\t';
- }
- if (fromTo == 'opening->closing')
- formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
- // substr removes line break (\n) from prev loop
- else formatted += padding + ln + '\n';
- }
- return formatted.trim();
- };
}