1
0
Fork 0
mirror of synced 2024-10-02 10:16:27 +13:00

region in UI

This commit is contained in:
Damodar Lohani 2022-09-08 05:24:46 +00:00
parent 119344031a
commit 8450a0c213
4 changed files with 24 additions and 2 deletions

2
.env
View file

@ -83,7 +83,7 @@ _APP_LOGGING_PROVIDER=
_APP_LOGGING_CONFIG=
_APP_REGION_DEFAULT=default
_APP_REGIIONS=default
_APP_REGION_DISABLED=
_APP_REGIONS_DISABLED=
DOCKERHUB_PULL_USERNAME=
DOCKERHUB_PULL_PASSWORD=
DOCKERHUB_PULL_EMAIL=

View file

@ -258,7 +258,7 @@ ENV _APP_SERVER=swoole \
_APP_LOGGING_CONFIG= \
_APP_REGIONS=default \
_APP_REGION_DEFAULT=default \
_APP_REGION_DISABLED=
_APP_REGIONS_DISABLED=
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

View file

@ -28,6 +28,12 @@ App::shutdown()
$header = new View(__DIR__ . '/../../views/console/comps/header.phtml');
$footer = new View(__DIR__ . '/../../views/console/comps/footer.phtml');
$header
->setParam('regions', App::getEnv('_APP_REGIONS', []))
->setParam('disabledRegions', App::getEnv('_APP_REGIONS_DISABLED', []))
->setParam('defaultRegion', App::getEnv('_APP_REGION_DEFAULT', 'default'))
;
$footer
->setParam('home', App::getEnv('_APP_HOME', ''))
->setParam('version', App::getEnv('_APP_VERSION', 'UNKNOWN'))

View file

@ -1,3 +1,8 @@
<?php
$regions = $this->getParam('regions', []);
$disabledRegions = $this->getParam('disabledRegions', []);
$defaultRegion = $this->getParam('defaultRegion', []);
?>
<header class="clear" data-version>
<a href="/console" class="logo pull-start">
<img src="/images/appwrite.svg" alt="Appwrite Light Logo" class="force-light" loading="lazy" />
@ -217,6 +222,17 @@
<label>Name</label>
<input type="text" class="full-width margin-bottom-xl" name="name" required autocomplete="off" maxlength="128" />
<?php if(count(array_diff($regions, $disabledRegions)) > 1): ?>
<label>Region</label>
<select name="region">
<?php foreach($regions as $region): ?>
<option value="<?php echo $region ?>"><?php echo $region ?></option>
<?php endforeach; ?>
</select>
<?php else: ?>
<input type="hidden" name="region" data-ls-bind="{{$defaultRegion}}" />
<?php endif; ?>
<footer>
<button type="submit">Create</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
</footer>