Code Monkey home page Code Monkey logo

exam_mini_dashboard's Introduction

Inho Shin @42inshin

Hits

Hello! I'm Inho Shin.
A Developer from South Korea.(๐Ÿ‘€ maybe soon)
I love different experiences and attempts, and I am currently traveling the developer road.

With passion! With colorful!
I will be a professional team member.

Skill

Community

42inshin's GitHub stats

Contacts

Gmail Badge

exam_mini_dashboard's People

Contributors

42inshin avatar

Watchers

 avatar

exam_mini_dashboard's Issues

[FE] BUG: mocks resolvers ์˜ ์˜ฌ๋ฐ”๋ฅธ response๋ฅผ ์œ„ํ•œ ์ฝ”๋“œ ์ˆ˜์ •

๋ฒ„๊ทธ ์„ค๋ช…

์‹œ๊ฐ„ ๋ฒ”์œ„ selector์˜ ์„ ํƒ ๊ฐ€๋Šฅํ•œ ์˜ต์…˜์€ 10๋ถ„, 30๋ถ„, 1์‹œ๊ฐ„์ด๋ฉฐ, 10์ดˆ ๊ฐ„๊ฒฉ์œผ๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ›์•„์˜ค๊ธฐ ๋•Œ๋ฌธ์—

api ๋ฐ์ดํ„ฐ๋ฅผ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ๋ฐ›์•„์˜ฌ ๊ฒฝ์šฐ 61, 181, 361๊ฐœ์˜ ๋ฐ์ดํ„ฐ๋“ค์ด ๋“ค์–ด์™€์•ผ ํ• ๊ฒƒ์œผ๋กœ ๋ณด์ž…๋‹ˆ๋‹ค.

ํ•˜์ง€๋งŒ, ์ˆ˜์ •์„ ๊ฑฐ์น˜์ง€ ์•Š์€ ๊ธฐ์กด ์ƒํƒœ์—์„œ ํ•ด๋‹น api๋ฅผ ์‚ฌ์šฉํ•˜๊ฒŒ ๋  ๋•Œ 1๊ฐœ ๋˜๋Š” 0๊ฐœ์˜ ๋ฐ์ดํ„ฐ๋งŒ ๋“ค์–ด์˜ค๋Š” ์ƒํ™ฉ์ด๋ผ resolvers๋‚ด pie, timeseries, value ๋‚ด ์ฝ”๋“œ๋ฅผ ํ™•์ธํ•˜์—ฌ ์ˆ˜์ •์ด ํ•„์š”ํ•ด ๋ณด์ž…๋‹ˆ๋‹ค.

์žฌํ˜„ ๋ฐฉ๋ฒ•

์•„๋ž˜์˜ ์ฝ”๋“œ๋ฅผ ํ†ตํ•ด์„œ api ํ˜ธ์ถœ ํ•จ์ˆ˜๋ฅผ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.
unixtime ๋‹จ์œ„ ์‹œ๊ฐ„์„ ์ดˆ ๋‹จ์œ„๋กœ ๋„ฃ์—ˆ์„ ๋•Œ ๋ฐ์ดํ„ฐ๊ฐ€ 0๊ฐœ ๋˜๋Š” 1๊ฐœ๊ฐ€ ๋“ค์–ด์˜ค๋Š” ์ƒํ™ฉ์ž…๋‹ˆ๋‹ค.

// ํ˜„์žฌ ์‹œ๊ฐ„์„ Unix ์‹œ๊ฐ„์œผ๋กœ ๋ณ€ํ™˜
const currentUnixTime = Math.floor(Date.now() / 1000)
const selectorOption = {
  tenMin: 600,
  thirtyMin: 1800,
  oneHour: 3600
}

const defaultSelector = selectorOption.tenMin

const getTimesHandler = async () => {
  const requestData = {
    from: currentUnixTime - defaultSelector,
    to: currentUnixTime
  }
  const timeseriesData = await getTimeseries(requestData.from, requestData.to)
  console.log(timeseriesData)
}

์‹œ์Šคํ…œ ํ™˜๊ฒฝ (์„ ํƒ ์‚ฌํ•ญ)

No response

[FE] UI ์ •๋ฆฌ, ๋งˆ๋ฌด๋ฆฌ๋ฅผ ์œ„ํ•œ ์ˆ˜์ • ๋ฐ ์„ ํƒ์‚ฌํ•ญ ๊ตฌํ˜„

์ž‘์—… ์„ค๋ช…

  • UI ์ •๋ฆฌ
  • readme ์ •๋ฆฌ
  • ์ฝ”๋“œ ๋ฆฌํŒฉํ† ๋ง
  • ๋ฒ„๊ทธ ํ™•์ธ ๋ฐ ์ˆ˜์ •
  • ์„ ํƒ์‚ฌํ•ญ ๊ตฌํ˜„
    • ์‚ฌ์šฉ์ž๊ฐ€ ๋Œ€์‹œ๋ณด๋“œ์— 3์ข…์˜ ์ฐจํŠธ ์ค‘ ์›ํ•˜๋Š” ๊ฒƒ ํ•˜๋‚˜๋ฅผ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ ํ•ด์ฃผ์„ธ์š”.
    • ๊ฐ’ ์ฐจํŠธ๊ฐ€ ํŠน์ • ๊ธฐ์ค€ ๊ฐ’ ์ด์ƒ์ผ ๋•Œ, ๊ฐ’์˜ ์ƒ‰์ƒ์ด ๋ณ€ํ•˜๋Š” ๊ธฐ๋Šฅ์„ ๊ฐœ๋ฐœํ•ด์ฃผ์„ธ์š”.
    • ๊ฐ’ ์ฐจํŠธ์˜ ๊ฐ’์„ ํ•ญ์ƒ ์†Œ์ˆ˜ ์  ์œ„ 3์ž๋ฆฌ, ์†Œ์ˆ˜ ์  ์•„๋ž˜ 2์ž๋ฆฌ๊นŒ์ง€๋งŒ ๋ณด์ด๋„๋ก ํ•ด์ฃผ์„ธ์š”.
    • ๋Œ€์‹œ๋ณด๋“œ ํŽ˜์ด์ง€์˜ ์ฐจํŠธ๋“ค์˜ ์œ„์น˜์™€ ํฌ๊ธฐ๋ฅผ ์›ํ•˜๋Š” ๋Œ€๋กœ ์กฐ์ž‘ํ•  ์ˆ˜ ์žˆ๋„๋ก ๋งŒ๋“ค์–ด์ฃผ์„ธ์š”.

์ ‘๊ทผ ๋ฐฉ๋ฒ• (์„ ํƒ ์‚ฌํ•ญ)

No response

๋Œ€์ฒด ๋ฐฉ์•ˆ (์„ ํƒ ์‚ฌํ•ญ)

No response

[FE] ์ฐจํŠธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ถ”๊ฐ€ ๋ฐ ์ฐจํŠธ ๊ตฌํ˜„

์ž‘์—… ์„ค๋ช…

  1. 3์ข…์˜ ์ฐจํŠธ๋ฅผ ๊ตฌํ˜„ํ•˜๊ธฐ ์œ„ํ•ด ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

  2. ์ฐจํŠธ๋ฅผ ๊ตฌํ˜„ ํ•ฉ๋‹ˆ๋‹ค.

  • ๋ผ์ธ ์ฐจํŠธ : GET /timeseries API
  • ํŒŒ์ด ์ฐจํŠธ: GET /pie API
  • ๊ฐ’ ์ฐจํŠธ: GET /value API

3์ข…์˜ ์ฐจํŠธ๋Š” 10์ดˆ ์ฃผ๊ธฐ๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐฑ์‹ ํ•ฉ๋‹ˆ๋‹ค.

  1. ์‹œ๊ฐ„ ๋ฒ”์œ„์ธ selector๋ฅผ ๊ตฌํ˜„ ํ•ฉ๋‹ˆ๋‹ค.
  • 10๋ถ„
  • 30๋ถ„
  • 1์‹œ๊ฐ„

์ ‘๊ทผ ๋ฐฉ๋ฒ• (์„ ํƒ ์‚ฌํ•ญ)

chart.js ์™€ vue-chart-3 ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์„ค์น˜ํ•  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค.

๋ผ์ธ ์ฐจํŠธ์™€ ํŒŒ์ด ์ฐจํŠธ๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ํ†ตํ•ด ๊ตฌํ˜„ํ•˜๋ฉฐ, ๊ฐ’ ์ฐจํŠธ๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์‚ฌ์šฉ ์—†์ด ํ•  ๊ณ„ํš์ž…๋‹ˆ๋‹ค.

์˜ˆ์‹œ

image image

๋Œ€์ฒด ๋ฐฉ์•ˆ (์„ ํƒ ์‚ฌํ•ญ)

chart.js ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ๋ฏธํกํ•  ์‹œ echarts.js๋กœ ๋ณ€๊ฒฝํ•  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค.

[FE] MSW๋ฅผ ์‚ฌ์šฉํ•œ mockingServer ๊ตฌ์ถ•

์„ค๋ช…

  • MSW๋ฅผ ์‚ฌ์šฉํ•œ mockingServer ๋ฅผ ๊ตฌ์„ฑํ•ฉ๋‹ˆ๋‹ค.
    • MSW ์„ค์น˜
    • ๋ธŒ๋ผ์šฐ์ €์— ์„œ๋น„์Šค ์›Œ์ปค ๋“ฑ๋ก
    • ์›Œ์ปค ์„ค์ •
    • ์›Œ์ปค ์‹คํ–‰

MSW(Mock Service Worker)๋ž€?

MSW(Mock Service Worker)๋Š” Service Worker๋ฅผ ์ด์šฉํ•ด ์„œ๋ฒ„๋ฅผ ํ–ฅํ•œ ์‹ค์ œ ๋„คํŠธ์›Œํฌ ์š”์ฒญ์„ ๊ฐ€๋กœ์ฑ„์„œ(intercept) ๋ชจ์˜ ์‘๋‹ต (Mocked response)๋ฅผ ๋ณด๋‚ด์ฃผ๋Š” API Mocking ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์ด๋‹ค. MSW๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์ง์ ‘ Mock ์„œ๋ฒ„๋ฅผ ๊ตฌํ˜„ํ•˜์ง€ ์•Š์•„๋„, ๋„คํŠธ์›Œํฌ ์ˆ˜์ค€์—์„œ API๋ฅผ Mocking ํ•  ์ˆ˜ ์žˆ๋‹ค. Mocking ํ…Œ์ŠคํŠธ๋ฅผ ์œ„ํ•œ ๋…ธ๋“œ(node.js)ํ™˜๊ฒฝ, ๊ฐœ๋ฐœ ๋ฐ ๋””๋ฒ„๊น…์„ ์œ„ํ•œ ๋ธŒ๋ผ์šฐ์ € ํ™˜๊ฒฝ์—์„œ ๋ชจ๋‘ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค๋Š” ์žฅ์ ์ด ์žˆ๋‹ค. ๋˜ํ•œ, ์†Œ์Šค ์ฝ”๋“œ ์ˆ˜์ • ์—†์ด ๋ชจํ‚น์ด ํ•„์š”ํ•œ ํ™˜๊ฒฝ์—์„œ๋งŒ MSW ์ธ์Šคํ„ด์Šค๋ฅผ ์‹คํ–‰ํ•ด API Mocking์„ ์ ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.

MSW๊ฐ€ ์ด๋Ÿฐ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•  ์ˆ˜ ์žˆ๋Š” ์ด์œ ๋Š” ๋ฐ”๋กœ Service Worker๋ฅผ ์ด์šฉํ•ด HTTP ์š”์ฒญ์„ ๊ฐ€๋กœ์ฑ„๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.

์„ค์น˜ ๋ฐฉ๋ฒ•

MSW ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์„ค์น˜

npm install msw --save-dev

๋ธŒ๋ผ์šฐ์ €์— ์„œ๋น„์Šค ์›Œ์ปค ๋“ฑ๋ก

๋ธŒ๋ผ์šฐ์ €์—์„œ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” MSW๋ฅผ ์„œ๋น„์Šค ์›Œ์ปค์— ๋“ฑ๋กํ•˜๋Š” ๊ณผ์ •์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.
์•„๋ž˜์˜ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•˜๋ฉด ์„œ๋น„์Šค ์›Œ์ปค ๋“ฑ๋ก์„ ์œ„ํ•œ ํŒŒ์ผ์ด public ํด๋”์— ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

npx msw init public/ --save

Worker ์„ค์ •

src/mocks/browser.js ํŒŒ์ผ์„ ์ƒ์„ฑํ•ด์„œ worker ์„ค์ •์„ ํ•ฉ๋‹ˆ๋‹ค.

import { setupWorker, type SetupWorker } from 'msw'
import { handlers } from './handlers'

const worker: SetupWorker = setupWorker(...handlers)

export default worker

Worker ์‹คํ–‰

src/main.ts ์— Worker ์‹คํ–‰ ์ฝ”๋“œ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

import worker from './mocks/browser'

// MockServiceWorker
if (process.env.NODE_ENV === 'development') {
  worker.start({ onUnhandledRequest: 'bypass' })
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.