-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #625 from Adamant-im/feat/download_and_upload_files
Feat/download and upload files
- Loading branch information
Showing
30 changed files
with
573 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<template> | ||
<NodesTableContainer> | ||
<NodesTableHead hide-label hide-socket /> | ||
|
||
<tbody> | ||
<IpfsNodesTableItem v-for="node in ipfsNodes" :key="node.url" blockchain="adm" :node="node" /> | ||
</tbody> | ||
</NodesTableContainer> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { computed, defineComponent } from 'vue' | ||
import { useStore } from 'vuex' | ||
import NodesTableContainer from '@/components/nodes/components/NodesTableContainer.vue' | ||
import NodesTableHead from '@/components/nodes/components/NodesTableHead.vue' | ||
import IpfsNodesTableItem from './IpfsNodesTableItem.vue' | ||
import { sortNodesFn } from '@/components/nodes/utils/sortNodesFn' | ||
const className = 'adm-nodes-table' | ||
const classes = { | ||
root: className | ||
} | ||
export default defineComponent({ | ||
components: { | ||
NodesTableContainer, | ||
NodesTableHead, | ||
IpfsNodesTableItem | ||
}, | ||
setup() { | ||
const store = useStore() | ||
const ipfsNodes = computed(() => { | ||
const arr = store.getters['nodes/ipfs'] | ||
return [...arr].sort(sortNodesFn) | ||
}) | ||
return { | ||
ipfsNodes, | ||
classes | ||
} | ||
} | ||
}) | ||
</script> | ||
|
||
<style lang="scss"> | ||
@import 'vuetify/settings'; | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<template> | ||
<tr :class="classes.root"> | ||
<NodeColumn checkbox> | ||
<NodeStatusCheckbox :value="active" @change="toggleActiveStatus" /> | ||
</NodeColumn> | ||
|
||
<NodeColumn> | ||
<NodeUrl :node="node" /> | ||
<NodeVersion v-if="node.version && active" :node="node" /> | ||
</NodeColumn> | ||
|
||
<NodeColumn :colspan="!showSocketColumn ? 2 : 1"> | ||
<NodeStatus :node="node" /> | ||
</NodeColumn> | ||
</tr> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { computed, PropType } from 'vue' | ||
import { useStore } from 'vuex' | ||
import type { NodeStatusResult } from '@/lib/nodes/abstract.node' | ||
import NodeUrl from '@/components/nodes/components/NodeUrl.vue' | ||
import NodeColumn from '@/components/nodes/components/NodeColumn.vue' | ||
import NodeStatus from '@/components/nodes/components/NodeStatus.vue' | ||
import NodeVersion from '@/components/nodes/components/NodeVersion.vue' | ||
import NodeStatusCheckbox from '@/components/nodes/components/NodeStatusCheckbox.vue' | ||
const className = 'adm-nodes-table-item' | ||
const classes = { | ||
root: className, | ||
column: `${className}__column`, | ||
columnCheckbox: `${className}__column--checkbox`, | ||
checkbox: `${className}__checkbox` | ||
} | ||
export default { | ||
components: { | ||
NodeStatusCheckbox, | ||
NodeColumn, | ||
NodeStatus, | ||
NodeVersion, | ||
NodeUrl | ||
}, | ||
props: { | ||
node: { | ||
type: Object as PropType<NodeStatusResult>, | ||
required: true | ||
} | ||
}, | ||
setup(props) { | ||
const store = useStore() | ||
const url = computed(() => props.node.url) | ||
const active = computed(() => props.node.active) | ||
const socketSupport = computed(() => props.node.socketSupport) | ||
const isUnsupported = computed(() => props.node.status === 'unsupported_version') | ||
const type = computed(() => props.node.type) | ||
const showSocketColumn = computed(() => active.value && !isUnsupported.value) | ||
const toggleActiveStatus = () => { | ||
store.dispatch('nodes/toggle', { | ||
type: type.value, | ||
url: url.value, | ||
active: !active.value | ||
}) | ||
store.dispatch('nodes/updateStatus') | ||
} | ||
const computedResult = computed(() => { | ||
const baseUrl = new URL(url.value) | ||
const protocol = baseUrl.protocol | ||
const hostname = baseUrl.hostname | ||
const port = baseUrl.port | ||
const result = /^[\d.]+$/.test(hostname) | ||
let nodeName = null | ||
let domain = null | ||
if (!result) { | ||
const regex = /([^.]*)\.(.*)/ | ||
const parts = hostname.match(regex) | ||
if (parts !== null) { | ||
nodeName = parts[1] | ||
domain = parts[2] | ||
} | ||
} | ||
return { | ||
protocol, | ||
hostname, | ||
nodeName, | ||
domain, | ||
result, | ||
port | ||
} | ||
}) | ||
return { | ||
classes, | ||
url, | ||
active, | ||
socketSupport, | ||
isUnsupported, | ||
showSocketColumn, | ||
toggleActiveStatus, | ||
computedResult | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss"> | ||
.ipfs-nodes-table-item { | ||
line-height: 14px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as IpfsNodesTable } from './IpfsNodesTable.vue' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.