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

fixed stepper in deploy form; tailing logs to last 200 logs; fix chan… #281

Merged
merged 1 commit into from
Feb 10, 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
7 changes: 4 additions & 3 deletions backend/api/actions/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def deploy_app(template: schemas.DeployForm):

def Merge(dict1, dict2):
if dict1 and dict2:
updated_dict = dict2.update(dict1)
dict2.update(dict1)
return dict2
elif dict1:
return dict1
Expand All @@ -163,7 +163,7 @@ def launch_app(
edit
):
dclient = docker.from_env()
if edit != False:
if edit == True:
try:
dclient.containers.get(name)
try:
Expand All @@ -172,7 +172,8 @@ def launch_app(
except Exception as e:
raise e
except Exception as e:
raise e
# User probably changed the name so it doesn't conflict. If this is the case we'll just spin up a second container.
pass



Expand Down
5 changes: 2 additions & 3 deletions backend/api/routers/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ async def logs(websocket: WebSocket, app_name: str, Authorize: AuthJWT = Depends
async with aiodocker.Docker() as docker:
container: DockerContainer = await docker.containers.get(app_name)
if container._container["State"]["Status"] == "running":
stats = container.stats(stream=True)
logs = container.log(stdout=True, stderr=True, follow=True, tail=1000)
logs = container.log(stdout=True, stderr=True, follow=True, tail=200)
async for line in logs:
try:
await websocket.send_text(line)
Expand Down Expand Up @@ -206,7 +205,7 @@ async def process_container(name, stats, websocket):
cpu_percent, cpu_system, cpu_total = await calculate_cpu_percent2(
line, cpu_total, cpu_system
)
except KeyError as e:
except KeyError:
print("error while getting new CPU stats: %r, falling back")
cpu_percent = await calculate_cpu_percent(line)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
<template>
<v-card color="foreground" raised>
<v-card-title class="primary font-weight-bold">
Logs
</v-card-title>
<v-card-title class="primary font-weight-bold"> Logs</v-card-title>
<v-card-text
v-if="app.State.Status != 'running'"
class="secondary text-center px-5 py-5"
>
Start the app to view logs
</v-card-text>
<v-virtual-scroll
v-chat-scroll="scrollOptions"
v-else
v-chat-scroll="{enable: true, always: false, notSmoothOnInit: true}"
:bench="20"
:items="logs"
height="600"
Expand All @@ -34,8 +32,9 @@ export default {
props: ["app", "logs"],
data() {
return {
scrollOptions: { enable: true, always: false, smooth: false, notSmoothOnInit: true },
};
}
},
};
</script>

Expand Down
13 changes: 7 additions & 6 deletions frontend/src/components/applications/ApplicationsForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
</form>
<v-btn
color="primary"
@click="deployStep += 1"
@click="deployStep = 2"
:disabled="invalid"
class="float-right"
>
Expand Down Expand Up @@ -253,15 +253,15 @@
</form>
<v-btn
color="primary"
@click="deployStep += 1"
@click="deployStep = 3"
:disabled="invalid"
class="float-right"
>
Continue
</v-btn>
<v-btn
color="secondary"
@click="deployStep -= 1"
@click="deployStep = 1"
class="mx-2 float-right primary--text"
>
Back
Expand Down Expand Up @@ -331,15 +331,15 @@
</form>
<v-btn
color="primary"
@click="deployStep += 1"
@click="deployStep = 4"
:disabled="invalid"
class="float-right"
>
Continue
</v-btn>
<v-btn
color="secondary"
@click="deployStep -= 1"
@click="deployStep = 2"
class="mx-2 float-right primary--text"
>
Back
Expand Down Expand Up @@ -425,7 +425,7 @@
</v-btn>
<v-btn
color="secondary"
@click="deployStep -= 1"
@click="deployStep = 3"
class="mx-2 float-right primary--text"
>
Back
Expand Down Expand Up @@ -867,6 +867,7 @@ export default {
})
.catch((err) => {
this.isLoading = false;
this.deployStep = 1;
this.setErr(err);
});
},
Expand Down
1 change: 1 addition & 0 deletions frontend/src/store/modules/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const actions = {
.get(url)
.then(response => {
const images = response.data;
console.log(images)
commit("setImages", images);
})
.catch(err => {
Expand Down