| | |
| | | } |
| | | if (repository == null) { |
| | | log.warn("Repo with name '" + repoConfig.getRepo() + "' not found."); |
| | | } else { |
| | | repoConfig.setId(repository.getId()); |
| | | } |
| | | return repository; |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param repoName |
| | | * @param repoIdOrName |
| | | * @param archiveIdOrName |
| | | * @param forceReload If true, any cache value will be ignored. Default is false. |
| | | * @return |
| | | */ |
| | | public Archive getArchive(String repoName, String archiveIdOrName, boolean forceReload) { |
| | | BorgRepoConfig repoConfig = ConfigurationHandler.getConfiguration().getRepoConfig(repoName); |
| | | public Archive getArchive(String repoIdOrName, String archiveIdOrName, boolean forceReload) { |
| | | BorgRepoConfig repoConfig = ConfigurationHandler.getConfiguration().getRepoConfig(repoIdOrName); |
| | | if (repoConfig == null) { |
| | | log.error("Can't find configured repo '" + repoName + "'."); |
| | | log.error("Can't find configured repo '" + repoIdOrName + "'."); |
| | | return null; |
| | | } |
| | | return getArchive(repoConfig, archiveIdOrName, forceReload); |
| | |
| | | package de.micromata.borgbutler.config; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | |
| | | private String passphrase; |
| | | @Getter @Setter |
| | | private String passwordCommand; |
| | | @Getter @Setter |
| | | @JsonIgnore |
| | | private String id; |
| | | } |
| | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | import lombok.Getter; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | repoConfigs.add(repoConfig); |
| | | } |
| | | |
| | | public BorgRepoConfig getRepoConfig(String name) { |
| | | if (name == null) { |
| | | public BorgRepoConfig getRepoConfig(String idOrName) { |
| | | if (idOrName == null) { |
| | | return null; |
| | | } |
| | | for (BorgRepoConfig repoConfig : repoConfigs) { |
| | | if (name.equals(repoConfig.getRepo())) { |
| | | if (StringUtils.equals(idOrName, repoConfig.getRepo()) || StringUtils.equals(idOrName, repoConfig.getId())) { |
| | | return repoConfig; |
| | | } |
| | | } |
| | |
| | | class ArchiveView extends React.Component { |
| | | |
| | | state = { |
| | | repo: this.props.match.params.repoId, |
| | | archive: this.props.match.params.archiveId, |
| | | repoId: this.props.match.params.repoId, |
| | | archiveId: this.props.match.params.archiveId, |
| | | isFetching: false, |
| | | activeTab: '1', |
| | | }; |
| | |
| | | failed: false |
| | | }); |
| | | fetch(getRestServiceUrl('repos/archive', { |
| | | repo: this.state.repo, |
| | | archive: this.state.archive, |
| | | repo: this.state.repoId, |
| | | archive: this.state.archiveId, |
| | | force: force |
| | | }), { |
| | | method: 'GET', |
| | |
| | | import React from 'react' |
| | | import {Nav, NavLink, TabContent, Table, TabPane} from 'reactstrap'; |
| | | import { Link } from "react-router-dom"; |
| | | import classNames from 'classnames'; |
| | | import {PageHeader} from '../../general/BootstrapComponents'; |
| | | import {getRestServiceUrl, humanFileSize} from '../../../utilities/global'; |
| | |
| | | {repo.archives.map((archive) => { |
| | | // Return the element. Also pass key |
| | | return ( |
| | | <tr key={archive.id} onClick={() => this.redirectToArchive(archive)}> |
| | | <td>{archive.archive}</td> |
| | | <tr key={archive.id}> |
| | | <td><Link to={`/archives/${repo.id}/${archive.id}`}>{archive.archive}</Link></td> |
| | | <td>{archive.time}</td> |
| | | <td>{archive.id}</td> |
| | | </tr>); |