Merge branch '17119-support-filter-groups'
[arvados-workbench2.git] / src / models / resource.ts
index 2af51ecbc44e0b4595512ee4ffcd9cf32adb2d0c..371278e52333bbfff0a8e81bc817c23645d5153b 100644 (file)
@@ -14,6 +14,10 @@ export interface Resource {
     etag: string;
 }
 
+export interface EditableResource extends Resource {
+    isEditable: boolean;
+}
+
 export interface TrashableResource extends Resource {
     trashAt: string;
     deleteAt: string;
@@ -58,8 +62,9 @@ export enum ResourceObjectType {
 }
 
 export const RESOURCE_UUID_PATTERN = '[a-z0-9]{5}-[a-z0-9]{5}-[a-z0-9]{15}';
-export const RESOURCE_UUID_REGEX = new RegExp(RESOURCE_UUID_PATTERN);
-export const COLLECTION_PDH_REGEX = /[a-f0-9]{32}\+\d+/;
+export const PORTABLE_DATA_HASH_PATTERN = '[a-f0-9]{32}\\+\\d+';
+export const RESOURCE_UUID_REGEX = new RegExp("^" + RESOURCE_UUID_PATTERN + "$");
+export const COLLECTION_PDH_REGEX = new RegExp("^" + PORTABLE_DATA_HASH_PATTERN + "$");
 
 export const isResourceUuid = (uuid: string) =>
     RESOURCE_UUID_REGEX.test(uuid);
@@ -104,7 +109,6 @@ export const extractUuidKind = (uuid: string = '') => {
             return ResourceKind.LINK;
         default:
             const match = COLLECTION_PDH_REGEX.exec(uuid);
-            console.log("matching " + match);
             return match ? ResourceKind.COLLECTION : undefined;
     }
 };