Browse Source

WIP

digibyte
AlphaX-Projects 3 years ago committed by GitHub
parent
commit
0649b11985
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 61
      qortal-ui-plugins/plugins/core/qdn/publish/publish.src.js

61
qortal-ui-plugins/plugins/core/qdn/publish/publish.src.js

@ -6,7 +6,6 @@ import '@material/mwc-button'
import '@material/mwc-textfield'
import '@material/mwc-select'
import '@material/mwc-list/mwc-list-item.js'
import '@material/mwc-slider'
import '@polymer/paper-progress/paper-progress.js'
const parentEpml = new Epml({ type: 'WINDOW', source: window.parent })
@ -120,12 +119,15 @@ class PublishData extends LitElement {
if (urlParams.get('showName') === "true") {
this.showName = true
}
if (urlParams.get('showService') === "true") {
this.showService = true
}
if (urlParams.get('showIdentifier') === "true") {
this.showIdentifier = true
}
if (urlParams.get('showMetadata') === "true") {
this.showMetadata = true
}
@ -150,10 +152,7 @@ class PublishData extends LitElement {
this.theme = localStorage.getItem('qortalTheme') ? localStorage.getItem('qortalTheme') : 'light'
const fetchNames = () => {
parentEpml.request('apiCall', {
url: `/names/address/${this.selectedAddress.address}?limit=0&reverse=true`
}).then(res => {
parentEpml.request('apiCall', {url: `/names/address/${this.selectedAddress.address}?limit=0&reverse=true`}).then(res => {
setTimeout(() => {
this.names = res
if (res[0] != null) {
@ -165,21 +164,16 @@ class PublishData extends LitElement {
}
const fetchCategories = () => {
parentEpml.request('apiCall', {
url: `/arbitrary/categories`
}).then(res => {
parentEpml.request('apiCall', {url: `/arbitrary/categories`}).then(res => {
setTimeout(() => {
this.categories = res
}, 1)
})
setTimeout(fetchCategories, this.config.user.nodeSettings.pingInterval)
}
const fetchPeersSummary = () => {
parentEpml.request('apiCall', {
url: `/peers/summary`
}).then(res => {
parentEpml.request('apiCall', {url: `/peers/summary`}).then(res => {
setTimeout(() => {
this.portForwardingEnabled = (res.inboundConnections != null && res.inboundConnections > 0);
}, 1)
@ -188,6 +182,7 @@ class PublishData extends LitElement {
}
let configLoaded = false
parentEpml.ready().then(() => {
parentEpml.subscribe('selected_address', async selectedAddress => {
this.selectedAddress = {}
@ -195,6 +190,7 @@ class PublishData extends LitElement {
if (!selectedAddress || Object.entries(selectedAddress).length === 0) return
this.selectedAddress = selectedAddress
})
parentEpml.subscribe('config', c => {
if (!configLoaded) {
setTimeout(fetchNames, 1)
@ -204,10 +200,9 @@ class PublishData extends LitElement {
}
this.config = JSON.parse(c)
})
parentEpml.subscribe('copy_menu_switch', async value => {
parentEpml.subscribe('copy_menu_switch', async value => {
if (value === 'false' && window.getSelection().toString().length !== 0) {
this.clearSelection()
}
})
@ -234,7 +229,6 @@ class PublishData extends LitElement {
<mwc-list-item value="${this.myRegisteredName}">${this.myRegisteredName}</mwc-list-item>
</mwc-select>
</p>
<div style="display: ${this.showMetadata ? 'block' : 'none'}">
<p>
<mwc-textfield style="width:100%;" label="Title" id="title" type="text" value="${this.metadata != null && this.metadata.title != null ? this.metadata.title : ''}" maxLength="80"></mwc-textfield><!--charCounter="true"-->
@ -250,29 +244,24 @@ class PublishData extends LitElement {
</mwc-select>
</p>
<p>
<mwc-textfield style="width:19.5%;" id="tag1" type="text" value="${this.metadata != null && this.metadata.tags != null && this.metadata.tags[0] != null ? this.metadata.tags[0] : ''}" placeholder="Tag 1" maxLength="20"></mwc-textfield>
<mwc-textfield style="width:19.5%;" id="tag2" type="text" value="${this.metadata != null && this.metadata.tags != null && this.metadata.tags[1] != null ? this.metadata.tags[1] : ''}" placeholder="Tag 2" maxLength="20"></mwc-textfield>
<mwc-textfield style="width:19.5%;" id="tag3" type="text" value="${this.metadata != null && this.metadata.tags != null && this.metadata.tags[2] != null ? this.metadata.tags[2] : ''}" placeholder="Tag 3" maxLength="20"></mwc-textfield>
<mwc-textfield style="width:19.5%;" id="tag4" type="text" value="${this.metadata != null && this.metadata.tags != null && this.metadata.tags[3] != null ? this.metadata.tags[3] : ''}" placeholder="Tag 4" maxLength="20"></mwc-textfield>
<mwc-textfield style="width:19.5%;" id="tag5" type="text" value="${this.metadata != null && this.metadata.tags != null && this.metadata.tags[4] != null ? this.metadata.tags[4] : ''}" placeholder="Tag 5" maxLength="20"></mwc-textfield>
<mwc-textfield style="width:19.85%;" id="tag1" type="text" value="${this.metadata != null && this.metadata.tags != null && this.metadata.tags[0] != null ? this.metadata.tags[0] : ''}" placeholder="Tag 1" maxLength="20"></mwc-textfield>
<mwc-textfield style="width:19.85%;" id="tag2" type="text" value="${this.metadata != null && this.metadata.tags != null && this.metadata.tags[1] != null ? this.metadata.tags[1] : ''}" placeholder="Tag 2" maxLength="20"></mwc-textfield>
<mwc-textfield style="width:19.85%;" id="tag3" type="text" value="${this.metadata != null && this.metadata.tags != null && this.metadata.tags[2] != null ? this.metadata.tags[2] : ''}" placeholder="Tag 3" maxLength="20"></mwc-textfield>
<mwc-textfield style="width:19.85%;" id="tag4" type="text" value="${this.metadata != null && this.metadata.tags != null && this.metadata.tags[3] != null ? this.metadata.tags[3] : ''}" placeholder="Tag 4" maxLength="20"></mwc-textfield>
<mwc-textfield style="width:19.85%;" id="tag5" type="text" value="${this.metadata != null && this.metadata.tags != null && this.metadata.tags[4] != null ? this.metadata.tags[4] : ''}" placeholder="Tag 5" maxLength="20"></mwc-textfield>
</p>
</div>
${this.renderUploadField()}
<p style="display: ${this.showService ? 'block' : 'none'}">
<mwc-textfield style="width:100%;" label="Service" id="service" type="text" value="${this.service}"></mwc-textfield>
</p>
<p style="display: ${this.showIdentifier ? 'block' : 'none'}">
<mwc-textfield style="width:100%;" label="Identifier" id="identifier" type="text" value="${this.identifier != null ? this.identifier : ''}"></mwc-textfield>
</p>
<p style="break-word; color: var(--black);">${this.generalMessage}</p>
<p style="color:red">${this.errorMessage}</p>
<p style="color:green;word-break: break-word;">${this.successMessage}</p>
${this.loading ? html` <paper-progress indeterminate style="width:100%; margin:4px;"></paper-progress> ` : ''}
<div class="buttons">
<div>
<mwc-button ?disabled=${this.btnDisable} style="width:100%;" raised icon="send" @click=${(e) => this.doPublish(e)}>Publish &nbsp;</mwc-button>
@ -280,7 +269,6 @@ class PublishData extends LitElement {
</div>
</div>
</div>
</div>
`
}
@ -326,20 +314,26 @@ class PublishData extends LitElement {
renderUploadField() {
if (this.uploadType === "file") {
return html`<p>
return html`
<p>
<input style="width: 100%; background: var(--white); color: var(--black)" id="file" type="file">
</p>`;
</p>
`
}
else if (this.uploadType === "zip") {
return html`<p>
return html`
<p>
<span class="upload-text">Select zip file containing static content:</span><br />
<input style="width: 100%; background: var(--white); color: var(--black)" id="file" type="file" accept=".zip">
</p>`;
</p>
`
}
else {
return html`<p>
return html`
<p>
<mwc-textfield style="width:100%;" label="Local path to static files" id="path" type="text" value="${this.path}"></mwc-textfield>
</p>`;
</p>
`
}
}
@ -590,6 +584,7 @@ class PublishData extends LitElement {
}, 1)
})
}
selectName(e) {
let name = this.shadowRoot.getElementById('registeredName')
this.selectedName = (name.value)

Loading…
Cancel
Save