fastapi-voyager 0.10.1__py3-none-any.whl → 0.10.3__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.
fastapi_voyager/filter.py CHANGED
@@ -106,7 +106,7 @@ def filter_graph(
106
106
  return _tags, _routes, _nodes, _links
107
107
 
108
108
 
109
- def filter_subgraph(
109
+ def filter_subgraph_by_module_prefix(
110
110
  *,
111
111
  tags: list[Tag],
112
112
  routes: list[Route],
fastapi_voyager/server.py CHANGED
@@ -9,6 +9,7 @@ from fastapi_voyager.voyager import Voyager
9
9
  from fastapi_voyager.type import Tag, FieldInfo, CoreData, SchemaNode
10
10
  from fastapi_voyager.render import Renderer
11
11
  from fastapi_voyager.type_helper import get_source, get_vscode_link
12
+ from fastapi_voyager.version import __version__
12
13
 
13
14
 
14
15
  WEB_DIR = Path(__file__).parent / "web"
@@ -20,6 +21,7 @@ class OptionParam(BaseModel):
20
21
  schemas: list[SchemaNode]
21
22
  dot: str
22
23
  enable_brief_mode: bool
24
+ version: str
23
25
 
24
26
  class Payload(BaseModel):
25
27
  tags: Optional[list[str]] = None
@@ -54,7 +56,7 @@ def create_route(
54
56
  schemas = voyager.nodes[:]
55
57
  schemas.sort(key=lambda s: s.name)
56
58
 
57
- return OptionParam(tags=tags, schemas=schemas, dot=dot, enable_brief_mode=bool(module_prefix))
59
+ return OptionParam(tags=tags, schemas=schemas, dot=dot, enable_brief_mode=bool(module_prefix), version=__version__)
58
60
 
59
61
  @router.post("/dot", response_class=PlainTextResponse)
60
62
  def get_filtered_dot(payload: Payload) -> str:
@@ -1,2 +1,2 @@
1
1
  __all__ = ["__version__"]
2
- __version__ = "0.10.1"
2
+ __version__ = "0.10.3"
@@ -14,7 +14,7 @@ from fastapi_voyager.type_helper import (
14
14
  )
15
15
  from pydantic import BaseModel
16
16
  from fastapi_voyager.type import Route, SchemaNode, Link, Tag, LinkType, FieldType, PK, CoreData
17
- from fastapi_voyager.filter import filter_graph, filter_subgraph
17
+ from fastapi_voyager.filter import filter_graph, filter_subgraph_by_module_prefix
18
18
  from fastapi_voyager.render import Renderer
19
19
  import pydantic_resolve.constant as const
20
20
 
@@ -308,14 +308,25 @@ class Voyager:
308
308
  return renderer.render_dot(_tags, _routes, _nodes, _links)
309
309
 
310
310
  def render_brief_dot(self, module_prefix: str | None = None):
311
- _tags, _routes, _nodes, _links = filter_subgraph(
312
- module_prefix=module_prefix,
311
+ _tags, _routes, _nodes, _links = filter_graph(
312
+ schema=self.schema,
313
+ schema_field=self.schema_field,
313
314
  tags=self.tags,
314
315
  routes=self.routes,
315
316
  nodes=self.nodes,
316
317
  links=self.links,
318
+ node_set=self.node_set,
319
+ )
320
+
321
+ _tags, _routes, _nodes, _links = filter_subgraph_by_module_prefix(
322
+ module_prefix=module_prefix,
323
+ tags=_tags,
324
+ routes=_routes,
325
+ nodes=_nodes,
326
+ links=_links,
317
327
  )
318
- renderer = Renderer(show_fields=self.show_fields, module_color=self.module_color, schema=None)
328
+
329
+ renderer = Renderer(show_fields=self.show_fields, module_color=self.module_color, schema=self.schema)
319
330
 
320
331
  _tags, _routes, _links = self.handle_hide(_tags, _routes, _links)
321
332
  return renderer.render_dot(_tags, _routes, _nodes, _links, True)
@@ -57,7 +57,7 @@
57
57
  }
58
58
 
59
59
  .adjust-fit {
60
- height: calc(100% - 54px);
60
+ height: calc(100vh - 54px);
61
61
  }
62
62
  </style>
63
63
  <body>
@@ -67,10 +67,11 @@
67
67
  <q-toolbar class="row text-grey-9 bg-white" style="width: 100%">
68
68
  <div
69
69
  class="col-auto text-primary"
70
- style="font-size: 16px; font-weight: bold"
70
+ style="font-size: 18px; font-weight: bold; display: flex; align-items: baseline;"
71
71
  >
72
72
  <q-icon class="q-mr-sm" name="satellite_alt"></q-icon>
73
73
  <span> FastAPI Voyager </span>
74
+ <span v-if="state.version" style="font-size: 12px; margin-left: 8px; font-weight: normal;">{{ state.version }}</span>
74
75
  </div>
75
76
  <div class="col-auto" style="font-size: 16px">
76
77
  <q-option-group
@@ -151,7 +152,6 @@
151
152
  shift + click to see schema's dependencies without
152
153
  unrelated nodes
153
154
  </li>
154
- <li>alt + click to see schema details</li>
155
155
  </ul>
156
156
  </div>
157
157
  </q-tooltip>
@@ -279,13 +279,14 @@
279
279
 
280
280
  <template #after>
281
281
  <div style="position: relative; width: 100%; height: 100%;">
282
- <div id="graph" class="fit"></div>
282
+ <div id="graph" class="adjust-fit"></div>
283
283
  <q-toggle
284
284
  v-model="state.focus"
285
285
  v-show="schemaCodeName"
286
286
  @update:model-value="val => onFocusChange(val)"
287
287
  label="Focus"
288
- style="position: absolute; left: 8px; top: 8px; z-index: 10; background: rgba(255,255,255,0.85); border-radius: 4px; padding: 2px 8px;"
288
+ title="pick a schema and toggle focus on to display related nodes only"
289
+ style="position: absolute; left: 8px; bottom: 8px; z-index: 10; background: rgba(255,255,255,0.85); border-radius: 4px; padding: 2px 8px;"
289
290
  size="sm"
290
291
  />
291
292
  </div>
@@ -31,7 +31,8 @@ const app = createApp({
31
31
  // Splitter size (left panel width in px)
32
32
  splitter: 300,
33
33
  detailDrawer: false,
34
- drawerWidth: 500, // drawer 宽度
34
+ drawerWidth: 300, // drawer 宽度
35
+ version: "", // version from backend
35
36
  });
36
37
 
37
38
  const showDetail = ref(false);
@@ -75,6 +76,7 @@ const app = createApp({
75
76
  return acc;
76
77
  }, {});
77
78
  state.enableBriefMode = data.enable_brief_mode || false;
79
+ state.version = data.version || "";
78
80
 
79
81
  // default route options placeholder
80
82
  } catch (e) {
@@ -91,7 +93,6 @@ const app = createApp({
91
93
  await onGenerate(false, null)
92
94
  setTimeout(() => {
93
95
  const ele = $(`[data-name='${schemaCodeName.value}'] polygon`)
94
- debugger
95
96
  ele.click()
96
97
  }, 1)
97
98
  }
@@ -119,11 +120,13 @@ const app = createApp({
119
120
  const graphUI = new GraphUI("#graph", {
120
121
  onSchemaShiftClick: (id) => {
121
122
  if (state.rawSchemas.has(id)) {
123
+ resetDetailPanels()
122
124
  schemaFieldFilterSchema.value = id;
123
125
  showSchemaFieldFilter.value = true;
124
126
  }
125
127
  },
126
128
  onSchemaClick: (id) => {
129
+ resetDetailPanels()
127
130
  if (state.rawSchemas.has(id)) {
128
131
  schemaCodeName.value = id;
129
132
  state.detailDrawer = true;
@@ -134,9 +137,7 @@ const app = createApp({
134
137
  }
135
138
  },
136
139
  resetCb: () => {
137
- state.detailDrawer = false;
138
- showRouteDetail.value = false;
139
- schemaCodeName.value = ''
140
+ resetDetailPanels()
140
141
  }
141
142
  });
142
143
 
@@ -210,6 +211,12 @@ const app = createApp({
210
211
  showSchemaFieldFilter.value = true;
211
212
  }
212
213
 
214
+ function resetDetailPanels() {
215
+ state.detailDrawer = false
216
+ showRouteDetail.value = false;
217
+ schemaCodeName.value = ''
218
+ }
219
+
213
220
  async function onReset() {
214
221
  state.tag = null;
215
222
  state.routeId = "";
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastapi-voyager
3
- Version: 0.10.1
3
+ Version: 0.10.3
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
@@ -226,12 +226,20 @@ or you can open router_viz.dot with vscode extension `graphviz interactive previ
226
226
  - [x] route list should have a max height
227
227
 
228
228
  #### 0.10
229
- - [x] refactor voyager.py tag -> route structure
230
- - [x] fix missing route (tag has only one route which return primitive value)
231
- - [x] make right panel resizable by dragging
232
- - [x] allow closing tag expansion item
233
- - [x] hide brief mode if not configured
234
- - [x] add focus button to only show related nodes under current route/tag graph in dialog
229
+ - 0.10.1
230
+ - [x] refactor voyager.py tag -> route structure
231
+ - [x] fix missing route (tag has only one route which return primitive value)
232
+ - [x] make right panel resizable by dragging
233
+ - [x] allow closing tag expansion item
234
+ - [x] hide brief mode if not configured
235
+ - [x] add focus button to only show related nodes under current route/tag graph in dialog
236
+ - 0.10.2
237
+ - [x] fix graph height
238
+ - [x] show version in title
239
+ - 0.10.3
240
+ - [x] fix focus in brief-mode
241
+ - [x] ui: adjust focus position
242
+ - [x] refactor naming
235
243
 
236
244
  #### 0.11
237
245
  - [ ] enable/disable module cluster (to save space)
@@ -1,20 +1,20 @@
1
1
  fastapi_voyager/__init__.py,sha256=tZy0Nkj8kTaMgbvHy-mGxVcFGVX0Km-36dnzsAIG2uk,230
2
2
  fastapi_voyager/cli.py,sha256=kQb4g6JEGZR99e5r8LyFFEeb_-uT-n_gp_sDoYG3R7k,11118
3
- fastapi_voyager/filter.py,sha256=2Yt37o8mhqSqleafO4YRrumh_ExYUqzXFOxQRPuTbAc,8078
3
+ fastapi_voyager/filter.py,sha256=C718iwMjnnFXtqZISe9tzDRLAaY2FjbcE2LgkauEwnw,8095
4
4
  fastapi_voyager/module.py,sha256=Z2QHNmiLk6ZAJlm2nSmO875Q33TweSg8UxZSzIpU9zY,3499
5
5
  fastapi_voyager/render.py,sha256=sR1oUh8d3hhDalQhUcrL-k2ZYAWbLDGpGDOB0dDaqRQ,7804
6
- fastapi_voyager/server.py,sha256=fyAfb6GwghcYBjk-pFJzj-uikUnATd7zmbYjUDN7bC8,6243
6
+ fastapi_voyager/server.py,sha256=6kCj906N4PVpKbUI8eq7bJ4RoET1kIQgUQUf-oMFdSY,6326
7
7
  fastapi_voyager/type.py,sha256=pWYKmgb9e0W_JeD7k54Mr2lxUZV_Ir9TNpewGRwHyHQ,1629
8
8
  fastapi_voyager/type_helper.py,sha256=hjBC4E0tgBpQDlYxGg74uK07SXjsrAgictEETJfIpYM,9231
9
- fastapi_voyager/version.py,sha256=cVQTkkihEPlsOisGI50rjHoCoQDT4b7cLPCnW6yGjYQ,49
10
- fastapi_voyager/voyager.py,sha256=DIc93SFPVwrsk1Nga74ZZyc4L0J50OAESE9j3fnEty0,12053
9
+ fastapi_voyager/version.py,sha256=Ly9dlTMt5hV5NpnQZMSH6dAdqe4rTuzydBQ4KMo8MJk,49
10
+ fastapi_voyager/voyager.py,sha256=r-_V0EPWwBM7N4hMlo-Si48mHVDc3zc9oGgTPCoEW_8,12377
11
11
  fastapi_voyager/web/graph-ui.js,sha256=FmKA3eeHMEeUDNuay3f54_fv4eGHT7MT0TaGqXhyMWQ,4978
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=CCodl9CaxjWrdQG7y9qJlSe23G7LYwK7JvIHKVPV95E,14985
14
+ fastapi_voyager/web/index.html,sha256=I41DH6WbfPgLGi49_1WFii9cldVIU8omQX13NulzaT0,15192
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
- fastapi_voyager/web/vue-main.js,sha256=lM7bxq2ivnEH-zpHF6_U8d_ebsZSg-UbSiiktss5hd8,10062
17
+ fastapi_voyager/web/vue-main.js,sha256=ZPOS0lsJ-Pg4p8kqz8jScvJod1CqMXx5DjPIqkmGDpY,10251
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
20
  fastapi_voyager/web/component/schema-code-display.js,sha256=UgFotzvqSuhnPXNOr6w_r1fV2_savRiCdokEvferutE,6244
@@ -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.10.1.dist-info/METADATA,sha256=RseoOEkS3k3BCnVZzQoGXj_kJVZNPGH7oCT2HuG9vyY,8794
30
- fastapi_voyager-0.10.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
31
- fastapi_voyager-0.10.1.dist-info/entry_points.txt,sha256=pEIKoUnIDXEtdMBq8EmXm70m16vELIu1VPz9-TBUFWM,53
32
- fastapi_voyager-0.10.1.dist-info/licenses/LICENSE,sha256=lNVRR3y_bFVoFKuK2JM8N4sFaj3m-7j29kvL3olFi5Y,1067
33
- fastapi_voyager-0.10.1.dist-info/RECORD,,
29
+ fastapi_voyager-0.10.3.dist-info/METADATA,sha256=wLQ_TjppZDsfoKMa6MRgCWtjSN5oHfW1EIyumk8Ya1E,9000
30
+ fastapi_voyager-0.10.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
31
+ fastapi_voyager-0.10.3.dist-info/entry_points.txt,sha256=pEIKoUnIDXEtdMBq8EmXm70m16vELIu1VPz9-TBUFWM,53
32
+ fastapi_voyager-0.10.3.dist-info/licenses/LICENSE,sha256=lNVRR3y_bFVoFKuK2JM8N4sFaj3m-7j29kvL3olFi5Y,1067
33
+ fastapi_voyager-0.10.3.dist-info/RECORD,,