Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Popup display in model and segment app #382

Merged
merged 11 commits into from
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions apps/model/model.css
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,14 @@ ul.disabled {
font-size: 14px;
cursor: pointer;
}
.btn-final-change{
background-color: rgb(138, 175, 35);
border: none;
color: white;
padding: 12px 16px;
font-size: 14px;
cursor: pointer;
}
body{
color: black;
}
13 changes: 11 additions & 2 deletions apps/model/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ function showNewClassInput(name) {
const self = $UI.chngClassLst;
self.body.innerHTML = `
<input id ="new_classList" type="text"/>
<button class="btn btn-primary btn-xs my-xs-btn" id="chngbtn" type="button">Change Class List</button>
<button class="btn btn-primary btn-xs my-xs-btn btn-final-change" id='chngbtn' type="button">Change Class List</button>
`;
$UI.chngClassLst.open(); // Open the box to take input from user
document.getElementById('chngbtn').addEventListener('click', () => {
Expand All @@ -861,7 +861,16 @@ async function changeClassList(newList, name) {
};
}
}
alert('Classes Changed');
let popups = document.getElementById('popup-container');
if (popups.childElementCount < 2) {
let popupBox = document.createElement('div');
popupBox.classList.add('popup-msg', 'slide-in');
popupBox.innerHTML = `<i class="small material-icons">info</i>` + ` Classes changed successfuly`;
popups.insertBefore(popupBox, popups.childNodes[0]);
setTimeout(function() {
popups.removeChild(popups.lastChild);
}, 3000);
}
}

function openHelp() {
Expand Down
3 changes: 3 additions & 0 deletions apps/segment/segment.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
<link rel='stylesheet' type='text/css' media='all' href='../../components/spyglass/spyglass.css'/>
<!-- modal box -->
<link rel="stylesheet" type="text/css" media="all" href="../../components/modalbox/modalbox.css" />
<!-- Popup -->
<link rel="stylesheet" type="text/css" media="all" href="../../css/popup.css" />
<!-- UI components css END -->

<!-- osd & core css START -->
Expand Down Expand Up @@ -160,6 +162,7 @@
<div id='main_viewer' class='main'></div>
<div id="model_info"></div>
<div id="upload_panel"></div>
<div id="popup-container"></div>
</body>

<script src='segment.js'></script>
Expand Down
29 changes: 24 additions & 5 deletions apps/segment/segment.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,9 +631,19 @@ function uploadModel() {
const req = store.put(data);
req.onsuccess = function(e) {
console.log('SUCCESS, ID:', e.target.result);
status.innerHTML = 'Done! Click refresh below.';
status.classList.remove('blink');
modelName.push(_name.value);
let popups = document.getElementById('popup-container');
if (popups.childElementCount < 2) {
let popupBox = document.createElement('div');
popupBox.classList.add('popup-msg', 'slide-in');
popupBox.innerHTML = `<i class="small material-icons">info</i>` + _name.value + ` model uploaded sucessfully`;
popups.insertBefore(popupBox, popups.childNodes[0]);
setTimeout(function() {
popups.removeChild(popups.lastChild);
}, 3000);
}
$UI.uploadModal.close();
initUIcomponents();
};
req.onerror = function(e) {
status.innerHTML = 'Some error this way!';
Expand Down Expand Up @@ -1123,9 +1133,19 @@ async function deleteModel(name) {
alert(err);
} finally {
if (status) {
alert('Deleted', name);
showInfo();
modelName.splice(modelName.indexOf(name.split('_').splice(1).join('_').slice(0, -3)), 1);
let popups = document.getElementById('popup-container');
if (popups.childElementCount < 2) {
let popupBox = document.createElement('div');
popupBox.classList.add('popup-msg', 'slide-in');
popupBox.innerHTML = `<i class="small material-icons">info</i>` + modelName + ` model deleted successfully`;
popups.insertBefore(popupBox, popups.childNodes[0]);
setTimeout(function() {
popups.removeChild(popups.lastChild);
}, 3000);
}
$UI.infoModal.close();
initUIcomponents();
}
}
} else {
Expand All @@ -1141,7 +1161,6 @@ async function showInfo() {
var tx = db.transaction('models_store', 'readonly');
var store = tx.objectStore('models_store');
var modelCount=0;

empty(table);
// Update table data
(function(callback) {
Expand Down