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 updating template list on delete #153

Merged
merged 2 commits into from
Oct 9, 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: 7 additions & 1 deletion backend/api/auth/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,16 @@ class UserTable(Base, SQLAlchemyBaseUserTable):
UserDB,
)

get_active_user = fastapi_users.get_current_active_user
# get_active_user = fastapi_users.get_current_active_user
get_auth_router = fastapi_users.get_auth_router
get_password_hash = get_password_hash

async def get_active_user():
DISABLE_AUTH = settings.DISABLE_AUTH
if DISABLE_AUTH == True:
return
else:
await fastapi_users.get_current_active_user()

async def user_create(UD):
await fastapi_users.db.create(UD)
8 changes: 4 additions & 4 deletions backend/api/routers/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@

router = APIRouter()

@router.get("/images/")
@router.get("/images/", dependencies=[Depends(get_active_user)])
def get_images():
return resources.get_images()

@router.get("/images/{image_id}")
@router.get("/images/{image_id}", dependencies=[Depends(get_active_user)])
def get_image(image_id):
return resources.get_image(image_id)

@router.get("/images/{image_id}/pull")
@router.get("/images/{image_id}/pull", dependencies=[Depends(get_active_user)])
def pull_image(image_id):
return resources.update_image(image_id)

@router.delete("/images/{image_id}")
@router.delete("/images/{image_id}", dependencies=[Depends(get_active_user)])
def delete_image(image_id):
return resources.delete_image(image_id)
3 changes: 1 addition & 2 deletions backend/api/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class Settings(BaseSettings):
ACCESS_TOKEN_EXPIRES = os.environ.get('ACCESS_TOKEN_EXPIRES', 15)
REFRESH_TOKEN_EXPIRES = os.environ.get('REFRESH_TOKEN_EXPIRES', 1)
SAME_SITE_COOKIES = os.environ.get('SAME_SITE_COOKIES', True)


DISABLE_AUTH = os.environ.get('DISABLE_AUTH', False)
BASE_TEMPLATE_VARIABLES = [
{"variable": "!config", "replacement": "/yacht/AppData/Config"},
{"variable": "!data", "replacement": "/yacht/AppData/Data"},
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/images/ImageDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<v-list-item-content style="max-width:20%">
Entrypoint
</v-list-item-content>
<v-list-item-content>
<v-list-item-content v-if="image.ContainerConfig.Entrypoint">
{{ image.ContainerConfig.Entrypoint[0] }}
</v-list-item-content>
</v-list-item>
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/components/images/ImageList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
hide-details
></v-text-field>
</v-card-title>
<v-card-subtitle>
Note: Image list will not update after an update or delete (WIP).
</v-card-subtitle>

<v-data-table
style="max-width: 99%;"
class="mx-auto image-datatable"
Expand Down Expand Up @@ -66,7 +64,7 @@
</v-list-item-icon>
<v-list-item-title>View</v-list-item-title>
</v-list-item>
<v-list-item @click="updateImage(item.Id)">
<v-list-item v-if="item.RepoTags[0]" @click="updateImage(item.Id)">
<v-list-item-icon>
<v-icon>mdi-update</v-icon>
</v-list-item-icon>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/store/modules/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const mutations = {
state.images.push(image);
},
removeImage(state, image) {
const idx = state.images.findIndex(x => x.id === image.id);
const idx = state.images.findIndex(x => x.Id === image.Id);
if (idx < 0) {
return;
}
Expand Down