-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: xls import was emptying the datasheet before import
- Loading branch information
1 parent
38587cd
commit cb0a75f
Showing
4 changed files
with
1,110 additions
and
1,103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,68 @@ | ||
import _ from 'lodash'; | ||
|
||
import request from 'request-promise'; | ||
|
||
import { Governance } from '../models'; | ||
import PickListStub from '../models/governance/governance.stub.json'; | ||
import { getConfig } from '../utils/config-loader'; | ||
import { logger } from '../config/logger.cjs'; | ||
|
||
const { USE_SIMULATOR, CHIA_NETWORK } = getConfig().APP; | ||
const { TESTNET_DEFAULT_ORGANIZATIONS } = getConfig().TESTNET; | ||
|
||
let downloadedPickList = {}; | ||
export const getPicklistValues = () => downloadedPickList; | ||
|
||
export const pullPickListValues = async () => { | ||
if (USE_SIMULATOR) { | ||
downloadedPickList = PickListStub; | ||
} else { | ||
const goveranceData = await Governance.findOne({ | ||
where: { metaKey: 'pickList' }, | ||
raw: true, | ||
}); | ||
|
||
if (_.get(goveranceData, 'metaValue')) { | ||
downloadedPickList = JSON.parse(goveranceData.metaValue); | ||
} | ||
} | ||
|
||
return downloadedPickList; | ||
}; | ||
|
||
export const getDefaultOrganizationList = async () => { | ||
if (USE_SIMULATOR || CHIA_NETWORK === 'testnet') { | ||
const options = { | ||
method: 'GET', | ||
url: TESTNET_DEFAULT_ORGANIZATIONS, | ||
}; | ||
|
||
return JSON.parse(await request(Object.assign({}, options))); | ||
} else { | ||
const goveranceData = await Governance.findOne({ | ||
where: { metaKey: 'orgList' }, | ||
raw: true, | ||
}); | ||
|
||
return JSON.parse(_.get(goveranceData, 'metaValue', '[]')); | ||
} | ||
}; | ||
|
||
export const serverAvailable = async (server, port) => { | ||
const options = { | ||
method: 'GET', | ||
url: `http://${server}:${port}`, | ||
}; | ||
|
||
try { | ||
await request(Object.assign({}, options)); | ||
return true; | ||
} catch (err) { | ||
if (JSON.stringify(err).includes('Python')) { | ||
logger.info(`SERVER IS AVAILABLE ${server}`); | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
}; | ||
import _ from 'lodash'; | ||
|
||
import request from 'request-promise'; | ||
|
||
import { Governance } from '../models'; | ||
import PickListStub from '../models/governance/governance.stub.json'; | ||
import { getConfig } from '../utils/config-loader'; | ||
import { logger } from '../config/logger.cjs'; | ||
|
||
const { USE_SIMULATOR, CHIA_NETWORK } = getConfig().APP; | ||
const { TESTNET_DEFAULT_ORGANIZATIONS } = getConfig().TESTNET; | ||
|
||
let downloadedPickList = {}; | ||
export const getPicklistValues = () => downloadedPickList; | ||
|
||
export const pullPickListValues = async () => { | ||
if (USE_SIMULATOR || CHIA_NETWORK === 'testnet') { | ||
downloadedPickList = PickListStub; | ||
} else { | ||
const goveranceData = await Governance.findOne({ | ||
where: { metaKey: 'pickList' }, | ||
raw: true, | ||
}); | ||
|
||
if (_.get(goveranceData, 'metaValue')) { | ||
downloadedPickList = JSON.parse(goveranceData.metaValue); | ||
} | ||
} | ||
|
||
return downloadedPickList; | ||
}; | ||
|
||
export const getDefaultOrganizationList = async () => { | ||
if (USE_SIMULATOR || CHIA_NETWORK === 'testnet') { | ||
const options = { | ||
method: 'GET', | ||
url: TESTNET_DEFAULT_ORGANIZATIONS, | ||
}; | ||
|
||
return JSON.parse(await request(Object.assign({}, options))); | ||
} else { | ||
const goveranceData = await Governance.findOne({ | ||
where: { metaKey: 'orgList' }, | ||
raw: true, | ||
}); | ||
|
||
return JSON.parse(_.get(goveranceData, 'metaValue', '[]')); | ||
} | ||
}; | ||
|
||
export const serverAvailable = async (server, port) => { | ||
const options = { | ||
method: 'GET', | ||
url: `http://${server}:${port}`, | ||
}; | ||
|
||
try { | ||
await request(Object.assign({}, options)); | ||
return true; | ||
} catch (err) { | ||
if (JSON.stringify(err).includes('Python')) { | ||
logger.info(`SERVER IS AVAILABLE ${server}`); | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
}; |
Oops, something went wrong.