backend.ai-webui icon indicating copy to clipboard operation
backend.ai-webui copied to clipboard

Use precise decorators for each member variable and avoid `@property` abusing

Open lizable opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 기능 요청이 특정 문제에 연관된 것이라면 여기에 그 문제를 설명해주세요. For now, we've been using only three decorators supported by Lit, @customElement, @property, and @query. Most of the member variables defined in each component class are treated as @property, which is automatically treated as "public". But there are many variables that shouldn't be handled as a "public", such as role-based accessible data. Therefore we need to refactor member variables which are mostly using @property decorator with a precise fit for use.

Describe the solution you'd like A clear and concise description of what you want to happen. 어떤 기능이 있으면 좋겠는지 자세히 설명해주세요. Here's the official(highly recommended) guideline for each usage.

Lit Documentation: Decorators

e.g.) In [backend.ai-resource-policy-list](https://github.com/lablup/backend.ai-webui/blob/main/src/components/backend-ai-resource-policy-list.ts#L45) component, we can replace the decorator in "is_admin" member variable from @property to @state since this value affects accesses to certain part which shouldn't be exposed as "public".

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered. 혹시 다른 대안들을 생각해본 적이 있다면 함께 적어주세요.

Additional context Add any other context or screenshots about the feature request here. 기능 요청에 대해 보다 잘 이해할 수 있는 다른 맥락을 기술해주세요. @Jaewoook suggested this issue first.(Thx!) Assignees could ask him if needed, such as how actually decorators work in our code.

lizable avatar Jul 19 '22 00:07 lizable