* make the design progress bar step more precise.

This commit is contained in:
Chenjianyu
2023-07-10 15:56:55 +08:00
parent af8b46a1b5
commit c9cd289391
3 changed files with 52 additions and 23 deletions
+23 -18
View File
@@ -170,10 +170,11 @@ class ai extends control
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->inlink('promptAssignRole', "promptID=$promptID") . '#app=admin'));
}
$this->view->prompt = $prompt;
$this->view->promptID = $promptID;
$this->view->title = $this->lang->ai->prompts->assignRole . " {$this->lang->colon} " . $this->lang->ai->prompts->common;
$this->view->position[] = $this->lang->ai->prompts->common;
$this->view->prompt = $prompt;
$this->view->promptID = $promptID;
$this->view->lastActiveStep = $this->ai->getLastActiveStep($prompt);
$this->view->title = $this->lang->ai->prompts->assignRole . " {$this->lang->colon} " . $this->lang->ai->prompts->common;
$this->view->position[] = $this->lang->ai->prompts->common;
$this->display();
}
@@ -214,6 +215,7 @@ class ai extends control
$this->view->dataSource = $this->config->ai->dataSource;
$this->view->prompt = $prompt;
$this->view->promptID = $promptID;
$this->view->lastActiveStep = $this->ai->getLastActiveStep($prompt);
$this->view->title = $this->lang->ai->prompts->selectDataSource . " {$this->lang->colon} " . $this->lang->ai->prompts->common;
$this->view->position[] = $this->lang->ai->prompts->common;
$this->display();
@@ -251,11 +253,12 @@ class ai extends control
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->inlink('promptSetPurpose', "promptID=$promptID") . '#app=admin'));
}
$this->view->dataPreview = $this->ai->generateDemoDataPrompt($prompt->module, $prompt->source);
$this->view->prompt = $prompt;
$this->view->promptID = $promptID;
$this->view->title = $this->lang->ai->prompts->setPurpose . " {$this->lang->colon} " . $this->lang->ai->prompts->common;
$this->view->position[] = $this->lang->ai->prompts->common;
$this->view->dataPreview = $this->ai->generateDemoDataPrompt($prompt->module, $prompt->source);
$this->view->prompt = $prompt;
$this->view->promptID = $promptID;
$this->view->lastActiveStep = $this->ai->getLastActiveStep($prompt);
$this->view->title = $this->lang->ai->prompts->setPurpose . " {$this->lang->colon} " . $this->lang->ai->prompts->common;
$this->view->position[] = $this->lang->ai->prompts->common;
$this->display();
}
@@ -297,11 +300,12 @@ class ai extends control
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->inlink('promptSetTargetForm', "promptID=$promptID") . '#app=admin'));
}
$this->view->dataPreview = $this->ai->generateDemoDataPrompt($prompt->module, $prompt->source);
$this->view->prompt = $prompt;
$this->view->promptID = $promptID;
$this->view->title = $this->lang->ai->prompts->setTargetForm . " {$this->lang->colon} " . $this->lang->ai->prompts->common;
$this->view->position[] = $this->lang->ai->prompts->common;
$this->view->dataPreview = $this->ai->generateDemoDataPrompt($prompt->module, $prompt->source);
$this->view->prompt = $prompt;
$this->view->promptID = $promptID;
$this->view->lastActiveStep = $this->ai->getLastActiveStep($prompt);
$this->view->title = $this->lang->ai->prompts->setTargetForm . " {$this->lang->colon} " . $this->lang->ai->prompts->common;
$this->view->position[] = $this->lang->ai->prompts->common;
$this->display();
}
@@ -337,10 +341,11 @@ class ai extends control
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->inlink('promptFinalize', "promptID=$promptID") . '#app=admin'));
}
$this->view->prompt = $prompt;
$this->view->promptID = $promptID;
$this->view->title = $this->lang->ai->prompts->finalize . " {$this->lang->colon} " . $this->lang->ai->prompts->common;
$this->view->position[] = $this->lang->ai->prompts->common;
$this->view->prompt = $prompt;
$this->view->promptID = $promptID;
$this->view->lastActiveStep = $this->ai->getLastActiveStep($prompt);
$this->view->title = $this->lang->ai->prompts->finalize . " {$this->lang->colon} " . $this->lang->ai->prompts->common;
$this->view->position[] = $this->lang->ai->prompts->common;
$this->display();
}
}
+22
View File
@@ -745,4 +745,26 @@ class aiModel extends model
return false;
}
/**
* Get the last active step of prompt by id.
*
* @param object $prompt
* @access public
* @return string
*/
public function getLastActiveStep($prompt)
{
if(empty($prompt)) return 'assignrole';
if($prompt->status == 'active') return 'finalize';
if(!empty($prompt->targetForm)) return 'settargetform';
if(!empty($prompt->purpose)) return 'setpurpose';
if(!empty($prompt->source)) return 'selectdatasource';
return 'assignrole';
}
}
@@ -17,6 +17,7 @@
$stepSequence = array('assignrole', 'selectdatasource', 'setpurpose', 'settargetform', 'finalize');
$currentStepIndex = array_search($step, $stepSequence);
$lastActiveStepIndex = array_search($lastActiveStep, $stepSequence);
$stepstatus = array();
@@ -26,11 +27,7 @@
{
$stepstatus[$stepName] = 'active';
}
elseif($index == $currentStepIndex)
{
$stepstatus[$stepName] = 'current';
}
elseif($index == $currentStepIndex + 1)
elseif($index > $currentStepIndex && $index <= $lastActiveStepIndex + 1)
{
$stepstatus[$stepName] = 'clickable';
}
@@ -38,6 +35,11 @@
{
$stepstatus[$stepName] = 'disabled';
}
if($index == $currentStepIndex)
{
$stepstatus[$stepName] = 'current';
}
}
foreach($lang->ai->designStepNav as $stepKey => $stepLang)