Skip to content

Commit

Permalink
update uid
Browse files Browse the repository at this point in the history
Signed-off-by: SamiulSourav <[email protected]>
  • Loading branch information
SamiulSourav committed Oct 16, 2024
1 parent 43afa2b commit 4885b81
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
let invokerData = []

function initName({ model, getValue, commit }) {
const invoker = getValue(model, '/spec/invoker/name')
const session = getValue(model, '/spec/session')
const invoker = getValue(model, '/spec/invoker/name') || ''
const session = getValue(model, '/spec/session') || ''
let name = ''
if (invoker && session) name = `${invoker}-${session}-${Date.now()}`
else name = ''
Expand All @@ -11,6 +11,14 @@ function initName({ model, getValue, commit }) {
value: name,
force: true,
})

const found = invokerData.find((item) => item.metadata.name === invoker)
const uid = found ? found.metadata?.uid : ''
commit('wizard/model$update', {
path: '/spec/ownerUID',
value: uid,
force: true,
})
}

async function fetchNamespaces({ axios, storeGet }) {
Expand Down Expand Up @@ -45,8 +53,8 @@ async function fetchNamespaces({ axios, storeGet }) {
async function fetchInvokerName({ getValue, model, watchDependency, axios, storeGet }) {
watchDependency('model#/spec/invoker/kind')
watchDependency('model#/metadata/release/namespace')
const namespace = getValue(model, '/metadata/release/namespace')
const kind = getValue(model, '/spec/invoker/kind')
const namespace = getValue(model, '/metadata/release/namespace') || ''
const kind = getValue(model, '/spec/invoker/kind') || ''
const user = storeGet('/route/params/user') || ''
const cluster = storeGet('/route/params/cluster') || ''
const core = 'core.kubestash.com'
Expand All @@ -71,7 +79,7 @@ async function fetchInvokerName({ getValue, model, watchDependency, axios, store

function fetchSessions({ getValue, model, watchDependency }) {
watchDependency('model#/spec/invoker/name')
const invokerName = getValue(model, '/spec/invoker/name')
const invokerName = getValue(model, '/spec/invoker/name') || ''
const found = invokerData.find((item) => item.metadata.name === invokerName)
if (found) return found.spec?.sessions.map((item) => item.name)
return []
Expand Down

0 comments on commit 4885b81

Please sign in to comment.