fix: should update the catalog when the server is changed

This commit is contained in:
Joxit 2021-11-02 22:51:32 +01:00
parent dd26bf66a2
commit 992328eae9
No known key found for this signature in database
GPG key ID: F526592B8E012263

View file

@ -26,12 +26,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<div if="{ !state.loadend }" class="spinner-wrapper"> <div if="{ !state.loadend }" class="spinner-wrapper">
<material-spinner></material-spinner> <material-spinner></material-spinner>
</div> </div>
<catalog-element each="{ item in state.repositories }" item="{ item }" filter-results="{ props.filterResults }"/> <catalog-element each="{ item in state.repositories }" item="{ item }" filter-results="{ props.filterResults }" />
<script> <script>
import CatalogElement from './catalog-element.riot' import CatalogElement from './catalog-element.riot'
import { import {
Http Http
} from '../../scripts/http'; } from '../../scripts/http';
import {
getRegistryServers
} from '../../scripts/utils';
export default { export default {
components: { components: {
@ -41,18 +44,25 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
registryName: '', registryName: '',
length: 0, length: 0,
loadend: false, loadend: false,
repositories: [] repositories: [],
registryUrl: ''
}, },
onBeforeMount(props) { onBeforeMount(props) {
this.state.registryName = props.registryName; this.state.registryName = props.registryName;
this.state.catalogElementsLimit = props.catalogElementsLimit; this.state.catalogElementsLimit = props.catalogElementsLimit;
}, },
onMounted(props) { onMounted(props, state) {
this.display(props, this.state) this.display(props, state)
},
onUpdated(props, state) {
this.display(props, state);
}, },
display(props, state) { display(props, state) {
if (props.registryUrl === state.registryUrl) {
return;
}
state.registryUrl = props.registryUrl;
let repositories = []; let repositories = [];
const self = this; const self = this;
const oReq = new Http({ const oReq = new Http({