@things-factory/shell 7.0.1-alpha.5 → 7.0.1-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/shell",
|
3
|
-
"version": "7.0.1-alpha.
|
3
|
+
"version": "7.0.1-alpha.9",
|
4
4
|
"description": "Core module for framework",
|
5
5
|
"bin": {
|
6
6
|
"things-factory": "bin/things-factory",
|
@@ -133,5 +133,5 @@
|
|
133
133
|
"pg": "^8.7.3",
|
134
134
|
"sqlite3": "^5.0.8"
|
135
135
|
},
|
136
|
-
"gitHead": "
|
136
|
+
"gitHead": "e77082517f5483704f1e884cbc81b7f94c0eec15"
|
137
137
|
}
|
@@ -1,73 +0,0 @@
|
|
1
|
-
# OOPS Progress 컴포넌트
|
2
|
-
|
3
|
-
긴 시간 진행되는 작업의 진행 상황을 표현해주기 위해 서버에 진행율을 Subscribe하는 클라이언트 컴포넌트이다.
|
4
|
-
이 컴포넌트는 자체적으로 시각적 요소를 포함하지 않지만, 시각적 표현을 위해서 자식 노드(Light DOM)를 포함할 수는 있다.
|
5
|
-
|
6
|
-
## properties
|
7
|
-
|
8
|
-
- tag: String 서브스크립션 태그이며, 서버의 'publishProgress'의 tag와 일치시키도록 한다.
|
9
|
-
- subscription: String (readonly) 이 속성이 값을 가지고 있으면, 서브스크립션 중임을 의미한다.
|
10
|
-
|
11
|
-
## methods
|
12
|
-
|
13
|
-
- startSubscribe() 진행율 구독을 시작한다.
|
14
|
-
- stopSubscribe() 진행율 구독을 종료한다.(서버쪽 작업의 종료를 의미하지 않으며, 클라이언트에서 구독을 종료한다는 의미임.)
|
15
|
-
|
16
|
-
## event
|
17
|
-
|
18
|
-
- progress(event) 서버로부터 진행율이 Subscribe 되었을 때 발생한다.
|
19
|
-
- event.detail : progress 값을 갖는다.
|
20
|
-
- finish(event) 진행율이 100% 도달하면 발생한다.
|
21
|
-
|
22
|
-
## 예시
|
23
|
-
|
24
|
-
### 클라이언트 사이드
|
25
|
-
|
26
|
-
```
|
27
|
-
<oops-progress
|
28
|
-
.tag='progress-pending-job'
|
29
|
-
@progress=${e => {
|
30
|
-
this.progress = e.detail
|
31
|
-
}}
|
32
|
-
@finish=${() => {
|
33
|
-
console.log('complete')
|
34
|
-
}}
|
35
|
-
?hidden=${progress < 0 || progress > 100}
|
36
|
-
>
|
37
|
-
<div>
|
38
|
-
<mwc-linear-progress .progress=${progress / 100}></mwc-linear-progress>
|
39
|
-
<span>Progress : ${progress} % (${message})</span>
|
40
|
-
</div>
|
41
|
-
</oops-progress>
|
42
|
-
|
43
|
-
```
|
44
|
-
|
45
|
-
### 서버사이드
|
46
|
-
|
47
|
-
```
|
48
|
-
import { sleep } from '@things-factory/utils'
|
49
|
-
|
50
|
-
...
|
51
|
-
|
52
|
-
@Mutation(returns => String, { description: 'To reference of pending job progress' })
|
53
|
-
async referencePendingJob(
|
54
|
-
@Root() _,
|
55
|
-
@Ctx() context: any
|
56
|
-
) : Promise<string> {
|
57
|
-
|
58
|
-
const { domain } = context.state
|
59
|
-
|
60
|
-
for(var i = 0;i <= 100;i++) {
|
61
|
-
await sleep(100)
|
62
|
-
|
63
|
-
publishProgress({
|
64
|
-
domain,
|
65
|
-
tag: 'progress-pending-job',
|
66
|
-
progress: i,
|
67
|
-
message: `${i * 10} / 1000`
|
68
|
-
})
|
69
|
-
}
|
70
|
-
|
71
|
-
return 'success'
|
72
|
-
}
|
73
|
-
```
|