# Tizen Image Configurator
-# Install
-Install command
+## Install
-- npm install
-- ./node_modules/bower/bin/bower install
-- ./node_modules/gulp/bin/gulp.js
+>
+ npm install
+ ./node_modules/bower/bin/bower install
+ ./node_modules/gulp/bin/gulp.js
-# Run
-Run command
+## Run
-- ./node_modules/pm2/bin/pm2 start app.js
+>
+ ./node_modules/pm2/bin/pm2 start app.js
-# PM2 Options
+### PM2 Options
- ./node_modules/pm2/bin/pm2 start app.js -i 0
- ./node_modules/pm2/bin/pm2 stop all
- ./node_modules/pm2/bin/pm2 delete all
- ./node_modules/pm2/bin/pm2 start app.js --watch
-- https://github.com/Unitech/pm2#commands-overview
\ No newline at end of file
+- https://github.com/Unitech/pm2#commands-overview
+
+
+## Proxy Settings
+### NPM proxy
+
+>
+ npm config set proxy http://yourProxy:yourPort
+ npm config set https-proxy https://yourProxy:yourPort
+ npm config set strict-ssl false
+ npm config set registry http://registry.npmjs.org/
+
+### Bower proxy
+
+- Edit for .bowerrc file
+
+>
+ {
+ "directory": "bower_components",
+ "proxy": "http://yourProxy:yourPort",
+ "https-proxy":"https://yourProxy:yourPort",
+ "strict-ssl": false
+ }
"jquery": "~3.1.1",
"express": "~4.14.0",
"body-parser": "~1.15.2",
- "socket.io": "~1.6.0"
+ "socket.io": "~1.6.0",
+ "mime": "~1.3.4"
},
"devDependencies": {
"bower": "~1.8.0",
<div class="panel-heading">Image List</div>
<div class="panel-body">
<div class="infoboxheader">
- <h4>create a image</h4>
+ <h4>Create a image</h4>
</div>
<div class="infobox info" id="tic-image-new">
- <div id="tic-image-new-log">
- </div>
+ <div id="tic-image-new-log"></div>
</div>
<div class="infoboxheader">
- <h4>image list</h4>
+ <h4>Image File list</h4>
</div>
<ul class="list-group" id="tic-image-list"></ul>
</div>
</div><!-- /End Image List Column -->
</div>
</div><!-- /.container -->
- <!-- modal -->
- <div class="modal fade" id="confirmModalCreateImage" role="dialog">
- <div class="modal-dialog modal-sm">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal">×</button>
- <h4 class="modal-title">Create a new Image</h4>
- </div>
- <div class="modal-body">
- <p>Are you sure ?</p>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
- <button type="button" class="btn btn-primary">Ok</button>
- </div>
- </div>
- </div>
- </div>
</section>
</div><!-- /End Loading Dialog -->
<!-- Alert Dialog -->
- <div class="modal fade" id="tic-alert-dialog" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static">
+ <div class="modal fade" id="tic-alert-dialog" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-body">
</div>
</div>
</div>
- </div>><!-- /End Alert Dialog -->
+ </div><!-- /End Alert Dialog -->
+
+ <!-- Confirm Dialog -->
+ <div class="modal fade" id="tic-confirm-dialog" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static">
+ <div class="modal-dialog modal-sm">
+ <div class="modal-content">
+ <div class="modal-body">
+ <p id="tic-confirm-content"></p>
+ </div>
+ <div class="modal-footer">
+ <button id="tic-confirm-ok" type="button" class="btn btn-primary" data-dismiss="modal">OK</button>
+ <button id="tic-confirm-cancel" type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>
+ </div>
+ </div>
+ </div>
+ </div><!-- /End Confirm Dialog -->
<!-- library loading -->
liElem.setAttribute('class', 'list-group-item image-item');
spanElem = document.createElement('span');
- spanElem.innerText = '(' + file.size + 'B / ' + file.mtime + ')';
+ spanElem.innerText = '(' + Util.bytesToSize(file.size) + ' / ' + file.mtime + ')';
spanElem.setAttribute('class', 'image-list-time');
aElem = document.createElement('a');
}
function confirmCreateImage() {
- var isOk;
-
$('#tic-image-create').prop('disabled', true);
// when packages are checked nothing
var elem = document.createElement('p');
elem.innerText = data;
tableDomElem.append(elem);
+ $('#tic-image-new').animate({ scrollTop : $('#tic-image-new').height() }, 'slow');
});
// when finished
client.on('ws/fs/image/add/finished', function (data) {
$('#tic-image-create').prop('disabled', false);
- $('#tic-image-new').empty();
+ $('#tic-image-new-log').empty();
updateList();
});
}
* $('#confirmModalCreateImage').modal('show');
*/
// confirm
- isOk = window.confirm('Are you sure?');
- if (isOk) {
+ Util.showConfirmDialog('Are you sure?')
+ .then(function () {
getKickstartRecipeFile()
- .then(createImage)
- .catch(function (err) {
- console.log(err);
- Util.showLoadingDialog(false);
- Util.showAlertDialog('Failed to create a image.<br>Please check the ks file.');
- });
- } else {
+ .then(createImage)
+ .catch(function (err) {
+ console.error(err);
+ Util.showAlertDialog('Failed to create a image.<br>Please check the ks file.');
+ $('#tic-image-create').prop('disabled', false);
+ });
+ })
+ .catch(function () {
$('#tic-image-create').prop('disabled', false);
- }
+ });
}
/**
$('#tic-alert-dialog').modal('show');
}
+ function showConfirmDialog(content) {
+ return new Promise(function (resolve, reject) {
+ $('#tic-confirm-content').html(content);
+ $('#tic-confirm-ok').on('click', function () {
+ resolve();
+ })
+ $('#tic-confirm-cancel').on('click', function () {
+ reject();
+ })
+ $('#tic-confirm-dialog').modal('show');
+ });
+ }
+
function bytesToSize(bytes) {
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
if (bytes == 0) {
*/
showAlertDialog: showAlertDialog,
+ /**
+ * Display the confirm dialog.
+ * @method showLoadingDialog
+ * @param {string} content in dialog
+ * @return Promise
+ */
+ showConfirmDialog: showConfirmDialog,
+
/*
* Convert size in bytes to KB, MB, GB, TB
* {@link http://stackoverflow.com/questions/15900485/correct-way-to-convert-size-in-bytes-to-kb-mb-gb-in-javascript}