mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-23 12:52:53 +08:00
fix: show the Logs empty-org state when an org holds only internal streams (#17118)
This commit is contained in:
1 parent
5eb67c75a9
commit
a4bc98dbf8
2 files changed
+86
-10
No files matched your search
@@ -1654,6 +1654,74 @@ describe("Logs Index", async () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("empty-org state when the org holds only internal streams", () => {
|
||||
const setStreams = async (
|
||||
streamLists: { label: string; value: string; internal: boolean }[],
|
||||
{ drillDown = false, selectedStream = [] as string[] } = {},
|
||||
) => {
|
||||
const { searchObj } = wrapper.vm;
|
||||
searchObj.meta.sqlMode = false;
|
||||
searchObj.meta.logsVisualizeToggle = drillDown ? "drilldown" : "logs";
|
||||
searchObj.data.stream.streamType = "logs";
|
||||
searchObj.data.stream.streamLists = streamLists;
|
||||
searchObj.data.stream.selectedStream = selectedStream;
|
||||
searchObj.data.filterErrMsg = "";
|
||||
searchObj.loadingStream = false;
|
||||
searchObj.loading = false;
|
||||
await flushPromises();
|
||||
};
|
||||
const calibration = {
|
||||
label: "_o2_alert_calibration_digests",
|
||||
value: "_o2_alert_calibration_digests",
|
||||
internal: true,
|
||||
};
|
||||
const emptyOrg = () => wrapper.find('[data-test="logs-search-no-streams-in-org-text"]');
|
||||
const noStreamSelected = () =>
|
||||
wrapper.find('[data-test="logs-search-no-stream-selected-text"]');
|
||||
const drillDownEmptyOrg = () =>
|
||||
wrapper.find('[data-test="logs-drill-down-no-streams-in-org-text"]');
|
||||
|
||||
it("shows the empty-org state when the only stream is internal", async () => {
|
||||
await setStreams([calibration]);
|
||||
|
||||
expect(wrapper.vm.noUserStreamsInOrg).toBe(true);
|
||||
expect(emptyOrg().exists()).toBe(true);
|
||||
expect(noStreamSelected().exists()).toBe(false);
|
||||
});
|
||||
|
||||
it("shows the drill-down empty-org state when the only stream is internal", async () => {
|
||||
await setStreams([calibration], { drillDown: true });
|
||||
|
||||
expect(drillDownEmptyOrg().exists()).toBe(true);
|
||||
expect(wrapper.find('[data-test="logs-drill-down-no-stream-selected-text"]').exists()).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
it("shows the pick-a-stream state when a user stream exists", async () => {
|
||||
await setStreams([calibration, { label: "app_logs", value: "app_logs", internal: false }]);
|
||||
|
||||
expect(wrapper.vm.noUserStreamsInOrg).toBe(false);
|
||||
expect(emptyOrg().exists()).toBe(false);
|
||||
expect(noStreamSelected().exists()).toBe(true);
|
||||
});
|
||||
|
||||
it("counts a user-sourced internal stream like _rumdata as user data", async () => {
|
||||
await setStreams([calibration, { label: "_rumdata", value: "_rumdata", internal: true }]);
|
||||
|
||||
expect(wrapper.vm.noUserStreamsInOrg).toBe(false);
|
||||
expect(emptyOrg().exists()).toBe(false);
|
||||
expect(noStreamSelected().exists()).toBe(true);
|
||||
});
|
||||
|
||||
it("keeps an explicitly selected internal stream out of the empty-org state", async () => {
|
||||
await setStreams([calibration], { selectedStream: [calibration.value] });
|
||||
|
||||
expect(wrapper.vm.noUserStreamsInOrg).toBe(false);
|
||||
expect(emptyOrg().exists()).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Drill down mode", () => {
|
||||
const hits = [
|
||||
{ _timestamp: 1, level: "info" },
|
||||
|
||||
@@ -117,9 +117,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<div class="bg-card-glass-bg relative-position h-full w-full">
|
||||
<div
|
||||
v-if="
|
||||
!searchObj.loadingStream &&
|
||||
searchObj.data.stream.streamLists.length == 0 &&
|
||||
searchObj.loading == false
|
||||
!searchObj.loadingStream && noUserStreamsInOrg && searchObj.loading == false
|
||||
"
|
||||
class="h-full max-lg:overflow-y-auto"
|
||||
>
|
||||
@@ -167,7 +165,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<div
|
||||
v-else-if="
|
||||
searchObj.data.stream.streamLists.length > 0 &&
|
||||
!noUserStreamsInOrg &&
|
||||
searchObj.data.stream.selectedStream.length == 0 &&
|
||||
searchObj.data.filterErrMsg === ''
|
||||
"
|
||||
@@ -515,9 +513,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/>
|
||||
<LogsNoDataState
|
||||
v-else-if="
|
||||
!searchObj.loadingStream &&
|
||||
searchObj.data.stream.streamLists.length == 0 &&
|
||||
searchObj.loading == false
|
||||
!searchObj.loadingStream && noUserStreamsInOrg && searchObj.loading == false
|
||||
"
|
||||
:ai-enabled="isAiEnabled"
|
||||
data-test="logs-drill-down-no-streams-in-org-text"
|
||||
@@ -525,7 +521,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/>
|
||||
<LogsNoStreamState
|
||||
v-else-if="
|
||||
searchObj.data.stream.streamLists.length > 0 &&
|
||||
!noUserStreamsInOrg &&
|
||||
searchObj.data.stream.selectedStream.length == 0 &&
|
||||
searchObj.data.filterErrMsg === ''
|
||||
"
|
||||
@@ -716,6 +712,7 @@ import { resolveUrlViewToggle } from "@/composables/useLogs/logsViewToggle";
|
||||
import { checkFeatureAccess, buildFeatureGateContext } from "@/utils/enterpriseFeatures";
|
||||
import { featureState, streamTypeFeature } from "@/utils/featureGate";
|
||||
import { inheritedRetentionDays } from "@/utils/dataRetention";
|
||||
import { isUserDataStream } from "@/utils/internalStreams";
|
||||
import { useLicenseLocks } from "@/composables/useFeatureLock";
|
||||
import { verifyOrganizationStatus, deepCopy, addSpacesToOperators } from "@/utils/zincutils";
|
||||
import MainLayoutCloudMixin from "@/enterprise/mixins/mainLayout.mixin";
|
||||
@@ -2072,6 +2069,16 @@ export default defineComponent({
|
||||
return !!searchObj.data.stream.streamLists.length;
|
||||
});
|
||||
|
||||
// A picked internal stream still shows its results; "logs" keeps enrichment-table lists counted as user data.
|
||||
const noUserStreamsInOrg = computed(() => {
|
||||
const stream = searchObj.data.stream;
|
||||
return !stream.streamLists.some(
|
||||
(row: { value: string; internal?: boolean }) =>
|
||||
stream.selectedStream.includes(row.value) ||
|
||||
isUserDataStream({ name: row.value, is_internal: row.internal === true }, "logs"),
|
||||
);
|
||||
});
|
||||
|
||||
const toggleExpandLog = (index: number) => {
|
||||
if (expandedLogs.value.includes(index))
|
||||
expandedLogs.value = expandedLogs.value.filter((item) => item != index);
|
||||
@@ -2155,8 +2162,8 @@ export default defineComponent({
|
||||
// Mirrors the drill-down template's state chain, so the stream select sits in the dashboard header only while it is mounted.
|
||||
const drillDownShowsDashboard = computed(() => {
|
||||
const stream = searchObj.data.stream;
|
||||
const noStreamsInOrg = !searchObj.loadingStream && stream.streamLists.length == 0;
|
||||
const noStreamSelected = stream.streamLists.length > 0 && stream.selectedStream.length == 0;
|
||||
const noStreamsInOrg = !searchObj.loadingStream && noUserStreamsInOrg.value;
|
||||
const noStreamSelected = !noUserStreamsInOrg.value && stream.selectedStream.length == 0;
|
||||
return (
|
||||
!searchObj.meta.sqlMode &&
|
||||
!searchObj.loading &&
|
||||
@@ -4351,6 +4358,7 @@ export default defineComponent({
|
||||
verifyOrganizationStatus,
|
||||
collapseFieldList,
|
||||
areStreamsPresent,
|
||||
noUserStreamsInOrg,
|
||||
toggleExpandLog,
|
||||
expandedLogs,
|
||||
fieldValues,
|
||||
|
||||
Reference in new issue
Block a user