MCPcopy Create free account
hub / github.com/FSGModding/FSG_Mod_Assistant / gotData

Method gotData

renderer/renderJS/resolve_ui.js:90–156  ·  view source on GitHub ↗
(key)

Source from the content-addressed store, hash-verified

88
89 // MARK: receive data
90 gotData(key) {
91 MA.byIdText('modName', key)
92 window.resolve_IPC.get(key).then((results) => {
93 const sourceMod = this.getMostRecent(results)
94
95 if ( sourceMod === false ) {
96 MA.byId('versionBroken').clsShow()
97 MA.byId('versionInfo').clsHide()
98 return
99 }
100
101 MA.byIdText('newVersion', sourceMod.version)
102
103 const modListDiv = MA.byId('modSet')
104
105 modListDiv.innerHTML = ''
106 for ( const thisMod of results ) {
107 modListDiv.appendChild(this.doLine(thisMod, sourceMod))
108 }
109
110 // MARK: copy button action
111 MA.byIdEventIfExists('copyButton', () => {
112 this.overlay.show()
113 MA.byId('fileOpWorking').clsShow()
114 MA.byId('fileOpSuccess').clsHide()
115 MA.byId('fileOpDanger').clsHide()
116 MA.byId('badFileFeedback').clsHide()
117 const fileOpPacket = []
118 for ( const thisCheck of MA.query('.fileOpCheck:checked') ) {
119 fileOpPacket.push({
120 destinations : [thisCheck.value],
121 source_collectKey : sourceMod.collectKey,
122 source_modUUID : sourceMod.modRecord.uuid,
123 type : 'copy',
124 })
125 }
126 window.resolve_IPC.fileOp(fileOpPacket).then((opResult) => {
127 const didFail = opResult.some((x) => x.status === false )
128 if ( didFail ) {
129 MA.byId('fileOpDanger').clsShow()
130 MA.byId('fileOpWorking').clsHide()
131 MA.byId('badFileFeedback').clsShow()
132 const badFiles = opResult
133 .filter((x) => x.status === false)
134 .map((x) => {
135 if ( x.type === 'delete' ) {
136 return `<i class="bi bi-trash3"></i> ${x.source}`
137 }
138 return `-> ${x.dest}<br>`
139 })
140 MA.byId('badFileList').innerHTML = badFiles.join('')
141 } else {
142 MA.byId('fileOpSuccess').clsShow()
143 MA.byId('fileOpWorking').clsHide()
144 }
145
146 setTimeout(() => {
147 if ( ! didFail ) {

Callers 1

constructorMethod · 0.95

Calls 5

getMostRecentMethod · 0.95
doLineMethod · 0.95
closeMethod · 0.80
getMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected