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

added edit dialog, now will edit even if the name is changed #284

Merged
merged 1 commit into from
Feb 18, 2021
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
6 changes: 4 additions & 2 deletions backend/api/actions/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ def deploy_app(template: schemas.DeployForm):
conv_sysctls2data(template.sysctls),
conv_caps2data(template.cap_add),
edit=template.edit or False,
id=template.id or None
)
except HTTPException as exc:
raise HTTPException(status_code=exc.status_code, detail=exc.detail)
Expand Down Expand Up @@ -217,13 +218,14 @@ def launch_app(
sysctls,
caps,
edit,
id
):
dclient = docker.from_env()
if edit == True:
try:
dclient.containers.get(name)
dclient.containers.get(id)
try:
running_app = dclient.containers.get(name)
running_app = dclient.containers.get(id)
running_app.remove(force=True)
except Exception as e:
raise e
Expand Down
2 changes: 1 addition & 1 deletion backend/api/auth/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def generate_password() -> str:


def auth_check(Authorize):
if settings.DISABLE_AUTH == "True":
if str(settings.DISABLE_AUTH).lower() == "true":
return
else:
try:
Expand Down
1 change: 1 addition & 0 deletions backend/api/db/schemas/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class DeployForm(BaseModel):
network_mode: Optional[str]
network: Optional[str]
edit: Optional[bool]
id: Optional[str]


# LOGS #
Expand Down
51 changes: 49 additions & 2 deletions frontend/src/components/applications/ApplicationsForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,25 @@
</v-row>
</form>
<v-btn
v-if="form.edit == true"
color="primary"
@click="editDialog = true"
:disabled="invalid"
class="float-right"
>
<div v-if="isLoading">
Deploying
<v-progress-circular
indeterminate
color="white"
size="15"
width="2"
/>
</div>
<div v-else>Deploy</div>
</v-btn>
<v-btn
v-else
color="primary"
@click="nextStep(4)"
:disabled="invalid"
Expand Down Expand Up @@ -666,6 +685,33 @@
</v-expansion-panel>
</v-expansion-panels>
</v-card>
<v-dialog v-model="editDialog" max-width="290">
<v-card>
<v-card-title class="headline" style="word-break: break-all;">
Are you sure you want to edit this container?
</v-card-title>
<v-card-text>
This will remove the currently running container and deploy a new one with the settings in this form.
Please make sure your container data is persistant or backed up.
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn text @click="editDialog = false">
Cancel
</v-btn>
<v-btn
text
color="yellow"
@click="
nextStep(4);
editDialog = false;
"
>
Edit
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div>
</template>

Expand All @@ -686,6 +732,7 @@ export default {
notes: "",
networks: [],
volumes: [],
editDialog: false,
form: {
name: "",
image: "",
Expand Down Expand Up @@ -906,7 +953,6 @@ export default {
} else if (this.$route.params.appName) {
const appName = this.$route.params.appName;
const app = await this.readApp(appName);
console.log(app);
this.form = {
name: app.name || "",
image: app.Config.Image || "",
Expand All @@ -919,7 +965,8 @@ export default {
labels: this.transform_labels(app.Config.Labels) || [],
sysctls: this.transform_labels(app.HostConfig.Sysctls),
cap_add: app.HostConfig.CapAdd || [],
edit: true
edit: true,
id: app.Id
};
}
}
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/store/modules/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const actions = {
resolve(resp);
})
.catch(error => {
console.log(error);
console.error(error);
commit(AUTH_CLEAR);
});
});
Expand All @@ -85,7 +85,7 @@ const actions = {
resolve(resp);
})
.catch(error => {
console.log(error);
console.error(error);
commit(AUTH_CLEAR);
});
});
Expand Down Expand Up @@ -115,7 +115,6 @@ const actions = {
axios
.get(url)
.then(resp => {
console.log(resp);
if (resp.data.authDisabled == true) {
localStorage.setItem("username", resp.data.username);
commit(AUTH_DISABLED);
Expand Down