Skip to content

Commit

Permalink
crlf to lf & bump to 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieyang committed Jul 11, 2024
1 parent 2e53a53 commit ec7fd01
Show file tree
Hide file tree
Showing 6 changed files with 258 additions and 258 deletions.
2 changes: 1 addition & 1 deletion photoshop/dist/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "sd-ppp",
"name": "SD-PPP",
"version": "1.0.0",
"version": "1.1.0",
"main": "index.html",
"manifestVersion": 5,
"host": {
Expand Down
2 changes: 1 addition & 1 deletion photoshop/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sdppp",
"version": "1.0.0",
"version": "1.1.0",
"scripts": {
"watch": "nodemon -w src -e js,jsx,json,css,html -w webpack.config.js -x npm run build",
"build": "webpack --mode development",
Expand Down
2 changes: 1 addition & 1 deletion photoshop/plugin/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "sd-ppp",
"name": "SD-PPP",
"version": "1.0.0",
"version": "1.1.0",
"main": "index.html",
"manifestVersion": 5,
"host": {
Expand Down
192 changes: 96 additions & 96 deletions photoshop/src/panels/Main.jsx
Original file line number Diff line number Diff line change
@@ -1,96 +1,96 @@
import React from "react";
import ComfyConnection from "../system/ComfyConnection";
import { storage } from "uxp";
export default class Main extends React.Component {
state = {
backendURL: '',
isConnected: false,
isReconnecting: false,
pageInstances: []
}

componentDidMount() {
ComfyConnection.onConnectStateChange(() => {
const instance = ComfyConnection.instance
console.log('isConnected:', instance?.isConnected)
this.setState({
isConnected: instance?.isConnected,
isReconnecting: instance?.isReconnecting,
backendURL: instance ? instance.backendURL : ''
})
});
ComfyConnection.onPageInstancesChange((data) => {
this.setState({ pageInstances: data.pages || [] });
});
storage.secureStorage.getItem('backendURL').then((value) => {
if (!value) return
this.setState({ backendURL: Buffer.from(value).toString() })
if (this.state.backendURL) {
console.log('backendURL:', this.state.backendURL)
this.doConnectOrDisconnect()
}
})
}

doConnectOrDisconnect() {
if (ComfyConnection.instance?.isConnected || ComfyConnection.instance?.isReconnecting)
ComfyConnection.instance.disconnect();
else
ComfyConnection.createInstance(this.state.backendURL);
}

render() {
let inputDisable = { };
if (this.state.isConnected || this.state.isReconnecting) inputDisable = { disabled: true };
console.log(this.state.backendURL)
return (
<>
<sp-textfield
id="url-bar"
label="backendURL"
onInput={(ev) => { console.log('onInput', ev.currentTarget.value); this.state.backendURL = ev.currentTarget.value }}
{...inputDisable}
value={this.state.backendURL}
placeholder="http://127.0.0.1:8188"
></sp-textfield>
<div className="connect-box">
<div className={"status-bar " + (
this.state.isConnected ? 'connected' : (
this.state.isReconnecting ? 'reconnecting' :
'disconnected'
)
)}>
<div className="status-icon"></div>
<div className="status-text">{(
this.state.isConnected ? 'connected' : (
this.state.isReconnecting ? 'reconnecting...' :
'disconnected'
)
)}</div>
</div>
<sp-button
id="connect-btn"
variant="primary"
onClick={this.doConnectOrDisconnect.bind(this)}
>{this.state.isConnected || this.state.isReconnecting ? 'disconnect' : 'connect'}</sp-button>
</div>

<sp-divider size="small"></sp-divider>

<sp-label>webpage-list</sp-label>
<ul className="client-list">
{
this.state.pageInstances.map((item) => {
return (
<li key={item} className="client-list-item">
<sp-label class="client-name">{item.slice(0, 6)}</sp-label>
<sp-link onClick={() => { ComfyConnection.instance?.pageInstanceRun(item) }}>Run</sp-link>
</li>
)
})
}
</ul>
</>
)
}
}
import React from "react";
import ComfyConnection from "../system/ComfyConnection";
import { storage } from "uxp";
export default class Main extends React.Component {
state = {
backendURL: '',
isConnected: false,
isReconnecting: false,
pageInstances: []
}

componentDidMount() {
ComfyConnection.onConnectStateChange(() => {
const instance = ComfyConnection.instance
console.log('isConnected:', instance?.isConnected)
this.setState({
isConnected: instance?.isConnected,
isReconnecting: instance?.isReconnecting,
backendURL: instance ? instance.backendURL : ''
})
});
ComfyConnection.onPageInstancesChange((data) => {
this.setState({ pageInstances: data.pages || [] });
});
storage.secureStorage.getItem('backendURL').then((value) => {
if (!value) return
this.setState({ backendURL: Buffer.from(value).toString() })
if (this.state.backendURL) {
console.log('backendURL:', this.state.backendURL)
this.doConnectOrDisconnect()
}
})
}

doConnectOrDisconnect() {
if (ComfyConnection.instance?.isConnected || ComfyConnection.instance?.isReconnecting)
ComfyConnection.instance.disconnect();
else
ComfyConnection.createInstance(this.state.backendURL);
}

render() {
let inputDisable = { };
if (this.state.isConnected || this.state.isReconnecting) inputDisable = { disabled: true };
console.log(this.state.backendURL)
return (
<>
<sp-textfield
id="url-bar"
label="backendURL"
onInput={(ev) => { console.log('onInput', ev.currentTarget.value); this.state.backendURL = ev.currentTarget.value }}
{...inputDisable}
value={this.state.backendURL}
placeholder="http://127.0.0.1:8188"
></sp-textfield>
<div className="connect-box">
<div className={"status-bar " + (
this.state.isConnected ? 'connected' : (
this.state.isReconnecting ? 'reconnecting' :
'disconnected'
)
)}>
<div className="status-icon"></div>
<div className="status-text">{(
this.state.isConnected ? 'connected' : (
this.state.isReconnecting ? 'reconnecting...' :
'disconnected'
)
)}</div>
</div>
<sp-button
id="connect-btn"
variant="primary"
onClick={this.doConnectOrDisconnect.bind(this)}
>{this.state.isConnected || this.state.isReconnecting ? 'disconnect' : 'connect'}</sp-button>
</div>

<sp-divider size="small"></sp-divider>

<sp-label>webpage-list</sp-label>
<ul className="client-list">
{
this.state.pageInstances.map((item) => {
return (
<li key={item} className="client-list-item">
<sp-label class="client-name">{item.slice(0, 6)}</sp-label>
<sp-link onClick={() => { ComfyConnection.instance?.pageInstanceRun(item) }}>Run</sp-link>
</li>
)
})
}
</ul>
</>
)
}
}
Loading

0 comments on commit ec7fd01

Please sign in to comment.