-
Notifications
You must be signed in to change notification settings - Fork 30
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
Feature/location list updates #3541
Merged
+1,148
−286
Merged
Changes from 26 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
b34d6fd
Add vertical mat-tab display of location levels and content
5ded93b
Add button to export Location Lists as JSON
bab4d09
Revert Change to Location List Content UI
3edacba
Trigger changes of location list metadata tab content
1325dc0
Update button color and layouts of location list tab content
88e110d
Update styles of location list import and export
faaf30d
Update the import location list ui to make the export ui
abac540
Merge remote-tracking branch 'origin/develop' into feature/location-l…
7988f31
Post-review fixes
7ab0b85
Show JSON data after Location List import
cc5bad6
Revert "Show JSON data after Location List import"
5bdbe41
Add location list levels and counts to import
8d428c3
Update manage location list levels css
aaa60e0
Move Add Metadata button to top of location levels
49a7423
updates after review
3c31bdd
Merge branch 'main' into feature/location-list-updates
3282158
Allow configuration of multiple location lists
b18e30f
Merge remote-tracking branch 'origin/main' into feature/location-list…
c3e121f
Multipl location list functionality
f120d5b
Update navigation and styles for location list configuration
86f9bd2
During new group creation, add id and name to location-list metadata
e86c4ad
Make LocationList a class
aa3818c
CSV and MySQL-JS modules: parse data from multiple locaiton lists
f6d0d52
Simplify group location lists read script
152c27c
Add location list data to tangy-form-editor instance
1c2ff92
Merge remote-tracking branch 'origin/develop' into feature/location-l…
6af2f07
Add multiple locations list dir to online survey releases
757dcce
remove unused file
0c1cbf1
Fix group location list express app script responses
c28a4e5
Load context when switching between location list tabs
37932d0
Updates to tangy-form and tangy-form-editor; fixes
1eedf26
Update device user list to use multiple location lists
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,14 @@ | ||
[ | ||
{ | ||
"id": "location-1", | ||
"name": "Schools", | ||
"src": "./school-locations.json", | ||
"default": true | ||
}, | ||
{ | ||
"id": "location-2", | ||
"name": "Hospitals", | ||
"src": "./hospital-locations.json", | ||
"default": false | ||
} | ||
] |
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,37 @@ | ||
.tangy-full-width { | ||
width: 95%; | ||
} | ||
|
||
span.tangy-foreground-secondary { | ||
padding-top: 0.3rem; | ||
} | ||
|
||
a.faux-anchor { | ||
cursor: pointer; | ||
} | ||
|
||
* { | ||
word-wrap: break-word; | ||
} | ||
|
||
.gray-bottom-border { | ||
border-bottom: #cccccc 0.5px solid; | ||
} | ||
|
||
.text-indent-3 { | ||
text-indent: 3rem; | ||
} | ||
|
||
.header { | ||
margin: 15px; | ||
} | ||
|
||
.submit { | ||
margin-left: 15px; | ||
margin-bottom: 15px; | ||
} | ||
|
||
.export-div { | ||
margin: 15px; | ||
padding-bottom: 30px; | ||
} |
16 changes: 13 additions & 3 deletions
16
editor/src/app/groups/export-location-list/export-location-list.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,4 +1,14 @@ | ||
<div class="tangy-content tangy-full-width"> | ||
<p *ngIf="isExporting">{{'Downloading file...'}}</p> | ||
<button mat-raised-button color="warn" (click)="export()" [disabled]="isExporting">{{'Export Location List'|translate}}</button> | ||
<div class="export-div"> | ||
<h3> {{'Export CSV'|translate}} </h3> | ||
<p *ngIf="isExportingCSV">{{'Downloading CSV file...'}}</p> | ||
<button mat-raised-button color="primary" (click)="exportAsCSV()" [disabled]="isExportingCSV">{{'Export Location List as CSV'|translate}}</button> | ||
<p>Export a CSV file of the Location List with columns of the location levels and unique identifiers</p> | ||
<p>The file can be modified and imported to update the location list.</p> | ||
</div> | ||
<div class="export-div"> | ||
<h3> {{'Export JSON'|translate}} </h3> | ||
<p *ngIf="isExportingJSON">{{'Downloading JSON file...'}}</p> | ||
<button mat-raised-button color="primary" (click)="exportAsJSON()" [disabled]="isExportingJSON">{{'Export Location List as JSON'|translate}}</button> | ||
<p>Export a JSON file of the Location List</p> | ||
<p>This file can be imported in another Group copy over the Location List.</p> | ||
</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
4 changes: 2 additions & 2 deletions
4
editor/src/app/groups/group-configure/group-configure.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
8 changes: 8 additions & 0 deletions
8
editor/src/app/groups/group-location-list-new/group-location-list-new.component.css
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add container with margin |
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,8 @@ | ||
.button { | ||
background: var(--mdc-theme-secondary); | ||
color: var(--accent-text-color); | ||
} | ||
|
||
.container { | ||
margin: 15px; | ||
} |
13 changes: 13 additions & 0 deletions
13
editor/src/app/groups/group-location-list-new/group-location-list-new.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,13 @@ | ||
<app-breadcrumb [title]="title" [breadcrumbs]="breadcrumbs"></app-breadcrumb> | ||
<div id="container" #container> | ||
<p> | ||
Enter a title for the new location list. After clicking submit, you will be able to enter location values manually or import a location list from csv or json. | ||
</p> | ||
<form class="form"> | ||
<mat-form-field class="example-full-width"> | ||
<mat-label>Title</mat-label> | ||
<input matInput placeholder="Location Title" [(ngModel)]="locationListTitle" name="title" required> | ||
</mat-form-field> | ||
<paper-button class="button" (click)="onSubmit()">submit</paper-button> | ||
</form> | ||
</div> |
25 changes: 25 additions & 0 deletions
25
editor/src/app/groups/group-location-list-new/group-location-list-new.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,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { GroupLocationListNewComponent } from './group-location-list-new.component'; | ||
|
||
describe('GroupLocationListNewComponent', () => { | ||
let component: GroupLocationListNewComponent; | ||
let fixture: ComponentFixture<GroupLocationListNewComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ GroupLocationListNewComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(GroupLocationListNewComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
63 changes: 63 additions & 0 deletions
63
editor/src/app/groups/group-location-list-new/group-location-list-new.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,63 @@ | ||
import { Component, OnInit, Input } from '@angular/core'; | ||
import { ActivatedRoute, Router } from '@angular/router'; | ||
import { Breadcrumb } from './../../shared/_components/breadcrumb/breadcrumb.component'; | ||
import { GroupsService, LocationList } from '../services/groups.service'; | ||
import { _TRANSLATE } from 'src/app/shared/_services/translation-marker'; | ||
|
||
@Component({ | ||
selector: 'app-group-location-list-new', | ||
templateUrl: './group-location-list-new.component.html', | ||
styleUrls: ['./group-location-list-new.component.css'] | ||
}) | ||
export class GroupLocationListNewComponent implements OnInit { | ||
|
||
title = _TRANSLATE('New Location List') | ||
breadcrumbs:Array<Breadcrumb> = [ | ||
<Breadcrumb>{ | ||
label: _TRANSLATE('Location Lists'), | ||
url: `location-lists/new` | ||
} | ||
] | ||
|
||
// Mat form field control type implied | ||
locationListTitle | ||
|
||
groupId:string | ||
generatedLocationId:string | ||
|
||
constructor( | ||
private groupsService: GroupsService, | ||
private route: ActivatedRoute, | ||
private router: Router | ||
) { } | ||
|
||
async ngOnInit() { | ||
this.route.params.subscribe(async params => { | ||
this.groupId = params['groupId']; | ||
this.generatedLocationId = params['locationListId']; | ||
}); | ||
} | ||
|
||
async onSubmit() { | ||
if (!this.locationListTitle) { | ||
alert(_TRANSLATE('Please provide a title for this location list.')) | ||
return | ||
} | ||
|
||
const locationList = new LocationList( | ||
{ | ||
id: this.generatedLocationId, | ||
name: this.locationListTitle, | ||
locationsLevels: [], | ||
locations: {}, | ||
metadata: {} | ||
} | ||
) | ||
try { | ||
await this.groupsService.createLocationList(this.groupId, locationList) | ||
this.router.navigate(['groups', this.groupId, 'configure', 'location-lists', this.generatedLocationId]) | ||
} catch (err) { | ||
alert("Failed to create new location list.") | ||
} | ||
} | ||
} |
16 changes: 8 additions & 8 deletions
16
editor/src/app/groups/group-location-list/group-location-list.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
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
3 changes: 3 additions & 0 deletions
3
editor/src/app/groups/group-location-lists/group-location-lists.component.css
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,3 @@ | ||
.container { | ||
margin: 15px; | ||
} |
18 changes: 18 additions & 0 deletions
18
editor/src/app/groups/group-location-lists/group-location-lists.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,18 @@ | ||
<app-breadcrumb [title]="title" [breadcrumbs]="breadcrumbs"></app-breadcrumb> | ||
<div id="container"> | ||
{{'Location Lists allow you to define sets of locations that appear as drop down lists. Each location list can be used as inputs in forms or to assign locations to devices.'|translate}} | ||
</div> | ||
<div id="container"> | ||
<app-dynamic-table | ||
*ngIf="locationListTableData.length > 0" | ||
[data]="locationListTableData" | ||
(rowDelete)="onRowDelete($event)" | ||
(rowEdit)="onRowEdit($event)" | ||
> | ||
</app-dynamic-table> | ||
</div> | ||
<div *ngIf="locationLists.length === 0" id="no-spreadsheets container"> | ||
{{'No Location Lists have been created. Click the + icon in the bottom right to get started.'|translate}} | ||
</div> | ||
<paper-fab (click)="createLocationList()" mat-raised-button icon="add" color="accent" class="action"> | ||
</paper-fab> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove