RE Single class scenarios picklist
This commit is contained in:
@@ -94,12 +94,30 @@
|
||||
</TabPanels>
|
||||
</Tabs>
|
||||
|
||||
<!-- Dialog per selezionare lo scenario -->
|
||||
<Dialog v-model:visible="showScenarioDialog" header="Seleziona uno Scenario" :closable="false" :modal="true" style="width: 400px;">
|
||||
<div>
|
||||
<h5>Seleziona uno Scenario</h5>
|
||||
<Dropdown
|
||||
v-model="selectedScenario"
|
||||
:options="scenario_store.scenariosForRE"
|
||||
optionLabel="name"
|
||||
placeholder="Seleziona uno scenario"
|
||||
class="w-full"
|
||||
/> </div>
|
||||
<div class="flex justify-end mt-3">
|
||||
<Button label="Annulla" severity="secondary" @click="showScenarioDialog = false" class="mr-2" />
|
||||
<Button label="Esegui" severity="primary" :disabled="!selectedScenario" @click="executeScenario" />
|
||||
</div>
|
||||
</Dialog>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
import { ApplicationCodeService } from '@/service/ApplicationCodeService';
|
||||
import { LoadingStore } from '@/stores/LoadingStore';
|
||||
import { ScenarioStore } from '@/stores/ScenarioStore';
|
||||
import { UserPrefStore } from '@/stores/UserPrefStore.js';
|
||||
import axios from 'axios';
|
||||
import { MdPreview } from 'md-editor-v3';
|
||||
@@ -132,6 +150,7 @@ const { className } = toRefs(props);
|
||||
const classDetails = ref(null);
|
||||
const classLoaded = ref(false);
|
||||
const loadingStore = LoadingStore();
|
||||
const scenario_store = ScenarioStore();
|
||||
const nodes = ref(null)
|
||||
const edges = ref(null)
|
||||
const dark = ref(false)
|
||||
@@ -144,6 +163,9 @@ const userPrefStore = UserPrefStore();
|
||||
const toast = useToast();
|
||||
const loading_data = ref(false);
|
||||
const { graph, layout, previousDirection } = useLayout()
|
||||
const showScenarioDialog = ref(false); // Controlla la visibilità del dialog
|
||||
const selectedScenario = ref(null); // Lo scenario selezionato
|
||||
const scenarios = ref([]); // Lista degli scenari disponibili
|
||||
const commonRevRequest = reactive({
|
||||
repositoryEntityId: '',
|
||||
applicationName: '',
|
||||
@@ -151,8 +173,9 @@ const commonRevRequest = reactive({
|
||||
fullClassQualifiedName: '',
|
||||
applicationVersion: '',
|
||||
deleteExistingData: true, // Valore booleano
|
||||
applicationType: 'JAVA',
|
||||
commitSha: ''
|
||||
applicationType: '',
|
||||
commitSha: '',
|
||||
scenarioId: ''
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
@@ -160,9 +183,73 @@ onMounted(() => {
|
||||
console.log("class details: ", classDetails.value);
|
||||
console.log("class name: ", className.value);
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Mostra il dialog quando si clicca il pulsante
|
||||
const openToastRE = () => {
|
||||
showScenarioDialog.value = true;
|
||||
};
|
||||
|
||||
// Esegue l'azione con lo scenario selezionato
|
||||
const executeScenario = () => {
|
||||
if (!selectedScenario.value) {
|
||||
toast.add({
|
||||
severity: 'warn',
|
||||
summary: 'Attenzione',
|
||||
detail: 'Seleziona uno scenario prima di continuare',
|
||||
life: 3000
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// Imposta l'ID dello scenario
|
||||
commonRevRequest.scenarioId = selectedScenario.value.id;
|
||||
|
||||
// Nasconde il dialog e chiama la funzione per l'RE
|
||||
showScenarioDialog.value = false;
|
||||
doREClass();
|
||||
};
|
||||
|
||||
function checkExtension() {
|
||||
// Ottieni la parte dopo il punto
|
||||
const extension = userPrefStore.getSelFile.split('.').pop();
|
||||
|
||||
// Controlla se è "java"
|
||||
if (extension === 'java' || extension === 'jsp') {
|
||||
commonRevRequest.applicationType = extension;
|
||||
} else {
|
||||
commonRevRequest.applicationType = 'GENERIC';
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Logica per eseguire l'RE
|
||||
const doREClass = () => {
|
||||
commonRevRequest.fullClassQualifiedName = props.className;
|
||||
checkExtension();
|
||||
console.log("commonRevRequest.fullClassQualifiedName", commonRevRequest.fullClassQualifiedName);
|
||||
commonRevRequest.applicationName = userPrefStore.getSelApp.internal_name;
|
||||
commonRevRequest.applicationProjectName = userPrefStore.selectedProject.internal_name;
|
||||
|
||||
ApplicationCodeService.doRevEngForSingleClass(commonRevRequest)
|
||||
.then(response => {
|
||||
if (response.data !== "KO") {
|
||||
startPolling(response.data);
|
||||
} else {
|
||||
toast.add({
|
||||
severity: 'error',
|
||||
summary: 'Errore',
|
||||
detail: 'Si è verificato un errore. Riprova più tardi.',
|
||||
life: 3000
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/*const openToastRE = () => {
|
||||
confirm.require({
|
||||
message: 'Do you want to proceed for the Reverse Engeeniring for this class?',
|
||||
header: 'RE Confirmation',
|
||||
@@ -196,8 +283,7 @@ const doREClass = () => {
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
}*/
|
||||
// Function to start polling
|
||||
function startPolling(processId) {
|
||||
// Set polling interval (every 5 seconds in this case)
|
||||
@@ -257,7 +343,7 @@ axios.get('/java-re-module/getProgressRevSingleClass/'+processId).then(response
|
||||
}
|
||||
|
||||
function tabUpdate(value) {
|
||||
console.log(value);
|
||||
console.log("tab update: ",value);
|
||||
if ((value === 'class-description' || value ==='class-code') && classLoaded.value === false) {
|
||||
loadClassDetails()
|
||||
}
|
||||
@@ -273,7 +359,7 @@ function updateSelectedMethod(value) {
|
||||
}
|
||||
loadingMethod.value = true;
|
||||
axios.get("/source-module/getMethodDetailedInfo?methodName=" + value.value ).then(resp => {
|
||||
console.log(resp.data);
|
||||
console.log("updateSelectedMethod",resp.data);
|
||||
selectedMethodDetails.value = resp.data;
|
||||
loadingMethod.value = false;
|
||||
})
|
||||
@@ -296,9 +382,13 @@ function loadClassDetails() {
|
||||
|
||||
function createMethodList() {
|
||||
let methods = [];
|
||||
console.log("classDetails.value.methods", classDetails.value.methods);
|
||||
classDetails.value.methods.forEach(method => {
|
||||
methods.push({name: method.split(".").slice(-1)[0], value: method});
|
||||
});
|
||||
console.log("methods", methods);
|
||||
methods.sort((a, b) => a.name.localeCompare(b.name));
|
||||
console.log("methods ordered", methods);
|
||||
return methods;
|
||||
}
|
||||
|
||||
@@ -307,4 +397,6 @@ function createMethodList() {
|
||||
<style>
|
||||
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
@@ -24,8 +24,8 @@ export const ScenarioService = {
|
||||
getScenariosForRE(){
|
||||
return axios.get('/getScenariosForRE')
|
||||
},
|
||||
updateScenarioExecRating(data) {
|
||||
return axios.post('/updateRating', data)
|
||||
updateScenarioExecRating(id, rating) {
|
||||
return axios.get('/updateRating?id=' + id + '&rating=' + rating)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@ export const ScenarioStore = defineStore('scenario_store', () => {
|
||||
const filterString = ref('')
|
||||
const allScenarios = ref([])
|
||||
const typeFilter = ref({ name: 'All', value: 'all' })
|
||||
const scenariosForRE = ref([])
|
||||
|
||||
const userPrefStore = UserPrefStore()
|
||||
const loadingStore = LoadingStore()
|
||||
@@ -28,6 +29,15 @@ export const ScenarioStore = defineStore('scenario_store', () => {
|
||||
|
||||
}
|
||||
|
||||
async function fetchScenariosForRE() {
|
||||
loadingStore.scenario_loading = true;
|
||||
await ScenarioService.getScenariosForRE().then(resp => {
|
||||
scenariosForRE.value = resp.data;
|
||||
loadingStore.scenario_loading = false;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
async function fetchScenariosCross() {
|
||||
loadingStore.scenario_loading = true;
|
||||
await ScenarioService.getScenariosCross().then(resp => {
|
||||
@@ -55,6 +65,7 @@ export const ScenarioStore = defineStore('scenario_store', () => {
|
||||
return allScenarios.value
|
||||
})
|
||||
|
||||
|
||||
const filteredScenarios = computed(() => {
|
||||
console.log("scenarios", allScenarios.value);
|
||||
var filteredScenario = []
|
||||
@@ -87,5 +98,5 @@ export const ScenarioStore = defineStore('scenario_store', () => {
|
||||
fetchScenarios,
|
||||
fetchApplicationScenarios,
|
||||
scenarios,
|
||||
filterString , typeFilter, fetchScenariosCross, globalScenarios}
|
||||
filterString , typeFilter, fetchScenariosCross, globalScenarios, fetchScenariosForRE, scenariosForRE}
|
||||
})
|
||||
@@ -10,6 +10,7 @@ export const UserPrefStore = defineStore('userpref_store', () => {
|
||||
const userLoaded = ref(false)
|
||||
const selectedApp = ref(null)
|
||||
const loadingStore = LoadingStore()
|
||||
const selectedFileRE = ref(null)
|
||||
|
||||
|
||||
async function fetchUserData(){
|
||||
@@ -61,6 +62,10 @@ export const UserPrefStore = defineStore('userpref_store', () => {
|
||||
}
|
||||
});
|
||||
|
||||
async function setSelectedFile(file){
|
||||
selectedFileRE.value = file;
|
||||
}
|
||||
|
||||
const getSelProj = computed(() => {
|
||||
return selectedProject.value
|
||||
})
|
||||
@@ -69,7 +74,11 @@ export const UserPrefStore = defineStore('userpref_store', () => {
|
||||
return selectedApp.value
|
||||
})
|
||||
|
||||
|
||||
|
||||
return { user,fetchUserData,userLoaded,selectedProject,availableApp,getSelApp,setSelectedApp,selectedApp, updateSelectedProject,getSelProj }
|
||||
const getSelFile = computed(() => {
|
||||
return selectedFileRE.value
|
||||
})
|
||||
|
||||
|
||||
|
||||
return {getSelFile, user,selectedFileRE,fetchUserData,userLoaded,selectedProject,availableApp,getSelApp,setSelectedApp,selectedApp, updateSelectedProject,getSelProj, setSelectedFile }
|
||||
})
|
||||
@@ -40,10 +40,11 @@
|
||||
import FileFlowViewer from '@/components/FileFlowViewer.vue';
|
||||
import { ApplicationCodeService } from '@/service/ApplicationCodeService';
|
||||
import { LoadingStore } from '@/stores/LoadingStore.js';
|
||||
import { ScenarioStore } from '@/stores/ScenarioStore.js';
|
||||
import { UserPrefStore } from '@/stores/UserPrefStore.js';
|
||||
import Tree from 'primevue/tree';
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { UserPrefStore } from '@/stores/UserPrefStore.js';
|
||||
|
||||
const nodes = ref(null)
|
||||
const expandedKeys = ref({});
|
||||
@@ -51,10 +52,13 @@ const selectedFile = ref({})
|
||||
const router = useRouter();
|
||||
const userPrefStore = UserPrefStore();
|
||||
const loadingStore = LoadingStore()
|
||||
const scenario_store = ScenarioStore();
|
||||
|
||||
onMounted(() => {
|
||||
console.log("Mounted")
|
||||
fetchApplicationData();
|
||||
scenario_store.fetchScenariosForRE();
|
||||
|
||||
})
|
||||
|
||||
function fetchApplicationData() {
|
||||
@@ -88,6 +92,8 @@ function onNodeSelect(e){
|
||||
if(e.icon == "pi pi-fw pi-file"){
|
||||
selectedFile.value = e.key
|
||||
}
|
||||
userPrefStore.setSelectedFile(e.label)
|
||||
console.log("user pref store file", userPrefStore.getSelFile)
|
||||
console.log(e)
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user