made some changes in the bin sensors to open a new dialog when the component being removed is the last one for a device so users can remove the device from the bin along with the component
This commit is contained in:
parent
da5ef99a3e
commit
0556fe2d8b
5 changed files with 121 additions and 17 deletions
|
|
@ -30,6 +30,7 @@ export interface IBinAPIContext {
|
|||
removeComponent: (
|
||||
bin: string,
|
||||
component: string,
|
||||
device?: number,
|
||||
otherTeam?: string
|
||||
) => Promise<AxiosResponse<pond.RemoveBinComponentResponse>>;
|
||||
removeAllComponents: (bin: string, otherTeam?: string) => Promise<AxiosResponse<pond.RemoveAllBinComponentsResponse>>;
|
||||
|
|
@ -254,10 +255,11 @@ export default function BinProvider(props: PropsWithChildren<Props>) {
|
|||
})
|
||||
};
|
||||
|
||||
const removeComponent = (bin: string, component: string, otherTeam?: string) => {
|
||||
const removeComponent = (bin: string, component: string, device?: number, otherTeam?: string) => {
|
||||
const view = otherTeam ? otherTeam : as
|
||||
let url = "/bins/" + bin + "/removeComponent/" + component;
|
||||
if (view) url = url + "?as=" + view;
|
||||
if (device) url = url + "?deviceToRemove=" + device
|
||||
if (view) url = url + (device ? "&as=" : "?as=") + view;
|
||||
return new Promise<AxiosResponse<pond.RemoveBinComponentResponse>>((resolve, reject)=>{
|
||||
post<pond.RemoveBinComponentResponse>(pondURL(url)).then(resp => {
|
||||
resp.data = pond.RemoveBinComponentResponse.fromObject(resp.data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue