-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
551 additions
and
6 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
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
Empty file.
74 changes: 74 additions & 0 deletions
74
...ain/ngapp/src/app/components/admin/admin-custom-fields/admin-custom-fields.component.html
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,74 @@ | ||
<div class="container-fluid"> | ||
<div class="row"> | ||
<div class="col p-3"> | ||
<div ng-controller="AdminCustomFieldsController" style="height: 1050px"> | ||
|
||
<uib-tabset class="pad_top"> | ||
<uib-tab select="selectedTab('plasmid')"> | ||
<uib-tab-heading>Plasmid</uib-tab-heading> | ||
</uib-tab> | ||
|
||
<uib-tab select="selectedTab('strain')"> | ||
<uib-tab-heading>Strain</uib-tab-heading> | ||
</uib-tab> | ||
|
||
<uib-tab select="selectedTab('part')"> | ||
<uib-tab-heading>Part</uib-tab-heading> | ||
</uib-tab> | ||
|
||
<uib-tab select="selectedTab('seed')"> | ||
<uib-tab-heading>Seed</uib-tab-heading> | ||
</uib-tab> | ||
|
||
<uib-tab select="selectedTab('protein')"> | ||
<uib-tab-heading>Protein</uib-tab-heading> | ||
</uib-tab> | ||
|
||
</uib-tabset> | ||
|
||
<br> | ||
<button class="ice-button" ng-click="addNewCustomEntryField()">Create Custom Field</button> | ||
<br><br> | ||
|
||
<div ng-if="partCustomFields.length"> | ||
<table class="table table-border-bottom table-hover table-condensed font-95em" | ||
ng-class="{'opacity_4':loadingPage}"> | ||
<thead> | ||
<th>Label</th> | ||
<th>Field Type</th> | ||
<th>Entry Type</th> | ||
<th>Required</th> | ||
<th>Value(s)</th> | ||
<th></th> | ||
</thead> | ||
<tbody ng-repeat="field in partCustomFields"> | ||
<tr> | ||
<td>{{field.label}}</td> | ||
<td>{{optionsText(field.fieldType)}}</td> | ||
<td>{{field.entryType}}</td> | ||
<td style="text-align: center; width: 80px"> | ||
<i class="fa fa-fw fa-check green" ng-if="field.required"></i></td> | ||
<td> | ||
<div ng-repeat="option in field.options">{{option.name}}</div> | ||
</td> | ||
<td style="width: 180px; border: 1px solid #ccc; vertical-align: middle"> | ||
<i ng-if="!field.delete" class="fa fa-fw fa-trash-o opacity_hover font-14em" | ||
ng-click="field.delete = true"></i> | ||
<span ng-if="field.delete">Permanently remove field?<br> | ||
<button class="btn btn-xs btn-primary" ng-click="deleteCustomField(field)">Yes</button> | ||
<button class="btn btn-xs btn-default" ng-click="field.delete = false">No</button> | ||
</span> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
|
||
<div class="pad_top" ng-if="!partCustomFields.length"> | ||
<i>No custom fields available for parts of type <b class="text-muted">{{selection | capitalize}}</b></i> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
</div> |
21 changes: 21 additions & 0 deletions
21
.../ngapp/src/app/components/admin/admin-custom-fields/admin-custom-fields.component.spec.ts
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,21 @@ | ||
import {ComponentFixture, TestBed} from '@angular/core/testing'; | ||
|
||
import {AdminCustomFieldsComponent} from './admin-custom-fields.component'; | ||
|
||
describe('AdminCustomFieldsComponent', () => { | ||
let component: AdminCustomFieldsComponent; | ||
let fixture: ComponentFixture<AdminCustomFieldsComponent>; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [AdminCustomFieldsComponent] | ||
}); | ||
fixture = TestBed.createComponent(AdminCustomFieldsComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
81 changes: 81 additions & 0 deletions
81
src/main/ngapp/src/app/components/admin/admin-custom-fields/admin-custom-fields.component.ts
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,81 @@ | ||
import {Component} from '@angular/core'; | ||
import {HttpService} from "../../../services/http.service"; | ||
import {NgbModal, NgbModalOptions} from "@ng-bootstrap/ng-bootstrap"; | ||
import {EditCustomFieldModalComponent} from "../../modal/edit-custom-field-modal/edit-custom-field-modal.component"; | ||
|
||
@Component({ | ||
selector: 'app-admin-custom-fields', | ||
templateUrl: './admin-custom-fields.component.html', | ||
styleUrls: ['./admin-custom-fields.component.css'] | ||
}) | ||
export class AdminCustomFieldsComponent { | ||
|
||
selection = 'plasmid'; | ||
loading: boolean; | ||
partCustomFields: any; | ||
|
||
constructor(private http: HttpService, private modalService: NgbModal) { | ||
this.retrievePartFields(); | ||
} | ||
|
||
options = [ | ||
{name: "Built in field", value: 'EXISTING'}, | ||
{name: 'Text', value: 'TEXT_INPUT'}, | ||
{name: 'Options', value: 'MULTI_CHOICE'}, | ||
{name: 'Options with Text', value: 'MULTI_CHOICE_PLUS'}]; | ||
|
||
optionsText(value: string): string { | ||
for (let i = 0; i < this.options.length; i += 1) { | ||
if (value === this.options[i].value) { | ||
return this.options[i].name; | ||
} | ||
} | ||
return value; | ||
} | ||
|
||
retrievePartFields(): void { | ||
this.partCustomFields = undefined; | ||
this.loading = true; | ||
this.http.get("rest/fields/" + this.selection).subscribe({ | ||
next: (result: any) => { | ||
this.partCustomFields = result.data; | ||
} | ||
}); | ||
}; | ||
|
||
selectedTab(selection: string): void { | ||
if (this.selection === selection) | ||
return; | ||
|
||
this.selection = selection; | ||
this.retrievePartFields(); | ||
}; | ||
|
||
deleteCustomField(customField: any): void { | ||
this.http.delete("rest/fields/" + customField.entryType + "/" + customField.id) | ||
.subscribe({ | ||
next: (result: any) => { | ||
const index = this.partCustomFields.indexOf(customField); | ||
if (index !== -1) | ||
this.partCustomFields.splice(index, 1); | ||
} | ||
}); | ||
}; | ||
|
||
addNewCustomEntryField() { | ||
const options: NgbModalOptions = {backdrop: 'static', size: 'md'}; | ||
const modalInstance = this.modalService.open(EditCustomFieldModalComponent, options); | ||
modalInstance.componentInstance.entryType = this.selection; | ||
|
||
modalInstance.result.then((result) => { | ||
if (!result) | ||
return; | ||
|
||
if (!this.partCustomFields) | ||
this.partCustomFields = []; | ||
this.partCustomFields.push(result); | ||
}); | ||
}; | ||
} | ||
|
||
|
89 changes: 88 additions & 1 deletion
89
...ain/ngapp/src/app/components/admin/admin-public-groups/admin-public-groups.component.html
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 +1,88 @@ | ||
<p>admin-public-groups works!</p> | ||
<div> | ||
<div class="pad_top"> | ||
<button type="button" (click)="openCreatePublicGroupModal(null)" class="ice-button"> | ||
Create Public Group | ||
</button> | ||
</div> | ||
|
||
<div class="pad_top" *ngIf="!groups.length"> | ||
<i class="text-muted">No public groups available</i> | ||
</div> | ||
|
||
<div class="pad_top" *ngIf="groups.length" style="width: 96%"> | ||
<table class="table table-hover table-border-bottom" [ngClass]="{'opacity_4':loadingPage}"> | ||
<thead> | ||
<tr> | ||
<th> </th> | ||
<th class="entry-table-header" style="width: 360px">Label</th> | ||
<th class="entry-table-header" style="width: 130px">Members</th> | ||
<th class="entry-table-header">Created</th> | ||
<th style="width:120px"></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr data-ng-repeat="group in groups"> | ||
<td style="vertical-align: middle; line-height:1; opacity:0.2; text-shadow:0 1px 0 #fff" | ||
class="font-14em"> | ||
<b></b> | ||
</td> | ||
<td>{{group.label}} | ||
<br> | ||
<i class="small text-muted">{{group.description || 'No description provided'}}</i> | ||
</td> | ||
<td style="width:180px; white-space:nowrap; vertical-align: middle"> | ||
<span class="label" | ||
[ngClass]="{ | ||
'label-primary': group.memberCount, | ||
'label-default': group.memberCount == 0}">{{group.memberCount | number}} | ||
</span> | ||
</td> | ||
<td style="width:190px"> | ||
{{group.ownerEmail}} <br> | ||
<small class="text-muted">{{group.creationTime | date:'MMM d, yyyy'}}</small> | ||
</td> | ||
<td style="border-left: 1px solid #EEEEEE; width:150px; white-space:nowrap; vertical-align: middle"> | ||
<div *ngIf="!group.confirmDeleteGroup"> | ||
<i class="fa fa-fw fa-pencil font-14em edit_icon" [ngbTooltip]="'Edit'" | ||
(click)="openCreatePublicGroupModal(group)"></i> | ||
| ||
<i class="fa fa-fw fa-trash font-14em delete_icon" (click)="group.confirmDeleteGroup = true" | ||
[ngbTooltip]="'Delete'"></i> | ||
</div> | ||
|
||
<div *ngIf="group.confirmDeleteGroup"> | ||
Delete? | ||
<button class="btn btn-primary btn-xs" (click)="deletePublicGroup(group)">Yes</button> | ||
<button class="btn btn-default btn-xs" (click)="group.confirmDeleteGroup=false">No</button> | ||
</div> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<div class="col-md-5" style="padding-left: 0"> | ||
<ngb-pagination [collectionSize]="paging.available" [pageSize]="paging.limit" [(page)]="paging.currentPage" | ||
[boundaryLinks]="true" [maxSize]="5" (pageChange)="pageChange($event)" size="sm"> | ||
<ng-template ngbPaginationFirst><i | ||
class="fa fa-fw fa-angle-double-left"></i> First | ||
</ng-template> | ||
<ng-template ngbPaginationPrevious><i | ||
class="fa fa-fw fa-angle-left"></i>Prev | ||
</ng-template> | ||
<!-- <ng-template ngbPaginationNumber let-p><button class="btn btn-sm btn-white">{{p}}</button></ng-template>--> | ||
<ng-template ngbPaginationNext>Next<i | ||
class="fa fa-fw fa-angle-right"></i></ng-template> | ||
<ng-template ngbPaginationLast>Last<i | ||
class="fa fa-fw fa-angle-double-right"></i> | ||
</ng-template> | ||
</ngb-pagination> | ||
</div> | ||
|
||
<div class="col-md-7" style="margin-top: 25px;"> | ||
<strong class="small"> | ||
<i *ngIf="loadingPage" class="fa fa-spin fa-gear opacity_4"></i> | ||
{{pageNumber | number}} - {{pageCount | number}} of {{paging.available}} | ||
</strong> | ||
</div> | ||
</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
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
Empty file.
Oops, something went wrong.