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", "ngx-markdown": "^12.0.1",
"protractor": "^7.0.0", "protractor": "^7.0.0",
"rxjs": "^6.5.3", "rxjs": "^6.5.3",
"sartography-workflow-lib": "^0.0.563", "sartography-workflow-lib": "0.0.567",
"tslib": "^2.3.0", "tslib": "^2.3.0",
"uuid": "^8.3.2", "uuid": "^8.3.2",
"zone.js": "^0.11.4" "zone.js": "^0.11.4"

View File

@ -50,6 +50,16 @@ export class WorkflowSpecCategoryDialogComponent {
required: true, 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( constructor(
@ -63,6 +73,7 @@ export class WorkflowSpecCategoryDialogComponent {
} }
onSubmit() { onSubmit() {
console.log('data is ', this.model);
this.model.name = toSnakeCase(this.model.name); this.model.name = toSnakeCase(this.model.name);
this.dialogRef.close(this.model); this.dialogRef.close(this.model);
} }

View File

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

View File

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

View File

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

View File

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