Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
@download-root-certificate="downloadRootCertificate"
@delete-certificate="deleteCertificate"
@set-root-certificate="setRootCertificate"
@handle-file-import="handleFileImport"
@upload-certificate="uploadCertificate"
>
<template #actions="{ newSettings, isDirty, validate }">
<u-btn :min-width="null" :disabled="!isDirty" @click="onSaveSettings(newSettings, validate)">{{
Expand All @@ -22,6 +24,7 @@
import settingsMixin from '../settingsMixin'
import Rpc from '../../../util/Rpc'
import Util from '@/util/util'
import util from '@/util/setupUtil'

export default {
components: { SettingsAdministration },
Expand Down Expand Up @@ -159,7 +162,7 @@
this.$vuntangle.toast.add(this.$t('an_error_occurred'), 'error')
}
} catch (ex) {
Util.handleException(ex)
util.handleException(ex)
}
},

Expand Down Expand Up @@ -284,7 +287,7 @@
await this.loadCertificates(true)
cb(null, true) // success
} catch (err) {
Util.handleException(err)
util.handleException(err)
cb(err, false) // error
}
}
Expand All @@ -299,7 +302,7 @@
'root_certificate.crt',
)
} catch (err) {
Util.handleException(err)
util.handleException(err)
}
},

Expand All @@ -314,7 +317,7 @@
await this.loadCertificates(true)
cb(null, true) // success
} catch (err) {
Util.handleException(err)
util.handleException(err)
cb(err, false) // error
}
},
Expand All @@ -339,11 +342,71 @@
}
cb(null, true) // success
} catch (err) {
Util.handleException(err)
util.handleException(err)
cb(err, false) // error
}
},

/**
* Handles file import for certificates.
* This function uploads a certificate file to the server.
* @param {Object} payload - The payload object.
* @param {File} payload.file - The file to be imported.
* @param {string} payload.argument - Additional argument for the upload.
* @param {Function} payload.cb - Callback function to handle the response.
*/
async handleFileImport({ file, argument, cb }) {
if (!file) {
this.$vuntangle.toast.add(this.$t('please_choose_a_file'), 'error')
return
}

try {
const response = await Util.uploadFile('/admin/upload', {
filename: file,
argument,
formName: 'upload_form',
type: 'certificate_upload',
})
const parseData = response?.msg ? JSON.parse(response.msg) : {}
cb(parseData)
} catch (err) {
util.handleException(err)
}
},

/**
* Uploads a certificate to the server using an RPC call.
* This function is used to upload a certificate with its key and other data.
* @param {Object} payload - The payload object.
* @param {string} payload.certMode - The certificate mode (e.g., 'ROOT').
* @param {Function} payload.cb - Callback function to handle success or error.
*/
async uploadCertificate({ certMode, certData, keyData, extraData, cb }) {
try {
const response = await Rpc.asyncData(
'rpc.UvmContext.certificateManager.uploadCertificate',
certMode,
certData,
keyData,
extraData,
)

if (response.result !== 0) {
cb(response.output, false)
return
}

if (certMode === 'ROOT') {
await this.loadCertificates(true)
}

cb(response.output, true)
} catch (err) {
util.handleException(err)
cb(err, false)
}
},
/* Optional hook triggered on browser refresh.
*/
onBrowserRefresh() {
Expand Down
22 changes: 11 additions & 11 deletions untangle-vue-ui/source/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2501,9 +2501,9 @@ base@^0.11.1:
pascalcase "^0.1.1"

baseline-browser-mapping@^2.9.0:
version "2.9.8"
resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.9.8.tgz#04fb5c10ff9c7a1b04ac08cfdfc3b10942a8ac72"
integrity sha512-Y1fOuNDowLfgKOypdc9SPABfoWXuZHBOyCS4cD52IeZBhr4Md6CLLs6atcxVrzRmQ06E7hSlm5bHHApPKR/byA==
version "2.9.11"
resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.9.11.tgz#53724708c8db5f97206517ecfe362dbe5181deea"
integrity sha512-Sg0xJUNDU1sJNGdfGWhVHX0kkZ+HWcvmVymJbj6NSgZZmW/8S9Y2HQ5euytnIgakgxN6papOAWiwDo1ctFDcoQ==

batch-processor@1.0.0:
version "1.0.0"
Expand Down Expand Up @@ -2709,9 +2709,9 @@ caniuse-lite@^1.0.30001726:
integrity sha512-uhE1Ye5vgqju6OI71HTQqcBCZrvHugk0MjLak7Q+HfoBgoq5Bi+5YnwjP4fjDgrtYr/l8MVRBvzz9dPD4KyK0A==

caniuse-lite@^1.0.30001759:
version "1.0.30001760"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001760.tgz#bdd1960fafedf8d5f04ff16e81460506ff9b798f"
integrity sha512-7AAMPcueWELt1p3mi13HR/LHH0TJLT11cnwDJEs3xA4+CK/PLKeO9Kl1oru24htkyUKtkGCvAx4ohB0Ttry8Dw==
version "1.0.30001761"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001761.tgz#4ca4c6e3792b24e8e2214baa568fc0e43de28191"
integrity sha512-JF9ptu1vP2coz98+5051jZ4PwQgd2ni8A+gYSN7EA7dPKIMf0pDlSUxhdmVOaV3/fYK5uWBkgSXJaRLr4+3A6g==

case-sensitive-paths-webpack-plugin@^2.3.0:
version "2.4.0"
Expand Down Expand Up @@ -7858,9 +7858,9 @@ validate-npm-package-license@^3.0.1:
spdx-expression-parse "^3.0.0"

validator@^13.11.0:
version "13.15.23"
resolved "https://registry.yarnpkg.com/validator/-/validator-13.15.23.tgz#59a874f84e4594588e3409ab1edbe64e96d0c62d"
integrity sha512-4yoz1kEWqUjzi5zsPbAS/903QXSYp0UOtHsPpp7p9rHAw/W+dkInskAE386Fat3oKRROwO98d9ZB0G4cObgUyw==
version "13.15.26"
resolved "https://registry.yarnpkg.com/validator/-/validator-13.15.26.tgz#36c3deeab30e97806a658728a155c66fcaa5b944"
integrity sha512-spH26xU080ydGggxRyR1Yhcbgx+j3y5jbNXk/8L+iRvdIEQ4uTRH2Sgf2dokud6Q4oAtsbNvJ1Ft+9xmm6IZcA==

vary@~1.1.2:
version "1.1.2"
Expand Down Expand Up @@ -8004,8 +8004,8 @@ vuex@^3.6.2:
integrity sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==

vuntangle@untangle/vuntangle:
version "1.60.29"
resolved "git+ssh://git@github.com/untangle/vuntangle.git#d04565195a530a7d66c90d64944eabec6dc86060"
version "1.60.34"
resolved "git+ssh://git@github.com/untangle/vuntangle.git#505e6aac2c0f5f2689ab63b4161720b8d24c49f0"
dependencies:
"@ag-grid-community/client-side-row-model" "^25.3.0"
"@ag-grid-community/core" "^25.3.0"
Expand Down