Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update UI File / UI Build file #94

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions applicationFE/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"application-manager-ui": "file:",
"axios": "^1.7.2",
"bootstrap": "^5.3.0",
"bootstrap-icons": "^1.11.3",
"lodash": "^4.17.21",
"pinia": "^2.1.7",
"tabulator-tables": "^6.2.1",
Expand Down
1 change: 1 addition & 0 deletions applicationFE/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ app.use(Toast, {});

import 'bootstrap/dist/css/bootstrap.min.css'
import 'bootstrap/dist/js/bootstrap.bundle.min.js'
import 'bootstrap-icons/font/bootstrap-icons.css';

app.mount('#app')

398 changes: 198 additions & 200 deletions applicationFE/src/views/softwareCatalog/SoftwareCatalogList.vue

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,35 @@
</div>
</div>
</div>

<!-- <div class="mb-3">
<label class="form-label">HPA (For K8S)</label>
<div style="display: flex; justify-content: space-between;">
<div>
<label class="form-label required">minReplicas</label>
<input type="number" class="form-control w-90-per" placeholder="1" v-model="catalogDto.hpaMinReplicas" />
</div>
<div>
<label class="form-label required">maxReplicas</label>
<input type="number" class="form-control w-90-per" placeholder="10" v-model="catalogDto.hpaMaxReplicas" />
</div>
<div>
<div>
<input class="form-check-input mr-5" type="checkbox" v-model="checkedHPACpu" />
<label class="form-check-label d-inline">CPU (%)</label>
</div>
<input type="number" class="form-control w-80-per d-inline" placeholder="60" v-model="catalogDto.hpaCpuUtilization" :disabled="!checkedHPACpu"/> %
</div>
<div>
<div>
<input class="form-check-input mr-5" type="checkbox" v-model="checkedHPAMemory" />
<label class="form-check-label d-inline" >MEMORY (%)</label>
</div>
<input type="number" class="form-control w-80-per d-inline" placeholder="80" v-model="catalogDto.hpaMemoryUtilization" :disabled="!checkedHPAMemory"/> %
</div>
</div>
</div> -->

<div class="row" id="sc-ref" v-for="(ref, idx) in refData" :key="idx">
<div class="col-lg-6">
<div class="mb-3">
Expand Down Expand Up @@ -142,6 +171,9 @@ const catalogDto = ref({} as any);
const refData = ref([] as any)
const files = ref([] as any)

const checkedHPACpu = ref(false as boolean)
const checkedHPAMemory = ref(false as boolean)

const splitUrl = window.location.host.split(':');
const baseUrl = window.location.protocol + '//' + splitUrl[0] + ':18084'
// const baseUrl = "http://15.164.227.13:18084";
Expand All @@ -162,25 +194,34 @@ const setInit = async () => {
if(props.mode == 'update') {
await _getSoftwareCatalogDetail()
} else {
catalogDto.value = {
catalogDto.value = {
"catalogIdx": null,
"catalogTitle": "",
"catalogDescription": "",
"catalogSummary": "",
"catalogCategory": "",
"catalogRefData": [],

"recommendedCpu": "",
"recommendedMemory": "",
"recommendedDisk": "",

"hpaMinReplicas": "",
"hpaMaxReplicas": "",
"hpaCpuUtilization": "",
"hpaMemoryUtilization": "",
}
refData.value = [];
refData.value.push(
{
"catalogRefIdx": null,
"catalogIdx": null,
"catalogTitle": "",
"catalogDescription": "",
"catalogSummary": "",
"catalogCategory": "",
"catalogRefData": []
"referncetIdx": 0,
"referenceValue": "",
"referenceDescription": "",
"referenceType": "URL"
}
refData.value = [];
refData.value.push(
{
"catalogRefIdx": null,
"catalogIdx": null,
"referncetIdx": 0,
"referenceValue": "",
"referenceDescription": "",
"referenceType": "URL"
}
)
)
}
}

Expand All @@ -201,72 +242,71 @@ const _getSoftwareCatalogDetail = async () => {
}

const addRef = () => {
console.log("addRef");
refData.value.push({
"catalogRefIdx": null,
"catalogIdx": null,
"referncetIdx": 0,
"referenceValue": "",
"referenceDescription": "",
"referenceType": "URL"
})
// location.reload()
console.log("addRef");
refData.value.push({
"catalogRefIdx": null,
"catalogIdx": null,
"referncetIdx": 0,
"referenceValue": "",
"referenceDescription": "",
"referenceType": "URL"
})
// location.reload()
}
const removeRef = (idx:number) => {
if(refData.value.length !== 1) {
refData.value.splice(idx, 1)
}
if(refData.value.length !== 1) {
refData.value.splice(idx, 1)
}
}

const handleFileChange = (event: any) => {
files.value = event.target.files[0];
}

const createSoftwareCatalog = async () => {
const formData = new FormData();
formData.append('iconFile', files.value);

catalogDto.value.catalogRefData = refData.value;
formData.append('catalogDto', new Blob([JSON.stringify(catalogDto.value)], {
type: 'application/json'
}));

if(props.mode == 'new') {
const response = await axios.post(baseUrl + '/catalog/software', formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
});

if(response.data) {
if(response.data.data == null) {
toast.error('등록 할 수 없습니다.')
setInit();
} else {
toast.success('등록되었습니다.')
emit('get-list')
}
} else {
toast.error('등록 할 수 없습니다.')
setInit();
}
const formData = new FormData();
formData.append('iconFile', files.value);

catalogDto.value.catalogRefData = refData.value;
formData.append('catalogDto', new Blob([JSON.stringify(catalogDto.value)], {
type: 'application/json'
}));

if(props.mode == 'new') {
const response = await axios.post(baseUrl + '/catalog/software', formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
});

if(response.data) {
if(response.data.data == null) {
toast.error('등록 할 수 없습니다.')
setInit();
} else {
const response = await axios.put(baseUrl + '/catalog/software', formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
});

if(response.data) {
toast.success('수정되었습니다.')
emit('get-list')
} else {
toast.error('수정 할 수 없습니다.')
setInit();
}
toast.success('등록되었습니다.')
emit('get-list')
}
} else {
toast.error('등록 할 수 없습니다.')
setInit();
}

} else {
const response = await axios.put(baseUrl + '/catalog/software', formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
});

if(response.data) {
toast.success('수정되었습니다.')
emit('get-list')
} else {
toast.error('수정 할 수 없습니다.')
setInit();
}
}
}

</script>
Expand All @@ -277,10 +317,16 @@ const createSoftwareCatalog = async () => {
gap: 10px;
margin-bottom: 10px;
}
.w-50-per {
width: 50% !important;
}
.w-80-per {
width: 80% !important;
}
.w-90-per {
width: 90% !important;
}
.mr-5 {
margin-right: 5px;
}
</style>
Loading