forked from OwnZones/orchestration-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/differ between multiview preset and layout (#20)
* feat: add management lock * fix: remove left-over file, has been renamed * Feat/thumbnail fetch (#14) * feat: add additional filtering * fix: handle active + source filter, reduce code * fix: allow multiple source type selection * fix: linting * fixup! * feat: sorting ui * fix: add ingest type to database * feat: add sort based on lastConnected * fix: remove duplicate handleSorting call * fixup! * fix: add date to source card * fixup! * fix: add status-not-gone check * fix: linting error * fix: remove unused function * feat: updated to add additional multiviewers in the production-output-modal * feat: updated the functions on the production-page to handle a multiview-array * fix: changed the interface to have multiview as array * feat: updated to handle multiview-array when fetching server and api * fix: updated to stream-handling, not comfortable with the structure of this part * fix: updated to handle multiview-arr * feat: not possible to add output to same port, will cause visible error * fix: changed find to filter and maped through the results * fix: removed dev-logs * fix: correct filtering * fix: lint test fail * fix: changed to a some-check instead of a map * fix: multiview-arr does individual fetch for all mvs and creates unique ids for each * fix: updated ts-error * fix: adding and removing source from active production is working again * fix: added duplicate-check whenever multiviews-arr update and minor fixes * fix: updated multiview-arr-interface to be called multiviews instead of multiview, and minor fixes * fix: bug solve for incorrect gone assignment * fix: some cleanups * style: redesign SourceListItem Thumbnails * feat: imageComponent and sourceListing cleanup * feat: editView always shows same image as listing thumbnail * feat: general sourceList component and GlobalContext * fix: bad main merge * fix: lint * chore: add refresh images to translate and make modal z-index 50 * fix: use translate for refresh thumbnails and delete duplicated code from merge * fix: remove another duplicated line --------- Co-authored-by: Saelmala <[email protected]> Co-authored-by: malmen237 <[email protected]> Co-authored-by: Linda Malm <[email protected]> * feat: add management lock * fix: use global context instead of state * fix: remove duplicates * Feat/thumbnail fetch (#14) * feat: add additional filtering * fix: handle active + source filter, reduce code * fix: allow multiple source type selection * fix: linting * fixup! * feat: sorting ui * fix: add ingest type to database * feat: add sort based on lastConnected * fix: remove duplicate handleSorting call * fixup! * fix: add date to source card * fixup! * fix: add status-not-gone check * fix: linting error * fix: remove unused function * feat: updated to add additional multiviewers in the production-output-modal * feat: updated the functions on the production-page to handle a multiview-array * fix: changed the interface to have multiview as array * feat: updated to handle multiview-array when fetching server and api * fix: updated to stream-handling, not comfortable with the structure of this part * fix: updated to handle multiview-arr * feat: not possible to add output to same port, will cause visible error * fix: changed find to filter and maped through the results * fix: removed dev-logs * fix: correct filtering * fix: lint test fail * fix: changed to a some-check instead of a map * fix: multiview-arr does individual fetch for all mvs and creates unique ids for each * fix: updated ts-error * fix: adding and removing source from active production is working again * fix: added duplicate-check whenever multiviews-arr update and minor fixes * fix: updated multiview-arr-interface to be called multiviews instead of multiview, and minor fixes * fix: bug solve for incorrect gone assignment * fix: some cleanups * style: redesign SourceListItem Thumbnails * feat: imageComponent and sourceListing cleanup * feat: editView always shows same image as listing thumbnail * feat: general sourceList component and GlobalContext * fix: bad main merge * fix: lint * chore: add refresh images to translate and make modal z-index 50 * fix: use translate for refresh thumbnails and delete duplicated code from merge * fix: remove another duplicated line --------- Co-authored-by: Saelmala <[email protected]> Co-authored-by: malmen237 <[email protected]> Co-authored-by: Linda Malm <[email protected]> * fix: errors after conflict solving * fix: build error * fix: remove leftover file, unused import * fix: update lock * Feat/specify multiview layout when doing production-config(#16) * feat: added another mv-preset and updated code to be arr instead of single-object * feat: added optional style to be added to the options-dropdown * feat: first draft of a multiview-layout setting * feat: possible to create new layouts as multiview-previews and add it to productions * feat: added feedback-streams to input-choice for multiviewer-layout * fix: removed unnecessary undefined * fix: when added a new layout it will be chosen in output-form on save * feat: preview and program is now selectable and restructured the way options handle value * feat: separated db-preset into db-preset and db-layout - 'multiview-preset' and 'multiviews' * fix: a folder had accidentily been made as a file * feat: resolved the remaining issues, so preset is turned into a layout and saved in production * fix: resolved rebase-conflicts * fix: updates due to feedback and some label-fixes --------- Co-authored-by: Saelmala <[email protected]> Co-authored-by: Lucas Maupin <[email protected]>
- Loading branch information
1 parent
5ae889e
commit 78ea35d
Showing
41 changed files
with
710 additions
and
421 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { ObjectId, WithId } from 'mongodb'; | ||
import { MultiviewPreset } from '../../interfaces/preset'; | ||
import { getDatabase } from '../mongoClient/dbClient'; | ||
|
||
export async function getMultiviewPresets(): Promise<MultiviewPreset[]> { | ||
const db = await getDatabase(); | ||
return await db | ||
.collection<MultiviewPreset>('multiview-presets') | ||
.find({}) | ||
.toArray(); | ||
} | ||
|
||
export async function getMultiviewPreset( | ||
id: string | ||
): Promise<WithId<MultiviewPreset>> { | ||
const db = await getDatabase(); | ||
return (await db | ||
.collection<MultiviewPreset>('multiview-presets') | ||
.findOne({ _id: new ObjectId(id) })) as WithId<MultiviewPreset>; | ||
} | ||
|
||
// TODO Add this when possibility to update and add mv-presets are added | ||
// export async function putMultiviewPreset( | ||
// newMultiviewPreset: MultiviewPreset | ||
// ): Promise<void> { | ||
// const db = await getDatabase(); | ||
// await db | ||
// .collection('multiview-presets') | ||
// .insertOne({ ...newMultiviewPreset, _id: new ObjectId() }); | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { ObjectId, WithId } from 'mongodb'; | ||
import { MultiviewPreset } from '../../interfaces/preset'; | ||
import { getDatabase } from '../mongoClient/dbClient'; | ||
|
||
export async function getMultiviewLayouts(): Promise<MultiviewPreset[]> { | ||
const db = await getDatabase(); | ||
return await db.collection<MultiviewPreset>('multiviews').find({}).toArray(); | ||
} | ||
|
||
export async function getMultiviewLayout( | ||
id: string | ||
): Promise<WithId<MultiviewPreset>> { | ||
const db = await getDatabase(); | ||
return (await db | ||
.collection<MultiviewPreset>('multiviews') | ||
.findOne({ _id: new ObjectId(id) })) as WithId<MultiviewPreset>; | ||
} | ||
|
||
export async function putMultiviewLayout( | ||
newMultiviewLayout: MultiviewPreset | ||
): Promise<void> { | ||
const db = await getDatabase(); | ||
const collection = db.collection('multiviews'); | ||
const editLayout = await collection.findOne({ | ||
name: newMultiviewLayout.name | ||
}); | ||
const newMultiviewLayoutWithoutID = { ...newMultiviewLayout }; | ||
delete newMultiviewLayoutWithoutID._id; | ||
|
||
if (editLayout) { | ||
await collection.updateOne( | ||
{ name: newMultiviewLayout.name }, | ||
{ $set: { ...newMultiviewLayoutWithoutID } } | ||
); | ||
} else { | ||
await collection.insertOne({ ...newMultiviewLayout, _id: new ObjectId() }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { NextRequest, NextResponse } from 'next/server'; | ||
import { Params } from 'next/dist/shared/lib/router/utils/route-matcher'; | ||
import { getMultiviewPreset } from '../../../../../api/manager/multiview-presets'; | ||
import { isAuthenticated } from '../../../../../api/manager/auth'; | ||
|
||
export async function GET( | ||
request: NextRequest, | ||
{ params }: { params: Params } | ||
): Promise<NextResponse> { | ||
if (!(await isAuthenticated())) { | ||
return new NextResponse(`Not Authorized!`, { | ||
status: 403 | ||
}); | ||
} | ||
try { | ||
return NextResponse.json(await getMultiviewPreset(params.id)); | ||
} catch (e) { | ||
return new NextResponse(JSON.stringify(e), { | ||
status: 500 | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { NextRequest, NextResponse } from 'next/server'; | ||
import { isAuthenticated } from '../../../../api/manager/auth'; | ||
import { | ||
getMultiviewPresets | ||
// TODO Add this when possibility to update and add mv-presets are added | ||
// putMultiviewPreset | ||
} from '../../../../api/manager/multiview-presets'; | ||
// TODO Add this when possibility to update and add mv-presets are added | ||
// import { Log } from '../../../../api/logger'; | ||
// import { MultiviewPreset } from '../../../../interfaces/preset'; | ||
|
||
export async function GET(request: NextRequest): Promise<NextResponse> { | ||
if (!(await isAuthenticated())) { | ||
return new NextResponse(`Not Authorized!`, { | ||
status: 403 | ||
}); | ||
} | ||
|
||
try { | ||
return NextResponse.json(await getMultiviewPresets()); | ||
} catch (e) { | ||
return new NextResponse(JSON.stringify(e), { | ||
status: 500 | ||
}); | ||
} | ||
} | ||
|
||
// TODO Add this when possibility to update and add mv-presets are added | ||
// export async function PUT(request: NextRequest): Promise<NextResponse> { | ||
// if (!(await isAuthenticated())) { | ||
// return new NextResponse(`Not Authorized!`, { | ||
// status: 403 | ||
// }); | ||
// } | ||
|
||
// try { | ||
// const body = (await request.json()) as MultiviewPreset; | ||
// const newMultiviewPreset = await putMultiviewPreset(body); | ||
// return await new NextResponse(JSON.stringify(newMultiviewPreset), { | ||
// status: 200 | ||
// }); | ||
// } catch (error) { | ||
// Log().warn('Could not update preset', error); | ||
// return new NextResponse(`Error searching DB! Error: ${error}`, { | ||
// status: 500 | ||
// }); | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.