18692: Aditional while loop variable added
[arvados-workbench2.git] / src / common / frozen-resources.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { ProjectResource } from "models/project";
6 import { getResource } from "store/resources/resources";
7
8 export const resourceIsFrozen = (resource: any, resources): boolean => {
9     let isFrozen: boolean = !!resource.frozenByUuid;
10     let ownerUuid: string | undefined = resource?.ownerUuid;
11
12     while(!isFrozen && !!ownerUuid && ownerUuid.indexOf('000000000000000') === -1) {
13         console.log(isFrozen, ownerUuid, resource.uuid, resource);
14         const parentResource: ProjectResource | undefined = getResource<ProjectResource>(ownerUuid)(resources);
15         isFrozen = !!parentResource?.frozenByUuid;
16         ownerUuid = parentResource?.ownerUuid;
17     }
18
19     return isFrozen;
20 }