Changeset View
Changeset View
Standalone View
Standalone View
swh/web/assets/src/bundles/webapp/webapp-utils.js
Show First 20 Lines • Show All 283 Lines • ▼ Show 20 Lines | |||||
export function setBrowsedSwhObjectMetadata(metadata) { | export function setBrowsedSwhObjectMetadata(metadata) { | ||||
browsedSwhObjectMetadata = metadata; | browsedSwhObjectMetadata = metadata; | ||||
} | } | ||||
export function getBrowsedSwhObjectMetadata() { | export function getBrowsedSwhObjectMetadata() { | ||||
return browsedSwhObjectMetadata; | return browsedSwhObjectMetadata; | ||||
} | } | ||||
vlorentz: Please add a comment explaining what it contains | |||||
// This will contain a mapping between an archived object type | |||||
// and its related SWHID metadata for each object reachable from | |||||
// the current browse view. | |||||
Not Done Inline Actionswhat related metadata? Isn't it only the SWHID? and it should mention there's only one SWHID per type so it's less confusing vlorentz: what related metadata? Isn't it only the SWHID?
and it should mention there's only one SWHID… | |||||
Done Inline ActionsIf you want the details, this is currently what we get when browsing a directory in a snapshot context for instance: { "directory": { "object_type": "directory", "object_id": "b720379ee0bb9aca6695fa04d4f6dc446f70d394", "object_icon": "fa fa-folder", "swh_id": "swh:1:dir:b720379ee0bb9aca6695fa04d4f6dc446f70d394", "swh_id_url": "/swh:1:dir:b720379ee0bb9aca6695fa04d4f6dc446f70d394/", "show_options": true }, "revision": { "object_type": "revision", "object_id": "8bae21962bab2fac7630982abd73676b89930902", "object_icon": "octicon-git-commit", "swh_id": "swh:1:rev:8bae21962bab2fac7630982abd73676b89930902", "swh_id_url": "/swh:1:rev:8bae21962bab2fac7630982abd73676b89930902/", "show_options": true }, "snapshot": { "object_type": "snapshot", "object_id": "cd510e99a42139ed36f15a5774301c113c3e494b", "object_icon": "fa fa-camera", "swh_id": "swh:1:snp:cd510e99a42139ed36f15a5774301c113c3e494b", "swh_id_url": "/swh:1:snp:cd510e99a42139ed36f15a5774301c113c3e494b/", "show_options": true } } The metadata will likely evolve as I progress on T2330 so I did not describe the content. anlambert: If you want the details, this is currently what we get when browsing a directory in a snapshot… | |||||
Not Done Inline ActionsThen swhid/swhids are badly named in setSwhIdsContext. It would be nice to have a comment listing the keys of each item. vlorentz: Then `swhid`/`swhids` are badly named in `setSwhIdsContext`.
It would be nice to have a… | |||||
Done Inline ActionsSigh ... Ok let me finish to handle revision metadata first as a nice rebase party is coming. anlambert: Sigh ... Ok let me finish to handle revision metadata first as a nice rebase party is coming. | |||||
// SWHID metadata contain the following keys: | |||||
// * object_type: type of archived object | |||||
// * object_id: sha1 object identifier | |||||
// * swh_id: SWH persistent identifier without contextual info | |||||
Not Done Inline ActionsVariable names are very confusing in this function... vlorentz: Variable names are very confusing in this function... | |||||
// * swh_id_url: URL to resolve SWH persistent identifier without contextual info | |||||
let swhidsContext_ = {}; | |||||
export function setSwhIdsContext(swhidsContext) { | |||||
swhidsContext_ = {}; | |||||
for (let swhidContext of swhidsContext) { | |||||
swhidsContext_[swhidContext.object_type] = swhidContext; | |||||
} | |||||
} | |||||
export function getSwhIdsContext() { | |||||
return swhidsContext_; | |||||
} |
Please add a comment explaining what it contains