Browse Source

code cleanupo

anomly-detector-configurable-iteration-steps-#35
Alexey Velikiy 2 years ago
parent
commit
55c5e08ed6
  1. 14
      client/src/components/Graph.vue
  2. 5
      client/src/views/Home.vue

14
client/src/components/Graph.vue

@ -10,18 +10,20 @@ import { AnomalyHSR, TimeRange } from "@/types";
import { PatternPod } from "./pods/pattern_pod";
import { ThresholdPod } from './pods/threshold_pod';
import { AnomalyPod } from './pods/anomaly_pod';
import { getMetrics } from '../services/metrics.service';
import { getSegments, postSegment, deleteSegment } from '../services/segments.service';
import { LineTimeSerie } from "@chartwerk/line-pod";
import { SegmentArray } from '@/types/segment_array';
import { Segment, SegmentId } from '@/types/segment';
import _ from "lodash";
import { AnalyticUnitType } from '@/types/analytic_units';
import { defineComponent, watch } from 'vue';
import { getHSRAnomaly } from "@/services/analytics.service";
import { getMetrics } from '@/services/metrics.service';
import { getSegments, postSegment, deleteSegment } from '@/services/segments.service';
import { defineComponent } from 'vue';
import _ from "lodash";
// TODO: move to store
async function resolveDataPatterns(range: TimeRange): Promise<{
@ -117,7 +119,6 @@ async function resolveDataAnomaly(range: TimeRange): Promise<{
}
}
// TODO: move to store
async function addSegment(segment: Segment): Promise<SegmentId> {
try {
@ -147,7 +148,6 @@ async function _deleteSegment(from: number, to: number): Promise<number> {
}
}
// TODO: convert to class component
export default defineComponent({
name: 'Graph',
@ -222,8 +222,6 @@ export default defineComponent({
let cfg = _.clone(this.analyticUnitConfig);
// TODO: get 10 (step) from API config
cfg.seasonality = Math.ceil(Math.abs(from - to) / 10) * 10;
console.log("cfg.seasonality: " + cfg.seasonality);
this.$store.dispatch('patchConfig', { Anomaly: cfg });
}
},

5
client/src/views/Home.vue

@ -35,7 +35,7 @@
<div v-if="analyticUnitType == analyticUnitTypes[2]">
Hold <pre>Z</pre> to set seasonality timespan
<hr/>
<!-- Alpha:
<!-- Alpha:
<input :value="analyticUnitConfig.alpha" @change="alphaChange" /> <br/> -->
Confidence:
<input :value="analyticUnitConfig.confidence" @change="confidenceChange" /> <br/>
@ -48,11 +48,12 @@
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import Graph from '@/components/Graph.vue';
import AnalyticStatus from '@/components/AnlyticsStatus.vue';
import { AnalyticUnitType } from '@/types/analytic_units';
import { defineComponent } from 'vue';
import * as _ from 'lodash';

Loading…
Cancel
Save