Skip to content

Commit

Permalink
GUI S3 Objects lifecycle (#2759): show restore status icons on versio…
Browse files Browse the repository at this point in the history
…ns. Restored status minor fix
  • Loading branch information
AleksandrGorodetskii committed Oct 19, 2022
1 parent 339ba6a commit 5e86013
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions client/src/components/pipelines/browser/DataStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -1287,15 +1287,12 @@ export default class DataStorage extends React.Component {
});
};

checkRestoredStatus = (item) => {
getRestoredStatus = (item) => {
const {
parentRestore,
currentRestores
} = this.lifeCycleRestoreInfo;
if (
!item ||
(item.labels && item.labels.StorageClass === STORAGE_CLASSES.standard)
) {
if (!item) {
return null;
}
const itemRestoreStatus = (currentRestores || [])
Expand Down Expand Up @@ -1331,13 +1328,13 @@ export default class DataStorage extends React.Component {
return undefined;
}
const childList = [];
const restoreStatus = this.checkRestoredStatus(item) || {};
const restoreStatus = this.getRestoredStatus(item) || {};
const fileRestored = restoreStatus.status === STATUS.SUCCEEDED;
for (let version in versions) {
if (versions.hasOwnProperty(version)) {
const archived = versions[version].labels &&
versions[version].labels['StorageClass'] !== STORAGE_CLASSES.standard;
const versionRestored = archived && restoreStatus.restoreVersions;
const versionRestored = restoreStatus.restoreVersions;
const latest = versions[version].version === item.version;
childList.push({
key: `${item.type}_${item.path}_${version}`,
Expand Down Expand Up @@ -1381,7 +1378,7 @@ export default class DataStorage extends React.Component {
results = this.props.storage.value.results || [];
}
items.push(...results.map(i => {
const restored = (this.checkRestoredStatus(i) || {}).status === STATUS.SUCCEEDED;
const restored = (this.getRestoredStatus(i) || {}).status === STATUS.SUCCEEDED;
const archived = i.labels && i.labels['StorageClass'] !== STORAGE_CLASSES.standard;
return {
key: `${i.type}_${i.path}`,
Expand Down Expand Up @@ -1429,8 +1426,8 @@ export default class DataStorage extends React.Component {
if (!item) {
return null;
}
const restoredStatus = item.selectable
? this.checkRestoredStatus(item)
const restoredStatus = item.archived && item.restored
? this.getRestoredStatus(item)
: null;
if (/^file$/i.test(item.type) && SAMPLE_SHEET_FILE_NAME_REGEXP.test(item.name)) {
return (
Expand Down Expand Up @@ -2179,7 +2176,9 @@ export default class DataStorage extends React.Component {
if (!item) {
return '';
}
const activeRestore = this.checkRestoredStatus(item);
const activeRestore = item.archived
? this.getRestoredStatus(item)
: null;
let disclaimer;
if (item.type === 'Folder' && activeRestore) {
disclaimer = [
Expand Down

0 comments on commit 5e86013

Please sign in to comment.