Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reoganising menus #2

Merged
merged 13 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@
{
"type": "initial",
"maximumWarning": "10mb",
"maximumError": "10mb"
"maximumError": "15mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "1mb",
"maximumWarning": "10kb",
"maximumError": "1mb"
}
]
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
rm -rf .angular
npm link sb-shared-lib
ng build --configuration production --output-hashing none --base-href="/workbench/"
ng build --configuration production --base-href="/workbench/"
touch manifest.json && rm -f web.app && cp manifest.json dist/symbiose/ && cd dist/symbiose && zip -r ../../web.app * && cd ../..
cat web.app | md5sum | awk '{print $1}'
15 changes: 15 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@angular/router": "~13.3.4",
"@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^6.0.0",
"@reactivex/rxjs": "^6.6.7",
"@types/jquery": "^3.5.14",
"@types/quill": "^1.3.10",
"date-fns": "^2.28.0",
Expand Down
52 changes: 52 additions & 0 deletions src/app/_services/routermemory.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { Injectable } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';

@Injectable({
providedIn: 'root'
})
export class RouterMemory {
constructor(
private router : Router,
private activatedRoute : ActivatedRoute,
) {}

public previous:any[] = []

public saved_args: {[route:string]:{[val:string]:any}} = {}

public navigate(command:any[],args:{[val:string]:any}|undefined=undefined) {
this.previous.push(this.router.url)
if(args) {
for (let [k, v] of Object.entries(args)) {
this.updateArg(k,v)
console.log(k)
}
}
console.log(this.retrieveArgs())
console.log(this.previous)
this.router.navigate(command)
}

public goBack() {
let route
try {
route = this.previous.pop()
route = route ? route : "/"
} catch {
route = "/"
}
console.log(this.previous)
this.router.navigate([route])
}

public retrieveArgs():any {
return this.saved_args[this.router.url]
}

public updateArg(key:string,value:any) {
let r = this.router.url
if(!this.saved_args[r]) this.saved_args[r] = {}
this.saved_args[r][key] = value
console.log(this.saved_args[r])
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,106 +9,113 @@
<label class="packagename accent-color">({{ controller_type.toUpperCase() }})</label>
</div>
<br>
<label class="content-label">Description</label>
<p class="content-desc">{{scheme['description']}}</p>
<div *ngIf="AccessString !== undefined">
<br>
<label class="content-label">Access</label>
<pre class="content-desc" [innerHTML]="AccessString"></pre>
<div *ngIf="fetch_error">
It looks like you don't have the rights to see this controller informations
</div>
<br>
<label class="content-label">Request header</label>
<pre class="content-desc" [innerHTML]="requestString"></pre>
<br>
<label class="content-label">params</label>
<div class="params-container">
<div *ngFor="let value of params | keyvalue" class="params-mat-card">
<div>
<p class="controller-param-title">{{value.key}} : {{getType(value.key)}} <strong *ngIf="isRequired(value.key)">(required)</strong></p>
</div>
<div>
<p>{{getDescription(value.key)}}</p>
</div>
<div class="flex">
<div class="flex card-content2">
<ng-container *ngIf="getType(value.key) == 'string'">
<app-string
[value]="getParamsValue(value.key)"
[required]="isRequired(value.key)"
[selection]="getSelection(value.key)"
(valueChange)="updateParamsValue($event, value.key)">
</app-string>
</ng-container>
<ng-container *ngIf="getType(value.key) == 'integer' || getType(value.key) == 'float'">
<app-number
[value]="getParamsValue(value.key)"
[required]="isRequired(value.key)"
[selection]="getSelection(value.key)"
[params_property]="value.value"
(valueChange)="updateParamsValue($event, value.key)">
</app-number>
</ng-container>
<ng-container *ngIf="getType(value.key) == 'boolean'">
<app-boolean
[value]="getParamsValue(value.key)"
[required]="isRequired(value.key)"
(valueChange)="updateParamsValue($event, value.key)">
</app-boolean>
</ng-container>
<ng-container *ngIf="getType(value.key) == 'array' && value.key != 'domain'">
<app-array
[value]="getParamsValue(value.key)"
(valueChange)="updateParamsValue($event, value.key)">
</app-array>
</ng-container>
<ng-container *ngIf="value.key == 'domain'">
<app-domain
[value]="getParamsValue(value.key)"
[class]="getEntity()"
(valueChange)="updateParamsValue($event, value.key)">
</app-domain>
</ng-container>
</div>
<br>
</div>
<div *ngIf="!fetch_error">
<label class="content-label">Description</label>
<p class="content-desc">{{scheme['description']}}</p>
<div *ngIf="AccessString !== undefined">
<br>
<label class="content-label">Access</label>
<pre class="content-desc" [innerHTML]="AccessString"></pre>
</div>
</div>
<br>
<button mat-button class="action-controller-button" (click)="submit()" [disabled]="!canSubmit">
<mat-icon class="action-controller-icon">upload</mat-icon>Submit action
</button>
<br><br>
<div>
<label class="content-label">cli command</label>
<pre class="content-desc" [innerHTML]="cliCommand"></pre>
<button mat-button class="action-controller-button" (click)="cpyCLI()" [disabled]="!canSubmit">
<mat-icon class="action-controller-icon">content_copy</mat-icon>Copy cli
</button>
</div>
<br>
<div>
<label class="content-label">Base route</label>
<pre class="content-desc" [innerHTML]="baseRoute"></pre>
<button mat-button class="action-controller-button" (click)="cpyRequest()" [disabled]="!canSubmit">
<mat-icon class="action-controller-icon">content_copy</mat-icon>Copy http request
</button>
</div>
<br>
<div>
<label class="content-label">Custom routes</label>
<div *ngFor="let item of obk(filtered_routes)">
<div *ngFor="let method of obk(filtered_routes[item]['methods'])" class="controller_cr">
<div class="controller_cr_el controller_cr_method {{method}}">
{{method}}
<br>
<label class="content-label">Request header</label>
<pre class="content-desc" [innerHTML]="requestString"></pre>
<br>
<label class="content-label">params</label>
<div class="params-container">
<div *ngFor="let value of params | keyvalue" class="params-mat-card">
<div>
<p class="controller-param-title">{{value.key}} : {{getType(value.key)}} <strong *ngIf="isRequired(value.key)">(required)</strong></p>
</div>
<div class="controller_cr_el controller_cr_path">
{{item}}
<div>
<p>{{getDescription(value.key)}}</p>
</div>
<div class="controller_cr_el controller_cr_desc">
{{filtered_routes[item]['methods'][method]['description']}}
<div class="flex">
<div class="flex card-content2">
<ng-container *ngIf="getType(value.key) == 'string'">
<app-string
[value]="getParamsValue(value.key)"
[required]="isRequired(value.key)"
[selection]="getSelection(value.key)"
(valueChange)="updateParamsValue($event, value.key)">
</app-string>
</ng-container>
<ng-container *ngIf="getType(value.key) == 'integer' || getType(value.key) == 'float'">
<app-number
[value]="getParamsValue(value.key)"
[required]="isRequired(value.key)"
[selection]="getSelection(value.key)"
[params_property]="value.value"
(valueChange)="updateParamsValue($event, value.key)">
</app-number>
</ng-container>
<ng-container *ngIf="getType(value.key) == 'boolean'">
<app-boolean
[value]="getParamsValue(value.key)"
[required]="isRequired(value.key)"
(valueChange)="updateParamsValue($event, value.key)">
</app-boolean>
</ng-container>
<ng-container *ngIf="getType(value.key) == 'array' && value.key != 'domain'">
<app-array
[value]="getParamsValue(value.key)"
(valueChange)="updateParamsValue($event, value.key)">
</app-array>
</ng-container>
<ng-container *ngIf="value.key == 'domain'">
<app-property-domain-component
[value]="getParamsValue(value.key)"
[class]="getEntity()"
(valueChange)="updateParamsValue($event, value.key)">
</app-property-domain-component>
</ng-container>
</div>
<br>
</div>
</div>
<br>
</div>
<br>
<button mat-button class="action-controller-button" (click)="submit()" [disabled]="!canSubmit">
<mat-icon class="action-controller-icon">upload</mat-icon>Submit action
</button>
<br><br>
<div>
<label class="content-label">cli command</label>
<pre class="content-desc" [innerHTML]="cliCommand"></pre>
<button mat-button class="action-controller-button" (click)="cpyCLI()" [disabled]="!canSubmit">
<mat-icon class="action-controller-icon">content_copy</mat-icon>Copy cli
</button>
</div>
<br>
<div>
<label class="content-label">Base route</label>
<pre class="content-desc" [innerHTML]="baseRoute"></pre>
<button mat-button class="action-controller-button" (click)="cpyRequest()" [disabled]="!canSubmit">
<mat-icon class="action-controller-icon">content_copy</mat-icon>Copy http request
</button>
</div>
<br>
<div>
<label class="content-label">Custom routes</label>
<div *ngFor="let item of obk(filtered_routes)">
<a class="cr-click" [class.clickable]="moving" (click)="sendTo(item)">
<div *ngFor="let method of obk(filtered_routes[item]['methods'])" class="controller_cr">
<div class="controller_cr_el controller_cr_method {{method}}">
{{method}}
</div>
<div class="controller_cr_el controller_cr_path">
{{item}}
</div>
<div class="controller_cr_el controller_cr_desc">
{{filtered_routes[item]['methods'][method]['description']}}
</div>
</div>
</a>
<br>
</div>
</div>
</div>
<br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@
display: flex;
}

a.cr-click {
text-decoration: none;
}

.controller_cr_el {
border: solid 1px #dddddd;
height: 3em;
Expand All @@ -149,3 +153,13 @@
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
}

.clickable {
cursor: help;
}

pre {
background-color: white;
border: 1px solid silver;
padding: .5em;
}
Loading