Last active
July 31, 2019 01:13
-
-
Save klauszhang/1ad32faaf5b7177a16a684836cf08282 to your computer and use it in GitHub Desktop.
Migrate gitlab variables
This file contains hidden or 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
// read value | |
JSON.stringify( | |
[...document.getElementsByClassName('js-row')].map(el => { | |
const key = el.querySelector('.js-ci-variable-input-key').value | |
const { value } = el.querySelector('textarea.js-ci-variable-input-value') | |
return [key, value] | |
}) | |
) | |
const result=[[]] //whatever from last step | |
// write value from last step (you need to create rows fist) | |
result.forEach((setting, index) => { | |
document.querySelectorAll('.js-row .js-ci-variable-input-key')[index].value = | |
setting[0] | |
document.querySelectorAll('.js-row textarea.js-ci-variable-input-value')[ | |
index | |
].value = setting[1] | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment