Skip to content

Commit eb7972a

Browse files
committed
WIP fix issues
1 parent 1b22c91 commit eb7972a

File tree

5 files changed

+31
-27
lines changed

5 files changed

+31
-27
lines changed

browser/data-browser/src/views/DrivePage.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,23 @@ function DrivePage({ resource }: ResourcePageProps): JSX.Element {
6969
<CardRow key={child}>
7070
<ResourceInline subject={child} />
7171
</CardRow>
72-
);
73-
})}
74-
<CardRow>
75-
<AtomicLink path={paths.new}>
76-
<FaPlus /> Create new resource
77-
</AtomicLink>
78-
</CardRow>
79-
</CardInsideFull>
80-
</Card>
81-
{baseURL.includes('localhost') && (
82-
<p>
83-
You are running Atomic-Server on `localhost`, which means that it will
84-
not be available from any other machine than your current local
85-
device. If you want your Atomic-Server to be available from the web,
86-
you should set this up at a Domain on a server.
87-
</p>
88-
)}
72+
))}
73+
<CardRow>
74+
<AtomicLink path={paths.new}>
75+
<FaPlus /> Create new resource
76+
</AtomicLink>
77+
</CardRow>
78+
</CardInsideFull>
79+
</Card>
80+
{baseURL.includes('localhost') && (
81+
<p>
82+
You are running Atomic-Server on `localhost`, which means that it
83+
will not be available from any other machine than your current local
84+
device. If you want your Atomic-Server to be available from the web,
85+
you should set this up at a Domain on a server.
86+
</p>
87+
)}
88+
</Column>
8989
</ContainerNarrow>
9090
);
9191
}

browser/data-browser/src/views/OntologyPage/newClass.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Resource, Store, core } from '@tomic/react';
22

3-
const DEFAULT_DESCRIPTION = 'Change me';
3+
const DEFAULT_DESCRIPTION = 'Default description - Change me';
44

55
export const subjectForClass = (parent: Resource, shortName: string): string =>
66
`${parent.subject}/class/${shortName}`;

browser/data-browser/src/views/TablePage/ExpandedRowDialog.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ export function ExpandedRowDialog({
2323
}: ExpandedRowDialogProps): JSX.Element {
2424
const { tableRef } = useTableEditorContext();
2525
const resource = useResource(subject);
26-
const [dialogProps, show] = useDialog({
26+
const { dialogProps, show } = useDialog({
2727
bindShow: bindOpen,
2828
triggerRef: tableRef,
2929
});
30-
3130
useEffect(() => {
3231
if (open) {
3332
show();

browser/lib/src/authentication.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import type { Agent } from './agent.js';
1+
import { Agent } from './agent.js';
22
import type { HeadersObject } from './client.js';
3-
import { getTimestampNow, signToBase64 } from './commit.js';
3+
import { generateKeyPair, getTimestampNow, signToBase64 } from './commit.js';
4+
import { Store } from './store.js';
5+
import { properties } from './urls.js';
46

57
/** Returns a JSON-AD resource of an Authentication */
68
export async function createAuthentication(subject: string, agent: Agent) {

lib/src/commit.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,12 @@ impl Commit {
174174
if is_new && opts.validate_subject_url_parent {
175175
if let Ok(parent) = resource_new.get(urls::PARENT) {
176176
let parent_str = parent.to_string();
177-
if !self.subject.starts_with(&parent_str) {
177+
let parent_url = url::Url::parse(&parent_str)?;
178+
let subj_host = subject_url.host_str().ok_or("No host in subject URL")?;
179+
let parent_host = parent_url.host_str().ok_or("No host in parent URL")?;
180+
if subj_host != parent_host {
178181
return Err(format!(
179-
"You cannot create a new Resource with this subject, because the parent '{}' is not part of the URL of the new subject '{}'.",
182+
"Subject URL host '{}' does not match parent host URL '{}'.",
180183
parent_str, self.subject
181184
)
182185
.into());
@@ -729,7 +732,7 @@ mod test {
729732

730733
#[test]
731734
fn agent_and_commit() {
732-
let store = crate::Store::init().unwrap();
735+
let mut store = crate::Store::init().unwrap();
733736
store.populate().unwrap();
734737
let agent = store.create_agent(Some("test_actor")).unwrap();
735738
let subject = "https://localhost/new_thing";
@@ -761,7 +764,7 @@ mod test {
761764

762765
#[test]
763766
fn serialize_commit() {
764-
let store = crate::Store::init().unwrap();
767+
let mut store = crate::Store::init().unwrap();
765768
store.populate().unwrap();
766769
let mut set: HashMap<String, Value> = HashMap::new();
767770
let shortname = Value::new("shortname", &DataType::String).unwrap();
@@ -827,7 +830,7 @@ mod test {
827830
#[test]
828831

829832
fn invalid_subjects() {
830-
let store = crate::Store::init().unwrap();
833+
let mut store = crate::Store::init().unwrap();
831834
store.populate().unwrap();
832835
let agent = store.create_agent(Some("test_actor")).unwrap();
833836
let resource = Resource::new("https://localhost/test_resource".into());

0 commit comments

Comments
 (0)