Browse Source

Removed links.

pull/364/head
Sebastian Stehle 7 years ago
parent
commit
a842e09c00
  1. 9
      src/Squidex/app/features/administration/state/users.state.ts
  2. 4
      src/Squidex/app/shared/components/markdown-editor.component.ts
  3. 10
      src/Squidex/app/shared/components/pipes.ts
  4. 6
      src/Squidex/app/shared/components/rich-editor.component.ts
  5. 4
      src/Squidex/app/shared/services/assets.service.ts
  6. 8
      src/Squidex/app/shared/state/backups.state.ts
  7. 8
      src/Squidex/app/shared/state/clients.state.ts
  8. 9
      src/Squidex/app/shared/state/contents.state.ts
  9. 8
      src/Squidex/app/shared/state/contributors.state.ts
  10. 7
      src/Squidex/app/shared/state/languages.state.ts
  11. 10
      src/Squidex/app/shared/state/patterns.state.ts
  12. 8
      src/Squidex/app/shared/state/roles.state.ts
  13. 8
      src/Squidex/app/shared/state/rules.state.ts
  14. 8
      src/Squidex/app/shared/state/schemas.state.ts

9
src/Squidex/app/features/administration/state/users.state.ts

@ -15,7 +15,6 @@ import {
DialogService, DialogService,
ImmutableArray, ImmutableArray,
Pager, Pager,
ResourceLinks,
shareSubscribed, shareSubscribed,
State State
} from '@app/shared'; } from '@app/shared';
@ -45,9 +44,6 @@ interface Snapshot {
// Indicates if the user can create a user. // Indicates if the user can create a user.
canCreate?: boolean; canCreate?: boolean;
// The resource links.
_links?: ResourceLinks;
} }
export type UsersList = ImmutableArray<UserDto>; export type UsersList = ImmutableArray<UserDto>;
@ -114,7 +110,7 @@ export class UsersState extends State<Snapshot> {
this.snapshot.usersPager.pageSize, this.snapshot.usersPager.pageSize,
this.snapshot.usersPager.skip, this.snapshot.usersPager.skip,
this.snapshot.usersQuery).pipe( this.snapshot.usersQuery).pipe(
tap(({ total, items, canCreate, _links }) => { tap(({ total, items, canCreate }) => {
if (isReload) { if (isReload) {
this.dialogs.notifyInfo('Users reloaded.'); this.dialogs.notifyInfo('Users reloaded.');
} }
@ -134,8 +130,7 @@ export class UsersState extends State<Snapshot> {
isLoaded: true, isLoaded: true,
selectedUser, selectedUser,
users, users,
usersPager, usersPager
_links
}; };
}); });
}), }),

4
src/Squidex/app/shared/components/markdown-editor.component.ts

@ -201,7 +201,7 @@ export class MarkdownEditorComponent extends StatefulControlComponent<State, str
let content = ''; let content = '';
for (let asset of assets) { for (let asset of assets) {
content += `![${asset.fileName}](${asset._links['content'].href} '${asset.fileName}')`; content += `![${asset.fileName}](${asset.contentUrl} '${asset.fileName}')`;
} }
if (content.length > 0) { if (content.length > 0) {
@ -244,7 +244,7 @@ export class MarkdownEditorComponent extends StatefulControlComponent<State, str
this.assetUploader.uploadFile(file) this.assetUploader.uploadFile(file)
.subscribe(asset => { .subscribe(asset => {
if (Types.is(asset, AssetDto)) { if (Types.is(asset, AssetDto)) {
replaceText(`![${asset.fileName}](${asset._links['content'].href} '${asset.fileName}')`); replaceText(`![${asset.fileName}](${asset.contentUrl} '${asset.fileName}')`);
} }
}, error => { }, error => {
if (!Types.is(error, UploadCanceled)) { if (!Types.is(error, UploadCanceled)) {

10
src/Squidex/app/shared/components/pipes.ts

@ -13,10 +13,10 @@ import { map } from 'rxjs/operators';
import { import {
ApiUrlConfig, ApiUrlConfig,
AssetDto,
formatHistoryMessage, formatHistoryMessage,
HistoryEventDto, HistoryEventDto,
MathHelper, MathHelper,
Resource,
UserDto, UserDto,
UsersProviderService UsersProviderService
} from '@app/shared/internal'; } from '@app/shared/internal';
@ -216,8 +216,8 @@ export class UserPictureRefPipe extends UserAsyncPipe implements PipeTransform {
pure: true pure: true
}) })
export class AssetUrlPipe implements PipeTransform { export class AssetUrlPipe implements PipeTransform {
public transform(asset: Resource): string { public transform(asset: AssetDto): string {
return `${asset._links['content'].href}&sq=${MathHelper.guid()}`; return `${asset.contentUrl}&sq=${MathHelper.guid()}`;
} }
} }
@ -226,8 +226,8 @@ export class AssetUrlPipe implements PipeTransform {
pure: true pure: true
}) })
export class AssetPreviewUrlPipe implements PipeTransform { export class AssetPreviewUrlPipe implements PipeTransform {
public transform(asset: Resource): string { public transform(asset: AssetDto): string {
return asset._links['content'].href; return asset.contentUrl;
} }
} }

6
src/Squidex/app/shared/components/rich-editor.component.ts

@ -98,7 +98,7 @@ export class RichEditorComponent extends StatefulControlComponent<any, string> i
this.assetUploader.uploadFile(file) this.assetUploader.uploadFile(file)
.subscribe(asset => { .subscribe(asset => {
if (Types.is(asset, AssetDto)) { if (Types.is(asset, AssetDto)) {
success(asset._links['content'].href); success(asset.contentUrl);
} }
}, error => { }, error => {
if (!Types.is(error, UploadCanceled)) { if (!Types.is(error, UploadCanceled)) {
@ -186,7 +186,7 @@ export class RichEditorComponent extends StatefulControlComponent<any, string> i
let content = ''; let content = '';
for (let asset of assets) { for (let asset of assets) {
content += `<img src="${asset._links['content'].href}" alt="${asset.fileName}" />`; content += `<img src="${asset.contentUrl}" alt="${asset.fileName}" />`;
} }
if (content.length > 0) { if (content.length > 0) {
@ -216,7 +216,7 @@ export class RichEditorComponent extends StatefulControlComponent<any, string> i
this.assetUploader.uploadFile(file) this.assetUploader.uploadFile(file)
.subscribe(asset => { .subscribe(asset => {
if (Types.is(asset, AssetDto)) { if (Types.is(asset, AssetDto)) {
replaceText(`<img src="${asset._links['content'].href}" alt="${asset.fileName}" />`); replaceText(`<img src="${asset.contentUrl}" alt="${asset.fileName}" />`);
} }
}, error => { }, error => {
if (!Types.is(error, UploadCanceled)) { if (!Types.is(error, UploadCanceled)) {

4
src/Squidex/app/shared/services/assets.service.ts

@ -39,6 +39,10 @@ export class AssetDto {
public readonly canUpdate: boolean; public readonly canUpdate: boolean;
public readonly canUpload: boolean; public readonly canUpload: boolean;
public get contentUrl() {
return this._links['content'].href;
}
constructor(links: ResourceLinks, meta: Metadata, constructor(links: ResourceLinks, meta: Metadata,
public readonly id: string, public readonly id: string,
public readonly created: DateTime, public readonly created: DateTime,

8
src/Squidex/app/shared/state/backups.state.ts

@ -12,7 +12,6 @@ import { tap } from 'rxjs/operators';
import { import {
DialogService, DialogService,
ImmutableArray, ImmutableArray,
ResourceLinks,
shareSubscribed, shareSubscribed,
State State
} from '@app/framework'; } from '@app/framework';
@ -30,9 +29,6 @@ interface Snapshot {
// Indicates if the user can create new backups. // Indicates if the user can create new backups.
canCreate?: boolean; canCreate?: boolean;
// The links.
_links?: ResourceLinks;
} }
type BackupsList = ImmutableArray<BackupDto>; type BackupsList = ImmutableArray<BackupDto>;
@ -65,7 +61,7 @@ export class BackupsState extends State<Snapshot> {
} }
return this.backupsService.getBackups(this.appName).pipe( return this.backupsService.getBackups(this.appName).pipe(
tap(({ items, canCreate, _links }) => { tap(({ items, canCreate }) => {
if (isReload && !silent) { if (isReload && !silent) {
this.dialogs.notifyInfo('Backups reloaded.'); this.dialogs.notifyInfo('Backups reloaded.');
} }
@ -73,7 +69,7 @@ export class BackupsState extends State<Snapshot> {
this.next(s => { this.next(s => {
return { ...s, backups, isLoaded: true, canCreate, _links }; return { ...s, backups, isLoaded: true, canCreate };
}); });
}), }),
shareSubscribed(this.dialogs, { silent })); shareSubscribed(this.dialogs, { silent }));

8
src/Squidex/app/shared/state/clients.state.ts

@ -14,7 +14,6 @@ import { tap } from 'rxjs/operators';
import { import {
DialogService, DialogService,
ImmutableArray, ImmutableArray,
ResourceLinks,
shareSubscribed, shareSubscribed,
State, State,
Version Version
@ -42,9 +41,6 @@ interface Snapshot {
// Indicates if the user can create new clients. // Indicates if the user can create new clients.
canCreate?: boolean; canCreate?: boolean;
// The links.
_links?: ResourceLinks;
} }
type ClientsList = ImmutableArray<ClientDto>; type ClientsList = ImmutableArray<ClientDto>;
@ -109,12 +105,12 @@ export class ClientsState extends State<Snapshot> {
} }
private replaceClients(payload: ClientsPayload, version: Version) { private replaceClients(payload: ClientsPayload, version: Version) {
const { canCreate, items, _links } = payload; const { canCreate, items } = payload;
const clients = ImmutableArray.of(items); const clients = ImmutableArray.of(items);
this.next(s => { this.next(s => {
return { ...s, clients, isLoaded: true, version, canCreate, _links }; return { ...s, clients, isLoaded: true, version, canCreate };
}); });
} }

9
src/Squidex/app/shared/state/contents.state.ts

@ -14,7 +14,6 @@ import {
ErrorDto, ErrorDto,
ImmutableArray, ImmutableArray,
Pager, Pager,
ResourceLinks,
shareSubscribed, shareSubscribed,
State, State,
Version, Version,
@ -51,9 +50,6 @@ interface Snapshot {
// Indicates if the user can create and publish a content. // Indicates if the user can create and publish a content.
canCreateAndPublish?: boolean; canCreateAndPublish?: boolean;
// The links.
_links?: ResourceLinks;
} }
function sameContent(lhs: ContentDto, rhs?: ContentDto): boolean { function sameContent(lhs: ContentDto, rhs?: ContentDto): boolean {
@ -137,7 +133,7 @@ export abstract class ContentsStateBase extends State<Snapshot> {
this.snapshot.contentsPager.pageSize, this.snapshot.contentsPager.pageSize,
this.snapshot.contentsPager.skip, this.snapshot.contentsPager.skip,
this.snapshot.contentsQuery, undefined).pipe( this.snapshot.contentsQuery, undefined).pipe(
tap(({ total, items, canCreate, canCreateAndPublish, statuses, _links }) => { tap(({ total, items, canCreate, canCreateAndPublish, statuses }) => {
if (isReload) { if (isReload) {
this.dialogs.notifyInfo('Contents reloaded.'); this.dialogs.notifyInfo('Contents reloaded.');
} }
@ -161,8 +157,7 @@ export abstract class ContentsStateBase extends State<Snapshot> {
contentsPager, contentsPager,
isLoaded: true, isLoaded: true,
selectedContent, selectedContent,
statuses, statuses
_links
}; };
}); });
})); }));

8
src/Squidex/app/shared/state/contributors.state.ts

@ -13,7 +13,6 @@ import {
DialogService, DialogService,
ErrorDto, ErrorDto,
ImmutableArray, ImmutableArray,
ResourceLinks,
shareMapSubscribed, shareMapSubscribed,
shareSubscribed, shareSubscribed,
State, State,
@ -45,9 +44,6 @@ interface Snapshot {
// Indicates if the user can add a contributor. // Indicates if the user can add a contributor.
canCreate?: boolean; canCreate?: boolean;
// The links.
_links?: ResourceLinks;
} }
type ContributorsList = ImmutableArray<ContributorDto>; type ContributorsList = ImmutableArray<ContributorDto>;
@ -115,11 +111,11 @@ export class ContributorsState extends State<Snapshot> {
private replaceContributors(version: Version, payload: ContributorsPayload) { private replaceContributors(version: Version, payload: ContributorsPayload) {
this.next(s => { this.next(s => {
const { canCreate, items, maxContributors, _links } = payload; const { canCreate, items, maxContributors } = payload;
const contributors = ImmutableArray.of(items); const contributors = ImmutableArray.of(items);
return { ...s, contributors, maxContributors, isLoaded: true, version, canCreate, _links }; return { ...s, contributors, maxContributors, isLoaded: true, version, canCreate };
}); });
} }

7
src/Squidex/app/shared/state/languages.state.ts

@ -12,7 +12,6 @@ import { map, tap } from 'rxjs/operators';
import { import {
DialogService, DialogService,
ImmutableArray, ImmutableArray,
ResourceLinks,
shareMapSubscribed, shareMapSubscribed,
shareSubscribed, shareSubscribed,
State, State,
@ -58,9 +57,6 @@ interface Snapshot {
// Inedicates if the user can add a language. // Inedicates if the user can add a language.
canCreate?: boolean; canCreate?: boolean;
// The links.
_links?: ResourceLinks;
} }
type AppLanguagesList = ImmutableArray<AppLanguageDto>; type AppLanguagesList = ImmutableArray<AppLanguageDto>;
@ -146,7 +142,7 @@ export class LanguagesState extends State<Snapshot> {
this.next(s => { this.next(s => {
allLanguages = allLanguages || s.allLanguages; allLanguages = allLanguages || s.allLanguages;
const { canCreate, items, _links } = payload; const { canCreate, items } = payload;
const languages = ImmutableArray.of(items); const languages = ImmutableArray.of(items);
@ -157,7 +153,6 @@ export class LanguagesState extends State<Snapshot> {
allLanguages: allLanguages, allLanguages: allLanguages,
allLanguagesNew: allLanguages.filter(x => !languages.find(l => l.iso2Code === x.iso2Code)), allLanguagesNew: allLanguages.filter(x => !languages.find(l => l.iso2Code === x.iso2Code)),
isLoaded: true, isLoaded: true,
_links,
version: version version: version
}; };
}); });

10
src/Squidex/app/shared/state/patterns.state.ts

@ -12,7 +12,6 @@ import { tap } from 'rxjs/operators';
import { import {
DialogService, DialogService,
ImmutableArray, ImmutableArray,
ResourceLinks,
shareMapSubscribed, shareMapSubscribed,
shareSubscribed, shareSubscribed,
State, State,
@ -40,9 +39,6 @@ interface Snapshot {
// Indicates if patterns can be created. // Indicates if patterns can be created.
canCreate?: boolean; canCreate?: boolean;
// The links.
_links: ResourceLinks;
} }
type PatternsList = ImmutableArray<PatternDto>; type PatternsList = ImmutableArray<PatternDto>;
@ -63,7 +59,7 @@ export class PatternsState extends State<Snapshot> {
private readonly appsState: AppsState, private readonly appsState: AppsState,
private readonly dialogs: DialogService private readonly dialogs: DialogService
) { ) {
super({ patterns: ImmutableArray.empty(), version: Version.EMPTY, _links: {} }); super({ patterns: ImmutableArray.empty(), version: Version.EMPTY });
} }
public load(isReload = false): Observable<any> { public load(isReload = false): Observable<any> {
@ -109,10 +105,10 @@ export class PatternsState extends State<Snapshot> {
private replacePatterns(payload: PatternsPayload, version: Version) { private replacePatterns(payload: PatternsPayload, version: Version) {
const patterns = ImmutableArray.of(payload.items); const patterns = ImmutableArray.of(payload.items);
const { _links: links, canCreate } = payload; const { canCreate } = payload;
this.next(s => { this.next(s => {
return { ...s, patterns, isLoaded: true, version, _links: links, canCreate }; return { ...s, patterns, isLoaded: true, version, canCreate };
}); });
} }

8
src/Squidex/app/shared/state/roles.state.ts

@ -12,7 +12,6 @@ import { tap } from 'rxjs/operators';
import { import {
DialogService, DialogService,
ImmutableArray, ImmutableArray,
ResourceLinks,
shareSubscribed, shareSubscribed,
State, State,
Version Version
@ -40,9 +39,6 @@ interface Snapshot {
// Indicates if the user can add a role. // Indicates if the user can add a role.
canCreate?: boolean; canCreate?: boolean;
// The links.
_links?: ResourceLinks;
} }
type RolesList = ImmutableArray<RoleDto>; type RolesList = ImmutableArray<RoleDto>;
@ -107,12 +103,12 @@ export class RolesState extends State<Snapshot> {
} }
private replaceRoles(payload: RolesPayload, version: Version) { private replaceRoles(payload: RolesPayload, version: Version) {
const { canCreate, items, _links } = payload; const { canCreate, items } = payload;
const roles = ImmutableArray.of(items); const roles = ImmutableArray.of(items);
this.next(s => { this.next(s => {
return { ...s, roles, isLoaded: true, version, canCreate, _links }; return { ...s, roles, isLoaded: true, version, canCreate };
}); });
} }

8
src/Squidex/app/shared/state/rules.state.ts

@ -12,7 +12,6 @@ import { tap } from 'rxjs/operators';
import { import {
DialogService, DialogService,
ImmutableArray, ImmutableArray,
ResourceLinks,
shareSubscribed, shareSubscribed,
State State
} from '@app/framework'; } from '@app/framework';
@ -37,9 +36,6 @@ interface Snapshot {
// Indicates if the user can read events. // Indicates if the user can read events.
canReadEvents?: boolean; canReadEvents?: boolean;
// The resource links.
_links?: ResourceLinks;
} }
type RulesList = ImmutableArray<RuleDto>; type RulesList = ImmutableArray<RuleDto>;
@ -72,7 +68,7 @@ export class RulesState extends State<Snapshot> {
} }
return this.rulesService.getRules(this.appName).pipe( return this.rulesService.getRules(this.appName).pipe(
tap(({ items, canCreate, canReadEvents, _links }) => { tap(({ items, canCreate, canReadEvents }) => {
if (isReload) { if (isReload) {
this.dialogs.notifyInfo('Rules reloaded.'); this.dialogs.notifyInfo('Rules reloaded.');
} }
@ -80,7 +76,7 @@ export class RulesState extends State<Snapshot> {
this.next(s => { this.next(s => {
const rules = ImmutableArray.of(items); const rules = ImmutableArray.of(items);
return { ...s, rules, isLoaded: true, canCreate, canReadEvents, _links }; return { ...s, rules, isLoaded: true, canCreate, canReadEvents };
}); });
}), }),
shareSubscribed(this.dialogs)); shareSubscribed(this.dialogs));

8
src/Squidex/app/shared/state/schemas.state.ts

@ -13,7 +13,6 @@ import {
compareStringsAsc, compareStringsAsc,
DialogService, DialogService,
ImmutableArray, ImmutableArray,
ResourceLinks,
shareMapSubscribed, shareMapSubscribed,
shareSubscribed, shareSubscribed,
State, State,
@ -52,9 +51,6 @@ interface Snapshot {
// Indicates if the user can create a schema. // Indicates if the user can create a schema.
canCreate?: boolean; canCreate?: boolean;
// The links.
_links?: ResourceLinks;
} }
export type SchemasList = ImmutableArray<SchemaDto>; export type SchemasList = ImmutableArray<SchemaDto>;
@ -122,7 +118,7 @@ export class SchemasState extends State<Snapshot> {
} }
return this.schemasService.getSchemas(this.appName).pipe( return this.schemasService.getSchemas(this.appName).pipe(
tap(({ items, canCreate, _links }) => { tap(({ items, canCreate }) => {
if (isReload) { if (isReload) {
this.dialogs.notifyInfo('Schemas reloaded.'); this.dialogs.notifyInfo('Schemas reloaded.');
} }
@ -132,7 +128,7 @@ export class SchemasState extends State<Snapshot> {
const categories = buildCategories(s.categories, schemas); const categories = buildCategories(s.categories, schemas);
return { ...s, schemas, isLoaded: true, categories, canCreate, _links }; return { ...s, schemas, isLoaded: true, categories, canCreate };
}); });
}), }),
shareSubscribed(this.dialogs)); shareSubscribed(this.dialogs));

Loading…
Cancel
Save