Skip to content

Commit

Permalink
update storage provider interface
Browse files Browse the repository at this point in the history
add count of part matches to Inventory screen
  • Loading branch information
replaysMike committed Feb 18, 2022
1 parent 28db652 commit 652efbb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions Binner/Binner.Web/ClientApp/src/pages/Inventory.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class Inventory extends Component {
manufacturer: '',
manufacturerPartNumber: '',
imageUrl: '',
projectId: viewPreferences.lastProjectId,
projectId: '',
supplier: '',
supplierPartNumber: ''
},
Expand Down Expand Up @@ -317,6 +317,7 @@ export class Inventory extends Component {
}

async fetchProjects() {
const { part, viewPreferences } = this.state;
this.setState({ loadingProjects: true });
const response = await fetch('project/list?orderBy=DateCreatedUtc&direction=Descending&results=999');
const data = await response.json();
Expand All @@ -328,7 +329,11 @@ export class Inventory extends Component {
label: { ...(_.find(ProjectColors, c => c.value === item.color).name !== '' && { color: _.find(ProjectColors, c => c.value === item.color).name }), circular: true, content: item.parts, size: 'tiny' },
};
}), 'text');
this.setState({ projects, loadingProjects: false });
// ensure that the current part's projectId can't be set to an invalid project
if (!_.find(projects, p => p.value === viewPreferences.lastProjectId)) {
part.projectId = '';
}
this.setState({ projects, part, loadingProjects: false });
}

getMountingTypeById(mountingTypeId) {
Expand Down Expand Up @@ -933,9 +938,9 @@ export class Inventory extends Component {
</Form.Field>
<Segment loading={loadingPartMetadata} color='blue'>
<Header dividing as='h3'>Part Metadata</Header>
{metadataParts.length > 0 &&
{metadataParts.length > 1 &&
<Modal centered
trigger={<Button onClick={this.handleOpenModal}>Choose alternate part</Button>}
trigger={<Button onClick={this.handleOpenModal}>Choose alternate part ({metadataParts.length})</Button>}
open={partModalOpen}
onClose={this.handlePartModalClose}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private void ValidateBinnerConfiguration(BinnerFileStorageConfiguration config)
}
}

public async Task<IBinnerDb> GetDatabaseAsync()
public async Task<IBinnerDb> GetDatabaseAsync(IUserContext userContext)
{
await _dataLock.WaitAsync();
try
Expand Down

0 comments on commit 652efbb

Please sign in to comment.