-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from tmunzer/2.0.a
2.0.0
- Loading branch information
Showing
32 changed files
with
1,601 additions
and
1,002 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"compile-hero.disable-compile-files-on-did-save-code": false, | ||
"python.pythonPath": "/usr/local/bin/python3" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import json | ||
import shutil | ||
|
||
js_path = "./mist_openapi/Mist.openapi.json" | ||
res_path ="./api.json" | ||
js_chrome = { | ||
"paths":{}, | ||
"components": {} | ||
} | ||
|
||
|
||
|
||
def process_specs(specs): | ||
for verb in specs: | ||
if "responses" in specs[verb]: | ||
del specs[verb]["responses"] | ||
if "summary" in specs[verb]: | ||
del specs[verb]["summary"] | ||
if "requestBody" in specs[verb]: | ||
del specs[verb]["requestBody"] | ||
return specs | ||
|
||
def process_sub(parent_path: dict, splitted_path: list, specs: dict): | ||
#pp {} | ||
current_path = splitted_path[0] # api | ||
splitted_path = splitted_path[1:] # [v1, orgs, ...] | ||
# pp {api: {}}} | ||
if len(splitted_path)>0: | ||
if not current_path in parent_path: | ||
parent_path[current_path] = {} | ||
if not "paths" in parent_path[current_path]: | ||
parent_path[current_path]["paths"] = {} | ||
parent_path[current_path]["paths"]= process_sub(parent_path[current_path]["paths"], splitted_path, specs) | ||
|
||
else: | ||
parent_path[current_path] = {"specs": process_specs(specs)} | ||
return parent_path | ||
|
||
|
||
|
||
### entry point | ||
# open file | ||
with open(js_path, 'r') as js: | ||
js_data = json.loads(js.read()) | ||
|
||
# loop on each path from the open api spec | ||
for path in js_data["paths"]: | ||
# split the path to create the JSON levels | ||
splitted_path = path.split("/")[1:] | ||
specs = js_data["paths"][path] | ||
js_chrome["paths"] = process_sub(js_chrome["paths"], splitted_path, specs) | ||
|
||
|
||
js_chrome["components"]["parameters"] = js_data["components"]["parameters"] | ||
|
||
with open(res_path, "w") as f: | ||
json.dump(js_chrome, f) | ||
|
||
shutil.copy("./api.json", "./src/angular/src/assets/api.json") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
cd mist_openapi | ||
git pull | ||
cd .. | ||
python3 ./chrome_ext_convert.py |
Submodule mist_openapi
updated
from 349b4c to ec7212
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,11 @@ | ||
<div class="content no-grow"> | ||
<h2>Page Info</h2> | ||
<div *ngIf="!org_id" class="not_mist"> | ||
<div>Sorry, this website does not look like a Mist Organization...</div> | ||
<div>If you think I'm wrong, please send me an email with the current URL.</div> | ||
<app-api-manage *ngIf="display=='manage'"></app-api-manage> | ||
<app-api-django *ngIf="display=='django'"></app-api-django> | ||
<div *ngIf="display !='manage' && display!='django'" class="notice-text"> | ||
<div> | ||
This page is not supported by the application yet... | ||
</div> | ||
<div *ngIf="org_id"> | ||
<div class="box-ids" *ngIf="org_id"> | ||
<label class="ids" for="org_id">ORG ID</label> | ||
<div class=box-ids-input> | ||
<input class="ids" type="text" readonly [(value)]="org_id" [ngClass]="focused == 'org_id'? 'focused' : ''" id="org_id" #org_id_input> | ||
<button class="copy-ids" name="copy" (click)="copyId(org_id_input)"> | ||
<img class="copy-ids" src="assets/copy.svg" alt="copy"> | ||
</button> | ||
</div> | ||
</div> | ||
<div class="box-ids" *ngIf="site_id"> | ||
<label class="ids" for="site_id">SITE ID</label> | ||
<div class=box-ids-input> | ||
<input class="ids" type="text" readonly [(value)]="site_id" [ngClass]="focused == 'site_id'? 'focused' : ''" id="site_id" #site_id_input> | ||
<button class="copy-ids" name="copy" (click)="copyId(site_id_input)"> | ||
<img class="copy-ids" src="assets/copy.svg" alt="copy"> | ||
</button> | ||
</div> | ||
</div> | ||
<div class="box-ids" *ngIf="obj_id"> | ||
<label class="ids" for="obj_id">{{obj_name | uppercase}} ID</label> | ||
<div class=box-ids-input> | ||
<input class="ids" type="text" readonly [(value)]="obj_id" [ngClass]="focused == 'obj_id'? 'focused': ''" id="obj_id" #obj_id_input> | ||
<button class="copy-ids" name="copy" (click)="copyId(obj_id_input)"> | ||
<img class="copy-ids" src="assets/copy.svg" alt="copy"> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div *ngIf="quick_links.length > 0" class="content no-grow"> | ||
<h2>Quick API Access</h2> | ||
<div class="box-apitab"> | ||
<button *ngFor="let quick_link of quick_links" class="apitab" (click)="openApiTab(quick_link.url)"> | ||
<div>{{quick_link.name | uppercase}}</div> | ||
<img class="icon-open" src="assets/open.svg" alt="open"> | ||
</button> | ||
|
||
<div style="margin-top:1em;">If you think it should, please create a request to report your current URL.</div> | ||
<div> | ||
<button class="request" (click)="openTab()">Create a Request</button> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.