Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    [3.6.0-beta.4] Inconsistent plugin state

    Scheduled Pinned Locked Moved Solved
    Plugins for DWC and DSF
    3
    6
    121
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • stuartofmtundefined
      stuartofmt
      last edited by

      I have a plugin that correctly reported status and button changes in v3.5.4. By "correctly" I mean all plugins reported status and button changes in a consistent manner.

      I recently re-built the plugin against 3.6.0-beta.4 and see an anomaly. This appears to be cosmetic only (or an error on my part)

      The basics are:
      [1] The plugin installs without error
      [2] Start - the plugin works as expected and the state updates to "started" and the button changes to "Stop"
      [3] Stop - the plugin stops but the state is reported as "deactivated"
      [4]Ctl+Shift+R - state shows as "installed" with button changed to "Start"

      Note that DSF only plugins (no ./src components) do not exhibit this behavior.

      A new plugin with essentially the same vue code has the same behavior. As this is small, I have included the code below:

      ./plugin.json

      {
          "id": "httpViewer",
          "name": "httpViewer",
          "author": "Stuartofmt",
          "version": "1.0.0",
          "license": "GPL-2.0-or-later",
          "homepage": "https://github.com/stuartofmt/usbStream",
      	"sbcRequired": false,
      	"dwcVersion": "3.6.0-beta.4",
      	"sbcOutputRedirected": false,
          "sbcPermissions": ["commandExecution","networkAccess", "fileSystemAccess","objectModelReadWrite"]
       }
       
      

      ./src/index.js

      'use strict'
      
      // import { registerRoute } from '../../routes'
      import { registerRoute } from '@/routes'
      
      //import Vue file;
      import httpViewer from './httpViewer.vue'
      
      
      // Register a route
      registerRoute(httpViewer, {
      	Plugins: {
      		httpViewer: {
      			icon: 'mdi-transition',
      			caption: 'httpViewer',
      			path: '/httpViewer'
      		}
      	}
      });
      

      /src/httpViewer.vue

      <comment>
      Displays an iFrame that is linked to the DuetLapse3 html Display
      Polls the status of the sbcPlugin and terminates the DWC plugin if the sbcPlugin is terminated
      Thanks to @MintyTrebor for all the help in getting this working
      </comment>
      <style scoped>
      	.iframe-container {
      		position: relative;
      		background-color: transparent;
      	}
      	.iframe-container iframe {
      	position: absolute;
      		top: 0;
      		left: 0;
      	}			
      </style>
       
      <template>
      		<div class="iframe_container">
      			<iframe id="myiframe" :src= "myurl" width="100%" :height="tmpHeight" frameborder="0">
      				<span>Your browser does not support iFrames</span>
      			</iframe>
      		</div>
      </template>
       
      <script>
      import Path from '@/utils/path';
      import store from "@/store";
      import { DisconnectedError, OperationCancelledError } from "@/utils/errors";
      
      // <!-- Do not change
      const pluginName = 'httpViewer';
      const configFile = pluginName + '/' + pluginName + '.config';
      // -->
      window.onmessage = function(event){
          if (event.data == 'reply') {
              console.log('Reply received!');
          }
      };
      export default {
      	data() { 
      		return{
      			myurl: '',
      			tmpHeight: "400px",
      		}
      	},
      	methods: {		
              //Modified file load from @mintyTrebor 
      		async loadSettingsFromFile() {
      			try {
      				const setFileName = Path.combine(this.systemDirectory, configFile);
      				const response = await store.dispatch("machine/download", { filename: setFileName, type: 'text', showSuccess: false, showError: false});
      				this.fileContent = await response;
      				//get the ip address
      				//let pattern = /-duet.*(?:$|\n)/i;
      				let pattern = /-http.+/i;
      				let match = this.fileContent.match(pattern).toString();
      				this.myurl = match.replace('-http', '').trim();
      				// get the port
      				//pattern = /-port.*(?:$|\n)/i;
      				//pattern = /-port.+/i;
      				//match = this.fileContent.match(pattern).toString();
      				//this.myurl = this.topurl + ":" + match.replace('-port', '').trim();
      				console.log('url is ' + this.myurl);
       
      			} catch (e) {
      				if (!(e instanceof DisconnectedError) && !(e instanceof OperationCancelledError)) {
      					console.warn(e);
      					console.warn("File Does Not Exist");
      				}
      			}
      		},
      		// Set the screen height - from @MintyTrebor
      		getAvailScreenHeight(){
      		let tmpHeight = window.innerHeight - 90;
      		if(window.document.getElementById("global-container")){
      			tmpHeight = tmpHeight - window.document.getElementById("global-container").offsetHeight;
      		}
      		if(this.showBottomNavigation) {
      			tmpHeight = tmpHeight - 56;
      		}
      		return tmpHeight;
      		}
      	},	
      	// use computed instead of methods cuz we only want it to run once
      	computed:{
      		systemDirectory() {
      			return store.state.machine.model.directories.system;
      		},
      		showBottomNavigation() {
      		return this.$vuetify.breakpoint.mobile && !this.$vuetify.breakpoint.xsOnly && this.$store.state.settings.bottomNavigation;
      		}
      	},
      	mounted() {
      		this.loadSettingsFromFile();
      		this.getAvailScreenHeight();
      	} 
      }
      </script>
      
      droftartsundefined chrishammundefined 2 Replies Last reply Reply Quote 0
      • droftartsundefined
        droftarts administrators @stuartofmt
        last edited by

        @stuartofmt one for @chrishamm

        Ian

        Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

        1 Reply Last reply Reply Quote 0
        • chrishammundefined
          chrishamm administrators @stuartofmt
          last edited by

          @stuartofmt Do you mean you'd rather like to see "stopped" instead of "installed" for third-party DWC plugins that are inactive?

          Duet software engineer

          stuartofmtundefined 1 Reply Last reply Reply Quote 0
          • stuartofmtundefined
            stuartofmt @chrishamm
            last edited by stuartofmt

            @chrishamm said in [3.6.0-beta.4] Inconsistent plugin state:

            @stuartofmt Do you mean you'd rather like to see "stopped" instead of "installed" for third-party DWC plugins that are inactive?

            Hi - I think the UI should behave consistently and avoid having to Ctrl+Shift+R if possible. Because of the different behavior - thought I may have been seeing a bug / problem.

            For example with my DSF only plugins (no UI element)

            (strikethrough --> greyed out):

            1- Currently: [started] [Stop] [Uninstall]
            2 - Press Stop
            3 - UI displays [stopped [Start] [Uninstall]
            4 - Press Start --> goes back to 1

            Note that no refresh of the UI is needed

            But for plugin that uses DWC (or DWC and DSF)

            1- Currently: [started] [Stop] [Uninstall]
            2 - Press Stop
            3 - UI displays [deactivated] [Stop] [Uninstall]
            4 - Ctrl+Shift+R
            5 - UI displays [installed] [Start] [Uninstall]
            4 - Press Start --> goes back to 1

            chrishammundefined 1 Reply Last reply Reply Quote 0
            • chrishammundefined
              chrishamm administrators @stuartofmt
              last edited by

              @stuartofmt It is not possible to unload active DWC plugins, so a refresh is needed to actually disable them. That's why their status changes to "deactivated" once they are stopped. Of course DSF plugins can be stopped/started at any time.

              Duet software engineer

              stuartofmtundefined 1 Reply Last reply Reply Quote 0
              • stuartofmtundefined
                stuartofmt @chrishamm
                last edited by

                @chrishamm

                I understand the refresh - that was a secondary thing. I'm not too fussed, now that I know its not a bug / issue.
                Cosmetically - I think it would benefit from consistent language.

                1 Reply Last reply Reply Quote 0
                • stuartofmtundefined stuartofmt marked this topic as a question
                • stuartofmtundefined stuartofmt has marked this topic as solved
                • First post
                  Last post
                Unless otherwise noted, all forum content is licensed under CC-BY-SA