-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create ToolGroup functionality, so the admin can create Tool groups, …
…assign countries, Languages and Praxis to them and then create relationships between ToolGroups and Tools. Only loading minimal data whe page loads. Load all Tool Group data when user selects Tool Group Created Service to handle all Tool Groups requests Add reuseable components to make mantaining simplier.
- Loading branch information
Showing
39 changed files
with
4,145 additions
and
54 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
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,113 @@ | ||
import { Language } from '../models/language'; | ||
import { Resource } from '../models/resource'; | ||
import { CountriesType, ToolGroup } from '../models/tool-group'; | ||
|
||
export class ToolGroupMocks { | ||
languageUKMock = { | ||
code: 'en-GB', | ||
name: 'English (British)', | ||
id: 5, | ||
customPages: null, | ||
canConfirmDelete: null, | ||
} as Language; | ||
|
||
languageUSMock = { | ||
code: 'en-US', | ||
name: 'English (American)', | ||
id: 2, | ||
customPages: null, | ||
canConfirmDelete: null, | ||
} as Language; | ||
|
||
countryUKMock = { | ||
code: 'GB', | ||
name: 'United Kingdom', | ||
native: 'United Kingdom', | ||
phone: [44], | ||
continent: 'EU', | ||
capital: 'London', | ||
currency: ['GBP'], | ||
languages: ['en'], | ||
} as CountriesType; | ||
|
||
countryUSMock = { | ||
code: 'US', | ||
name: 'United States', | ||
native: 'United States', | ||
phone: [1], | ||
continent: 'NA', | ||
capital: 'Washington D.C.', | ||
currency: ['USD', 'USN', 'USS'], | ||
languages: ['en'], | ||
} as CountriesType; | ||
|
||
getLanguagesResponse = [ | ||
{ | ||
code: 'ar-SA', | ||
name: 'Arabic (Saudi Arabia)', | ||
id: 9, | ||
customPages: null, | ||
canConfirmDelete: null, | ||
}, | ||
this.languageUKMock, | ||
this.languageUSMock, | ||
] as Language[]; | ||
|
||
toolGroupFullDetails = () => { | ||
const resource = new Resource(); | ||
resource.id = 13; | ||
resource.name = 'Test Resource'; | ||
|
||
return ({ | ||
id: 8, | ||
'suggestions-weight': '3.0', | ||
name: 'Test Tool Group', | ||
'rules-country': [ | ||
{ | ||
id: 1, | ||
'negative-rule': false, | ||
'tool-group': { | ||
id: 8, | ||
}, | ||
countries: [this.countryUKMock.code, this.countryUSMock.code], | ||
}, | ||
], | ||
'rules-language': [ | ||
{ | ||
id: 2, | ||
'negative-rule': true, | ||
'tool-group': { | ||
id: 8, | ||
}, | ||
languages: [this.languageUKMock.code, this.languageUSMock.code], | ||
}, | ||
], | ||
'rules-praxis': [ | ||
{ | ||
id: 3, | ||
'negative-rule': false, | ||
'tool-group': { | ||
id: 8, | ||
}, | ||
confidence: ['1', '2'], | ||
openness: ['3'], | ||
}, | ||
], | ||
tools: [ | ||
{ | ||
id: 17, | ||
'suggestions-weight': '12', | ||
suggestionsWeight: '12', | ||
tool: { | ||
...resource, | ||
id: 15, | ||
name: 'Resource Name', | ||
}, | ||
'tool-group': { | ||
id: 8, | ||
}, | ||
}, | ||
], | ||
} as unknown) as ToolGroup; | ||
}; | ||
} |
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
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
49 changes: 49 additions & 0 deletions
49
src/app/components/edit-tool-group-resource/tool-group-resource.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,49 @@ | ||
<div class="modal-header"> | ||
<h5>Connect Tools</h5> | ||
</div> | ||
<div class="modal-body"> | ||
<div | ||
class="tools" | ||
style=" | ||
max-height: calc(100vh - 350px); | ||
overflow-y: auto; | ||
overflow-x: hidden; | ||
" | ||
> | ||
<admin-tool-group-tool-reuseable | ||
*ngFor="let tool of tools" | ||
[tool]="tool" | ||
[resources]="resources" | ||
(updatedToolEmit)="updateTool($event)" | ||
(deleteTool)="deleteTool($event)" | ||
></admin-tool-group-tool-reuseable> | ||
</div> | ||
|
||
<button (click)="addResource()" class="btn btn-default">Add Tool</button> | ||
|
||
<div class="row"> | ||
<div class="col"> | ||
<ngb-alert type="info" [dismissible]="false" *ngIf="saving"> | ||
Saving... | ||
</ngb-alert> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col"> | ||
<ngb-alert | ||
type="danger" | ||
class="mt-2" | ||
[dismissible]="false" | ||
*ngFor="let error of errorMessage" | ||
> | ||
{{ error }} | ||
</ngb-alert> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="modal-footer" style="justify-content: space-between"> | ||
<button (click)="cancel()" class="btn btn-danger">Cancel</button> | ||
<button (click)="createOrUpdate()" class="btn btn-success">Save</button> | ||
</div> |
Oops, something went wrong.