Skip to content

Commit

Permalink
Refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Jul 13, 2024
1 parent b6826fe commit 3b8f6f7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 23 deletions.
8 changes: 4 additions & 4 deletions src/components/ConnectForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -432,20 +432,20 @@ export default {
showServerSelector() {
this.broadcast(
'showListModal',
"showListModal",
"Select previously used server",
this.storedServers,
[
{
callback: (url) => {
callback: url => {
this.serverUrl = url;
return true; // return true to close the modal
}
},
{
callback: (url) => this.removeServer(url),
callback: url => this.removeServer(url),
icon: 'trash',
title: 'Delete entry from history'
title: 'Delete'
}
]
);
Expand Down
33 changes: 16 additions & 17 deletions src/components/modals/ListModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,30 +40,29 @@ export default {
show: true
};
},
computed: {
computed: {
listCount() {
return Utils.size(this.listItems);
},
listItems() {
return (typeof this.list == 'function' ? this.list() : this.list);
listItems() {
return (typeof this.list == 'function' ? this.list() : this.list);
},
otherListActions() {
return Array.isArray(this.listActions) && this.listActions.length > 1 ? this.listActions.slice(1) : [];
}
},
},
methods: {
doListAction(item, key, callback) {
const closeAfterCompletion = callback(Array.isArray(this.listItems) ? item : key);
if(closeAfterCompletion === true) {
this.show = false;
}
doListAction(item, key, callback) {
const closeAfterCompletion = callback(item, key);
if(closeAfterCompletion === true) {
this.show = false;
}
},
doMainListAction(item, key) {
if(this.listActions.length > 0) {
this.doListAction(item, key, this.listActions[0].callback);
}
}
doMainListAction(item, key) {
if(this.listActions.length > 0) {
this.doListAction(item, key, this.listActions[0].callback);
}
}
}
};
</script>
Expand Down Expand Up @@ -100,7 +99,7 @@ export default {
}
.listEmpty {
display: block;
text-align: center;
display: block;
text-align: center;
}
</style>
1 change: 0 additions & 1 deletion src/formats/formatRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export default class FormatRegistry {

createFileFromAsset(asset, stac) {
try {

// Detect by media type
if (typeof asset.type === 'string') {
let mime = contentType.parse(asset.type.toLowerCase());
Expand Down
1 change: 0 additions & 1 deletion src/formats/json.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { isIterable } from 'core-js';
import Utils from '../utils';
import { SupportedFormat } from './format';

Expand Down

0 comments on commit 3b8f6f7

Please sign in to comment.