Move integration + geo-restriction UI to deploy/settings page
User feedback: these settings belong on the Beállítások (settings) page, not the app description/details page. Moves both sections from app_info.html to deploy.html and rewires data in deployHandler instead of appDetailHandler. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -390,6 +390,28 @@ func (s *Server) deployHandler(w http.ResponseWriter, r *http.Request, name stri
|
|||||||
data["BackupDestWarningSeverity"] = health.Severity
|
data["BackupDestWarningSeverity"] = health.Severity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// App-to-app integrations
|
||||||
|
if meta.HasIntegrations() && s.integrationMgr != nil {
|
||||||
|
data["HasIntegrations"] = true
|
||||||
|
data["Integrations"] = s.integrationMgr.ListForProvider(meta.Slug)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Geo-restriction per-app data
|
||||||
|
geo := s.settings.GetGeoRestriction()
|
||||||
|
if geo != nil && geo.Enabled && s.cfg.Infrastructure.CFAPIToken != "" {
|
||||||
|
data["GeoGlobalEnabled"] = true
|
||||||
|
data["GeoGlobalCountries"] = geo.AllowedCountries
|
||||||
|
if ov, ok := geo.AppOverrides[name]; ok {
|
||||||
|
data["GeoAppOverride"] = true
|
||||||
|
data["GeoAppOverrideCountries"] = ov.AllowedCountries
|
||||||
|
} else {
|
||||||
|
data["GeoAppOverrideCountries"] = []string{}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
data["GeoGlobalCountries"] = []string{}
|
||||||
|
data["GeoAppOverrideCountries"] = []string{}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Memory info for deploy page (only for non-deployed apps)
|
// Memory info for deploy page (only for non-deployed apps)
|
||||||
@@ -478,28 +500,6 @@ func (s *Server) appDetailHandler(w http.ResponseWriter, r *http.Request, slug s
|
|||||||
data["HasOptionalConfig"] = found.Meta.HasOptionalConfig()
|
data["HasOptionalConfig"] = found.Meta.HasOptionalConfig()
|
||||||
data["EffectiveSubdomain"] = effectiveSubdomain
|
data["EffectiveSubdomain"] = effectiveSubdomain
|
||||||
|
|
||||||
// App-to-app integrations
|
|
||||||
if found.Meta.HasIntegrations() && s.integrationMgr != nil {
|
|
||||||
data["HasIntegrations"] = true
|
|
||||||
data["Integrations"] = s.integrationMgr.ListForProvider(found.Meta.Slug)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Geo-restriction per-app data
|
|
||||||
geo := s.settings.GetGeoRestriction()
|
|
||||||
if geo != nil && geo.Enabled && s.cfg.Infrastructure.CFAPIToken != "" {
|
|
||||||
data["GeoGlobalEnabled"] = true
|
|
||||||
data["GeoGlobalCountries"] = geo.AllowedCountries
|
|
||||||
if ov, ok := geo.AppOverrides[found.Name]; ok {
|
|
||||||
data["GeoAppOverride"] = true
|
|
||||||
data["GeoAppOverrideCountries"] = ov.AllowedCountries
|
|
||||||
} else {
|
|
||||||
data["GeoAppOverrideCountries"] = []string{}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
data["GeoGlobalCountries"] = []string{}
|
|
||||||
data["GeoAppOverrideCountries"] = []string{}
|
|
||||||
}
|
|
||||||
|
|
||||||
s.executeTemplate(w, r, "app_info", data)
|
s.executeTemplate(w, r, "app_info", data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -179,202 +179,5 @@ async function saveOptionalConfig(stackName) {
|
|||||||
</script>
|
</script>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{if .HasIntegrations}}
|
|
||||||
<div class="app-optional-config">
|
|
||||||
<h3>Integrációk</h3>
|
|
||||||
<p class="config-group-desc">
|
|
||||||
Más telepített alkalmazásokkal való összekapcsolás. Az integráció automatikusan felfüggesztődik, ha bármelyik alkalmazás leáll, és újraaktiválódik indításkor.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
{{range .Integrations}}
|
|
||||||
<div class="config-field" style="display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.75rem 0;border-bottom:1px solid var(--border)">
|
|
||||||
<div style="flex:1">
|
|
||||||
<strong>{{.Label}}</strong>
|
|
||||||
<p class="config-field-help" style="margin:0">{{.Description}}</p>
|
|
||||||
{{if not .TargetDeployed}}
|
|
||||||
<span class="badge badge-muted" style="margin-top:.25rem;display:inline-block">Nincs telepítve</span>
|
|
||||||
{{else if not .TargetRunning}}
|
|
||||||
<span class="badge badge-orphaned" style="margin-top:.25rem;display:inline-block">Célalkalmazás leállítva</span>
|
|
||||||
{{else if eq .Status "error"}}
|
|
||||||
<span class="badge badge-orphaned" style="margin-top:.25rem;display:inline-block">Hiba</span>
|
|
||||||
{{else if .Enabled}}
|
|
||||||
<span class="badge badge-ok" style="margin-top:.25rem;display:inline-block">Aktív</span>
|
|
||||||
{{end}}
|
|
||||||
</div>
|
|
||||||
<label class="toggle">
|
|
||||||
<input type="checkbox"
|
|
||||||
{{if .Enabled}}checked{{end}}
|
|
||||||
{{if not .TargetDeployed}}disabled title="A célalkalmazás nincs telepítve"{{end}}
|
|
||||||
{{if and .TargetDeployed (not .TargetRunning)}}disabled title="A célalkalmazás nem fut"{{end}}
|
|
||||||
onchange="toggleIntegration('{{$.Stack.Name}}', '{{.Target}}', this.checked, this)">
|
|
||||||
<span class="toggle-label"></span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
async function toggleIntegration(provider, target, enable, checkbox) {
|
|
||||||
checkbox.disabled = true;
|
|
||||||
try {
|
|
||||||
var resp = await fetch('/api/integrations/' + provider + '/' + target, {
|
|
||||||
method: 'POST',
|
|
||||||
headers: Object.assign({'Content-Type': 'application/json'}, csrfHeaders()),
|
|
||||||
body: JSON.stringify({enabled: enable})
|
|
||||||
});
|
|
||||||
var data = await resp.json();
|
|
||||||
if (!data.ok) {
|
|
||||||
checkbox.checked = !enable;
|
|
||||||
alert(data.error || 'Hiba történt');
|
|
||||||
} else {
|
|
||||||
// Reload to update status badges
|
|
||||||
setTimeout(function(){ location.reload(); }, 500);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} catch(err) {
|
|
||||||
checkbox.checked = !enable;
|
|
||||||
alert('Hálózati hiba');
|
|
||||||
}
|
|
||||||
checkbox.disabled = false;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
{{end}}
|
|
||||||
|
|
||||||
{{if .GeoGlobalEnabled}}
|
|
||||||
<div class="app-optional-config">
|
|
||||||
<h3>Földrajzi korlátozás</h3>
|
|
||||||
<p class="config-group-desc">
|
|
||||||
Az alkalmazás egyéni országkorlátozás nélkül a globális beállítást követi.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<label class="toggle" style="margin-bottom:1rem">
|
|
||||||
<input type="checkbox" id="app-geo-override-toggle"
|
|
||||||
{{if .GeoAppOverride}}checked{{end}}
|
|
||||||
onchange="toggleAppGeoOverride(this.checked)">
|
|
||||||
<span class="toggle-label">Egyéni országkorlátozás</span>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<div id="app-geo-override-details" {{if not .GeoAppOverride}}style="display:none"{{end}}>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Engedélyezett országok ehhez az alkalmazáshoz</label>
|
|
||||||
<div class="geo-country-selector">
|
|
||||||
<input type="text" id="app-geo-search" class="form-control config-input"
|
|
||||||
placeholder="Ország keresése..." autocomplete="off"
|
|
||||||
oninput="filterAppGeoCountries(this.value)"
|
|
||||||
onfocus="showAppGeoList()"
|
|
||||||
onblur="setTimeout(function(){hideAppGeoList()},200)">
|
|
||||||
<div class="geo-country-list" id="app-geo-country-list"></div>
|
|
||||||
</div>
|
|
||||||
<div class="geo-selected-tags" id="app-geo-tags"></div>
|
|
||||||
</div>
|
|
||||||
<div class="config-actions">
|
|
||||||
<button class="btn btn-primary" onclick="saveAppGeoOverride()">Mentés</button>
|
|
||||||
<span id="app-geo-status" class="config-save-status"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
(function(){
|
|
||||||
var allCountries = [];
|
|
||||||
var appGeoCountries = {{json .GeoAppOverrideCountries}};
|
|
||||||
var stackName = '{{.Stack.Name}}';
|
|
||||||
|
|
||||||
function loadCountries(cb) {
|
|
||||||
if (allCountries.length > 0) { cb(); return; }
|
|
||||||
fetch('/api/geo/countries', {headers: csrfHeaders()})
|
|
||||||
.then(function(r){return r.json()})
|
|
||||||
.then(function(d){ if(d.ok) allCountries = d.data; cb(); })
|
|
||||||
.catch(function(){ cb(); });
|
|
||||||
}
|
|
||||||
|
|
||||||
window.toggleAppGeoOverride = function(enabled) {
|
|
||||||
document.getElementById('app-geo-override-details').style.display = enabled ? '' : 'none';
|
|
||||||
if (enabled) {
|
|
||||||
if (!appGeoCountries || appGeoCountries.length === 0) {
|
|
||||||
appGeoCountries = {{json .GeoGlobalCountries}};
|
|
||||||
}
|
|
||||||
loadCountries(renderAppGeoTags);
|
|
||||||
} else {
|
|
||||||
// Remove override
|
|
||||||
fetch('/api/stacks/' + stackName + '/geo/override', {method:'DELETE', headers:csrfHeaders()});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
window.showAppGeoList = function() { loadCountries(function(){ filterAppGeoCountries(''); }); };
|
|
||||||
window.hideAppGeoList = function() { document.getElementById('app-geo-country-list').style.display='none'; };
|
|
||||||
|
|
||||||
window.filterAppGeoCountries = function(q) {
|
|
||||||
var list = document.getElementById('app-geo-country-list');
|
|
||||||
q = q.toLowerCase();
|
|
||||||
var html = ''; var count = 0;
|
|
||||||
for (var i = 0; i < allCountries.length && count < 15; i++) {
|
|
||||||
var c = allCountries[i];
|
|
||||||
if (appGeoCountries.indexOf(c.code) >= 0) continue;
|
|
||||||
if (q && c.name.toLowerCase().indexOf(q) < 0 && c.code.toLowerCase().indexOf(q) < 0) continue;
|
|
||||||
html += '<div class="geo-country-option" onmousedown="addAppGeoCountry(\'' + c.code + '\')">'
|
|
||||||
+ esc(c.name) + ' <small>(' + c.code + ')</small></div>';
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
list.innerHTML = html || '<div class="geo-country-option" style="opacity:.5">Nincs találat</div>';
|
|
||||||
list.style.display = (count > 0 || q) ? '' : 'none';
|
|
||||||
};
|
|
||||||
|
|
||||||
window.addAppGeoCountry = function(code) {
|
|
||||||
if (appGeoCountries.indexOf(code) >= 0) return;
|
|
||||||
appGeoCountries.push(code);
|
|
||||||
renderAppGeoTags();
|
|
||||||
document.getElementById('app-geo-search').value = '';
|
|
||||||
hideAppGeoList();
|
|
||||||
};
|
|
||||||
|
|
||||||
window.removeAppGeoCountry = function(code) {
|
|
||||||
appGeoCountries = appGeoCountries.filter(function(c){return c !== code});
|
|
||||||
renderAppGeoTags();
|
|
||||||
};
|
|
||||||
|
|
||||||
function renderAppGeoTags() {
|
|
||||||
var el = document.getElementById('app-geo-tags');
|
|
||||||
var html = '';
|
|
||||||
for (var i = 0; i < appGeoCountries.length; i++) {
|
|
||||||
var code = appGeoCountries[i];
|
|
||||||
var name = code;
|
|
||||||
for (var j = 0; j < allCountries.length; j++) {
|
|
||||||
if (allCountries[j].code === code) { name = allCountries[j].name; break; }
|
|
||||||
}
|
|
||||||
html += '<span class="geo-tag">' + esc(name) + ' (' + code + ') '
|
|
||||||
+ '<span class="geo-tag-remove" onclick="removeAppGeoCountry(\'' + code + '\')">×</span></span>';
|
|
||||||
}
|
|
||||||
el.innerHTML = html;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.saveAppGeoOverride = function() {
|
|
||||||
var status = document.getElementById('app-geo-status');
|
|
||||||
fetch('/api/stacks/' + stackName + '/geo/override', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: Object.assign({'Content-Type':'application/json'}, csrfHeaders()),
|
|
||||||
body: JSON.stringify({allowed_countries: appGeoCountries})
|
|
||||||
})
|
|
||||||
.then(function(r){return r.json()})
|
|
||||||
.then(function(d){
|
|
||||||
status.textContent = d.ok ? (d.message || 'Mentve') : (d.error || 'Hiba');
|
|
||||||
status.className = 'config-save-status ' + (d.ok ? 'config-save-ok' : 'config-save-err');
|
|
||||||
setTimeout(function(){ status.textContent=''; }, 5000);
|
|
||||||
})
|
|
||||||
.catch(function(){
|
|
||||||
status.textContent = 'Hálózati hiba';
|
|
||||||
status.className = 'config-save-status config-save-err';
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
function esc(s) { var d = document.createElement('div'); d.textContent = s; return d.innerHTML; }
|
|
||||||
|
|
||||||
if (document.getElementById('app-geo-override-toggle') && document.getElementById('app-geo-override-toggle').checked) {
|
|
||||||
loadCountries(renderAppGeoTags);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
{{end}}
|
|
||||||
|
|
||||||
{{template "layout_end" .}}
|
{{template "layout_end" .}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|||||||
@@ -207,6 +207,201 @@
|
|||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
{{if .HasIntegrations}}
|
||||||
|
<div class="app-optional-config">
|
||||||
|
<h3>Integrációk</h3>
|
||||||
|
<p class="config-group-desc">
|
||||||
|
Más telepített alkalmazásokkal való összekapcsolás. Az integráció automatikusan felfüggesztődik, ha bármelyik alkalmazás leáll, és újraaktiválódik indításkor.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{{range .Integrations}}
|
||||||
|
<div class="config-field" style="display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.75rem 0;border-bottom:1px solid var(--border)">
|
||||||
|
<div style="flex:1">
|
||||||
|
<strong>{{.Label}}</strong>
|
||||||
|
<p class="config-field-help" style="margin:0">{{.Description}}</p>
|
||||||
|
{{if not .TargetDeployed}}
|
||||||
|
<span class="badge badge-muted" style="margin-top:.25rem;display:inline-block">Nincs telepítve</span>
|
||||||
|
{{else if not .TargetRunning}}
|
||||||
|
<span class="badge badge-orphaned" style="margin-top:.25rem;display:inline-block">Célalkalmazás leállítva</span>
|
||||||
|
{{else if eq .Status "error"}}
|
||||||
|
<span class="badge badge-orphaned" style="margin-top:.25rem;display:inline-block">Hiba</span>
|
||||||
|
{{else if .Enabled}}
|
||||||
|
<span class="badge badge-ok" style="margin-top:.25rem;display:inline-block">Aktív</span>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
<label class="toggle">
|
||||||
|
<input type="checkbox"
|
||||||
|
{{if .Enabled}}checked{{end}}
|
||||||
|
{{if not .TargetDeployed}}disabled title="A célalkalmazás nincs telepítve"{{end}}
|
||||||
|
{{if and .TargetDeployed (not .TargetRunning)}}disabled title="A célalkalmazás nem fut"{{end}}
|
||||||
|
onchange="toggleIntegration('{{$.Stack.Name}}', '{{.Target}}', this.checked, this)">
|
||||||
|
<span class="toggle-label"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
async function toggleIntegration(provider, target, enable, checkbox) {
|
||||||
|
checkbox.disabled = true;
|
||||||
|
try {
|
||||||
|
var resp = await fetch('/api/integrations/' + provider + '/' + target, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: Object.assign({'Content-Type': 'application/json'}, csrfHeaders()),
|
||||||
|
body: JSON.stringify({enabled: enable})
|
||||||
|
});
|
||||||
|
var data = await resp.json();
|
||||||
|
if (!data.ok) {
|
||||||
|
checkbox.checked = !enable;
|
||||||
|
alert(data.error || 'Hiba történt');
|
||||||
|
} else {
|
||||||
|
setTimeout(function(){ location.reload(); }, 500);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch(err) {
|
||||||
|
checkbox.checked = !enable;
|
||||||
|
alert('Hálózati hiba');
|
||||||
|
}
|
||||||
|
checkbox.disabled = false;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
{{if .GeoGlobalEnabled}}
|
||||||
|
<div class="app-optional-config">
|
||||||
|
<h3>Földrajzi korlátozás</h3>
|
||||||
|
<p class="config-group-desc">
|
||||||
|
Az alkalmazás egyéni országkorlátozás nélkül a globális beállítást követi.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<label class="toggle" style="margin-bottom:1rem">
|
||||||
|
<input type="checkbox" id="app-geo-override-toggle"
|
||||||
|
{{if .GeoAppOverride}}checked{{end}}
|
||||||
|
onchange="toggleAppGeoOverride(this.checked)">
|
||||||
|
<span class="toggle-label">Egyéni országkorlátozás</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div id="app-geo-override-details" {{if not .GeoAppOverride}}style="display:none"{{end}}>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Engedélyezett országok ehhez az alkalmazáshoz</label>
|
||||||
|
<div class="geo-country-selector">
|
||||||
|
<input type="text" id="app-geo-search" class="form-control config-input"
|
||||||
|
placeholder="Ország keresése..." autocomplete="off"
|
||||||
|
oninput="filterAppGeoCountries(this.value)"
|
||||||
|
onfocus="showAppGeoList()"
|
||||||
|
onblur="setTimeout(function(){hideAppGeoList()},200)">
|
||||||
|
<div class="geo-country-list" id="app-geo-country-list"></div>
|
||||||
|
</div>
|
||||||
|
<div class="geo-selected-tags" id="app-geo-tags"></div>
|
||||||
|
</div>
|
||||||
|
<div class="config-actions">
|
||||||
|
<button class="btn btn-primary" onclick="saveAppGeoOverride()">Mentés</button>
|
||||||
|
<span id="app-geo-status" class="config-save-status"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
(function(){
|
||||||
|
var allCountries = [];
|
||||||
|
var appGeoCountries = {{json .GeoAppOverrideCountries}};
|
||||||
|
var stackName = '{{.Stack.Name}}';
|
||||||
|
|
||||||
|
function loadCountries(cb) {
|
||||||
|
if (allCountries.length > 0) { cb(); return; }
|
||||||
|
fetch('/api/geo/countries', {headers: csrfHeaders()})
|
||||||
|
.then(function(r){return r.json()})
|
||||||
|
.then(function(d){ if(d.ok) allCountries = d.data; cb(); })
|
||||||
|
.catch(function(){ cb(); });
|
||||||
|
}
|
||||||
|
|
||||||
|
window.toggleAppGeoOverride = function(enabled) {
|
||||||
|
document.getElementById('app-geo-override-details').style.display = enabled ? '' : 'none';
|
||||||
|
if (enabled) {
|
||||||
|
if (!appGeoCountries || appGeoCountries.length === 0) {
|
||||||
|
appGeoCountries = {{json .GeoGlobalCountries}};
|
||||||
|
}
|
||||||
|
loadCountries(renderAppGeoTags);
|
||||||
|
} else {
|
||||||
|
fetch('/api/stacks/' + stackName + '/geo/override', {method:'DELETE', headers:csrfHeaders()});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.showAppGeoList = function() { loadCountries(function(){ filterAppGeoCountries(''); }); };
|
||||||
|
window.hideAppGeoList = function() { document.getElementById('app-geo-country-list').style.display='none'; };
|
||||||
|
|
||||||
|
window.filterAppGeoCountries = function(q) {
|
||||||
|
var list = document.getElementById('app-geo-country-list');
|
||||||
|
q = q.toLowerCase();
|
||||||
|
var html = ''; var count = 0;
|
||||||
|
for (var i = 0; i < allCountries.length && count < 15; i++) {
|
||||||
|
var c = allCountries[i];
|
||||||
|
if (appGeoCountries.indexOf(c.code) >= 0) continue;
|
||||||
|
if (q && c.name.toLowerCase().indexOf(q) < 0 && c.code.toLowerCase().indexOf(q) < 0) continue;
|
||||||
|
html += '<div class="geo-country-option" onmousedown="addAppGeoCountry(\'' + c.code + '\')">'
|
||||||
|
+ esc(c.name) + ' <small>(' + c.code + ')</small></div>';
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
list.innerHTML = html || '<div class="geo-country-option" style="opacity:.5">Nincs találat</div>';
|
||||||
|
list.style.display = (count > 0 || q) ? '' : 'none';
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addAppGeoCountry = function(code) {
|
||||||
|
if (appGeoCountries.indexOf(code) >= 0) return;
|
||||||
|
appGeoCountries.push(code);
|
||||||
|
renderAppGeoTags();
|
||||||
|
document.getElementById('app-geo-search').value = '';
|
||||||
|
hideAppGeoList();
|
||||||
|
};
|
||||||
|
|
||||||
|
window.removeAppGeoCountry = function(code) {
|
||||||
|
appGeoCountries = appGeoCountries.filter(function(c){return c !== code});
|
||||||
|
renderAppGeoTags();
|
||||||
|
};
|
||||||
|
|
||||||
|
function renderAppGeoTags() {
|
||||||
|
var el = document.getElementById('app-geo-tags');
|
||||||
|
var html = '';
|
||||||
|
for (var i = 0; i < appGeoCountries.length; i++) {
|
||||||
|
var code = appGeoCountries[i];
|
||||||
|
var name = code;
|
||||||
|
for (var j = 0; j < allCountries.length; j++) {
|
||||||
|
if (allCountries[j].code === code) { name = allCountries[j].name; break; }
|
||||||
|
}
|
||||||
|
html += '<span class="geo-tag">' + esc(name) + ' (' + code + ') '
|
||||||
|
+ '<span class="geo-tag-remove" onclick="removeAppGeoCountry(\'' + code + '\')">×</span></span>';
|
||||||
|
}
|
||||||
|
el.innerHTML = html;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.saveAppGeoOverride = function() {
|
||||||
|
var status = document.getElementById('app-geo-status');
|
||||||
|
fetch('/api/stacks/' + stackName + '/geo/override', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: Object.assign({'Content-Type':'application/json'}, csrfHeaders()),
|
||||||
|
body: JSON.stringify({allowed_countries: appGeoCountries})
|
||||||
|
})
|
||||||
|
.then(function(r){return r.json()})
|
||||||
|
.then(function(d){
|
||||||
|
status.textContent = d.ok ? (d.message || 'Mentve') : (d.error || 'Hiba');
|
||||||
|
status.className = 'config-save-status ' + (d.ok ? 'config-save-ok' : 'config-save-err');
|
||||||
|
setTimeout(function(){ status.textContent=''; }, 5000);
|
||||||
|
})
|
||||||
|
.catch(function(){
|
||||||
|
status.textContent = 'Hálózati hiba';
|
||||||
|
status.className = 'config-save-status config-save-err';
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function esc(s) { var d = document.createElement('div'); d.textContent = s; return d.innerHTML; }
|
||||||
|
|
||||||
|
if (document.getElementById('app-geo-override-toggle') && document.getElementById('app-geo-override-toggle').checked) {
|
||||||
|
loadCountries(renderAppGeoTags);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
{{if and (not .AlreadyDeployed) .MemoryInfo}}
|
{{if and (not .AlreadyDeployed) .MemoryInfo}}
|
||||||
{{with .MemoryInfo}}
|
{{with .MemoryInfo}}
|
||||||
{{if .Available}}
|
{{if .Available}}
|
||||||
|
|||||||
Reference in New Issue
Block a user