fix errors (#124)

This commit is contained in:
Fine0830 2022-07-20 19:42:41 +08:00 committed by GitHub
parent bec86e80fd
commit 017f5bf709
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 3 deletions

View File

@ -36,7 +36,7 @@ limitations under the License. -->
<Header :needQuery="needQuery" />
</div>
<div class="event">
<Content />
<Content :data="data" />
</div>
</div>
</template>

View File

@ -30,7 +30,13 @@ import { dateFormatTime } from "@/utils/dateFormat";
import { useAppStoreWithOut } from "@/store/modules/app";
const eventStore = useEventStore();
/*global Nullable */
/*global defineProps, Nullable */
const props = defineProps({
data: {
type: Object,
default: () => ({}),
},
});
const timeline = ref<Nullable<HTMLDivElement>>(null);
const visGraph = ref<Nullable<any>>(null);
const oldVal = ref<{ width: number; height: number }>({ width: 0, height: 0 });
@ -97,9 +103,10 @@ function visTimeline() {
};
visGraph.value = new Timeline(timeline.value, items, options);
visGraph.value.on("select", (properties: { items: number[] }) => {
if (!dashboardStore.selectedGrid.eventAssociate) {
if (!props.data.eventAssociate) {
return;
}
dashboardStore.selectWidget(props.data);
const all = getDashboard(dashboardStore.currentDashboard).widgets;
const widgets = all.filter(
(d: { value: string; label: string } & LayoutConfig) => {

View File

@ -125,6 +125,9 @@ function fetchSelectors() {
async function getEndpoints(id?: string) {
const resp = await eventStore.getEndpoints(id);
if (!resp) {
return;
}
if (resp.errors) {
ElMessage.error(resp.errors);
return;
@ -148,6 +151,9 @@ async function queryEvents() {
if (dashboardStore.entity === EntityType[3].value) {
instance = selectorStore.currentPod.id;
}
if (!selectorStore.currentService) {
return;
}
eventStore.setEventCondition({
// layer: dashboardStore.layerId,
paging: {