Merge pull request #107 from sartography/chore/admin-cat-456

Chore/admin cat 456
This commit is contained in:
Dan Funk 2021-09-30 14:06:12 -04:00 committed by GitHub
commit 2e0ea9e591
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 7 deletions

View File

@ -63,7 +63,7 @@
"ngx-markdown": "^12.0.1",
"protractor": "^7.0.0",
"rxjs": "^6.5.3",
"sartography-workflow-lib": "^0.0.563",
"sartography-workflow-lib": "0.0.567",
"tslib": "^2.3.0",
"uuid": "^8.3.2",
"zone.js": "^0.11.4"

View File

@ -50,6 +50,16 @@ export class WorkflowSpecCategoryDialogComponent {
required: true,
},
},
{
key: 'admin',
type: 'checkbox',
defaultValue: this.data.admin ? this.data.admin : false,
templateOptions: {
label: 'Admin Category',
description: 'Should this category only be shown to Admins?',
indeterminate: false,
}
}
];
constructor(
@ -63,6 +73,7 @@ export class WorkflowSpecCategoryDialogComponent {
}
onSubmit() {
console.log('data is ', this.model);
this.model.name = toSnakeCase(this.model.name);
this.dialogRef.close(this.model);
}

View File

@ -34,6 +34,7 @@ export interface WorkflowSpecCategoryDialogData {
name: string;
display_name: string;
display_order?: number;
admin: boolean;
}
export interface DeleteFileDialogData {

View File

@ -68,9 +68,14 @@
<mat-panel-title>
{{cat.display_name}}
</mat-panel-title>
<mat-panel-description>
({{cat.name}})
</mat-panel-description>
<mat-panel-description>
<div *ngIf="cat.admin" style="color: darkorange">
({{cat.name}})
</div>
<div *ngIf="!cat.admin">
({{cat.name}})
</div>
</mat-panel-description>
<button mat-mini-fab color="primary" style="box-shadow: none">
{{cat.workflow_specs.length}}
</button>

View File

@ -263,6 +263,7 @@ describe('WorkflowSpecListComponent', () => {
id: null,
name: '',
display_name: '',
admin: null,
};
const _upsertWorkflowSpecCategorySpy = spyOn((component as any), '_upsertWorkflowSpecCategory')

View File

@ -37,6 +37,7 @@ export interface WorkflowSpecCategoryGroup {
display_name: string;
workflow_specs?: WorkflowSpec[];
display_order: number;
admin: boolean,
}
@Component({
@ -165,9 +166,9 @@ export class WorkflowSpecListComponent implements OnInit {
name: this.selectedCat ? this.selectedCat.name || this.selectedCat.id : '',
display_name: this.selectedCat ? this.selectedCat.display_name : '',
display_order: this.selectedCat ? this.selectedCat.display_order : null,
admin: this.selectedCat ? this.selectedCat.admin : null,
},
});
dialogRef.afterClosed().subscribe((data: WorkflowSpecCategoryDialogData) => {
if (data && isNumberDefined(data.id) && data.name && data.display_name) {
this._upsertWorkflowSpecCategory(data);
@ -312,11 +313,9 @@ export class WorkflowSpecListComponent implements OnInit {
display_name: data.display_name,
description: data.description,
category_id: data.category_id,
// display_order: data.display_order,
standalone: data.standalone,
library: data.library,
};
console.log('DO: ', data.display_order);
if (isNew) {
this._addWorkflowSpec(newSpec);
@ -338,6 +337,7 @@ export class WorkflowSpecListComponent implements OnInit {
name: data.name,
display_name: data.display_name,
display_order: data.display_order,
admin: data.admin,
};
if (isNumberDefined(catId)) {