fastapi-voyager 0.11.3__py3-none-any.whl → 0.11.5__py3-none-any.whl

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.
@@ -1,2 +1,2 @@
1
1
  __all__ = ["__version__"]
2
- __version__ = "0.11.3"
2
+ __version__ = "0.11.5"
@@ -14,6 +14,8 @@ export default defineComponent({
14
14
  props: {
15
15
  schemaName: { type: String, required: true },
16
16
  schemas: { type: Object, default: () => ({}) },
17
+ // visibility from parent (e.g., dialog v-model)
18
+ modelValue: { type: Boolean, default: true },
17
19
  },
18
20
  setup(props, { emit }) {
19
21
  const code = ref("");
@@ -21,6 +23,7 @@ export default defineComponent({
21
23
  const error = ref("");
22
24
  const fields = ref([]); // schema fields list
23
25
  const tab = ref("fields");
26
+ const loading = ref(false);
24
27
 
25
28
 
26
29
  async function highlightLater() {
@@ -45,12 +48,22 @@ export default defineComponent({
45
48
  });
46
49
  }
47
50
 
51
+ function resetState() {
52
+ code.value = "";
53
+ link.value = "";
54
+ error.value = null;
55
+ fields.value = [];
56
+ // tab.value = "fields";
57
+ loading.value = true;
58
+ }
59
+
48
60
  async function loadSource() {
49
61
  if (!props.schemaName) return;
50
62
 
51
63
  error.value = null;
52
64
  code.value = "";
53
65
  link.value = "";
66
+ loading.value = true;
54
67
 
55
68
  // try to fetch from server: /source/{schema_name}
56
69
  const payload = { schema_name: props.schemaName };
@@ -71,13 +84,8 @@ export default defineComponent({
71
84
  } else {
72
85
  error.value = (data && data.error) || "Failed to load source";
73
86
  }
74
- } catch (e) {
75
- error.value = "Failed to load source";
76
- } finally {
77
- }
78
87
 
79
- try {
80
- const resp = await fetch(`vscode-link`, {
88
+ const resp2 = await fetch(`vscode-link`, {
81
89
  method: "POST",
82
90
  headers: {
83
91
  Accept: "application/json",
@@ -85,16 +93,16 @@ export default defineComponent({
85
93
  },
86
94
  body: JSON.stringify(payload),
87
95
  });
88
- // surface server-side validation message for bad request
89
- const data = await resp.json().catch(() => ({}));
90
- if (resp.ok) {
91
- link.value = data.link || "// no vscode link available";
96
+ const data2 = await resp2.json().catch(() => ({}));
97
+ if (resp2.ok) {
98
+ link.value = data2.link || "// no vscode link available";
92
99
  } else {
93
- error.value += (data && data.error) || "Failed to load source";
100
+ error.value = (error.value || "") + ((data2 && data2.error) || "Failed to load source");
94
101
  }
95
102
  } catch (e) {
96
103
  error.value = "Failed to load source";
97
104
  } finally {
105
+ loading.value = false;
98
106
  }
99
107
 
100
108
  const schema = props.schemas && props.schemas[props.schemaName];
@@ -118,18 +126,36 @@ export default defineComponent({
118
126
  watch(
119
127
  () => props.schemaName,
120
128
  () => {
129
+ resetState();
121
130
  loadSource();
122
131
  },
123
132
  );
124
133
 
134
+ // respond to visibility changes: when shown, clear old data and reload
135
+ watch(
136
+ () => props.modelValue,
137
+ (val) => {
138
+ if (val) {
139
+ resetState();
140
+ loadSource();
141
+ }
142
+ }
143
+ );
144
+
125
145
  onMounted(() => {
126
- loadSource();
146
+ if (props.modelValue) {
147
+ resetState();
148
+ loadSource();
149
+ }
127
150
  });
128
151
 
129
- return { link, code, error, fields, tab };
152
+ return { link, code, error, fields, tab, loading };
130
153
  },
131
154
  template: `
132
155
  <div class="frv-code-display" style="border: 1px solid #ccc; border-left: none; position:relative; height:100%; background:#fff;">
156
+ <div v-show="loading" style="position:absolute; top:0; left:0; right:0; z-index:10;">
157
+ <q-linear-progress indeterminate color="primary" size="2px"/>
158
+ </div>
133
159
  <div class="q-ml-lg q-mt-md">
134
160
  <a :href="link" target="_blank" rel="noopener" style="font-size:12px; color:#3b82f6;">
135
161
  Open in VSCode
@@ -218,9 +218,9 @@
218
218
  class="q-mr-sm"
219
219
  :name="state.tag == tag.name ? 'folder' : 'folder_open'"
220
220
  ></q-icon>
221
- <span>{{ tag.name }} <q-chip style="position:relative; top: -1px;" class="q-ml-sm" dense>{{ tag.routes.length }}</q-chip></span>
222
- <a target="_blank" class="q-ml-sm" v-if="state.swaggerUrl" :href="state.swaggerUrl + '#/' + tag.name">
223
- <q-icon size="small" name="link"></q-icon>
221
+ <span>{{ tag.name }} <q-chip style="position:relative; top: -1px;" class="q-ml-md" dense>{{ tag.routes.length }}</q-chip></span>
222
+ <a v-if="state._tag == tag.name" target="_blank" class="q-ml-sm" v-if="state.swaggerUrl" :href="state.swaggerUrl + '#/' + tag.name">
223
+ <q-icon color="primary" size="" name="link" title="open in swagger"></q-icon>
224
224
  </a>
225
225
  </div>
226
226
  </template>
@@ -241,8 +241,8 @@
241
241
  name="data_object"
242
242
  ></q-icon>
243
243
  {{ route.name }}
244
- <a target="_blank" class="q-ml-sm" v-if="state.swaggerUrl" :href="state.swaggerUrl + '#/' + tag.name + '/' + route.unique_id">
245
- <q-icon size="small" name="link"></q-icon>
244
+ <a v-if="state.routeId == route.id" target="_blank" class="q-ml-md" v-if="state.swaggerUrl" :href="state.swaggerUrl + '#/' + tag.name + '/' + route.unique_id">
245
+ <q-icon color="primary" size="" name="link" title="open in swagger"></q-icon>
246
246
  </a>
247
247
  </span>
248
248
  </q-item-section>
@@ -411,10 +411,7 @@
411
411
  </q-dialog>
412
412
  </div>
413
413
 
414
- <script
415
- type="text/javascript"
416
- src="https://code.jquery.com/jquery-2.1.3.min.js"
417
- ></script>
414
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js" integrity="sha512-egJ/Y+22P9NQ9aIyVCh0VCOsfydyn8eNmqBy+y2CnJG+fpRIxXMS6jbWP8tVKp0jp+NO5n8WtMUAnNnGoJKi4w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
418
415
  <script
419
416
  src="https://cdnjs.cloudflare.com/ajax/libs/d3/7.9.0/d3.min.js"
420
417
  integrity="sha512-vc58qvvBdrDR4etbxMdlTt4GBQk1qjvyORR2nrsPsFPyrs+/u5c3+1Ct6upOgdZoIl7eq6k3a1UPDSNAQi/32A=="
@@ -422,7 +419,7 @@
422
419
  referrerpolicy="no-referrer"
423
420
  ></script>
424
421
  <script src="https://unpkg.com/@hpcc-js/wasm@2.20.0/dist/graphviz.umd.js"></script>
425
- <script src="https://unpkg.com/d3-graphviz@5.6.0/build/d3-graphviz.js"></script>
422
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/d3-graphviz/5.6.0/d3-graphviz.min.js" integrity="sha512-Le8HpIpS2Tc7SDHLM6AOgAKq6ZR4uDwLhjPSR20DtXE5dFb9xECHRwgpc1nxxnU0Dv+j6FNMoSddky5gyvI3lQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
426
423
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js"></script>
427
424
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-color/2.1.2/jquery.color.min.js"></script>
428
425
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastapi-voyager
3
- Version: 0.11.3
3
+ Version: 0.11.5
4
4
  Summary: Visualize FastAPI application's routing tree and dependencies
5
5
  Project-URL: Homepage, https://github.com/allmonday/fastapi-voyager
6
6
  Project-URL: Source, https://github.com/allmonday/fastapi-voyager
@@ -45,8 +45,7 @@ interactively !!
45
45
 
46
46
  [visit online demo](https://www.newsyeah.fun/voyager/) of project: [composition oriented development pattern](https://github.com/allmonday/composition-oriented-development-pattern)
47
47
 
48
- <p align="center"><img src="./voyager.jpg" alt="" /></p>
49
- <p align="center"><a target="_blank" rel="" href="https://www.youtube.com/watch?v=PGlbQq1M-n8"><img src="http://img.youtube.com/vi/PGlbQq1M-n8/0.jpg" alt="" style="max-width: 100%;"></a></p>
48
+ <img width="1600" height="986" alt="image" src="https://github.com/user-attachments/assets/8829cda0-f42d-4c84-be2f-b019bb5fe7e1" />
50
49
 
51
50
  ## Installation
52
51
 
@@ -97,32 +96,25 @@ voyager -m tests.demo
97
96
  --module_color=tests.demo:tomato
98
97
  ```
99
98
 
100
- ### generate the graph
101
- after initialization, pick tag, rotue to render graph
102
-
103
- <img width="1628" height="765" alt="image" src="https://github.com/user-attachments/assets/b4712f82-e754-453b-aa69-24c932b8f48f" />
104
-
105
99
  ### highlight
106
100
  click a node to highlight it's upperstream and downstream nodes. figure out the related models of one page, or homw many pages are related with one model.
107
101
 
108
- <img width="1485" height="616" alt="image" style="border: 1px solid #aaa" src="https://github.com/user-attachments/assets/70c4095f-86c7-45da-a6f0-fd41ac645813" />
102
+ <img width="1100" height="700" alt="image" src="https://github.com/user-attachments/assets/3e0369ea-5fa4-469a-82c1-ed57d407e53d" />
109
103
 
110
- ### filter related nodes
111
- `shift` click a node to check related node, pick a field to narrow the result, picked node is marked as red.
104
+ ### focus on nodes
105
+ toggle focus to hide nodes not related with current picked one.
112
106
 
113
- <img width="1423" height="552" alt="image" src="https://github.com/user-attachments/assets/468a058d-afa1-4601-a7c5-c6aad6a8a557" />
107
+ before:
108
+ <img width="1066" height="941" alt="image" src="https://github.com/user-attachments/assets/39f30817-899a-4289-93f4-a1646d3441c1" />
109
+ after:
110
+ <img width="1061" height="937" alt="image" src="https://github.com/user-attachments/assets/79709b02-7571-43fc-abc9-17a287a97515" />
114
111
 
115
112
  ### view source code
116
- `alt` click a node to show source code or open file in vscode.
117
-
118
- <img width="1049" height="694" alt="image" src="https://github.com/user-attachments/assets/7839ac83-8d60-44ad-b1c9-9652a76339b1" />
119
-
120
- <img width="1042" height="675" alt="image" src="https://github.com/user-attachments/assets/38ae705f-5982-4a02-9c3f-038b1d00bcf6" />
121
-
122
- `alt` click a route to show source code or open file in vscode
123
-
124
- <img width="882" height="445" alt="image" src="https://github.com/user-attachments/assets/158560ef-63ca-4991-9b7d-587be4fa04e4" />
113
+ double click a node to show source code or open file in vscode.
114
+ <img width="1297" height="940" alt="image" src="https://github.com/user-attachments/assets/c8bb2e7d-b727-42a6-8c9e-64dce297d2d8" />
125
115
 
116
+ double click a route to show source code or open file in vscode
117
+ <img width="1132" height="824" alt="image" src="https://github.com/user-attachments/assets/b706e879-e4fc-48dd-ace1-99bf97e3ed6a" />
126
118
 
127
119
 
128
120
 
@@ -272,7 +264,12 @@ or you can open router_viz.dot with vscode extension `graphviz interactive previ
272
264
  - 0.11.3
273
265
  - [x] support online repo url
274
266
  - 0.11.4
275
- - [ ] add loading for field detail panel
267
+ - [x] add loading for field detail panel
268
+ - 0.11.5
269
+ - [x] optimize open in swagger link
270
+ - [x] change jquery cdn
271
+ - 0.11.6
272
+ - [ ] flag of loading full graph in first render or not
276
273
  - [ ] logging information
277
274
  - [ ] sort field name
278
275
  - [ ] set max limit for fields
@@ -6,18 +6,18 @@ fastapi_voyager/render.py,sha256=vdwqIync2wsP8gMPY0v_XjRhdPBtbKyRT8yTBa_Ep3Y,874
6
6
  fastapi_voyager/server.py,sha256=cRTUQik4rvrdZgfkFabCs6LBZnC1FVU4z3lwd1r8GNk,6839
7
7
  fastapi_voyager/type.py,sha256=VmcTB1G-LOT70EWCzi4LU_FUkSGWUIBJX15T_J5HnOo,1764
8
8
  fastapi_voyager/type_helper.py,sha256=QqP4c642vEkoWTZAtl_Vvt-kys3MkVDp4BNkLrw5mHQ,9477
9
- fastapi_voyager/version.py,sha256=lbhVTyfJZpsKCnUAXtQjVxbGBg1jjoqiyaCQRf2W6hk,49
9
+ fastapi_voyager/version.py,sha256=jjZSCgkES3-8Fj88lWI3Bp418XjCkMi4KhC0Rc564i8,49
10
10
  fastapi_voyager/voyager.py,sha256=hNal25S5Hi_ZRe-gnmdUKt8tnRd-BRCrzaybAEJ_1HI,13498
11
11
  fastapi_voyager/web/graph-ui.js,sha256=DTedkpZNbtufexONVkJ8mOwF_-VnvxoReYHtox6IKR4,5842
12
12
  fastapi_voyager/web/graphviz.svg.css,sha256=zDCjjpT0Idufu5YOiZI76PL70-avP3vTyzGPh9M85Do,1563
13
13
  fastapi_voyager/web/graphviz.svg.js,sha256=lvAdbjHc-lMSk4GQp-iqYA2PCFX4RKnW7dFaoe0LUHs,16005
14
- fastapi_voyager/web/index.html,sha256=9zp6id31DB_cWdAoCkO5NkeHCMTnNaz2VOdJO24__eM,17837
14
+ fastapi_voyager/web/index.html,sha256=ys5zhYNO-smzb1_EgrQ3cWSbhzgMSpk32d1AupX6EP8,18293
15
15
  fastapi_voyager/web/quasar.min.css,sha256=F5jQe7X2XT54VlvAaa2V3GsBFdVD-vxDZeaPLf6U9CU,203145
16
16
  fastapi_voyager/web/quasar.min.js,sha256=h0ftyPMW_CRiyzeVfQqiup0vrVt4_QWojpqmpnpn07E,502974
17
17
  fastapi_voyager/web/vue-main.js,sha256=sUjLmn06jYy1guwxAcouHwkcjxGD2UgZgkiiIEDbk04,10663
18
18
  fastapi_voyager/web/component/render-graph.js,sha256=e8Xgh2Kl-nYU0P1gstEmAepCgFnk2J6UdxW8TlMafGs,2322
19
19
  fastapi_voyager/web/component/route-code-display.js,sha256=8NJPPjNRUC21gjpY8XYEQs4RBbhX1pCiqEhJp39ku6k,3678
20
- fastapi_voyager/web/component/schema-code-display.js,sha256=UgFotzvqSuhnPXNOr6w_r1fV2_savRiCdokEvferutE,6244
20
+ fastapi_voyager/web/component/schema-code-display.js,sha256=FjoD3CLl967VMfbZNQMdbiEnS0z-doLJDJIeDCmKGew,6983
21
21
  fastapi_voyager/web/component/schema-field-filter.js,sha256=c--XiXJrhIS7sYo1x8ZwMoqak0k9xLkNYTWoli-zd38,6253
22
22
  fastapi_voyager/web/icon/android-chrome-192x192.png,sha256=35sBy6jmUFJCcquStaafHH1qClZIbd-X3PIKSeLkrNo,37285
23
23
  fastapi_voyager/web/icon/android-chrome-512x512.png,sha256=eb2eDjCwIruc05029_0L9hcrkVkv8KceLn1DJMYU0zY,210789
@@ -26,8 +26,8 @@ fastapi_voyager/web/icon/favicon-16x16.png,sha256=JC07jEzfIYxBIoQn_FHXvyHuxESdhW
26
26
  fastapi_voyager/web/icon/favicon-32x32.png,sha256=C7v1h58cfWOsiLp9yOIZtlx-dLasBcq3NqpHVGRmpt4,1859
27
27
  fastapi_voyager/web/icon/favicon.ico,sha256=tZolYIXkkBcFiYl1A8ksaXN2VjGamzcSdes838dLvNc,15406
28
28
  fastapi_voyager/web/icon/site.webmanifest,sha256=ep4Hzh9zhmiZF2At3Fp1dQrYQuYF_3ZPZxc1KcGBvwQ,263
29
- fastapi_voyager-0.11.3.dist-info/METADATA,sha256=2yD09_89vwgOEDQuiGN48d98XWowh8wTr4rnNNu7mVU,9960
30
- fastapi_voyager-0.11.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
31
- fastapi_voyager-0.11.3.dist-info/entry_points.txt,sha256=pEIKoUnIDXEtdMBq8EmXm70m16vELIu1VPz9-TBUFWM,53
32
- fastapi_voyager-0.11.3.dist-info/licenses/LICENSE,sha256=lNVRR3y_bFVoFKuK2JM8N4sFaj3m-7j29kvL3olFi5Y,1067
33
- fastapi_voyager-0.11.3.dist-info/RECORD,,
29
+ fastapi_voyager-0.11.5.dist-info/METADATA,sha256=-9xjzPJFY0WqW_SM9AGHLHI6tRrE3sqsy8iiKThQmvM,9712
30
+ fastapi_voyager-0.11.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
31
+ fastapi_voyager-0.11.5.dist-info/entry_points.txt,sha256=pEIKoUnIDXEtdMBq8EmXm70m16vELIu1VPz9-TBUFWM,53
32
+ fastapi_voyager-0.11.5.dist-info/licenses/LICENSE,sha256=lNVRR3y_bFVoFKuK2JM8N4sFaj3m-7j29kvL3olFi5Y,1067
33
+ fastapi_voyager-0.11.5.dist-info/RECORD,,