This is an automated email from the ASF dual-hosted git repository. qiuxiafan pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/skywalking-booster-ui.git
commit a174b18c23fb1e05b2f26951306edaacb5396e12 Author: Qiuxia Fan <[email protected]> AuthorDate: Wed Dec 8 20:21:08 2021 +0800 feat: add types --- {workflows => .github/workflows}/nodejs.yml | 0 package.json | 2 +- src/store/modules/app/index.ts | 2 +- src/utils/cancelToken.ts | 1 + src/utils/vec3.ts | 2 +- src/views/Settings.vue | 10 +++++++--- src/views/infrastructure/InfrastructureMap.vue | 5 ++--- src/views/infrastructure/geometry/hexagon-pillar.ts | 6 +++--- 8 files changed, 16 insertions(+), 12 deletions(-) diff --git a/workflows/nodejs.yml b/.github/workflows/nodejs.yml similarity index 100% rename from workflows/nodejs.yml rename to .github/workflows/nodejs.yml diff --git a/package.json b/package.json index ba0eaf1..5c2689c 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "parserOptions": { "ecmaVersion": 2020 }, - "rules": {}, + "rules": {"@typescript-eslint/no-explicit-any": ["off"]}, "overrides": [ { "files": [ diff --git a/src/store/modules/app/index.ts b/src/store/modules/app/index.ts index e042aa0..e3bc570 100644 --- a/src/store/modules/app/index.ts +++ b/src/store/modules/app/index.ts @@ -103,6 +103,6 @@ export const appStore = defineStore({ }, }, }); -export function useAppStoreWithOut() { +export function useAppStoreWithOut(): any { return appStore(store); } diff --git a/src/utils/cancelToken.ts b/src/utils/cancelToken.ts index a4a5b40..f5e65de 100644 --- a/src/utils/cancelToken.ts +++ b/src/utils/cancelToken.ts @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +/* eslint-disable */ import axios from "axios"; const CancelToken = axios.CancelToken; diff --git a/src/utils/vec3.ts b/src/utils/vec3.ts index 03a3e88..55613d5 100644 --- a/src/utils/vec3.ts +++ b/src/utils/vec3.ts @@ -141,7 +141,7 @@ class Vec3 extends Float32Array { return this; } /** Copy in vector data */ - copy(v: any[] | Float32Array): Vec3 { + copy(v: number[] | Float32Array): Vec3 { this[0] = v[0]; this[1] = v[1]; this[2] = v[2]; diff --git a/src/views/Settings.vue b/src/views/Settings.vue index c67b48e..a4d8c6f 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -79,7 +79,7 @@ import timeFormat from "@/utils/timeFormat"; import { ElSwitch } from "element-plus"; const { t, locale } = useI18n(); -const state = reactive<{ timer: any }>({ +const state = reactive<{ timer: ReturnType<typeof setInterval> | null }>({ timer: null, }); const lang = ref<boolean>(locale.value === "zh" ? false : true); @@ -105,14 +105,18 @@ const handleAuto = (status: boolean) => { handleReload(); state.timer = setInterval(handleReload, autoTime.value * 1000); } else { - clearInterval(state.timer); + if (state.timer) { + clearInterval(state.timer); + } } }; const changeAutoTime = () => { if (autoTime.value < 1) { return; } - clearInterval(state.timer); + if (state.timer) { + clearInterval(state.timer); + } if (auto.value) { handleReload(); state.timer = setInterval(handleReload, autoTime.value * 1000); diff --git a/src/views/infrastructure/InfrastructureMap.vue b/src/views/infrastructure/InfrastructureMap.vue index 17c622d..e4868b8 100644 --- a/src/views/infrastructure/InfrastructureMap.vue +++ b/src/views/infrastructure/InfrastructureMap.vue @@ -16,7 +16,7 @@ limitations under the License. --> <div class="infrastructure-box"> <div ref="mapRef" class="map"></div> <div class="info-box" v-show="showInfo"> - {{ nodeTypes[type] }} Information + {{ NodeTypes[type] }} Information </div> </div> </template> @@ -37,7 +37,6 @@ const animateCallbacks: Array<() => void> = []; const showInfo = ref<boolean>(false); const objSelected = ref<any>(null); const meshColors = ref([0xa1cffb, 0x333333, 0x333840, 0x999999]); //[0xa489b2, 0xf2bfd0, 0xf0eaea, 0xef6775, 0xfbc580]; -const nodeTypes = ref(NodeTypes); const type = ref<number>(0); const width = ref<number>(1920); const height = ref<number>(900); @@ -89,7 +88,7 @@ function init(dom: HTMLDivElement): void { const helper = new THREE.GridHelper(10000, 40, 0x04002c, 0x04002c); helper.position.y = -1000; // this.scene.add(helper); - const axis = new THREE.AxesHelper(15000); + // const axis = new THREE.AxesHelper(15000); // this.scene.add(axis); // add mesh createInfrastructure(); diff --git a/src/views/infrastructure/geometry/hexagon-pillar.ts b/src/views/infrastructure/geometry/hexagon-pillar.ts index bb2f570..1e714f8 100644 --- a/src/views/infrastructure/geometry/hexagon-pillar.ts +++ b/src/views/infrastructure/geometry/hexagon-pillar.ts @@ -74,7 +74,7 @@ class HexagonPillar { const poly = createPolygon(radius, 6, pointyUp ? (30 * Math.PI) / 180 : 0); // Create Base Shape toVec3(rtn, poly); - const vertices = []; + const vertices: any[] = []; for (let i = 0; i < rtn.vertices.length / 3; i++) { vertices.push( new Vec3( @@ -90,7 +90,7 @@ class HexagonPillar { } // Create the basic 2d polygon shape function createPolygon(radius: number, sides = 6, offset = 0) { - const poly = []; + const poly: number[] = []; let i, rad; for (i = 0; i < sides; i++) { rad = Math.PI * 2 * (i / sides); @@ -180,7 +180,7 @@ function polyCapBevel( ) { // eslint-disable-next-line const v: any = new Vec2(); - const lerp = []; + const lerp: any[] = []; let pivot, top, pnt, i, vlen, tlen; offset = offset || [0, 0, 0];
