Skip to content

Commit

Permalink
minor (#279): Added flag :new_sync_algorithm to table files
Browse files Browse the repository at this point in the history
  • Loading branch information
Luna-Klatzer committed Mar 2, 2025
1 parent 3bf6ec6 commit 85bb763
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const { loading, currMsg } = storeToRefs(loadingStore)
<span class="loader-spinner"></span>
</div>
<div id="loader-text">
<span>{{ currMsg || 'Loading...'}}</span>
<span>{{ currMsg || 'Loading...' }}</span>
</div>
</div>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { ensureLoggedIn } from '@/scripts/ensure-logged-in'
import { useRouter } from 'vue-router'
import { showInfoNotifFromObj } from '@/scripts/show-notif'
import constants from '@/plugins/constants'
import {useLoadingStore} from "@/stores/loading";
import { useLoadingStore } from '@/stores/loading'
const $router = useRouter()
Expand Down
14 changes: 7 additions & 7 deletions solardoc/frontend/src/scripts/editor/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,17 +280,17 @@ export class SolardocEditor {
const lines = content.split('\n')
const { slideIndex, subSlideIndex } = lines.slice(0, lineNumber).reduce(
(acc, line) => {
line = line.trim();
line = line.trim()
if (line.startsWith('== ')) {
acc.slideIndex++;
acc.subSlideIndex = -1;
acc.slideIndex++
acc.subSlideIndex = -1
} else if (line.startsWith('=== ')) {
acc.subSlideIndex++;
acc.subSlideIndex++
}
return acc;
return acc
},
{ slideIndex: 0, subSlideIndex: -1 }
);
{ slideIndex: 0, subSlideIndex: -1 },
)
previewSelectedSlideStore.setSlide(slideIndex, false, subSlideIndex)
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/
import * as Oazapfts from 'oazapfts/lib/runtime'
import * as QS from 'oazapfts/lib/runtime/query'

export const defaults: Oazapfts.RequestOpts = {
baseUrl: 'http://localhost:4000/phx/api',
}
Expand Down Expand Up @@ -87,6 +86,7 @@ export type UpdateFile = {
content?: string
file_name?: string
is_global?: boolean
new_sync_algorithm?: boolean
}
export type Ping = {
date: number
Expand Down Expand Up @@ -128,7 +128,6 @@ export type UserPrivate = {
role?: string
username?: string
}

/**
* Log out a user
*/
Expand All @@ -154,7 +153,6 @@ export function deleteV2AuthBearer(authorization: string, opts?: Oazapfts.Reques
},
})
}

/**
* Log in a user
*/
Expand All @@ -181,7 +179,6 @@ export function postV2AuthBearer(userLogin: UserLogin, opts?: Oazapfts.RequestOp
}),
)
}

/**
* List all currently running editor channels
*/
Expand All @@ -203,7 +200,6 @@ export function getV2EditorChannels(authorization: string, opts?: Oazapfts.Reque
},
})
}

/**
* Get a single editor channel
*/
Expand Down Expand Up @@ -233,7 +229,6 @@ export function getV2EditorChannelsById(
},
})
}

/**
* List all files owned by the current user
*/
Expand All @@ -255,7 +250,6 @@ export function getV2Files(authorization: string, opts?: Oazapfts.RequestOpts) {
},
})
}

/**
* Create a new file
*/
Expand Down Expand Up @@ -290,7 +284,6 @@ export function postV2Files(
}),
)
}

/**
* List all global files
*/
Expand Down Expand Up @@ -342,7 +335,6 @@ export function getV2FilesGlobal(
},
)
}

/**
* Create a new file permission
*/
Expand Down Expand Up @@ -381,7 +373,6 @@ export function postV2FilesPermissions(
}),
)
}

/**
* Get a single file permission
*/
Expand Down Expand Up @@ -411,7 +402,6 @@ export function getV2FilesPermissionsById(
},
})
}

/**
* Update a single file
*/
Expand Down Expand Up @@ -451,7 +441,6 @@ export function putV2FilesPermissionsById(
}),
)
}

/**
* Gets the permissions for one file for all users who have access to it
*/
Expand Down Expand Up @@ -485,7 +474,6 @@ export function getV2FilesByFileIdPermissions(
},
})
}

/**
* Gets the permissions for one file from one specific user
*/
Expand Down Expand Up @@ -520,7 +508,6 @@ export function getV2FilesByFileIdPermissionsAndUserId(
},
})
}

/**
* Deletes a file
*/
Expand Down Expand Up @@ -550,7 +537,6 @@ export function deleteV2FilesById(authorization: string, id: string, opts?: Oaza
},
})
}

/**
* Get a single file
*/
Expand All @@ -576,7 +562,6 @@ export function getV2FilesById(authorization: string, id: string, opts?: Oazapft
},
})
}

/**
* Update a single file
*/
Expand Down Expand Up @@ -616,7 +601,6 @@ export function putV2FilesById(
}),
)
}

/**
* Ping the server
*/
Expand All @@ -628,7 +612,6 @@ export function getV2Ping(opts?: Oazapfts.RequestOpts) {
...opts,
})
}

/**
* Create a new share url
*/
Expand Down Expand Up @@ -663,7 +646,6 @@ export function postV2Share(
}),
)
}

/**
* Delete a share url
*/
Expand All @@ -689,7 +671,6 @@ export function deleteV2ShareById(authorization: string, id: string, opts?: Oaza
},
})
}

/**
* Get a single share url
*/
Expand All @@ -715,7 +696,6 @@ export function getV2ShareById(authorization: string, id: string, opts?: Oazapft
},
})
}

/**
* Get a channel via a share url
*/
Expand Down Expand Up @@ -745,7 +725,6 @@ export function getV2ShareByIdChannel(
},
})
}

/**
* Get a file via a share url
*/
Expand All @@ -771,7 +750,6 @@ export function getV2ShareByIdFile(authorization: string, id: string, opts?: Oaz
},
})
}

/**
* List all users
*/
Expand All @@ -787,7 +765,6 @@ export function getV2Users(authorization: string, opts?: Oazapfts.RequestOpts) {
},
})
}

/**
* Create a new user
*/
Expand All @@ -810,7 +787,6 @@ export function postV2Users(createUser: CreateUser, opts?: Oazapfts.RequestOpts)
}),
)
}

/**
* Get the current user
*/
Expand All @@ -832,7 +808,6 @@ export function getV2UsersCurrent(authorization: string, opts?: Oazapfts.Request
},
})
}

/**
* Get a single user by id
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/**
* @solardoc/rest-api
* 1.0.0-beta.5
* v1.0.0-beta.5
* DO NOT MODIFY - This file has been generated using oazapfts.
* See https://www.npmjs.com/package/oazapfts
*/
import * as Oazapfts from 'oazapfts/lib/runtime'
import * as QS from 'oazapfts/lib/runtime/query'

export const defaults: Oazapfts.RequestOpts = {
baseUrl: '/',
}
Expand Down Expand Up @@ -66,7 +65,6 @@ export type RenderedSlideImageDtoModel = {
cache: CacheDtoModel
download: DownloadDtoModel
}

export function getV1Ping(opts?: Oazapfts.RequestOpts) {
return oazapfts.fetchJson<{
status: 200
Expand All @@ -75,7 +73,6 @@ export function getV1Ping(opts?: Oazapfts.RequestOpts) {
...opts,
})
}

export function postV1RenderPresentationImages(
renderPresentationDtoModel?: RenderPresentationDtoModel,
opts?: Oazapfts.RequestOpts,
Expand All @@ -92,7 +89,6 @@ export function postV1RenderPresentationImages(
}),
)
}

export function postV1RenderPresentationPdf(
renderPresentationDtoModel?: RenderPresentationDtoModel,
opts?: Oazapfts.RequestOpts,
Expand All @@ -109,7 +105,6 @@ export function postV1RenderPresentationPdf(
}),
)
}

export function postV1RenderPresentationRjsHtml(
renderPresentationDtoModel?: RenderPresentationDtoModel,
opts?: Oazapfts.RequestOpts,
Expand All @@ -126,7 +121,6 @@ export function postV1RenderPresentationRjsHtml(
}),
)
}

export function postV1RenderSlideByIdImage(
id: string,
renderPresentationDtoModel?: RenderPresentationDtoModel,
Expand All @@ -144,7 +138,6 @@ export function postV1RenderSlideByIdImage(
}),
)
}

export function getV1ResultByUuid(
uuid: string,
{
Expand Down
2 changes: 1 addition & 1 deletion solardoc/frontend/src/views/HomeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ async function routeWithLoading(to: string) {
}
@include r-min(var.$window-xmedium) {
min-height: 30rem;
min-height: 30rem;
gap: max(6rem, 10vw);
flex-flow: row wrap;
padding: 0 4rem 4rem 4rem;
Expand Down
5 changes: 3 additions & 2 deletions solardoc/phoenix-server/lib/solardoc_phoenix/files/file.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ defmodule SolardocPhoenix.Files.File do
field :last_edited, :naive_datetime
field :content, :string, default: ""
field :is_global, :boolean, default: false
field :new_sync_algorithm, :boolean, default: true
belongs_to :channel, SolardocPhoenix.EditorChannels.EditorChannel
belongs_to :owner, SolardocPhoenix.Accounts.User

Expand All @@ -21,7 +22,7 @@ defmodule SolardocPhoenix.Files.File do
def create_changeset(file, attrs) do
now = NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second)
file
|> cast(attrs, [:file_name, :owner_id, :content, :is_global])
|> cast(attrs, [:file_name, :owner_id, :content, :is_global, :new_sync_algorithm])
|> validate_required([:file_name, :owner_id])
|> validate_length(:file_name, min: 1, max: 40)
|> unique_constraint([:file_name, :owner_id])
Expand All @@ -33,7 +34,7 @@ defmodule SolardocPhoenix.Files.File do
def update_changeset(file, attrs) do
now = NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second)
file
|> cast(attrs, [:file_name, :content, :channel_id, :is_global])
|> cast(attrs, [:file_name, :content, :channel_id, :is_global, :new_sync_algorithm])
|> unique_constraint([:file_name, :owner_id])
|> unique_constraint(:channel_id)
|> validate_length(:file_name, min: 1, max: 40)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ defmodule SolardocPhoenixWeb.V2.FileController do
created :integer, "Creation date in UNIX timestamp milliseconds", required: true
channel_id :string, "UUID of the channel created for this file, if one exists", required: false
is_global :boolean, "Whether the file is global or not", required: true
new_sync_algorithm :boolean, "Whether the file uses the new sync algorithm", required: true
end
end,
GlobalFile: swagger_schema do
Expand Down Expand Up @@ -68,6 +69,7 @@ defmodule SolardocPhoenixWeb.V2.FileController do
file_name :string, "File name", required: false
content :string, "File content", required: false
is_global :boolean, "Whether the file is global or not", required: false
new_sync_algorithm :boolean, "Whether the file uses the new sync algorithm", required: false
end
end,
ErrorResp: swagger_schema do
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defmodule SolardocPhoenix.Repo.Migrations.AddNewSyncAlgorithmFileFlag do
use Ecto.Migration

def change do
alter table(:files) do
add :new_sync_algorithm, :boolean, null: false, default: true
end
end
end

0 comments on commit 85bb763

Please sign in to comment.