update
							parent
							
								
									38cc74dd6f
								
							
						
					
					
						commit
						3931d30181
					
				
							
								
								
									
										2
									
								
								file.go
								
								
								
								
							
							
						
						
									
										2
									
								
								file.go
								
								
								
								
							| 
						 | 
					@ -56,6 +56,8 @@ func (f *File) Do() (string, error) {
 | 
				
			||||||
	if f.Action == "" {
 | 
						if f.Action == "" {
 | 
				
			||||||
		return "", nil
 | 
							return "", nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						f.lock.RLock()
 | 
				
			||||||
 | 
						defer f.lock.RUnlock()
 | 
				
			||||||
	cmd := &exec.Cmd{}
 | 
						cmd := &exec.Cmd{}
 | 
				
			||||||
	if runtime.GOOS == "windows" {
 | 
						if runtime.GOOS == "windows" {
 | 
				
			||||||
		cmd = exec.Command(WIN_SHELL, "/c", f.Action)
 | 
							cmd = exec.Command(WIN_SHELL, "/c", f.Action)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,6 +26,11 @@ $modal-content-width: 90vw;
 | 
				
			||||||
  display: inline-block;
 | 
					  display: inline-block;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.icn-loading {
 | 
				
			||||||
 | 
					  animation: spin-animation 3s infinite;
 | 
				
			||||||
 | 
					  display: inline-block;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@keyframes spin-animation {
 | 
					@keyframes spin-animation {
 | 
				
			||||||
  0% {
 | 
					  0% {
 | 
				
			||||||
    transform: rotate(0deg);
 | 
					    transform: rotate(0deg);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -59,8 +59,7 @@ async function FileApply(){
 | 
				
			||||||
  else {
 | 
					  else {
 | 
				
			||||||
    const res = await fetch('/api/apply?name='+ Active, {
 | 
					    const res = await fetch('/api/apply?name='+ Active, {
 | 
				
			||||||
      method: 'POST',
 | 
					      method: 'POST',
 | 
				
			||||||
    }).catch(err=>{console.log(err);return;});
 | 
					    });
 | 
				
			||||||
    console.log("running")
 | 
					 | 
				
			||||||
    if(!res.ok){
 | 
					    if(!res.ok){
 | 
				
			||||||
      const result = await Catch(res)
 | 
					      const result = await Catch(res)
 | 
				
			||||||
      result_editor.session.setValue(result)
 | 
					      result_editor.session.setValue(result)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,7 +15,7 @@
 | 
				
			||||||
        <button class="button is-small has-tooltip-arrow" id="toolFollow" 
 | 
					        <button class="button is-small has-tooltip-arrow" id="toolFollow" 
 | 
				
			||||||
          data-tooltip="Follow file change (1s)" onclick="toolFollow()">
 | 
					          data-tooltip="Follow file change (1s)" onclick="toolFollow()">
 | 
				
			||||||
          <span class="icon is-small"><span class="material-icons" id="toolFollowIcon">
 | 
					          <span class="icon is-small"><span class="material-icons" id="toolFollowIcon">
 | 
				
			||||||
            pause
 | 
					            sync_disabled
 | 
				
			||||||
          </span></span>
 | 
					          </span></span>
 | 
				
			||||||
        </button>
 | 
					        </button>
 | 
				
			||||||
      </p>
 | 
					      </p>
 | 
				
			||||||
| 
						 | 
					@ -53,9 +53,9 @@
 | 
				
			||||||
  <div class="level-right">
 | 
					  <div class="level-right">
 | 
				
			||||||
    <div class="field has-addons">
 | 
					    <div class="field has-addons">
 | 
				
			||||||
      <p class="control">
 | 
					      <p class="control">
 | 
				
			||||||
        <button class="button is-small has-tooltip-arrow" id="toolRefresh"
 | 
					        <button class="button is-small has-tooltip-arrow"
 | 
				
			||||||
          data-tooltip="Refresh" onclick="toolRefresh()">
 | 
					          data-tooltip="Refresh" onclick="toolRefresh()">
 | 
				
			||||||
          <span class="icon is-small"><span class="material-icons">
 | 
					          <span class="icon is-small"><span class="material-icons" id="toolRefreshIco">
 | 
				
			||||||
            refresh
 | 
					            refresh
 | 
				
			||||||
          </span></span>
 | 
					          </span></span>
 | 
				
			||||||
        </button>
 | 
					        </button>
 | 
				
			||||||
| 
						 | 
					@ -63,16 +63,16 @@
 | 
				
			||||||
      {{if not .File.RO}}
 | 
					      {{if not .File.RO}}
 | 
				
			||||||
        <p class="control">
 | 
					        <p class="control">
 | 
				
			||||||
          {{if eq .File.Name .AppName}}
 | 
					          {{if eq .File.Name .AppName}}
 | 
				
			||||||
            <button class="button is-small has-tooltip-arrow" id="toolSave" 
 | 
					            <button class="button is-small has-tooltip-arrow"
 | 
				
			||||||
              data-tooltip="Apply" onclick="toolSave()">
 | 
					              data-tooltip="Apply" onclick="toolSave()">
 | 
				
			||||||
              <span class="icon is-small"><span class="material-icons">
 | 
					              <span class="icon is-small"><span class="material-icons" id="toolSaveIco">
 | 
				
			||||||
                play_arrow
 | 
					                play_arrow
 | 
				
			||||||
              </span></span>  
 | 
					              </span></span>  
 | 
				
			||||||
            </button>
 | 
					            </button>
 | 
				
			||||||
          {{else}}
 | 
					          {{else}}
 | 
				
			||||||
            <button class="button is-small has-tooltip-arrow" id="toolSave" 
 | 
					            <button class="button is-small has-tooltip-arrow"
 | 
				
			||||||
              data-tooltip="Save" onclick="toolSave()">
 | 
					              data-tooltip="Save" onclick="toolSave()">
 | 
				
			||||||
              <span class="icon is-small"><span class="material-icons">
 | 
					              <span class="icon is-small"><span class="material-icons" id="toolSaveIco">
 | 
				
			||||||
                save
 | 
					                save
 | 
				
			||||||
              </span></span>
 | 
					              </span></span>
 | 
				
			||||||
            </button>
 | 
					            </button>
 | 
				
			||||||
| 
						 | 
					@ -83,8 +83,8 @@
 | 
				
			||||||
      <p class="control">
 | 
					      <p class="control">
 | 
				
			||||||
        <button class="button is-small has-tooltip-arrow"
 | 
					        <button class="button is-small has-tooltip-arrow"
 | 
				
			||||||
          data-tooltip="{{.File.Action}}"
 | 
					          data-tooltip="{{.File.Action}}"
 | 
				
			||||||
          id="toolApply" onclick="toolApply()">
 | 
					          onclick="toolApply()">
 | 
				
			||||||
          <span class="icon is-small"><span class="material-icons">
 | 
					          <span class="icon is-small"><span class="material-icons"id="toolApplyIco">
 | 
				
			||||||
            play_arrow
 | 
					            play_arrow
 | 
				
			||||||
          </span></span> 
 | 
					          </span></span> 
 | 
				
			||||||
        </button>
 | 
					        </button>
 | 
				
			||||||
| 
						 | 
					@ -152,7 +152,7 @@ function toolFollow(){
 | 
				
			||||||
    let icon = document.getElementById('toolFollowIcon');
 | 
					    let icon = document.getElementById('toolFollowIcon');
 | 
				
			||||||
    el.classList.remove('is-primary');
 | 
					    el.classList.remove('is-primary');
 | 
				
			||||||
    icon.classList.remove('icn-spinner');
 | 
					    icon.classList.remove('icn-spinner');
 | 
				
			||||||
    icon.innerText='pause';
 | 
					    icon.innerText='sync_disabled';
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    ToolIsFollow = true
 | 
					    ToolIsFollow = true
 | 
				
			||||||
    let el = document.getElementById('toolFollow');
 | 
					    let el = document.getElementById('toolFollow');
 | 
				
			||||||
| 
						 | 
					@ -165,24 +165,30 @@ function toolFollow(){
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function toolRefresh(){
 | 
					async function toolRefresh(){
 | 
				
			||||||
  let el = document.getElementById('toolRefresh');
 | 
					  let el = document.getElementById('toolRefreshIco');
 | 
				
			||||||
  el.classList.add("is-loading")
 | 
					  el.classList.toggle('icn-loading')
 | 
				
			||||||
  await FileGet()
 | 
					  await FileGet()
 | 
				
			||||||
  el.classList.remove("is-loading")
 | 
					  el.classList.toggle('icn-loading')
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function toolSave(){
 | 
					async function toolSave(){
 | 
				
			||||||
  let el = document.getElementById('toolSave');
 | 
					  let el = document.getElementById('toolSaveIco');
 | 
				
			||||||
  el.classList.add("is-loading")
 | 
					  let originText = el.innerText;
 | 
				
			||||||
 | 
					  el.innerText='refreash';
 | 
				
			||||||
 | 
					  el.classList.add("icn-loading")
 | 
				
			||||||
  await FileSave()
 | 
					  await FileSave()
 | 
				
			||||||
  el.classList.remove("is-loading")
 | 
					  el.innerText=originText;
 | 
				
			||||||
 | 
					  el.classList.remove("icn-loading")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function toolApply(){
 | 
					async function toolApply(){
 | 
				
			||||||
  let el = document.getElementById('toolApply');
 | 
					  let el = document.getElementById('toolApplyIco');
 | 
				
			||||||
  el.classList.add("is-loading")
 | 
					  let originText = el.innerText;
 | 
				
			||||||
  await FileApply()
 | 
					  el.innerText='refreash';
 | 
				
			||||||
  el.classList.remove("is-loading")
 | 
					  el.classList.add("icn-loading")
 | 
				
			||||||
 | 
					  FileApply()
 | 
				
			||||||
 | 
					  el.innerText=originText;
 | 
				
			||||||
 | 
					  el.classList.remove("icn-loading")
 | 
				
			||||||
  ResultViewTog()
 | 
					  ResultViewTog()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue